de0a52685d8164e791649724bb3c03c1e2601f00
[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 {
46 $itemRow = $conf['parentObj']->menuArr[$I['key']];
47 // Setting the document status content to the value of the page title
48 // on mouse over
49 if (!$I['linkHREF']['TARGET']) {
50 $I['linkHREF']['HREF'] = '#';
51 $I['linkHREF']['onClick'] .= 'ARO_setLocation' . $conf['setLocation'] . '(' . $itemRow['uid'] . ',\'' . $I['theName'] . '\'); return false;';
52 } else {
53 $I['linkHREF']['onClick'] .= 'ARO_setActiveImg' . '(\'' . $I['theName'] . '\');';
54 }
55 if ($I['linkHREF']['onMouseover']) {
56 $I['linkHREF']['onMouseover'] = 'ARO_' . $I['linkHREF']['onMouseover'];
57 }
58 if ($I['linkHREF']['onMouseout']) {
59 $I['linkHREF']['onMouseout'] = 'ARO_' . $I['linkHREF']['onMouseout'];
60 }
61 if ($conf['parentObj']->isActive($itemRow['uid'])) {
62 $conf['parentObj']->WMextraScript .= '
63 <script type="text/javascript">
64 /*<![CDATA[*/
65 ARO_Image = "' . $I['theName'] . '";
66 ' . $I['linkHREF']['onMouseover'] . '
67 /*]]>*/
68 </script>
69 ';
70 }
71 // Update the link in the parent object:
72 // setting internal $I - needed by setATagParts() function!
73 $conf['parentObj']->I = $I;
74 // Setting the A1 and A2 of the internal $I
75 $conf['parentObj']->setATagParts();
76 // retrieving internal $I
77 $I = $conf['parentObj']->I;
78 // Setting the ATag_begin to the value of this $I
79 $I['parts']['ATag_begin'] = $I['A1'];
80 // Debug:
81 if ($conf['debug']) {
82 // Outputting for debug example:
83 echo 'ITEM: <h2>' . htmlspecialchars(($itemRow['uid'] . ': ' . $itemRow['title'])) . '</h2>';
84 t3lib_utility_Debug::debug($itemRow);
85 t3lib_utility_Debug::debug($I);
86 echo '<hr />';
87 }
88 // Returns $I:
89 return $I;
90 }
91 ?>