TYPO3 CMS  TYPO3_6-2
LiveSearchToolbarItem.php
Go to the documentation of this file.
1 <?php
3 
23 
29  protected $backendReference;
30 
36  public function __construct(\TYPO3\CMS\Backend\Controller\BackendController &$backendReference = NULL) {
37  $this->backendReference = $backendReference;
38  }
39 
45  public function checkAccess() {
46  $access = FALSE;
47  // Loads the backend modules available for the logged in user.
48  $loadModules = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Backend\\Module\\ModuleLoader');
49  $loadModules->observeWorkspaces = TRUE;
50  $loadModules->load($GLOBALS['TBE_MODULES']);
51  // Live search is heavily dependent on the list module and only available when that module is.
52  if (is_array($loadModules->modules['web']['sub']['list'])) {
53  $access = TRUE;
54  }
55  return $access;
56  }
57 
63  public function render() {
64  $this->addJavascriptToBackend();
65  return '<div class="live-search-wrapper">
66  <span title="' . $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_common.xlf:search') . '" class="t3-icon t3-icon-apps t3-icon-apps-toolbar t3-icon-toolbar-menu-search">&nbsp;</span>
67  <input id="live-search-box" />
68  </div>';
69  }
70 
76  protected function addJavascriptToBackend() {
77  $pageRenderer = $GLOBALS['TBE_TEMPLATE']->getPageRenderer();
78  $this->backendReference->addJavascriptFile('sysext/backend/Resources/Public/JavaScript/livesearch.js');
79  }
80 
86  public function getAdditionalAttributes() {
87  return 'id="live-search-menu"';
88  }
89 
90 }
__construct(\TYPO3\CMS\Backend\Controller\BackendController &$backendReference=NULL)
if(!defined('TYPO3_MODE')) $GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['t3lib/class.t3lib_userauth.php']['logoff_pre_processing'][]