ab0dd4444e7306992d099bf6f978222f3b924f5c
2 /***************************************************************
5 * (c) 2007-2009 Ingo Renner <ingo@typo3.org>
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.
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.
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.
25 * This copyright notice MUST APPEAR in all copies of the script!
26 ***************************************************************/
28 if(TYPO3_REQUESTTYPE
& TYPO3_REQUESTTYPE_AJAX
) {
29 require_once('interfaces/interface.backend_toolbaritem.php');
30 $GLOBALS['LANG']->includeLLFile('EXT:lang/locallang_misc.xml');
32 // needed to get the correct icons when reloading the menu after saving it
33 $loadModules = t3lib_div
::makeInstance('t3lib_loadModules');
34 $loadModules->load($GLOBALS['TBE_MODULES']);
39 * class to render the shortcut menu
43 * @author Ingo Renner <ingo@typo3.org>
47 class ShortcutMenu
implements backend_toolbarItem
{
49 protected $shortcutGroups;
52 * all available shortcuts
59 * labels of all groups.
60 * If value is 1, the system will try to find a label in the locallang array.
64 protected $groupLabels;
67 * reference back to the backend object
71 protected $backendReference;
76 * @param TYPO3backend TYPO3 backend object reference
79 public function __construct(TYPO3backend
&$backendReference = null) {
80 $this->backendReference
= $backendReference;
81 $this->shortcuts
= array();
83 // by default, 5 groups are set
84 $this->shortcutGroups
= array(
92 $this->shortcutGroups
= $this->initShortcutGroups();
93 $this->shortcuts
= $this->initShortcuts();
97 * checks whether the user has access to this toolbar item
99 * @return boolean true if user has access, false if not
101 public function checkAccess() {
102 // Shortcut module is enabled for everybody
107 * Creates the shortcut menu (default renderer)
109 * @return string workspace selector as HTML select
111 public function render() {
112 $title = $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xml:toolbarItems.shortcuts', true);
113 $this->addJavascriptToBackend();
115 $shortcutMenu = array();
117 $shortcutMenu[] = '<a href="#" class="toolbar-item"><img'.t3lib_iconWorks
::skinImg($this->backPath
, 'gfx/toolbar_shortcut.png', 'width="16" height="16"').' title="'.$title.'" alt="'.$title.'" /></a>';
118 $shortcutMenu[] = '<div class="toolbar-item-menu" style="display: none;">';
119 $shortcutMenu[] = $this->renderMenu();
120 $shortcutMenu[] = '</div>';
122 return implode("\n", $shortcutMenu);
126 * renders the pure contents of the menu
128 * @return string the menu's content
130 public function renderMenu() {
132 $shortcutGroup = $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xml:toolbarItems.shortcutsGroup', true);
133 $shortcutEdit = $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xml:toolbarItems.shortcutsEdit', true);
134 $shortcutDelete = $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xml:toolbarItems.shortcutsDelete', true);
136 $groupIcon = '<img'.t3lib_iconWorks
::skinImg($this->backPath
, 'gfx/i/sysf.gif', 'width="18" height="16"').' title="'.$shortcutGroup.'" alt="'.$shortcutGroup.'" />';
137 $editIcon = '<img'.t3lib_iconWorks
::skinImg($this->backPath
, 'gfx/edit2.gif', 'width="11" height="12"').' title="'.$shortcutEdit.'" alt="'.$shortcutEdit.'"';
138 $deleteIcon = '<img'.t3lib_iconWorks
::skinImg($this->backPath
, 'gfx/garbage.gif', 'width="11" height="12"').' title="'.$shortcutDelete.'" alt="'.$shortcutDelete.'" />';
140 $shortcutMenu[] = '<table border="0" cellspacing="0" cellpadding="0" class="shortcut-list">';
142 // render shortcuts with no group (group id = 0) first
143 $noGroupShortcuts = $this->getShortcutsByGroup(0);
144 foreach($noGroupShortcuts as $shortcut) {
146 <tr id="shortcut-'.$shortcut['raw']['uid'].'" class="shortcut">
147 <td class="shortcut-icon">'.$shortcut['icon'].'</td>
148 <td class="shortcut-label">
149 <a id="shortcut-label-'.$shortcut['raw']['uid'].'" href="#" onclick="'.$shortcut['action'].'; return false;">'.$shortcut['label'].'</a>
151 <td class="shortcut-edit">'.$editIcon.' id="shortcut-edit-'.$shortcut['raw']['uid'].'" /></td>
152 <td class="shortcut-delete">'.$deleteIcon.'</td>
156 // now render groups and the contained shortcuts
157 $groups = $this->getGroupsFromShortcuts();
158 krsort($groups, SORT_NUMERIC
);
159 foreach($groups as $groupId => $groupLabel) {
162 <tr class="shortcut-group" id="shortcut-group-'.$groupId.'">
163 <td class="shortcut-group-icon">'.$groupIcon.'</td>
164 <td class="shortcut-group-label">'.$groupLabel.'</td>
165 <td colspan="2"> </td>
168 $shortcuts = $this->getShortcutsByGroup($groupId);
170 foreach($shortcuts as $shortcut) {
175 $firstRow = ' first-row';
179 <tr id="shortcut-'.$shortcut['raw']['uid'].'" class="shortcut'.$firstRow.'">
180 <td class="shortcut-icon">'.$shortcut['icon'].'</td>
181 <td class="shortcut-label">
182 <a id="shortcut-label-'.$shortcut['raw']['uid'].'" href="#" onclick="'.$shortcut['action'].'; return false;">'.$shortcut['label'].'</a>
184 <td class="shortcut-edit">'.$editIcon.' id="shortcut-edit-'.$shortcut['raw']['uid'].'" /></td>
185 <td class="shortcut-delete">'.$deleteIcon.'</td>
189 $shortcutMenu[] = $shortcutGroup;
193 if(count($shortcutMenu) == 1) {
194 //no shortcuts added yet, show a small help message how to add shortcuts
195 $title = $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xml:toolbarItems.shortcuts', true);
196 $icon = '<img'.t3lib_iconWorks
::skinImg($backPath,'gfx/shortcut.gif','width="14" height="14"').' title="'.$title.'" alt="'.$title.'" />';
197 $label = str_replace('%icon%', $icon, $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_misc.php:shortcutDescription'));
199 $shortcutMenu[] = '<tr><td style="padding:1px 2px; color: #838383;">'.$label.'</td></tr>';
202 $shortcutMenu[] = '</table>';
204 $compiledShortcutMenu = implode("\n", $shortcutMenu);
206 return $compiledShortcutMenu;
210 * renders the menu so that it can be returned as response to an AJAX call
212 * @param array array of parameters from the AJAX interface, currently unused
213 * @param TYPO3AJAX object of type TYPO3AJAX
216 public function renderAjax($params = array(), TYPO3AJAX
&$ajaxObj = null) {
217 $menuContent = $this->renderMenu();
219 $ajaxObj->addContent('shortcutMenu', $menuContent);
223 * adds the necessary JavaScript to the backend
227 protected function addJavascriptToBackend() {
228 $this->backendReference
->addJavascriptFile('js/shortcutmenu.js');
232 * returns additional attributes for the list item in the toolbar
234 * @return string list item HTML attibutes
236 public function getAdditionalAttributes() {
237 return ' id="shortcut-menu"';
241 * retrieves the shortcuts for the current user
243 * @return array array of shortcuts
245 protected function initShortcuts() {
246 $shortcuts = array();
247 $globalGroups = $this->getGlobalShortcutGroups();
249 $res = $GLOBALS['TYPO3_DB']->exec_SELECTquery(
252 '((userid = '.$GLOBALS['BE_USER']->user
['uid'].' AND sc_group>=0) OR sc_group IN ('.implode(',', array_keys($globalGroups)).'))',
257 // Traverse shortcuts
258 while($row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res)) {
259 $shortcut = array('raw' => $row);
260 $moduleParts = explode('|', $row['module_name']);
261 $row['module_name'] = $moduleParts[0];
262 $row['M_module_name'] = $moduleParts[1];
263 $moduleParts = explode('_', $row['M_module_name'] ?
264 $row['M_module_name'] :
267 $queryParts = parse_url($row['url']);
268 $queryParameters = t3lib_div
::explodeUrl2Array($queryParts['query'], 1);
270 if($row['module_name'] == 'xMOD_alt_doc.php' && is_array($queryParameters['edit'])) {
271 $shortcut['table'] = key($queryParameters['edit']);
272 $shortcut['recordid'] = key($queryParameters['edit'][$shortcut['table']]);
274 if($queryParameters['edit'][$shortcut['table']][$shortcut['recordid']] == 'edit') {
275 $shortcut['type'] = 'edit';
276 } elseif($queryParameters['edit'][$shortcut['table']][$shortcut['recordid']] == 'new') {
277 $shortcut['type'] = 'new';
280 if(substr($shortcut['recordid'], -1) == ',') {
281 $shortcut['recordid'] = substr($shortcut['recordid'], 0, -1);
284 $shortcut['type'] = 'other';
287 // check for module access
288 if(!$GLOBALS['BE_USER']->isAdmin()) {
289 if(!isset($GLOBALS['LANG']->moduleLabels
['tabs_images'][implode('_', $moduleParts).'_tab'])) {
290 // nice hack to check if the user has access to this module
291 // - otherwise the translation label would not have been loaded :-)
295 $pageId = $this->getLinkedPageId($row['url']);
296 if(t3lib_div
::testInt($pageId)) {
297 // check for webmount access
298 if(!$GLOBALS['BE_USER']->isInWebMount($pageId)) {
302 // check for record access
303 $pageRow = t3lib_BEfunc
::getRecord('pages', $pageId);
304 if(!$GLOBALS['BE_USER']->doesUserHaveAccess($pageRow, $perms = 1)) {
310 $shortcutGroup = $row['sc_group'];
311 if($shortcutGroup && strcmp($lastGroup, $shortcutGroup) && ($shortcutGroup != -100)) {
312 $shortcut['groupLabel'] = $this->getShortcutGroupLabel($shortcutGroup);
315 if($row['description']) {
316 $shortcut['label'] = $row['description'];
318 $shortcut['label'] = t3lib_div
::fixed_lgd_cs(rawurldecode($queryParts['query']), 150);
321 $shortcut['group'] = $shortcutGroup;
322 $shortcut['icon'] = $this->getShortcutIcon($row, $shortcut);
323 $shortcut['iconTitle'] = $this->getShortcutIconTitle($shortcutLabel, $row['module_name'], $row['M_module_name']);
324 $shortcut['action'] = 'jump(unescape(\''.rawurlencode($row['url']).'\'),\''.implode('_',$moduleParts).'\',\''.$moduleParts[0].'\');';
326 $lastGroup = $row['sc_group'];
327 $shortcuts[] = $shortcut;
334 * gets shortcuts for a specific group
336 * @param integer group Id
337 * @return array array of shortcuts that matched the group
339 protected function getShortcutsByGroup($groupId) {
340 $shortcuts = array();
342 foreach($this->shortcuts
as $shortcut) {
343 if($shortcut['group'] == $groupId) {
344 $shortcuts[] = $shortcut;
352 * gets a shortcut by its uid
354 * @param integer shortcut id to get the complete shortcut for
355 * @return mixed an array containing the shortcut's data on success or false on failure
357 protected function getShortcutById($shortcutId) {
358 $returnShortcut = false;
360 foreach($this->shortcuts
as $shortcut) {
361 if($shortcut['raw']['uid'] == (int) $shortcutId) {
362 $returnShortcut = $shortcut;
367 return $returnShortcut;
371 * gets the available shortcut groups from default gropups, user TSConfig,
374 * @param array array of parameters from the AJAX interface, currently unused
375 * @param TYPO3AJAX object of type TYPO3AJAX
378 protected function initShortcutGroups($params = array(), TYPO3AJAX
&$ajaxObj = null) {
379 // groups from TSConfig
380 $userShortcutGroups = $GLOBALS['BE_USER']->getTSConfig('options.shortcutGroups');
382 if(is_array($userShortcutGroups['properties']) && count($userShortcutGroups['properties'])) {
383 foreach($userShortcutGroups['properties'] as $groupId => $label) {
384 if(strcmp('', $label) && strcmp('0', $label)) {
385 $this->shortcutGroups
[$groupId] = (string) $label;
386 } elseif($GLOBALS['BE_USER']->isAdmin()) {
387 unset($this->shortcutGroups
[$groupId]);
392 // generate global groups, all global groups have negative IDs.
393 if(count($this->shortcutGroups
)) {
394 $groups = $this->shortcutGroups
;
395 foreach($groups as $groupId => $groupLabel) {
396 $this->shortcutGroups
[($groupId * -1)] = $groupLabel;
400 // group -100 is kind of superglobal and can't be changed.
401 $this->shortcutGroups
[-100] = 1;
404 foreach($this->shortcutGroups
as $groupId => $groupLabel) {
405 $label = $groupLabel;
407 if($groupLabel == '1') {
408 $label = $GLOBALS['LANG']->getLL('shortcut_group_'.abs($groupId), 1);
412 $label = $GLOBALS['LANG']->getLL('shortcut_group', 1).' '.abs($groupId);
418 $label = $GLOBALS['LANG']->getLL('shortcut_global', 1).': '.
424 if($groupId == -100) {
425 $label = $GLOBALS['LANG']->getLL('shortcut_global', 1).': '.$GLOBALS['LANG']->getLL('shortcut_all', 1);
429 $this->shortcutGroups
[$groupId] = $label;
432 return $this->shortcutGroups
;
436 * gets the available shortcut groups
438 * @param array array of parameters from the AJAX interface, currently unused
439 * @param TYPO3AJAX object of type TYPO3AJAX
442 public function getAjaxShortcutGroups($params = array(), TYPO3AJAX
&$ajaxObj = null) {
443 $shortcutGroups = $this->shortcutGroups
;
445 if(!$GLOBALS['BE_USER']->isAdmin()) {
446 foreach($shortcutGroups as $groupId => $groupName) {
447 if(intval($groupId) < 0) {
448 unset($shortcutGroups[$groupId]);
453 $ajaxObj->addContent('shortcutGroups', $shortcutGroups);
454 $ajaxObj->setContentFormat('json');
458 * deletes a shortcut through an AJAX call
460 * @param array array of parameters from the AJAX interface, currently unused
461 * @param TYPO3AJAX object of type TYPO3AJAX
464 public function deleteAjaxShortcut($params = array(), TYPO3AJAX
&$ajaxObj = null) {
465 $shortcutId = (int) t3lib_div
::_POST('shortcutId');
466 $fullShortcut = $this->getShortcutById($shortcutId);
467 $ajaxReturn = 'failed';
469 if($fullShortcut['raw']['userid'] == $GLOBALS['BE_USER']->user
['uid']) {
470 $GLOBALS['TYPO3_DB']->exec_DELETEquery(
475 if($GLOBALS['TYPO3_DB']->sql_affected_rows() == 1) {
476 $ajaxReturn = 'deleted';
480 $ajaxObj->addContent('delete', $ajaxReturn);
484 * creates a shortcut through an AJAX call
486 * @param array array of parameters from the AJAX interface, currently unused
487 * @param TYPO3AJAX object of type TYPO3AJAX
490 public function createAjaxShortcut($params = array(), TYPO3AJAX
&$ajaxObj = null) {
493 $shortcutCreated = 'failed';
494 $shortcutName = 'Shortcut'; // default name
495 $shortcutNamePrepend = '';
497 $url = t3lib_div
::_POST('url');
498 $module = t3lib_div
::_POST('module');
499 $motherModule = t3lib_div
::_POST('motherModName');
501 // determine shortcut type
502 $queryParts = parse_url($url);
503 $queryParameters = t3lib_div
::explodeUrl2Array($queryParts['query'], 1);
505 if(is_array($queryParameters['edit'])) {
506 $shortcut['table'] = key($queryParameters['edit']);
507 $shortcut['recordid'] = key($queryParameters['edit'][$shortcut['table']]);
509 if($queryParameters['edit'][$shortcut['table']][$shortcut['recordid']] == 'edit') {
510 $shortcut['type'] = 'edit';
511 $shortcutNamePrepend = $GLOBALS['LANG']->getLL('shortcut_edit', 1);
512 } elseif($queryParameters['edit'][$shortcut['table']][$shortcut['recordid']] == 'new') {
513 $shortcut['type'] = 'new';
514 $shortcutNamePrepend = $GLOBALS['LANG']->getLL('shortcut_create', 1);
517 $shortcut['type'] = 'other';
520 // Lookup the title of this page and use it as default description
521 $pageId = $shortcut['recordid'] ?
$shortcut['recordid'] : $this->getLinkedPageId($url);
523 if(t3lib_div
::testInt($pageId)) {
524 $page = t3lib_BEfunc
::getRecord('pages', $pageId);
526 // set the name to the title of the page
527 if($shortcut['type'] == 'other') {
528 $shortcutName = $page['title'];
530 $shortcutName = $shortcutNamePrepend.' '.$LANG->sL($TCA[$shortcut['table']]['ctrl']['title']).' ('.$page['title'].')';
534 $dirName = urldecode($pageId);
535 if (preg_match('/\/$/', $dirName)) {
536 // if $pageId is a string and ends with a slash,
537 // assume it is a fileadmin reference and set
538 // the description to the basename of that path
539 $shortcutName .= ' ' . basename($dirName);
543 // adding the shortcut
544 if($module && $url) {
545 $fieldValues = array(
546 'userid' => $GLOBALS['BE_USER']->user
['uid'],
547 'module_name' => $module.'|'.$motherModule,
549 'description' => $shortcutName,
550 'sorting' => $GLOBALS['EXEC_TIME'],
552 $GLOBALS['TYPO3_DB']->exec_INSERTquery('sys_be_shortcuts', $fieldValues);
554 if($GLOBALS['TYPO3_DB']->sql_affected_rows() == 1) {
555 $shortcutCreated = 'success';
559 $ajaxObj->addContent('create', $shortcutCreated);
563 * gets called when a shortcut is changed, checks whether the user has
564 * permissions to do so and saves the changes if everything is ok
566 * @param array array of parameters from the AJAX interface, currently unused
567 * @param TYPO3AJAX object of type TYPO3AJAX
570 public function setAjaxShortcut($params = array(), TYPO3AJAX
&$ajaxObj = null) {
572 $shortcutId = (int) t3lib_div
::_POST('shortcutId');
573 $shortcutName = strip_tags(t3lib_div
::_POST('value'));
574 $shortcutGroupId = (int) t3lib_div
::_POST('shortcut-group');
576 if($shortcutGroupId > 0 ||
$GLOBALS['BE_USER']->isAdmin()) {
577 // users can delete only their own shortcuts (except admins)
578 $addUserWhere = (!$GLOBALS['BE_USER']->isAdmin() ?
579 ' AND userid='.intval($GLOBALS['BE_USER']->user
['uid'])
583 $fieldValues = array(
584 'description' => $shortcutName,
585 'sc_group' => $shortcutGroupId
588 if($fieldValues['sc_group'] < 0 && !$GLOBALS['BE_USER']->isAdmin()) {
589 $fieldValues['sc_group'] = 0;
592 $GLOBALS['TYPO3_DB']->exec_UPDATEquery(
594 'uid='.$shortcutId.$addUserWhere,
598 $affectedRows = $GLOBALS['TYPO3_DB']->sql_affected_rows();
599 if($affectedRows == 1) {
600 $ajaxObj->addContent('shortcut', $shortcutName);
602 $ajaxObj->addContent('shortcut', 'failed');
606 $ajaxObj->setContentFormat('plain');
610 * gets the label for a shortcut group
612 * @param integer a shortcut group id
613 * @return string the shortcut group label, can be an empty string if no group was found for the id
615 protected function getShortcutGroupLabel($groupId) {
618 if($this->shortcutGroups
[$groupId]) {
619 $label = $this->shortcutGroups
[$groupId];
626 * gets a list of global groups, shortcuts in these groups are available to all users
628 * @return array array of global groups
630 protected function getGlobalShortcutGroups() {
631 $globalGroups = array();
633 foreach($this->shortcutGroups
as $groupId => $groupLabel) {
635 $globalGroups[$groupId] = $groupLabel;
639 return $globalGroups;
643 * runs through the available shortcuts an collects their groups
645 * @return array array of groups which have shortcuts
647 protected function getGroupsFromShortcuts() {
650 foreach($this->shortcuts
as $shortcut) {
651 $groups[$shortcut['group']] = $this->shortcutGroups
[$shortcut['group']];
654 return array_unique($groups);
658 * gets the icon for the shortcut
660 * @param string backend module name
661 * @return string shortcut icon as img tag
663 protected function getShortcutIcon($row, $shortcut) {
666 switch($row['module_name']) {
667 case 'xMOD_alt_doc.php':
668 $table = $shortcut['table'];
669 $recordid = $shortcut['recordid'];
671 if($shortcut['type'] == 'edit') {
672 // Creating the list of fields to include in the SQL query:
673 $selectFields = $this->fieldArray
;
674 $selectFields[] = 'uid';
675 $selectFields[] = 'pid';
677 if($table=='pages') {
678 if(t3lib_extMgm
::isLoaded('cms')) {
679 $selectFields[] = 'module';
680 $selectFields[] = 'extendToSubpages';
682 $selectFields[] = 'doktype';
685 if(is_array($TCA[$table]['ctrl']['enablecolumns'])) {
686 $selectFields = array_merge($selectFields,$TCA[$table]['ctrl']['enablecolumns']);
689 if($TCA[$table]['ctrl']['type']) {
690 $selectFields[] = $TCA[$table]['ctrl']['type'];
693 if($TCA[$table]['ctrl']['typeicon_column']) {
694 $selectFields[] = $TCA[$table]['ctrl']['typeicon_column'];
697 if($TCA[$table]['ctrl']['versioningWS']) {
698 $selectFields[] = 't3ver_state';
701 $selectFields = array_unique($selectFields); // Unique list!
702 $permissionClause = ($table=='pages' && $this->perms_clause
) ?
703 ' AND '.$this->perms_clause
:
706 $sqlQueryParts = array(
707 'SELECT' => implode(',', $selectFields),
709 'WHERE' => 'uid IN ('.$recordid.') '.$permissionClause.
710 t3lib_BEfunc
::deleteClause($table).
711 t3lib_BEfunc
::versioningPlaceholderClause($table)
713 $result = $GLOBALS['TYPO3_DB']->exec_SELECT_queryArray($sqlQueryParts);
714 $row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($result);
716 $icon = t3lib_iconWorks
::getIcon($table, $row, $this->backPath
);
717 } elseif($shortcut['type'] == 'new') {
718 $icon = t3lib_iconWorks
::getIcon($table, '', $this->backPath
);
721 $icon = t3lib_iconWorks
::skinImg($this->backPath
, $icon, '', 1);
723 case 'xMOD_file_edit.php':
724 $icon = 'gfx/edit_file.gif';
726 case 'xMOD_wizard_rte.php':
727 $icon = 'gfx/edit_rtewiz.gif';
730 if($GLOBALS['LANG']->moduleLabels
['tabs_images'][$row['module_name'].'_tab']) {
731 $icon = $GLOBALS['LANG']->moduleLabels
['tabs_images'][$row['module_name'].'_tab'];
733 // change icon of fileadmin references - otherwise it doesn't differ with Web->List
734 $icon = str_replace('mod/file/list/list.gif', 'mod/file/file.gif', $icon);
736 if(t3lib_div
::isAbsPath($icon)) {
737 $icon = '../'.substr($icon, strlen(PATH_site
));
740 $icon = 'gfx/dummy_module.gif';
744 return '<img src="' . $icon . '" alt="' . $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xml:toolbarItems.shortcut', true) . '" title="' . $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xml:toolbarItems.shortcut', true) . '" />';
748 * Returns title for the shortcut icon
750 * @param string shortcut label
751 * @param string backend module name (key)
752 * @param string parent module label
753 * @return string title for the shortcut icon
755 protected function getShortcutIconTitle($shortcutLabel, $moduleName, $parentModuleName = '') {
758 if(substr($moduleName, 0, 5) == 'xMOD_') {
759 $title = substr($moduleName, 5);
761 $splitModuleName = explode('_', $moduleName);
762 $title = $GLOBALS['LANG']->moduleLabels
['tabs'][$splitModuleName[0].'_tab'];
764 if(count($splitModuleName) > 1) {
765 $title .= '>'.$GLOBALS['LANG']->moduleLabels
['tabs'][$moduleName.'_tab'];
769 if($parentModuleName) {
770 $title .= ' ('.$parentModuleName.')';
773 $title .= ': '.$shortcutLabel;
779 * Return the ID of the page in the URL if found.
781 * @param string The URL of the current shortcut link
782 * @return string If a page ID was found, it is returned. Otherwise: 0
784 protected function getLinkedPageId($url) {
785 return preg_replace('/.*[\?&]id=([^&]+).*/', '$1', $url);
791 if (defined('TYPO3_MODE') && $TYPO3_CONF_VARS[TYPO3_MODE
]['XCLASS']['typo3/classes/class.shortcutmenu.php']) {
792 include_once($TYPO3_CONF_VARS[TYPO3_MODE
]['XCLASS']['typo3/classes/class.shortcutmenu.php']);