TYPO3 CMS  TYPO3_6-2
ShortcutToolbarItem.php
Go to the documentation of this file.
1 <?php
3 
21 
28 
29  const SUPERGLOBAL_GROUP = -100;
30 
35  public $perms_clause;
36 
41  public $backPath;
42 
47  public $fieldArray;
48 
54  protected $shortcuts;
55 
59  protected $shortcutGroups;
60 
67  protected $groupLabels;
68 
74  protected $backendReference;
75 
81  public function __construct(\TYPO3\CMS\Backend\Controller\BackendController &$backendReference = NULL) {
82  if (TYPO3_REQUESTTYPE & TYPO3_REQUESTTYPE_AJAX) {
83  $GLOBALS['LANG']->includeLLFile('EXT:lang/locallang_misc.xlf');
84  // Needed to get the correct icons when reloading the menu after saving it
85  $loadModules = GeneralUtility::makeInstance('TYPO3\\CMS\\Backend\\Module\\ModuleLoader');
86  $loadModules->load($GLOBALS['TBE_MODULES']);
87  }
88  $this->backendReference = $backendReference;
89  $this->shortcuts = array();
90  // By default, 5 groups are set
91  $this->shortcutGroups = array(
92  1 => '1',
93  2 => '1',
94  3 => '1',
95  4 => '1',
96  5 => '1'
97  );
98  $this->shortcutGroups = $this->initShortcutGroups();
99  $this->shortcuts = $this->initShortcuts();
100  }
101 
107  public function checkAccess() {
108  return (bool) $GLOBALS['BE_USER']->getTSConfigVal('options.enableBookmarks');
109  }
110 
116  public function render() {
117  $title = $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xlf:toolbarItems.bookmarks', TRUE);
118  $this->addJavascriptToBackend();
119  $shortcutMenu = array();
120  $shortcutMenu[] = '<a href="#" class="toolbar-item">' . IconUtility::getSpriteIcon('apps-toolbar-menu-shortcut', array('title' => $title)) . '</a>';
121  $shortcutMenu[] = '<div class="toolbar-item-menu" style="display: none;">';
122  $shortcutMenu[] = $this->renderMenu();
123  $shortcutMenu[] = '</div>';
124  return implode(LF, $shortcutMenu);
125  }
126 
132  public function renderMenu() {
133  $shortcutGroup = $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xlf:toolbarItems.bookmarksGroup', TRUE);
134  $shortcutEdit = $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xlf:toolbarItems.bookmarksEdit', TRUE);
135  $shortcutDelete = $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xlf:toolbarItems.bookmarksDelete', TRUE);
136  $groupIcon = '<img' . IconUtility::skinImg($this->backPath, 'gfx/i/sysf.gif', 'width="18" height="16"') . ' title="' . $shortcutGroup . '" alt="' . $shortcutGroup . '" />';
137  $editIcon = '<img' . IconUtility::skinImg($this->backPath, 'gfx/edit2.gif', 'width="11" height="12"') . ' title="' . $shortcutEdit . '" alt="' . $shortcutEdit . '"';
138  $deleteIcon = '<img' . IconUtility::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">';
140  // Render shortcuts with no group (group id = 0) first
141  $noGroupShortcuts = $this->getShortcutsByGroup(0);
142  foreach ($noGroupShortcuts as $shortcut) {
143  $shortcutMenu[] = '
144  <tr id="shortcut-' . $shortcut['raw']['uid'] . '" class="shortcut">
145  <td class="shortcut-icon">' . $shortcut['icon'] . '</td>
146  <td class="shortcut-label">
147  <a id="shortcut-label-' . $shortcut['raw']['uid'] . '" href="#" onclick="' . $shortcut['action'] . '; return false;">' . htmlspecialchars($shortcut['label']) . '</a>
148  </td>
149  <td class="shortcut-edit">' . $editIcon . ' id="shortcut-edit-' . $shortcut['raw']['uid'] . '" /></td>
150  <td class="shortcut-delete">' . $deleteIcon . '</td>
151  </tr>';
152  }
153  // Now render groups and the contained shortcuts
154  $groups = $this->getGroupsFromShortcuts();
155  krsort($groups, SORT_NUMERIC);
156  foreach ($groups as $groupId => $groupLabel) {
157  if ($groupId != 0) {
158  $shortcutGroup = '
159  <tr class="shortcut-group" id="shortcut-group-' . $groupId . '">
160  <td class="shortcut-group-icon">' . $groupIcon . '</td>
161  <td class="shortcut-group-label">' . $groupLabel . '</td>
162  <td colspan="2">&nbsp;</td>
163  </tr>';
164  $shortcuts = $this->getShortcutsByGroup($groupId);
165  $i = 0;
166  foreach ($shortcuts as $shortcut) {
167  $i++;
168  $firstRow = '';
169  if ($i == 1) {
170  $firstRow = ' first-row';
171  }
172  $shortcutGroup .= '
173  <tr id="shortcut-' . $shortcut['raw']['uid'] . '" class="shortcut' . $firstRow . '">
174  <td class="shortcut-icon">' . $shortcut['icon'] . '</td>
175  <td class="shortcut-label">
176  <a id="shortcut-label-' . $shortcut['raw']['uid'] . '" href="#" onclick="' . $shortcut['action'] . '; return false;">' . htmlspecialchars($shortcut['label']) . '</a>
177  </td>
178  <td class="shortcut-edit">' . $editIcon . ' id="shortcut-edit-' . $shortcut['raw']['uid'] . '" /></td>
179  <td class="shortcut-delete">' . $deleteIcon . '</td>
180  </tr>';
181  }
182  $shortcutMenu[] = $shortcutGroup;
183  }
184  }
185  if (count($shortcutMenu) == 1) {
186  // No shortcuts added yet, show a small help message how to add shortcuts
187  $title = $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xlf:toolbarItems.bookmarks', TRUE);
188  $icon = IconUtility::getSpriteIcon('actions-system-shortcut-new', array(
189  'title' => $title
190  ));
191  $label = str_replace('%icon%', $icon, $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_misc.xlf:bookmarkDescription'));
192  $shortcutMenu[] = '<tr><td style="padding:1px 2px; color: #838383;">' . $label . '</td></tr>';
193  }
194  $shortcutMenu[] = '</table>';
195  $compiledShortcutMenu = implode(LF, $shortcutMenu);
196  return $compiledShortcutMenu;
197  }
198 
206  public function renderAjax($params = array(), \TYPO3\CMS\Core\Http\AjaxRequestHandler &$ajaxObj = NULL) {
207  $menuContent = $this->renderMenu();
208  $ajaxObj->addContent('shortcutMenu', $menuContent);
209  }
210 
216  protected function addJavascriptToBackend() {
217  $this->backendReference->addJavascriptFile('sysext/backend/Resources/Public/JavaScript/shortcutmenu.js');
218  }
219 
225  public function getAdditionalAttributes() {
226  return 'id="shortcut-menu"';
227  }
228 
234  protected function initShortcuts() {
235  $globalGroupIdList = implode(',', array_keys($this->getGlobalShortcutGroups()));
236  $res = $GLOBALS['TYPO3_DB']->exec_SELECTquery(
237  '*',
238  'sys_be_shortcuts',
239  '(userid = ' . (int)$GLOBALS['BE_USER']->user['uid'] . ' AND sc_group>=0) OR sc_group IN (' . $globalGroupIdList . ')',
240  '',
241  'sc_group,sorting'
242  );
243  // Traverse shortcuts
244  $lastGroup = 0;
245  $shortcuts = array();
246  while ($row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res)) {
247  $shortcut = array('raw' => $row);
248 
249  list($row['module_name'], $row['M_module_name']) = explode('|', $row['module_name']);
250 
251  $queryParts = parse_url($row['url']);
252  $queryParameters = GeneralUtility::explodeUrl2Array($queryParts['query'], 1);
253  if ($row['module_name'] === 'xMOD_alt_doc.php' && is_array($queryParameters['edit'])) {
254  $shortcut['table'] = key($queryParameters['edit']);
255  $shortcut['recordid'] = key($queryParameters['edit'][$shortcut['table']]);
256  if ($queryParameters['edit'][$shortcut['table']][$shortcut['recordid']] === 'edit') {
257  $shortcut['type'] = 'edit';
258  } elseif ($queryParameters['edit'][$shortcut['table']][$shortcut['recordid']] === 'new') {
259  $shortcut['type'] = 'new';
260  }
261  if (substr($shortcut['recordid'], -1) === ',') {
262  $shortcut['recordid'] = substr($shortcut['recordid'], 0, -1);
263  }
264  } else {
265  $shortcut['type'] = 'other';
266  }
267  // Check for module access
268  $moduleName = $row['M_module_name'] ?: $row['module_name'];
269  $pageId = $this->getLinkedPageId($row['url']);
270  if (!$GLOBALS['BE_USER']->isAdmin()) {
271  if (!isset($GLOBALS['LANG']->moduleLabels['tabs_images'][$moduleName . '_tab'])) {
272  // Nice hack to check if the user has access to this module
273  // - otherwise the translation label would not have been loaded :-)
274  continue;
275  }
277  // Check for webmount access
278  if (!$GLOBALS['BE_USER']->isInWebMount($pageId)) {
279  continue;
280  }
281  // Check for record access
282  $pageRow = BackendUtility::getRecord('pages', $pageId);
283  if (!$GLOBALS['BE_USER']->doesUserHaveAccess($pageRow, ($perms = 1))) {
284  continue;
285  }
286  }
287  }
288  $moduleParts = explode('_', $moduleName);
289  $shortcutGroup = (int)$row['sc_group'];
290  if ($shortcutGroup && $lastGroup !== $shortcutGroup && $shortcutGroup !== self::SUPERGLOBAL_GROUP) {
291  $shortcut['groupLabel'] = $this->getShortcutGroupLabel($shortcutGroup);
292  }
293  $lastGroup = $shortcutGroup;
294 
295  if ($row['description']) {
296  $shortcut['label'] = $row['description'];
297  } else {
298  $shortcut['label'] = GeneralUtility::fixed_lgd_cs(rawurldecode($queryParts['query']), 150);
299  }
300  $shortcut['group'] = $shortcutGroup;
301  $shortcut['icon'] = $this->getShortcutIcon($row, $shortcut);
302  $shortcut['iconTitle'] = $this->getShortcutIconTitle($shortcut['label'], $row['module_name'], $row['M_module_name']);
303  $shortcut['action'] = 'jump(' . GeneralUtility::quoteJSvalue($this->getTokenUrl($row['url'])) . ',' . GeneralUtility::quoteJSvalue($moduleName) . ',' . GeneralUtility::quoteJSvalue($moduleParts[0]) . ', ' . (int)$pageId . ');';
304 
305  $shortcuts[] = $shortcut;
306  }
307  return $shortcuts;
308  }
309 
316  protected function getTokenUrl($url) {
317  $parsedUrl = parse_url($url);
318  parse_str($parsedUrl['query'], $parameters);
319 
320  // parse the returnUrl and replace the module token of it
321  if (isset($parameters['returnUrl'])) {
322  $parsedReturnUrl = parse_url($parameters['returnUrl']);
323  parse_str($parsedReturnUrl['query'], $returnUrlParameters);
324  if (strpos($parsedReturnUrl['path'], 'mod.php') !== FALSE && isset($returnUrlParameters['M'])) {
325  $module = $returnUrlParameters['M'];
326  $returnUrl = BackendUtility::getModuleUrl($module, $returnUrlParameters);
327  $parameters['returnUrl'] = $returnUrl;
328  $url = $parsedUrl['path'] . '?' . http_build_query($parameters);
329  }
330  }
331 
332  if (strpos($parsedUrl['path'], 'mod.php') !== FALSE && isset($parameters['M'])) {
333  $module = $parameters['M'];
334  $url = str_replace('mod.php', '', $parsedUrl['path']) . BackendUtility::getModuleUrl($module, $parameters);
335  }
336  return $url;
337  }
338 
345  protected function getShortcutsByGroup($groupId) {
346  $shortcuts = array();
347  foreach ($this->shortcuts as $shortcut) {
348  if ($shortcut['group'] == $groupId) {
349  $shortcuts[] = $shortcut;
350  }
351  }
352  return $shortcuts;
353  }
354 
361  protected function getShortcutById($shortcutId) {
362  $returnShortcut = FALSE;
363  foreach ($this->shortcuts as $shortcut) {
364  if ($shortcut['raw']['uid'] == (int)$shortcutId) {
365  $returnShortcut = $shortcut;
366  continue;
367  }
368  }
369  return $returnShortcut;
370  }
371 
377  protected function initShortcutGroups() {
378  // Groups from TSConfig
379  $bookmarkGroups = $GLOBALS['BE_USER']->getTSConfigProp('options.bookmarkGroups');
380  if (is_array($bookmarkGroups) && count($bookmarkGroups)) {
381  foreach ($bookmarkGroups as $groupId => $label) {
382  if (!empty($label)) {
383  $this->shortcutGroups[$groupId] = (string)$label;
384  } elseif ($GLOBALS['BE_USER']->isAdmin()) {
385  unset($this->shortcutGroups[$groupId]);
386  }
387  }
388  }
389  // Generate global groups, all global groups have negative IDs.
390  if (count($this->shortcutGroups)) {
391  $groups = $this->shortcutGroups;
392  foreach ($groups as $groupId => $groupLabel) {
393  $this->shortcutGroups[$groupId * -1] = $groupLabel;
394  }
395  }
396  // Group -100 is kind of superglobal and can't be changed.
397  $this->shortcutGroups[self::SUPERGLOBAL_GROUP] = 1;
398  // Add labels
399  foreach ($this->shortcutGroups as $groupId => $groupLabel) {
400  $groupId = (int)$groupId;
401  $label = $groupLabel;
402  if ($groupLabel == '1') {
403  $label = $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_misc.xlf:bookmark_group_' . abs($groupId), TRUE);
404  if (empty($label)) {
405  // Fallback label
406  $label = $GLOBALS['LANG']->getLL('bookmark_group', 1) . ' ' . abs($groupId);
407  }
408  }
409  if ($groupId < 0) {
410  // Global group
411  $label = $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_misc.xlf:bookmark_global', TRUE) . ': ' . (!empty($label) ? $label : abs($groupId));
412  if ($groupId === self::SUPERGLOBAL_GROUP) {
413  $label = $GLOBALS['LANG']->getLL('bookmark_global', 1) . ': ' . $GLOBALS['LANG']->getLL('bookmark_all', 1);
414  }
415  }
416  $this->shortcutGroups[$groupId] = $label;
417  }
418  return $this->shortcutGroups;
419  }
420 
428  public function getAjaxShortcutGroups($params = array(), \TYPO3\CMS\Core\Http\AjaxRequestHandler &$ajaxObj = NULL) {
430  if (!$GLOBALS['BE_USER']->isAdmin()) {
431  foreach ($shortcutGroups as $groupId => $groupName) {
432  if ((int)$groupId < 0) {
433  unset($shortcutGroups[$groupId]);
434  }
435  }
436  }
437  $ajaxObj->addContent('shortcutGroups', $shortcutGroups);
438  $ajaxObj->setContentFormat('json');
439  }
440 
448  public function deleteAjaxShortcut($params = array(), \TYPO3\CMS\Core\Http\AjaxRequestHandler &$ajaxObj = NULL) {
449  $shortcutId = (int)GeneralUtility::_POST('shortcutId');
450  $fullShortcut = $this->getShortcutById($shortcutId);
451  $ajaxReturn = 'failed';
452  if ($fullShortcut['raw']['userid'] == $GLOBALS['BE_USER']->user['uid']) {
453  $GLOBALS['TYPO3_DB']->exec_DELETEquery('sys_be_shortcuts', 'uid = ' . $shortcutId);
454  if ($GLOBALS['TYPO3_DB']->sql_affected_rows() == 1) {
455  $ajaxReturn = 'deleted';
456  }
457  }
458  $ajaxObj->addContent('delete', $ajaxReturn);
459  }
460 
468  public function createAjaxShortcut($params = array(), \TYPO3\CMS\Core\Http\AjaxRequestHandler &$ajaxObj = NULL) {
469  $shortcutCreated = 'failed';
470  // Default name
471  $shortcutName = 'Shortcut';
472  $shortcutNamePrepend = '';
473  $url = GeneralUtility::_POST('url');
474  $module = GeneralUtility::_POST('module');
475  $motherModule = GeneralUtility::_POST('motherModName');
476  // Determine shortcut type
477  $queryParts = parse_url($url);
478  $queryParameters = GeneralUtility::explodeUrl2Array($queryParts['query'], 1);
479  // Proceed only if no scheme is defined, as URL is expected to be relative
480  if (empty($queryParts['scheme'])) {
481  if (is_array($queryParameters['edit'])) {
482  $shortcut['table'] = key($queryParameters['edit']);
483  $shortcut['recordid'] = key($queryParameters['edit'][$shortcut['table']]);
484  if ($queryParameters['edit'][$shortcut['table']][$shortcut['recordid']] == 'edit') {
485  $shortcut['type'] = 'edit';
486  $shortcutNamePrepend = $GLOBALS['LANG']->getLL('shortcut_edit', 1);
487  } elseif ($queryParameters['edit'][$shortcut['table']][$shortcut['recordid']] == 'new') {
488  $shortcut['type'] = 'new';
489  $shortcutNamePrepend = $GLOBALS['LANG']->getLL('shortcut_create', 1);
490  }
491  } else {
492  $shortcut['type'] = 'other';
493  }
494  // Lookup the title of this page and use it as default description
495  $pageId = $shortcut['recordid'] ? $shortcut['recordid'] : $this->getLinkedPageId($url);
497  $page = BackendUtility::getRecord('pages', $pageId);
498  if (count($page)) {
499  // Set the name to the title of the page
500  if ($shortcut['type'] == 'other') {
501  $shortcutName = $page['title'];
502  } else {
503  $shortcutName = $shortcutNamePrepend . ' ' . $GLOBALS['LANG']->sL($GLOBALS['TCA'][$shortcut['table']]['ctrl']['title']) . ' (' . $page['title'] . ')';
504  }
505  }
506  } else {
507  $dirName = urldecode($pageId);
508  if (preg_match('/\\/$/', $dirName)) {
509  // If $pageId is a string and ends with a slash,
510  // assume it is a fileadmin reference and set
511  // the description to the basename of that path
512  $shortcutName .= ' ' . basename($dirName);
513  }
514  }
515  // adding the shortcut
516  if ($module && $url) {
517  $fieldValues = array(
518  'userid' => $GLOBALS['BE_USER']->user['uid'],
519  'module_name' => $module . '|' . $motherModule,
520  'url' => $url,
521  'description' => $shortcutName,
522  'sorting' => $GLOBALS['EXEC_TIME']
523  );
524  $GLOBALS['TYPO3_DB']->exec_INSERTquery('sys_be_shortcuts', $fieldValues);
525  if ($GLOBALS['TYPO3_DB']->sql_affected_rows() == 1) {
526  $shortcutCreated = 'success';
527  }
528  }
529  $ajaxObj->addContent('create', $shortcutCreated);
530  }
531  }
532 
541  public function setAjaxShortcut($params = array(), \TYPO3\CMS\Core\Http\AjaxRequestHandler &$ajaxObj = NULL) {
542  $shortcutId = (int)GeneralUtility::_POST('shortcutId');
543  $shortcutName = strip_tags(GeneralUtility::_POST('value'));
544  $shortcutGroupId = (int)GeneralUtility::_POST('shortcut-group');
545  // Users can modify only their own shortcuts (except admins)
546  $addUserWhere = !$GLOBALS['BE_USER']->isAdmin() ? ' AND userid=' . (int)$GLOBALS['BE_USER']->user['uid'] : '';
547  $fieldValues = array(
548  'description' => $shortcutName,
549  'sc_group' => $shortcutGroupId
550  );
551  if ($fieldValues['sc_group'] < 0 && !$GLOBALS['BE_USER']->isAdmin()) {
552  $fieldValues['sc_group'] = 0;
553  }
554  $GLOBALS['TYPO3_DB']->exec_UPDATEquery('sys_be_shortcuts', 'uid=' . $shortcutId . $addUserWhere, $fieldValues);
555  $affectedRows = $GLOBALS['TYPO3_DB']->sql_affected_rows();
556  if ($affectedRows == 1) {
557  $ajaxObj->addContent('shortcut', $shortcutName);
558  } else {
559  $ajaxObj->addContent('shortcut', 'failed');
560  }
561  $ajaxObj->setContentFormat('plain');
562  }
563 
570  protected function getShortcutGroupLabel($groupId) {
571  return isset($this->shortcutGroups[$groupId]) ? $this->shortcutGroups[$groupId] : '';
572  }
573 
579  protected function getGlobalShortcutGroups() {
580  $globalGroups = array();
581  foreach ($this->shortcutGroups as $groupId => $groupLabel) {
582  if ($groupId < 0) {
583  $globalGroups[$groupId] = $groupLabel;
584  }
585  }
586  return $globalGroups;
587  }
588 
594  protected function getGroupsFromShortcuts() {
595  $groups = array();
596  foreach ($this->shortcuts as $shortcut) {
597  $groups[$shortcut['group']] = $this->shortcutGroups[$shortcut['group']];
598  }
599  return array_unique($groups);
600  }
601 
609  protected function getShortcutIcon($row, $shortcut) {
610  switch ($row['module_name']) {
611  case 'xMOD_alt_doc.php':
612  $table = $shortcut['table'];
613  $recordid = $shortcut['recordid'];
614  $icon = '';
615  if ($shortcut['type'] == 'edit') {
616  // Creating the list of fields to include in the SQL query:
617  $selectFields = $this->fieldArray;
618  $selectFields[] = 'uid';
619  $selectFields[] = 'pid';
620  if ($table == 'pages') {
621  $selectFields[] = 'module';
622  $selectFields[] = 'extendToSubpages';
623  $selectFields[] = 'doktype';
624  }
625  if (is_array($GLOBALS['TCA'][$table]['ctrl']['enablecolumns'])) {
626  $selectFields = array_merge($selectFields, $GLOBALS['TCA'][$table]['ctrl']['enablecolumns']);
627  }
628  if ($GLOBALS['TCA'][$table]['ctrl']['type']) {
629  $selectFields[] = $GLOBALS['TCA'][$table]['ctrl']['type'];
630  }
631  if ($GLOBALS['TCA'][$table]['ctrl']['typeicon_column']) {
632  $selectFields[] = $GLOBALS['TCA'][$table]['ctrl']['typeicon_column'];
633  }
634  if ($GLOBALS['TCA'][$table]['ctrl']['versioningWS']) {
635  $selectFields[] = 't3ver_state';
636  }
637  // Unique list!
638  $selectFields = array_unique($selectFields);
639  $permissionClause = $table === 'pages' && $this->perms_clause ? ' AND ' . $this->perms_clause : '';
640  $sqlQueryParts = array(
641  'SELECT' => implode(',', $selectFields),
642  'FROM' => $table,
643  'WHERE' => 'uid IN (' . $recordid . ') ' . $permissionClause . BackendUtility::deleteClause($table) . BackendUtility::versioningPlaceholderClause($table)
644  );
645  $result = $GLOBALS['TYPO3_DB']->exec_SELECT_queryArray($sqlQueryParts);
646  $row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($result);
647  $icon = IconUtility::getIcon($table, $row, $this->backPath);
648  } elseif ($shortcut['type'] == 'new') {
649  $icon = IconUtility::getIcon($table, array(), $this->backPath);
650  }
651  $icon = IconUtility::skinImg($this->backPath, $icon, '', 1);
652  break;
653  case 'xMOD_file_edit.php':
654  $icon = 'gfx/edit_file.gif';
655  break;
656  case 'wizard_rte':
657  $icon = 'gfx/edit_rtewiz.gif';
658  break;
659  default:
660  if ($GLOBALS['LANG']->moduleLabels['tabs_images'][$row['module_name'] . '_tab']) {
661  $icon = $GLOBALS['LANG']->moduleLabels['tabs_images'][$row['module_name'] . '_tab'];
662  // Change icon of fileadmin references - otherwise it doesn't differ with Web->List
663  $icon = str_replace('mod/file/list/list.gif', 'mod/file/file.gif', $icon);
664  if (GeneralUtility::isAbsPath($icon)) {
666  }
667  } else {
668  $icon = 'gfx/dummy_module.gif';
669  }
670  }
671  return '<img src="' . $icon . '" alt="' . $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xlf:toolbarItems.shortcut', TRUE) . '" title="' . $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xlf:toolbarItems.shortcut', TRUE) . '" />';
672  }
673 
682  protected function getShortcutIconTitle($shortcutLabel, $moduleName, $parentModuleName = '') {
683  $title = '';
684  if (substr($moduleName, 0, 5) == 'xMOD_') {
685  $title = substr($moduleName, 5);
686  } else {
687  $splitModuleName = explode('_', $moduleName);
688  $title = $GLOBALS['LANG']->moduleLabels['tabs'][$splitModuleName[0] . '_tab'];
689  if (count($splitModuleName) > 1) {
690  $title .= '>' . $GLOBALS['LANG']->moduleLabels['tabs'][($moduleName . '_tab')];
691  }
692  }
693  if ($parentModuleName) {
694  $title .= ' (' . $parentModuleName . ')';
695  }
696  $title .= ': ' . $shortcutLabel;
697  return $title;
698  }
699 
706  protected function getLinkedPageId($url) {
707  return preg_replace('/.*[\\?&]id=([^&]+).*/', '$1', $url);
708  }
709 
710 }
static skinImg($backPath, $src, $wHattribs='', $outputMode=0)
createAjaxShortcut($params=array(), \TYPO3\CMS\Core\Http\AjaxRequestHandler &$ajaxObj=NULL)
static explodeUrl2Array($string, $multidim=FALSE)
$parameters
Definition: FileDumpEID.php:15
$moduleName
Definition: mod.php:22
__construct(\TYPO3\CMS\Backend\Controller\BackendController &$backendReference=NULL)
deleteAjaxShortcut($params=array(), \TYPO3\CMS\Core\Http\AjaxRequestHandler &$ajaxObj=NULL)
renderAjax($params=array(), \TYPO3\CMS\Core\Http\AjaxRequestHandler &$ajaxObj=NULL)
static getModuleUrl($moduleName, $urlParameters=array(), $backPathOverride=FALSE, $returnAbsoluteUrl=FALSE)
static getIcon($table, $row=array(), $shaded=FALSE)
if($list_of_literals) if(!empty($literals)) if(!empty($literals)) $result
Analyse literals to prepend the N char to them if their contents aren&#39;t numeric.
getAjaxShortcutGroups($params=array(), \TYPO3\CMS\Core\Http\AjaxRequestHandler &$ajaxObj=NULL)
static getSpriteIcon($iconName, array $options=array(), array $overlays=array())
static fixed_lgd_cs($string, $chars, $appendString='...')
if(!defined('TYPO3_MODE')) $GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['t3lib/class.t3lib_userauth.php']['logoff_pre_processing'][]
setAjaxShortcut($params=array(), \TYPO3\CMS\Core\Http\AjaxRequestHandler &$ajaxObj=NULL)
getShortcutIconTitle($shortcutLabel, $moduleName, $parentModuleName='')
if($ajaxRegistryEntry !==NULL) $ajaxObj
Definition: ajax.php:63
static deleteClause($table, $tableAlias='')