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