ILIAS  Release_4_0_x_branch Revision 61816
 All Data Structures Namespaces Files Functions Variables Groups Pages
class.ilMainMenuSearchGUI.php
Go to the documentation of this file.
1 <?php
2 /*
3  +-----------------------------------------------------------------------------+
4  | ILIAS open source |
5  +-----------------------------------------------------------------------------+
6  | Copyright (c) 1998-2006 ILIAS open source, University of Cologne |
7  | |
8  | This program is free software; you can redistribute it and/or |
9  | modify it under the terms of the GNU General Public License |
10  | as published by the Free Software Foundation; either version 2 |
11  | of the License, or (at your option) any later version. |
12  | |
13  | This program is distributed in the hope that it will be useful, |
14  | but WITHOUT ANY WARRANTY; without even the implied warranty of |
15  | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
16  | GNU General Public License for more details. |
17  | |
18  | You should have received a copy of the GNU General Public License |
19  | along with this program; if not, write to the Free Software |
20  | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
21  +-----------------------------------------------------------------------------+
22 */
23 
34 {
35  protected $tpl = null;
36  protected $lng = null;
37 
38  private $ref_id = ROOT_FOLDER_ID;
39  private $obj_id = 0;
40  private $type = '';
41  private $isContainer = true;
42 
43 
48  public function __construct()
49  {
50  global $lng,$objDefinition,$tree;
51 
52  $this->lng = $lng;
53 
54  if(isset($_GET['ref_id']))
55  {
56  $this->ref_id = (int )$_GET['ref_id'];
57  }
58  $this->obj_id = ilObject::_lookupObjId($this->ref_id);
59  $this->type = ilObject::_lookupType($this->obj_id);
60 
61  /*
62  if(!$objDefinition->isContainer($this->type))
63  {
64  $this->isContainer = false;
65  $parent_id = $tree->getParentId($this->ref_id);
66  $this->obj_id = ilObject::_lookupObjId($parent_id);
67  $this->type = ilObject::_lookupType($this->obj_id);
68  }
69  */
70  }
71 
72  public function getHTML()
73  {
74  global $ilCtrl, $tpl;
75 
76  if(!$this->isContainer)
77  {
78  #return '';
79  }
80  if($_GET['baseClass'] == 'ilSearchController')
81  {
82  return '';
83  }
84 
85  include_once("./Services/YUI/classes/class.ilYuiUtil.php");
86  ilYuiUtil::initAutocomplete();
87  $this->tpl = new ilTemplate('tpl.main_menu_search.html',true,true,'Services/Search');
88  $this->tpl->setVariable('FORMACTION','ilias.php?baseClass=ilSearchController&cmd=post'.
89  '&rtoken='.$ilCtrl->getRequestToken().'&fallbackCmd=remoteSearch');
90  $this->tpl->setVariable('BTN_SEARCH',$this->lng->txt('search'));
91  $this->tpl->setVariable('CONT_REF_ID',ROOT_FOLDER_ID);
92  $this->tpl->setVariable('ID_AUTOCOMPLETE', "mm_sr_auto");
93  $this->tpl->setVariable('YUI_DATASOURCE', "ilias.php?baseClass=ilSearchController&cmd=autoComplete");
94 
95  return $this->tpl->get();
96  }
97 }
98 ?>