TYPO3 API  SVNRelease
class.tx_beuser.php
Go to the documentation of this file.
00001 <?php
00002 /***************************************************************
00003 *  Copyright notice
00004 *
00005 *  (c) 1999-2011 Kasper Skårhøj (kasperYYYY@typo3.com)
00006 *  All rights reserved
00007 *
00008 *  This script is part of the TYPO3 project. The TYPO3 project is
00009 *  free software; you can redistribute it and/or modify
00010 *  it under the terms of the GNU General Public License as published by
00011 *  the Free Software Foundation; either version 2 of the License, or
00012 *  (at your option) any later version.
00013 *
00014 *  The GNU General Public License can be found at
00015 *  http://www.gnu.org/copyleft/gpl.html.
00016 *  A copy is found in the textfile GPL.txt and important notices to the license
00017 *  from the author is found in LICENSE.txt distributed with these scripts.
00018 *
00019 *
00020 *  This script is distributed in the hope that it will be useful,
00021 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
00022 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00023 *  GNU General Public License for more details.
00024 *
00025 *  This copyright notice MUST APPEAR in all copies of the script!
00026 ***************************************************************/
00027 /**
00028  * Class, adding SU link to context menu
00029  *
00030  * $Id: class.tx_beuser.php 10120 2011-01-18 20:03:36Z ohader $
00031  *
00032  * @author  Kasper Skårhøj <kasperYYYY@typo3.com>
00033  */
00034 /**
00035  * [CLASS/FUNCTION INDEX of SCRIPT]
00036  *
00037  */
00038 
00039 
00040 
00041 
00042 
00043 
00044 
00045 
00046 
00047 
00048 
00049 
00050 /**
00051  * Class, adding SU link to context menu
00052  *
00053  * @author  Kasper Skårhøj <kasperYYYY@typo3.com>
00054  * @package TYPO3
00055  * @subpackage tx_beuser
00056  */
00057 class tx_beuser {
00058 
00059     /**
00060      * Adding various standard options to the context menu.
00061      * This includes both first and second level.
00062      *
00063      * @param   object      The calling object. Value by reference.
00064      * @param   array       Array with the currently collected menu items to show.
00065      * @param   string      Table name of clicked item.
00066      * @param   integer     UID of clicked item.
00067      * @return  array       Modified $menuItems array
00068      */
00069     function main(&$backRef,$menuItems,$table,$uid) {
00070         global $BE_USER,$TCA,$LANG;
00071 
00072         $localItems = array();  // Accumulation of local items.
00073 
00074             // Detecting menu level
00075         if ($BE_USER->isAdmin() && !$backRef->cmLevel && $table == 'be_users')  {   // LEVEL: Primary menu.
00076 
00077                 // "SU" element added:
00078             $url = 'mod.php?M=tools_beuser&SwitchUser='.rawurlencode($uid).'&switchBackUser=1';
00079             $localItems[] = $backRef->linkItem(
00080                 'Switch To User',
00081                 $backRef->excludeIcon(t3lib_iconWorks::getSpriteIcon('actions-system-backend-user-emulate')),
00082                 $backRef->urlRefForCM($url,'',1,'top'),
00083                 1
00084             );
00085 
00086             $menuItems=array_merge($menuItems,$localItems);
00087         }
00088         return $menuItems;
00089     }
00090 
00091     /**
00092      * Include local lang file.
00093      *
00094      * @return  array       Local lang array.
00095      */
00096     function includeLL()    {
00097         global $LANG;
00098 
00099         $LOCAL_LANG = $LANG->includeLLFile('EXT:extra_page_cm_options/locallang.php',FALSE);
00100         return $LOCAL_LANG;
00101     }
00102 }
00103 
00104 if (defined('TYPO3_MODE') && isset($GLOBALS['TYPO3_CONF_VARS'][TYPO3_MODE]['XCLASS']['ext/extra_page_cm_options/class.tx_extrapagecmoptions.php'])) {
00105     include_once($GLOBALS['TYPO3_CONF_VARS'][TYPO3_MODE]['XCLASS']['ext/extra_page_cm_options/class.tx_extrapagecmoptions.php']);
00106 }
00107 ?>