class.backendsearchmenu.php

Go to the documentation of this file.
00001 <?php
00002 /***************************************************************
00003 *  Copyright notice
00004 *
00005 *  (c) 2007-2008 Ingo Renner <ingo@typo3.org>
00006 *  All rights reserved
00007 *
00008 *  This script is part of the TYPO3 project. The TYPO3 project is
00009 *  free software; you can redistribute it and/or modify
00010 *  it under the terms of the GNU General Public License as published by
00011 *  the Free Software Foundation; either version 2 of the License, or
00012 *  (at your option) any later version.
00013 *
00014 *  The GNU General Public License can be found at
00015 *  http://www.gnu.org/copyleft/gpl.html.
00016 *  A copy is found in the textfile GPL.txt and important notices to the license
00017 *  from the author is found in LICENSE.txt distributed with these scripts.
00018 *
00019 *
00020 *  This script is distributed in the hope that it will be useful,
00021 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
00022 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00023 *  GNU General Public License for more details.
00024 *
00025 *  This copyright notice MUST APPEAR in all copies of the script!
00026 ***************************************************************/
00027 
00028 
00029 /**
00030  * class to render the backend search toolbar item menu
00031  *
00032  * $Id: class.backendsearchmenu.php 4432 2008-11-07 03:52:22Z flyguide $
00033  *
00034  * @author  Ingo Renner <ingo@typo3.org>
00035  * @package TYPO3
00036  * @subpackage core
00037  */
00038 class BackendSearchMenu implements backend_toolbarItem {
00039 
00040     /**
00041      * reference back to the backend object
00042      *
00043      * @var TYPO3backend
00044      */
00045     protected $backendReference;
00046 
00047     /**
00048      * constructor
00049      *
00050      * @param   TYPO3backend    TYPO3 backend object reference
00051      */
00052     public function __construct(TYPO3backend &$backendReference = null) {
00053         $this->backendReference = $backendReference;
00054     }
00055 
00056     /**
00057      * checks whether the user has access to this toolbar item
00058      *
00059      * @return  boolean  true if user has access, false if not
00060      */
00061     public function checkAccess() {
00062             // Backendsearch module is enabled for everybody
00063         return true;
00064     }
00065 
00066     /**
00067      * Creates the selector for workspaces
00068      *
00069      * @return  string      workspace selector as HTML select
00070      */
00071     public function render() {
00072         $title = $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xml:toolbarItems.search', true);
00073         $this->addJavascriptToBackend();
00074         $searchMenu = array();
00075 
00076         $searchMenu[] = '<a href="#" class="toolbar-item"><img'.t3lib_iconWorks::skinImg($this->backPath, 'gfx/magnifier.png', 'width="16" height="16"').' title="'.$title.'" alt="'.$title.'" /></a>';
00077 
00078         $searchMenu[] = '<div class="toolbar-item-menu" style="display: none;">';
00079         $searchMenu[] = '<input type="text" id="search-query" name="search-query" value="" />';
00080         $searchMenu[] = '</div>';
00081 
00082         return implode("\n", $searchMenu);
00083     }
00084 
00085     /**
00086      * adds the necessary JavaScript to the backend
00087      *
00088      * @return  void
00089      */
00090     protected function addJavascriptToBackend() {
00091         $this->backendReference->addJavascriptFile('js/backendsearch.js');
00092     }
00093 
00094     /**
00095      * returns additional attributes for the list item in the toolbar
00096      *
00097      * @return  string      list item HTML attibutes
00098      */
00099     public function getAdditionalAttributes() {
00100         return ' id="backend-search-menu"';
00101     }
00102 
00103 }
00104 
00105 
00106 if (defined('TYPO3_MODE') && $TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['typo3/classes/class.backendsearchmenu.php'])   {
00107     include_once($TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['typo3/classes/class.backendsearchmenu.php']);
00108 }
00109 
00110 ?>

Generated on Sat Jan 3 04:23:28 2009 for TYPO3 API by  doxygen 1.4.7