2 /***************************************************************
5 * (c) 2007-2011 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(PATH_typo3
. '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
41 * @author Ingo Renner <ingo@typo3.org>
45 class ShortcutMenu
implements backend_toolbarItem
{
47 protected $shortcutGroups;
50 * all available shortcuts
57 * labels of all groups.
58 * If value is 1, the system will try to find a label in the locallang array.
62 protected $groupLabels;
65 * reference back to the backend object
69 protected $backendReference;
74 * @param TYPO3backend TYPO3 backend object reference
77 public function __construct(TYPO3backend
&$backendReference = NULL) {
78 $this->backendReference
= $backendReference;
79 $this->shortcuts
= array();
81 // by default, 5 groups are set
82 $this->shortcutGroups
= array(
90 $this->shortcutGroups
= $this->initShortcutGroups();
91 $this->shortcuts
= $this->initShortcuts();
95 * checks whether the user has access to this toolbar item
97 * @return boolean TRUE if user has access, FALSE if not
99 public function checkAccess() {
100 return (bool) $GLOBALS['BE_USER']->getTSConfigVal('options.enableBookmarks');
104 * Creates the shortcut menu (default renderer)
106 * @return string workspace selector as HTML select
108 public function render() {
109 $title = $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xml:toolbarItems.bookmarks', TRUE);
110 $this->addJavascriptToBackend();
112 $shortcutMenu = array();
114 $shortcutMenu[] = '<a href="#" class="toolbar-item">' .
115 t3lib_iconWorks
::getSpriteIcon('apps-toolbar-menu-shortcut', array('title' => $title)) .
117 $shortcutMenu[] = '<div class="toolbar-item-menu" style="display: none;">';
118 $shortcutMenu[] = $this->renderMenu();
119 $shortcutMenu[] = '</div>';
121 return implode(LF
, $shortcutMenu);
125 * renders the pure contents of the menu
127 * @return string the menu's content
129 public function renderMenu() {
131 $shortcutGroup = $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xml:toolbarItems.bookmarksGroup', TRUE);
132 $shortcutEdit = $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xml:toolbarItems.bookmarksEdit', TRUE);
133 $shortcutDelete = $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xml:toolbarItems.bookmarksDelete', TRUE);
135 $groupIcon = '<img'.t3lib_iconWorks
::skinImg($this->backPath
, 'gfx/i/sysf.gif', 'width="18" height="16"').' title="'.$shortcutGroup.'" alt="'.$shortcutGroup.'" />';
136 $editIcon = '<img'.t3lib_iconWorks
::skinImg($this->backPath
, 'gfx/edit2.gif', 'width="11" height="12"').' title="'.$shortcutEdit.'" alt="'.$shortcutEdit.'"';
137 $deleteIcon = '<img'.t3lib_iconWorks
::skinImg($this->backPath
, 'gfx/garbage.gif', 'width="11" height="12"').' title="'.$shortcutDelete.'" alt="'.$shortcutDelete.'" />';
139 $shortcutMenu[] = '<table border="0" cellspacing="0" cellpadding="0" class="shortcut-list">';
141 // render shortcuts with no group (group id = 0) first
142 $noGroupShortcuts = $this->getShortcutsByGroup(0);
143 foreach($noGroupShortcuts as $shortcut) {
145 <tr id="shortcut-'.$shortcut['raw']['uid'].'" class="shortcut">
146 <td class="shortcut-icon">'.$shortcut['icon'].'</td>
147 <td class="shortcut-label">
148 <a id="shortcut-label-' . $shortcut['raw']['uid'] . '" href="#" onclick="' . $shortcut['action'] . '; return false;">' . htmlspecialchars($shortcut['label']) . '</a>
150 <td class="shortcut-edit">'.$editIcon.' id="shortcut-edit-'.$shortcut['raw']['uid'].'" /></td>
151 <td class="shortcut-delete">'.$deleteIcon.'</td>
155 // now render groups and the contained shortcuts
156 $groups = $this->getGroupsFromShortcuts();
157 krsort($groups, SORT_NUMERIC
);
158 foreach($groups as $groupId => $groupLabel) {
161 <tr class="shortcut-group" id="shortcut-group-'.$groupId.'">
162 <td class="shortcut-group-icon">'.$groupIcon.'</td>
163 <td class="shortcut-group-label">'.$groupLabel.'</td>
164 <td colspan="2"> </td>
167 $shortcuts = $this->getShortcutsByGroup($groupId);
169 foreach($shortcuts as $shortcut) {
174 $firstRow = ' first-row';
178 <tr id="shortcut-'.$shortcut['raw']['uid'].'" class="shortcut'.$firstRow.'">
179 <td class="shortcut-icon">'.$shortcut['icon'].'</td>
180 <td class="shortcut-label">
181 <a id="shortcut-label-' . $shortcut['raw']['uid'] . '" href="#" onclick="' . $shortcut['action'] . '; return false;">' . htmlspecialchars($shortcut['label']) . '</a>
183 <td class="shortcut-edit">'.$editIcon.' id="shortcut-edit-'.$shortcut['raw']['uid'].'" /></td>
184 <td class="shortcut-delete">'.$deleteIcon.'</td>
188 $shortcutMenu[] = $shortcutGroup;
192 if(count($shortcutMenu) == 1) {
193 //no shortcuts added yet, show a small help message how to add shortcuts
194 $title = $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xml:toolbarItems.bookmarks', TRUE);
195 $icon = t3lib_iconWorks
::getSpriteIcon('actions-system-shortcut-new', array(
198 $label = str_replace('%icon%', $icon, $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_misc.php:bookmarkDescription'));
200 $shortcutMenu[] = '<tr><td style="padding:1px 2px; color: #838383;">'.$label.'</td></tr>';
203 $shortcutMenu[] = '</table>';
205 $compiledShortcutMenu = implode(LF
, $shortcutMenu);
207 return $compiledShortcutMenu;
211 * renders the menu so that it can be returned as response to an AJAX call
213 * @param array array of parameters from the AJAX interface, currently unused
214 * @param TYPO3AJAX object of type TYPO3AJAX
217 public function renderAjax($params = array(), TYPO3AJAX
&$ajaxObj = NULL) {
218 $menuContent = $this->renderMenu();
220 $ajaxObj->addContent('shortcutMenu', $menuContent);
224 * adds the necessary JavaScript to the backend
228 protected function addJavascriptToBackend() {
229 $this->backendReference
->addJavascriptFile('js/shortcutmenu.js');
233 * returns additional attributes for the list item in the toolbar
235 * @return string list item HTML attibutes
237 public function getAdditionalAttributes() {
238 return ' id="shortcut-menu"';
242 * retrieves the shortcuts for the current user
244 * @return array array of shortcuts
246 protected function initShortcuts() {
247 $shortcuts = array();
248 $globalGroups = $this->getGlobalShortcutGroups();
250 $res = $GLOBALS['TYPO3_DB']->exec_SELECTquery(
253 '((userid = '.$GLOBALS['BE_USER']->user
['uid'].' AND sc_group>=0) OR sc_group IN ('.implode(',', array_keys($globalGroups)).'))',
258 // Traverse shortcuts
259 while($row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res)) {
260 $shortcut = array('raw' => $row);
261 $moduleParts = explode('|', $row['module_name']);
262 $row['module_name'] = $moduleParts[0];
263 $row['M_module_name'] = $moduleParts[1];
264 $moduleParts = explode('_', $row['M_module_name'] ?
265 $row['M_module_name'] :
268 $queryParts = parse_url($row['url']);
269 $queryParameters = t3lib_div
::explodeUrl2Array($queryParts['query'], 1);
271 if($row['module_name'] == 'xMOD_alt_doc.php' && is_array($queryParameters['edit'])) {
272 $shortcut['table'] = key($queryParameters['edit']);
273 $shortcut['recordid'] = key($queryParameters['edit'][$shortcut['table']]);
275 if($queryParameters['edit'][$shortcut['table']][$shortcut['recordid']] == 'edit') {
276 $shortcut['type'] = 'edit';
277 } elseif($queryParameters['edit'][$shortcut['table']][$shortcut['recordid']] == 'new') {
278 $shortcut['type'] = 'new';
281 if(substr($shortcut['recordid'], -1) == ',') {
282 $shortcut['recordid'] = substr($shortcut['recordid'], 0, -1);
285 $shortcut['type'] = 'other';
288 // check for module access
289 $pageId = $this->getLinkedPageId($row['url']);
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 if(t3lib_utility_Math
::canBeInterpretedAsInteger($pageId)) {
298 // check for webmount access
299 if(!$GLOBALS['BE_USER']->isInWebMount($pageId)) {
303 // check for record access
304 $pageRow = t3lib_BEfunc
::getRecord('pages', $pageId);
305 if(!$GLOBALS['BE_USER']->doesUserHaveAccess($pageRow, $perms = 1)) {
311 $shortcutGroup = $row['sc_group'];
312 if($shortcutGroup && strcmp($lastGroup, $shortcutGroup) && ($shortcutGroup != -100)) {
313 $shortcut['groupLabel'] = $this->getShortcutGroupLabel($shortcutGroup);
316 if($row['description']) {
317 $shortcut['label'] = $row['description'];
319 $shortcut['label'] = t3lib_div
::fixed_lgd_cs(rawurldecode($queryParts['query']), 150);
322 $shortcut['group'] = $shortcutGroup;
323 $shortcut['icon'] = $this->getShortcutIcon($row, $shortcut);
324 $shortcut['iconTitle'] = $this->getShortcutIconTitle($shortcutLabel, $row['module_name'], $row['M_module_name']);
325 $shortcut['action'] = 'jump(unescape(\''.rawurlencode($row['url']).'\'),\''.implode('_',$moduleParts).'\',\''.$moduleParts[0].'\', ' . intval($pageId) . ');';
327 $lastGroup = $row['sc_group'];
328 $shortcuts[] = $shortcut;
335 * gets shortcuts for a specific group
337 * @param integer group Id
338 * @return array array of shortcuts that matched the group
340 protected function getShortcutsByGroup($groupId) {
341 $shortcuts = array();
343 foreach($this->shortcuts
as $shortcut) {
344 if($shortcut['group'] == $groupId) {
345 $shortcuts[] = $shortcut;
353 * gets a shortcut by its uid
355 * @param integer shortcut id to get the complete shortcut for
356 * @return mixed an array containing the shortcut's data on success or FALSE on failure
358 protected function getShortcutById($shortcutId) {
359 $returnShortcut = FALSE;
361 foreach($this->shortcuts
as $shortcut) {
362 if($shortcut['raw']['uid'] == (int) $shortcutId) {
363 $returnShortcut = $shortcut;
368 return $returnShortcut;
372 * gets the available shortcut groups from default gropups, user TSConfig,
375 * @param array array of parameters from the AJAX interface, currently unused
376 * @param TYPO3AJAX object of type TYPO3AJAX
379 protected function initShortcutGroups($params = array(), TYPO3AJAX
&$ajaxObj = NULL) {
380 // groups from TSConfig
381 $bookmarkGroups = $GLOBALS['BE_USER']->getTSConfigProp('options.bookmarkGroups');
383 if(is_array($bookmarkGroups) && count($bookmarkGroups)) {
384 foreach($bookmarkGroups as $groupId => $label) {
385 if(strcmp('', $label) && strcmp('0', $label)) {
386 $this->shortcutGroups
[$groupId] = (string) $label;
387 } elseif($GLOBALS['BE_USER']->isAdmin()) {
388 unset($this->shortcutGroups
[$groupId]);
393 // generate global groups, all global groups have negative IDs.
394 if(count($this->shortcutGroups
)) {
395 $groups = $this->shortcutGroups
;
396 foreach($groups as $groupId => $groupLabel) {
397 $this->shortcutGroups
[($groupId * -1)] = $groupLabel;
401 // group -100 is kind of superglobal and can't be changed.
402 $this->shortcutGroups
[-100] = 1;
405 foreach($this->shortcutGroups
as $groupId => $groupLabel) {
406 $label = $groupLabel;
408 if($groupLabel == '1') {
409 $label = $GLOBALS['LANG']->getLL('bookmark_group_'.abs($groupId), 1);
413 $label = $GLOBALS['LANG']->getLL('bookmark_group', 1).' '.abs($groupId);
419 $label = $GLOBALS['LANG']->getLL('bookmark_global', 1).': '.
425 if($groupId == -100) {
426 $label = $GLOBALS['LANG']->getLL('bookmark_global', 1).': '.$GLOBALS['LANG']->getLL('bookmark_all', 1);
430 $this->shortcutGroups
[$groupId] = $label;
433 return $this->shortcutGroups
;
437 * gets the available shortcut groups
439 * @param array array of parameters from the AJAX interface, currently unused
440 * @param TYPO3AJAX object of type TYPO3AJAX
443 public function getAjaxShortcutGroups($params = array(), TYPO3AJAX
&$ajaxObj = NULL) {
444 $shortcutGroups = $this->shortcutGroups
;
446 if(!$GLOBALS['BE_USER']->isAdmin()) {
447 foreach($shortcutGroups as $groupId => $groupName) {
448 if(intval($groupId) < 0) {
449 unset($shortcutGroups[$groupId]);
454 $ajaxObj->addContent('shortcutGroups', $shortcutGroups);
455 $ajaxObj->setContentFormat('json');
459 * deletes a shortcut through an AJAX call
461 * @param array array of parameters from the AJAX interface, currently unused
462 * @param TYPO3AJAX object of type TYPO3AJAX
465 public function deleteAjaxShortcut($params = array(), TYPO3AJAX
&$ajaxObj = NULL) {
466 $shortcutId = (int) t3lib_div
::_POST('shortcutId');
467 $fullShortcut = $this->getShortcutById($shortcutId);
468 $ajaxReturn = 'failed';
470 if($fullShortcut['raw']['userid'] == $GLOBALS['BE_USER']->user
['uid']) {
471 $GLOBALS['TYPO3_DB']->exec_DELETEquery(
476 if($GLOBALS['TYPO3_DB']->sql_affected_rows() == 1) {
477 $ajaxReturn = 'deleted';
481 $ajaxObj->addContent('delete', $ajaxReturn);
485 * creates a shortcut through an AJAX call
487 * @param array array of parameters from the AJAX interface, currently unused
488 * @param TYPO3AJAX object of type TYPO3AJAX
491 public function createAjaxShortcut($params = array(), TYPO3AJAX
&$ajaxObj = NULL) {
492 $shortcutCreated = 'failed';
493 $shortcutName = 'Shortcut'; // default name
494 $shortcutNamePrepend = '';
496 $url = t3lib_div
::_POST('url');
497 $module = t3lib_div
::_POST('module');
498 $motherModule = t3lib_div
::_POST('motherModName');
500 // determine shortcut type
501 $queryParts = parse_url($url);
502 $queryParameters = t3lib_div
::explodeUrl2Array($queryParts['query'], 1);
504 // Proceed only if no scheme is defined, as URL is expected to be relative
505 if (empty($queryParts['scheme'])) {
506 if (is_array($queryParameters['edit'])) {
507 $shortcut['table'] = key($queryParameters['edit']);
508 $shortcut['recordid'] = key($queryParameters['edit'][$shortcut['table']]);
510 if($queryParameters['edit'][$shortcut['table']][$shortcut['recordid']] == 'edit') {
511 $shortcut['type'] = 'edit';
512 $shortcutNamePrepend = $GLOBALS['LANG']->getLL('shortcut_edit', 1);
513 } elseif($queryParameters['edit'][$shortcut['table']][$shortcut['recordid']] == 'new') {
514 $shortcut['type'] = 'new';
515 $shortcutNamePrepend = $GLOBALS['LANG']->getLL('shortcut_create', 1);
518 $shortcut['type'] = 'other';
521 // Lookup the title of this page and use it as default description
522 $pageId = $shortcut['recordid'] ?
$shortcut['recordid'] : $this->getLinkedPageId($url);
524 if(t3lib_utility_Math
::canBeInterpretedAsInteger($pageId)) {
525 $page = t3lib_BEfunc
::getRecord('pages', $pageId);
527 // set the name to the title of the page
528 if($shortcut['type'] == 'other') {
529 $shortcutName = $page['title'];
531 $shortcutName = $shortcutNamePrepend.' '.$GLOBALS['LANG']->sL($GLOBALS['TCA'][$shortcut['table']]['ctrl']['title']).' ('.$page['title'].')';
535 $dirName = urldecode($pageId);
536 if (preg_match('/\/$/', $dirName)) {
537 // if $pageId is a string and ends with a slash,
538 // assume it is a fileadmin reference and set
539 // the description to the basename of that path
540 $shortcutName .= ' ' . basename($dirName);
544 // adding the shortcut
545 if($module && $url) {
546 $fieldValues = array(
547 'userid' => $GLOBALS['BE_USER']->user
['uid'],
548 'module_name' => $module.'|'.$motherModule,
550 'description' => $shortcutName,
551 'sorting' => $GLOBALS['EXEC_TIME'],
553 $GLOBALS['TYPO3_DB']->exec_INSERTquery('sys_be_shortcuts', $fieldValues);
555 if($GLOBALS['TYPO3_DB']->sql_affected_rows() == 1) {
556 $shortcutCreated = 'success';
560 $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) {
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($GLOBALS['TCA'][$table]['ctrl']['enablecolumns'])) {
686 $selectFields = array_merge($selectFields,$GLOBALS['TCA'][$table]['ctrl']['enablecolumns']);
689 if($GLOBALS['TCA'][$table]['ctrl']['type']) {
690 $selectFields[] = $GLOBALS['TCA'][$table]['ctrl']['type'];
693 if($GLOBALS['TCA'][$table]['ctrl']['typeicon_column']) {
694 $selectFields[] = $GLOBALS['TCA'][$table]['ctrl']['typeicon_column'];
697 if($GLOBALS['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);