[TASK] CGL Cleanup: Fix OpeningFunctionBraceKernighanRitchie-Sniff
[Packages/TYPO3.CMS.git] / typo3 / sysext / statictemplates / media / scripts / example_keepRollover.php
1 <?php
2 /***************************************************************
3 * Copyright notice
4 *
5 * (c) 1999-2011 Kasper Skårhøj (kasperYYYY@typo3.com)
6 * All rights reserved
7 *
8 * This script is part of the TYPO3 project. The TYPO3 project is
9 * free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License as published by
11 * the Free Software Foundation; either version 2 of the License, or
12 * (at your option) any later version.
13 *
14 * The GNU General Public License can be found at
15 * http://www.gnu.org/copyleft/gpl.html.
16 * A copy is found in the textfile GPL.txt and important notices to the license
17 * from the author is found in LICENSE.txt distributed with these scripts.
18 *
19 *
20 * This script is distributed in the hope that it will be useful,
21 * but WITHOUT ANY WARRANTY; without even the implied warranty of
22 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
23 * GNU General Public License for more details.
24 *
25 * This copyright notice MUST APPEAR in all copies of the script!
26 ***************************************************************/
27 /**
28 * Demonstrates how to manipulate menu generation so that a click on a menu item will trigger two (or more) frames to load an URL
29 * Used in the "testsite" package
30 *
31 * Revised for TYPO3 3.6 June/2003 by Kasper Skårhøj
32 * XHTML compliant
33 *
34 * @author Kasper Skårhøj <kasperYYYY@typo3.com>
35 */
36 /**
37 * Example can be found in the testsite package at the page-path "/Intro/TypoScript examples/Menu object examples/Loading multiple.../"
38 *
39 * @param array $I The menu item array, $this->I (in the parent object)
40 * @param array $conf TypoScript configuration for the function. Notice that the property "parentObj" is a reference to the parent (calling) object (the tslib_Xmenu class instantiated)
41 * @return array The processed $I array returned (and stored in $this->I of the parent object again)
42 * @see tslib_menu::userProcess(), tslib_tmenu::writeMenu(), tslib_gmenu::writeMenu()
43 */
44 function user_keepRolloverAtOnClick($I, $conf) {
45 $itemRow = $conf['parentObj']->menuArr[$I['key']];
46 // Setting the document status content to the value of the page title
47 // on mouse over
48 if (!$I['linkHREF']['TARGET']) {
49 $I['linkHREF']['HREF'] = '#';
50 $I['linkHREF']['onClick'] .= 'ARO_setLocation' . $conf['setLocation'] . '(' . $itemRow['uid'] . ',\'' . $I['theName'] . '\'); return false;';
51 } else {
52 $I['linkHREF']['onClick'] .= 'ARO_setActiveImg' . '(\'' . $I['theName'] . '\');';
53 }
54 if ($I['linkHREF']['onMouseover']) {
55 $I['linkHREF']['onMouseover'] = 'ARO_' . $I['linkHREF']['onMouseover'];
56 }
57 if ($I['linkHREF']['onMouseout']) {
58 $I['linkHREF']['onMouseout'] = 'ARO_' . $I['linkHREF']['onMouseout'];
59 }
60 if ($conf['parentObj']->isActive($itemRow['uid'])) {
61 $conf['parentObj']->WMextraScript .= '
62 <script type="text/javascript">
63 /*<![CDATA[*/
64 ARO_Image = "' . $I['theName'] . '";
65 ' . $I['linkHREF']['onMouseover'] . '
66 /*]]>*/
67 </script>
68 ';
69 }
70 // Update the link in the parent object:
71 // setting internal $I - needed by setATagParts() function!
72 $conf['parentObj']->I = $I;
73 // Setting the A1 and A2 of the internal $I
74 $conf['parentObj']->setATagParts();
75 // retrieving internal $I
76 $I = $conf['parentObj']->I;
77 // Setting the ATag_begin to the value of this $I
78 $I['parts']['ATag_begin'] = $I['A1'];
79 // Debug:
80 if ($conf['debug']) {
81 // Outputting for debug example:
82 echo 'ITEM: <h2>' . htmlspecialchars(($itemRow['uid'] . ': ' . $itemRow['title'])) . '</h2>';
83 t3lib_utility_Debug::debug($itemRow);
84 t3lib_utility_Debug::debug($I);
85 echo '<hr />';
86 }
87 // Returns $I:
88 return $I;
89 }
90 ?>