[TASK] Use PHP5 constructors
[Packages/TYPO3.CMS.git] / typo3 / sysext / beuser / class.tx_beuser.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 * Class, adding SU link to context menu
29 *
30 * @author Kasper Skårhøj <kasperYYYY@typo3.com>
31 */
32 /**
33 * [CLASS/FUNCTION INDEX of SCRIPT]
34 *
35 */
36
37
38
39
40
41
42
43
44
45
46
47
48 /**
49 * Class, adding SU link to context menu
50 *
51 * @author Kasper Skårhøj <kasperYYYY@typo3.com>
52 * @package TYPO3
53 * @subpackage tx_beuser
54 */
55 class tx_beuser {
56
57 /**
58 * Adding various standard options to the context menu.
59 * This includes both first and second level.
60 *
61 * @param object The calling object. Value by reference.
62 * @param array Array with the currently collected menu items to show.
63 * @param string Table name of clicked item.
64 * @param integer UID of clicked item.
65 * @return array Modified $menuItems array
66 */
67 function main(&$backRef,$menuItems,$table,$uid) {
68 $localItems = array(); // Accumulation of local items.
69
70 // Detecting menu level
71 if ($GLOBALS['BE_USER']->isAdmin() && !$backRef->cmLevel && $table == 'be_users') {
72 // LEVEL: Primary menu.
73
74 // "SU" element added:
75 $url = 'mod.php?M=tools_beuser&SwitchUser='.rawurlencode($uid).'&switchBackUser=1';
76 $localItems[] = $backRef->linkItem(
77 'Switch To User',
78 $backRef->excludeIcon(t3lib_iconWorks::getSpriteIcon('actions-system-backend-user-emulate')),
79 $backRef->urlRefForCM($url,'',1,'top'),
80 1
81 );
82
83 $menuItems=array_merge($menuItems,$localItems);
84 }
85 return $menuItems;
86 }
87
88 /**
89 * Include local lang file.
90 *
91 * @return array Local lang array.
92 */
93 function includeLL() {
94 global $LANG;
95
96 $LOCAL_LANG = $GLOBALS['LANG']->includeLLFile('EXT:extra_page_cm_options/locallang.php', FALSE);
97 return $LOCAL_LANG;
98 }
99 }
100
101 if (defined('TYPO3_MODE') && isset($GLOBALS['TYPO3_CONF_VARS'][TYPO3_MODE]['XCLASS']['ext/extra_page_cm_options/class.tx_extrapagecmoptions.php'])) {
102 include_once($GLOBALS['TYPO3_CONF_VARS'][TYPO3_MODE]['XCLASS']['ext/extra_page_cm_options/class.tx_extrapagecmoptions.php']);
103 }
104 ?>