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