ILIAS  Release_4_2_x_branch Revision 61807
 All Data Structures Namespaces Files Functions Variables Groups Pages
class.ilMainMenuSearchGUI.php
Go to the documentation of this file.
1 <?php
2 
3 /* Copyright (c) 1998-2011 ILIAS open source, Extended GPL, see docs/LICENSE */
4 
15 {
16  protected $tpl = null;
17  protected $lng = null;
18 
19  private $ref_id = ROOT_FOLDER_ID;
20  private $obj_id = 0;
21  private $type = '';
22  private $isContainer = true;
23 
28  public function __construct()
29  {
30  global $lng,$objDefinition,$tree;
31 
32  $this->lng = $lng;
33 
34  if(isset($_GET['ref_id']))
35  {
36  $this->ref_id = (int )$_GET['ref_id'];
37  }
38  $this->obj_id = ilObject::_lookupObjId($this->ref_id);
39  $this->type = ilObject::_lookupType($this->obj_id);
40 
41  $lng->loadLanguageModule("search");
42 
43  /*
44  if(!$objDefinition->isContainer($this->type))
45  {
46  $this->isContainer = false;
47  $parent_id = $tree->getParentId($this->ref_id);
48  $this->obj_id = ilObject::_lookupObjId($parent_id);
49  $this->type = ilObject::_lookupType($this->obj_id);
50  }
51  */
52  }
53 
54  public function getHTML()
55  {
56  global $ilCtrl, $tpl, $lng, $ilUser;
57 
58  if(!$this->isContainer)
59  {
60  #return '';
61  }
62  if($_GET['baseClass'] == 'ilSearchController')
63  {
64 // return '';
65  }
66 
67  include_once("./Services/YUI/classes/class.ilYuiUtil.php");
68  ilYuiUtil::initAutocomplete();
69  $this->tpl = new ilTemplate('tpl.main_menu_search.html',true,true,'Services/Search');
70  $this->tpl->setVariable('FORMACTION','ilias.php?baseClass=ilSearchController&cmd=post'.
71  '&rtoken='.$ilCtrl->getRequestToken().'&fallbackCmd=remoteSearch');
72  $this->tpl->setVariable('BTN_SEARCH',$this->lng->txt('search'));
73  $this->tpl->setVariable('CONT_REF_ID',ROOT_FOLDER_ID);
74  $this->tpl->setVariable('ID_AUTOCOMPLETE', "mm_sr_auto");
75  $this->tpl->setVariable('YUI_DATASOURCE', "ilias.php?baseClass=ilSearchController&cmd=autoComplete");
76 
77  // search link menu
78  //$this->tpl->setVariable('ARROW', ilUtil::getImagePath("mm_down_arrow_dark.gif"));
79  //$this->tpl->setVariable('SRC_ICON', ilUtil::getImagePath("icon_seas_s.gif"));
80  //$this->tpl->setVariable('TXT_LAST_SEARCH', " > ".$lng->txt("last_search_result"));
81  //$this->tpl->setVariable('HREF_LAST_SEARCH', "ilias.php?baseClass=ilSearchController");
82 
83  if ($ilUser->getId() != ANONYMOUS_USER_ID)
84  {
85  include_once("./Services/UIComponent/GroupedList/classes/class.ilGroupedListGUI.php");
86  $list = new ilGroupedListGUI();
87  $list->addEntry($lng->txt("last_search_result"), "ilias.php?baseClass=ilSearchController");
88  $this->tpl->setVariable('SEARCH_LINK_MENU', $list->getHTML());
89  $this->tpl->setVariable('TXT_SEARCH', $lng->txt("search"));
90  include_once("./Services/UIComponent/Overlay/classes/class.ilOverlayGUI.php");
91  $ov = new ilOverlayGUI("mm_search_menu");
92  //$ov->setTrigger("main_menu_search", "none",
93  // "main_menu_search", "tr", "br");
94  //$ov->setAnchor("main_menu_search", "tr", "br");
95  $ov->setAutoHide(false);
96  $ov->add();
97  }
98 
99  return $this->tpl->get();
100  }
101 }
102 ?>