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 if ($GLOBALS['BE_USER']->getTSConfigVal('options.enableShortcuts')) {
109 * Creates the shortcut menu (default renderer)
111 * @return string workspace selector as HTML select
113 public function render() {
114 $title = $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xml:toolbarItems.shortcuts', true);
115 $this->addJavascriptToBackend();
117 $shortcutMenu = array();
119 $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>';
120 $shortcutMenu[] = '<div class="toolbar-item-menu" style="display: none;">';
121 $shortcutMenu[] = $this->renderMenu();
122 $shortcutMenu[] = '</div>';
124 return implode("\n", $shortcutMenu);
128 * renders the pure contents of the menu
130 * @return string the menu's content
132 public function renderMenu() {
134 $shortcutGroup = $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xml:toolbarItems.shortcutsGroup', true);
135 $shortcutEdit = $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xml:toolbarItems.shortcutsEdit', true);
136 $shortcutDelete = $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xml:toolbarItems.shortcutsDelete', true);
138 $groupIcon = '<img'.t3lib_iconWorks
::skinImg($this->backPath
, 'gfx/i/sysf.gif', 'width="18" height="16"').' title="'.$shortcutGroup.'" alt="'.$shortcutGroup.'" />';
139 $editIcon = '<img'.t3lib_iconWorks
::skinImg($this->backPath
, 'gfx/edit2.gif', 'width="11" height="12"').' title="'.$shortcutEdit.'" alt="'.$shortcutEdit.'"';
140 $deleteIcon = '<img'.t3lib_iconWorks
::skinImg($this->backPath
, 'gfx/garbage.gif', 'width="11" height="12"').' title="'.$shortcutDelete.'" alt="'.$shortcutDelete.'" />';
142 $shortcutMenu[] = '<table border="0" cellspacing="0" cellpadding="0" class="shortcut-list">';
144 // render shortcuts with no group (group id = 0) first
145 $noGroupShortcuts = $this->getShortcutsByGroup(0);
146 foreach($noGroupShortcuts as $shortcut) {
148 <tr id="shortcut-'.$shortcut['raw']['uid'].'" class="shortcut">
149 <td class="shortcut-icon">'.$shortcut['icon'].'</td>
150 <td class="shortcut-label">
151 <a id="shortcut-label-'.$shortcut['raw']['uid'].'" href="#" onclick="'.$shortcut['action'].'; return false;">'.$shortcut['label'].'</a>
153 <td class="shortcut-edit">'.$editIcon.' id="shortcut-edit-'.$shortcut['raw']['uid'].'" /></td>
154 <td class="shortcut-delete">'.$deleteIcon.'</td>
158 // now render groups and the contained shortcuts
159 $groups = $this->getGroupsFromShortcuts();
160 krsort($groups, SORT_NUMERIC
);
161 foreach($groups as $groupId => $groupLabel) {
164 <tr class="shortcut-group" id="shortcut-group-'.$groupId.'">
165 <td class="shortcut-group-icon">'.$groupIcon.'</td>
166 <td class="shortcut-group-label">'.$groupLabel.'</td>
167 <td colspan="2"> </td>
170 $shortcuts = $this->getShortcutsByGroup($groupId);
172 foreach($shortcuts as $shortcut) {
177 $firstRow = ' first-row';
181 <tr id="shortcut-'.$shortcut['raw']['uid'].'" class="shortcut'.$firstRow.'">
182 <td class="shortcut-icon">'.$shortcut['icon'].'</td>
183 <td class="shortcut-label">
184 <a id="shortcut-label-'.$shortcut['raw']['uid'].'" href="#" onclick="'.$shortcut['action'].'; return false;">'.$shortcut['label'].'</a>
186 <td class="shortcut-edit">'.$editIcon.' id="shortcut-edit-'.$shortcut['raw']['uid'].'" /></td>
187 <td class="shortcut-delete">'.$deleteIcon.'</td>
191 $shortcutMenu[] = $shortcutGroup;
195 if(count($shortcutMenu) == 1) {
196 //no shortcuts added yet, show a small help message how to add shortcuts
197 $title = $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xml:toolbarItems.shortcuts', true);
198 $icon = '<img'.t3lib_iconWorks
::skinImg($backPath,'gfx/shortcut.gif','width="14" height="14"').' title="'.$title.'" alt="'.$title.'" />';
199 $label = str_replace('%icon%', $icon, $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_misc.php:shortcutDescription'));
201 $shortcutMenu[] = '<tr><td style="padding:1px 2px; color: #838383;">'.$label.'</td></tr>';
204 $shortcutMenu[] = '</table>';
206 $compiledShortcutMenu = implode("\n", $shortcutMenu);
208 return $compiledShortcutMenu;
212 * renders the menu so that it can be returned as response to an AJAX call
214 * @param array array of parameters from the AJAX interface, currently unused
215 * @param TYPO3AJAX object of type TYPO3AJAX
218 public function renderAjax($params = array(), TYPO3AJAX
&$ajaxObj = null) {
219 $menuContent = $this->renderMenu();
221 $ajaxObj->addContent('shortcutMenu', $menuContent);
225 * adds the necessary JavaScript to the backend
229 protected function addJavascriptToBackend() {
230 $this->backendReference
->addJavascriptFile('js/shortcutmenu.js');
234 * returns additional attributes for the list item in the toolbar
236 * @return string list item HTML attibutes
238 public function getAdditionalAttributes() {
239 return ' id="shortcut-menu"';
243 * retrieves the shortcuts for the current user
245 * @return array array of shortcuts
247 protected function initShortcuts() {
248 $shortcuts = array();
249 $globalGroups = $this->getGlobalShortcutGroups();
251 $res = $GLOBALS['TYPO3_DB']->exec_SELECTquery(
254 '((userid = '.$GLOBALS['BE_USER']->user
['uid'].' AND sc_group>=0) OR sc_group IN ('.implode(',', array_keys($globalGroups)).'))',
259 // Traverse shortcuts
260 while($row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res)) {
261 $shortcut = array('raw' => $row);
262 $moduleParts = explode('|', $row['module_name']);
263 $row['module_name'] = $moduleParts[0];
264 $row['M_module_name'] = $moduleParts[1];
265 $moduleParts = explode('_', $row['M_module_name'] ?
266 $row['M_module_name'] :
269 $queryParts = parse_url($row['url']);
270 $queryParameters = t3lib_div
::explodeUrl2Array($queryParts['query'], 1);
272 if($row['module_name'] == 'xMOD_alt_doc.php' && is_array($queryParameters['edit'])) {
273 $shortcut['table'] = key($queryParameters['edit']);
274 $shortcut['recordid'] = key($queryParameters['edit'][$shortcut['table']]);
276 if($queryParameters['edit'][$shortcut['table']][$shortcut['recordid']] == 'edit') {
277 $shortcut['type'] = 'edit';
278 } elseif($queryParameters['edit'][$shortcut['table']][$shortcut['recordid']] == 'new') {
279 $shortcut['type'] = 'new';
282 if(substr($shortcut['recordid'], -1) == ',') {
283 $shortcut['recordid'] = substr($shortcut['recordid'], 0, -1);
286 $shortcut['type'] = 'other';
289 // check for module access
290 if(!$GLOBALS['BE_USER']->isAdmin()) {
291 if(!isset($GLOBALS['LANG']->moduleLabels
['tabs_images'][implode('_', $moduleParts).'_tab'])) {
292 // nice hack to check if the user has access to this module
293 // - otherwise the translation label would not have been loaded :-)
297 $pageId = $this->getLinkedPageId($row['url']);
298 if(t3lib_div
::testInt($pageId)) {
299 // check for webmount access
300 if(!$GLOBALS['BE_USER']->isInWebMount($pageId)) {
304 // check for record access
305 $pageRow = t3lib_BEfunc
::getRecord('pages', $pageId);
306 if(!$GLOBALS['BE_USER']->doesUserHaveAccess($pageRow, $perms = 1)) {
312 $shortcutGroup = $row['sc_group'];
313 if($shortcutGroup && strcmp($lastGroup, $shortcutGroup) && ($shortcutGroup != -100)) {
314 $shortcut['groupLabel'] = $this->getShortcutGroupLabel($shortcutGroup);
317 if($row['description']) {
318 $shortcut['label'] = $row['description'];
320 $shortcut['label'] = t3lib_div
::fixed_lgd_cs(rawurldecode($queryParts['query']), 150);
323 $shortcut['group'] = $shortcutGroup;
324 $shortcut['icon'] = $this->getShortcutIcon($row, $shortcut);
325 $shortcut['iconTitle'] = $this->getShortcutIconTitle($shortcutLabel, $row['module_name'], $row['M_module_name']);
326 $shortcut['action'] = 'jump(unescape(\''.rawurlencode($row['url']).'\'),\''.implode('_',$moduleParts).'\',\''.$moduleParts[0].'\');';
328 $lastGroup = $row['sc_group'];
329 $shortcuts[] = $shortcut;
336 * gets shortcuts for a specific group
338 * @param integer group Id
339 * @return array array of shortcuts that matched the group
341 protected function getShortcutsByGroup($groupId) {
342 $shortcuts = array();
344 foreach($this->shortcuts
as $shortcut) {
345 if($shortcut['group'] == $groupId) {
346 $shortcuts[] = $shortcut;
354 * gets a shortcut by its uid
356 * @param integer shortcut id to get the complete shortcut for
357 * @return mixed an array containing the shortcut's data on success or false on failure
359 protected function getShortcutById($shortcutId) {
360 $returnShortcut = false;
362 foreach($this->shortcuts
as $shortcut) {
363 if($shortcut['raw']['uid'] == (int) $shortcutId) {
364 $returnShortcut = $shortcut;
369 return $returnShortcut;
373 * gets the available shortcut groups from default gropups, user TSConfig,
376 * @param array array of parameters from the AJAX interface, currently unused
377 * @param TYPO3AJAX object of type TYPO3AJAX
380 protected function initShortcutGroups($params = array(), TYPO3AJAX
&$ajaxObj = null) {
381 // groups from TSConfig
382 $userShortcutGroups = $GLOBALS['BE_USER']->getTSConfig('options.shortcutGroups');
384 if(is_array($userShortcutGroups['properties']) && count($userShortcutGroups['properties'])) {
385 foreach($userShortcutGroups['properties'] as $groupId => $label) {
386 if(strcmp('', $label) && strcmp('0', $label)) {
387 $this->shortcutGroups
[$groupId] = (string) $label;
388 } elseif($GLOBALS['BE_USER']->isAdmin()) {
389 unset($this->shortcutGroups
[$groupId]);
394 // generate global groups, all global groups have negative IDs.
395 if(count($this->shortcutGroups
)) {
396 $groups = $this->shortcutGroups
;
397 foreach($groups as $groupId => $groupLabel) {
398 $this->shortcutGroups
[($groupId * -1)] = $groupLabel;
402 // group -100 is kind of superglobal and can't be changed.
403 $this->shortcutGroups
[-100] = 1;
406 foreach($this->shortcutGroups
as $groupId => $groupLabel) {
407 $label = $groupLabel;
409 if($groupLabel == '1') {
410 $label = $GLOBALS['LANG']->getLL('shortcut_group_'.abs($groupId), 1);
414 $label = $GLOBALS['LANG']->getLL('shortcut_group', 1).' '.abs($groupId);
420 $label = $GLOBALS['LANG']->getLL('shortcut_global', 1).': '.
426 if($groupId == -100) {
427 $label = $GLOBALS['LANG']->getLL('shortcut_global', 1).': '.$GLOBALS['LANG']->getLL('shortcut_all', 1);
431 $this->shortcutGroups
[$groupId] = $label;
434 return $this->shortcutGroups
;
438 * gets the available shortcut groups
440 * @param array array of parameters from the AJAX interface, currently unused
441 * @param TYPO3AJAX object of type TYPO3AJAX
444 public function getAjaxShortcutGroups($params = array(), TYPO3AJAX
&$ajaxObj = null) {
445 $shortcutGroups = $this->shortcutGroups
;
447 if(!$GLOBALS['BE_USER']->isAdmin()) {
448 foreach($shortcutGroups as $groupId => $groupName) {
449 if(intval($groupId) < 0) {
450 unset($shortcutGroups[$groupId]);
455 $ajaxObj->addContent('shortcutGroups', $shortcutGroups);
456 $ajaxObj->setContentFormat('json');
460 * deletes a shortcut through an AJAX call
462 * @param array array of parameters from the AJAX interface, currently unused
463 * @param TYPO3AJAX object of type TYPO3AJAX
466 public function deleteAjaxShortcut($params = array(), TYPO3AJAX
&$ajaxObj = null) {
467 $shortcutId = (int) t3lib_div
::_POST('shortcutId');
468 $fullShortcut = $this->getShortcutById($shortcutId);
469 $ajaxReturn = 'failed';
471 if($fullShortcut['raw']['userid'] == $GLOBALS['BE_USER']->user
['uid']) {
472 $GLOBALS['TYPO3_DB']->exec_DELETEquery(
477 if($GLOBALS['TYPO3_DB']->sql_affected_rows() == 1) {
478 $ajaxReturn = 'deleted';
482 $ajaxObj->addContent('delete', $ajaxReturn);
486 * creates a shortcut through an AJAX call
488 * @param array array of parameters from the AJAX interface, currently unused
489 * @param TYPO3AJAX object of type TYPO3AJAX
492 public function createAjaxShortcut($params = array(), TYPO3AJAX
&$ajaxObj = null) {
495 $shortcutCreated = 'failed';
496 $shortcutName = 'Shortcut'; // default name
497 $shortcutNamePrepend = '';
499 $url = t3lib_div
::_POST('url');
500 $module = t3lib_div
::_POST('module');
501 $motherModule = t3lib_div
::_POST('motherModName');
503 // determine shortcut type
504 $queryParts = parse_url($url);
505 $queryParameters = t3lib_div
::explodeUrl2Array($queryParts['query'], 1);
507 if(is_array($queryParameters['edit'])) {
508 $shortcut['table'] = key($queryParameters['edit']);
509 $shortcut['recordid'] = key($queryParameters['edit'][$shortcut['table']]);
511 if($queryParameters['edit'][$shortcut['table']][$shortcut['recordid']] == 'edit') {
512 $shortcut['type'] = 'edit';
513 $shortcutNamePrepend = $GLOBALS['LANG']->getLL('shortcut_edit', 1);
514 } elseif($queryParameters['edit'][$shortcut['table']][$shortcut['recordid']] == 'new') {
515 $shortcut['type'] = 'new';
516 $shortcutNamePrepend = $GLOBALS['LANG']->getLL('shortcut_create', 1);
519 $shortcut['type'] = 'other';
522 // Lookup the title of this page and use it as default description
523 $pageId = $shortcut['recordid'] ?
$shortcut['recordid'] : $this->getLinkedPageId($url);
525 if(t3lib_div
::testInt($pageId)) {
526 $page = t3lib_BEfunc
::getRecord('pages', $pageId);
528 // set the name to the title of the page
529 if($shortcut['type'] == 'other') {
530 $shortcutName = $page['title'];
532 $shortcutName = $shortcutNamePrepend.' '.$LANG->sL($TCA[$shortcut['table']]['ctrl']['title']).' ('.$page['title'].')';
536 $dirName = urldecode($pageId);
537 if (preg_match('/\/$/', $dirName)) {
538 // if $pageId is a string and ends with a slash,
539 // assume it is a fileadmin reference and set
540 // the description to the basename of that path
541 $shortcutName .= ' ' . basename($dirName);
545 // adding the shortcut
546 if($module && $url) {
547 $fieldValues = array(
548 'userid' => $GLOBALS['BE_USER']->user
['uid'],
549 'module_name' => $module.'|'.$motherModule,
551 'description' => $shortcutName,
552 'sorting' => $GLOBALS['EXEC_TIME'],
554 $GLOBALS['TYPO3_DB']->exec_INSERTquery('sys_be_shortcuts', $fieldValues);
556 if($GLOBALS['TYPO3_DB']->sql_affected_rows() == 1) {
557 $shortcutCreated = 'success';
561 $ajaxObj->addContent('create', $shortcutCreated);
565 * gets called when a shortcut is changed, checks whether the user has
566 * permissions to do so and saves the changes if everything is ok
568 * @param array array of parameters from the AJAX interface, currently unused
569 * @param TYPO3AJAX object of type TYPO3AJAX
572 public function setAjaxShortcut($params = array(), TYPO3AJAX
&$ajaxObj = null) {
574 $shortcutId = (int) t3lib_div
::_POST('shortcutId');
575 $shortcutName = strip_tags(t3lib_div
::_POST('value'));
576 $shortcutGroupId = (int) t3lib_div
::_POST('shortcut-group');
578 if($shortcutGroupId > 0 ||
$GLOBALS['BE_USER']->isAdmin()) {
579 // users can delete only their own shortcuts (except admins)
580 $addUserWhere = (!$GLOBALS['BE_USER']->isAdmin() ?
581 ' AND userid='.intval($GLOBALS['BE_USER']->user
['uid'])
585 $fieldValues = array(
586 'description' => $shortcutName,
587 'sc_group' => $shortcutGroupId
590 if($fieldValues['sc_group'] < 0 && !$GLOBALS['BE_USER']->isAdmin()) {
591 $fieldValues['sc_group'] = 0;
594 $GLOBALS['TYPO3_DB']->exec_UPDATEquery(
596 'uid='.$shortcutId.$addUserWhere,
600 $affectedRows = $GLOBALS['TYPO3_DB']->sql_affected_rows();
601 if($affectedRows == 1) {
602 $ajaxObj->addContent('shortcut', $shortcutName);
604 $ajaxObj->addContent('shortcut', 'failed');
608 $ajaxObj->setContentFormat('plain');
612 * gets the label for a shortcut group
614 * @param integer a shortcut group id
615 * @return string the shortcut group label, can be an empty string if no group was found for the id
617 protected function getShortcutGroupLabel($groupId) {
620 if($this->shortcutGroups
[$groupId]) {
621 $label = $this->shortcutGroups
[$groupId];
628 * gets a list of global groups, shortcuts in these groups are available to all users
630 * @return array array of global groups
632 protected function getGlobalShortcutGroups() {
633 $globalGroups = array();
635 foreach($this->shortcutGroups
as $groupId => $groupLabel) {
637 $globalGroups[$groupId] = $groupLabel;
641 return $globalGroups;
645 * runs through the available shortcuts an collects their groups
647 * @return array array of groups which have shortcuts
649 protected function getGroupsFromShortcuts() {
652 foreach($this->shortcuts
as $shortcut) {
653 $groups[$shortcut['group']] = $this->shortcutGroups
[$shortcut['group']];
656 return array_unique($groups);
660 * gets the icon for the shortcut
662 * @param string backend module name
663 * @return string shortcut icon as img tag
665 protected function getShortcutIcon($row, $shortcut) {
668 switch($row['module_name']) {
669 case 'xMOD_alt_doc.php':
670 $table = $shortcut['table'];
671 $recordid = $shortcut['recordid'];
673 if($shortcut['type'] == 'edit') {
674 // Creating the list of fields to include in the SQL query:
675 $selectFields = $this->fieldArray
;
676 $selectFields[] = 'uid';
677 $selectFields[] = 'pid';
679 if($table=='pages') {
680 if(t3lib_extMgm
::isLoaded('cms')) {
681 $selectFields[] = 'module';
682 $selectFields[] = 'extendToSubpages';
684 $selectFields[] = 'doktype';
687 if(is_array($TCA[$table]['ctrl']['enablecolumns'])) {
688 $selectFields = array_merge($selectFields,$TCA[$table]['ctrl']['enablecolumns']);
691 if($TCA[$table]['ctrl']['type']) {
692 $selectFields[] = $TCA[$table]['ctrl']['type'];
695 if($TCA[$table]['ctrl']['typeicon_column']) {
696 $selectFields[] = $TCA[$table]['ctrl']['typeicon_column'];
699 if($TCA[$table]['ctrl']['versioningWS']) {
700 $selectFields[] = 't3ver_state';
703 $selectFields = array_unique($selectFields); // Unique list!
704 $permissionClause = ($table=='pages' && $this->perms_clause
) ?
705 ' AND '.$this->perms_clause
:
708 $sqlQueryParts = array(
709 'SELECT' => implode(',', $selectFields),
711 'WHERE' => 'uid IN ('.$recordid.') '.$permissionClause.
712 t3lib_BEfunc
::deleteClause($table).
713 t3lib_BEfunc
::versioningPlaceholderClause($table)
715 $result = $GLOBALS['TYPO3_DB']->exec_SELECT_queryArray($sqlQueryParts);
716 $row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($result);
718 $icon = t3lib_iconWorks
::getIcon($table, $row, $this->backPath
);
719 } elseif($shortcut['type'] == 'new') {
720 $icon = t3lib_iconWorks
::getIcon($table, '', $this->backPath
);
723 $icon = t3lib_iconWorks
::skinImg($this->backPath
, $icon, '', 1);
725 case 'xMOD_file_edit.php':
726 $icon = 'gfx/edit_file.gif';
728 case 'xMOD_wizard_rte.php':
729 $icon = 'gfx/edit_rtewiz.gif';
732 if($GLOBALS['LANG']->moduleLabels
['tabs_images'][$row['module_name'].'_tab']) {
733 $icon = $GLOBALS['LANG']->moduleLabels
['tabs_images'][$row['module_name'].'_tab'];
735 // change icon of fileadmin references - otherwise it doesn't differ with Web->List
736 $icon = str_replace('mod/file/list/list.gif', 'mod/file/file.gif', $icon);
738 if(t3lib_div
::isAbsPath($icon)) {
739 $icon = '../'.substr($icon, strlen(PATH_site
));
742 $icon = 'gfx/dummy_module.gif';
746 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) . '" />';
750 * Returns title for the shortcut icon
752 * @param string shortcut label
753 * @param string backend module name (key)
754 * @param string parent module label
755 * @return string title for the shortcut icon
757 protected function getShortcutIconTitle($shortcutLabel, $moduleName, $parentModuleName = '') {
760 if(substr($moduleName, 0, 5) == 'xMOD_') {
761 $title = substr($moduleName, 5);
763 $splitModuleName = explode('_', $moduleName);
764 $title = $GLOBALS['LANG']->moduleLabels
['tabs'][$splitModuleName[0].'_tab'];
766 if(count($splitModuleName) > 1) {
767 $title .= '>'.$GLOBALS['LANG']->moduleLabels
['tabs'][$moduleName.'_tab'];
771 if($parentModuleName) {
772 $title .= ' ('.$parentModuleName.')';
775 $title .= ': '.$shortcutLabel;
781 * Return the ID of the page in the URL if found.
783 * @param string The URL of the current shortcut link
784 * @return string If a page ID was found, it is returned. Otherwise: 0
786 protected function getLinkedPageId($url) {
787 return preg_replace('/.*[\?&]id=([^&]+).*/', '$1', $url);
793 if (defined('TYPO3_MODE') && $TYPO3_CONF_VARS[TYPO3_MODE
]['XCLASS']['typo3/classes/class.shortcutmenu.php']) {
794 include_once($TYPO3_CONF_VARS[TYPO3_MODE
]['XCLASS']['typo3/classes/class.shortcutmenu.php']);