ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
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 $this->ref_id = (int) $_GET['ref_id'];
36 }
37 $this->obj_id = ilObject::_lookupObjId($this->ref_id);
38 $this->type = ilObject::_lookupType($this->obj_id);
39
40 $lng->loadLanguageModule("search");
41
42 /*
43 if(!$objDefinition->isContainer($this->type))
44 {
45 $this->isContainer = false;
46 $parent_id = $tree->getParentId($this->ref_id);
47 $this->obj_id = ilObject::_lookupObjId($parent_id);
48 $this->type = ilObject::_lookupType($this->obj_id);
49 }
50 */
51 }
52
53 public function getHTML()
54 {
55 global $ilCtrl, $tpl, $lng, $ilUser;
56
57 if (!$this->isContainer) {
58 #return '';
59 }
60 if ($_GET['baseClass'] == 'ilSearchController') {
61 // return '';
62 }
63
64 include_once "Services/jQuery/classes/class.iljQueryUtil.php";
67 $this->tpl = new ilTemplate('tpl.main_menu_search.html', true, true, 'Services/Search');
68
69 if ($ilUser->getId() != ANONYMOUS_USER_ID) {
70 if (ilSearchSettings::getInstance()->isLuceneUserSearchEnabled() or (int) $_GET['ref_id']) {
71 $this->tpl->setCurrentBlock("position");
72 $this->tpl->setVariable('TXT_GLOBALLY', $lng->txt("search_globally"));
73 $this->tpl->setVariable('ROOT_ID', ROOT_FOLDER_ID);
74 $this->tpl->parseCurrentBlock();
75 } else {
76 $this->tpl->setCurrentBlock("position_hid");
77 $this->tpl->setVariable('ROOT_ID_HID', ROOT_FOLDER_ID);
78 $this->tpl->parseCurrentBlock();
79 }
80 if ((int) $_GET['ref_id']) {
81 $this->tpl->setCurrentBlock('position_rep');
82 $this->tpl->setVariable('TXT_CURRENT_POSITION', $lng->txt("search_at_current_position"));
83 $this->tpl->setVariable('REF_ID', (int) $_GET["ref_id"]);
84 $this->tpl->parseCurrentBlock();
85 }
86 }
87
88 if ($ilUser->getId() != ANONYMOUS_USER_ID && ilSearchSettings::getInstance()->isLuceneUserSearchEnabled()) {
89 $this->tpl->setCurrentBlock('usr_search');
90 $this->tpl->setVariable('TXT_USR_SEARCH', $this->lng->txt('search_users'));
91 $this->tpl->parseCurrentBlock();
92 }
93
94 $this->tpl->setVariable('FORMACTION', 'ilias.php?baseClass=ilSearchController&cmd=post' .
95 '&rtoken=' . $ilCtrl->getRequestToken() . '&fallbackCmd=remoteSearch');
96 $this->tpl->setVariable('BTN_SEARCH', $this->lng->txt('search'));
97
98 // $this->tpl->setVariable('ID_AUTOCOMPLETE', "mm_sr_auto");
99 $this->tpl->setVariable('AC_DATASOURCE', "ilias.php?baseClass=ilSearchController&cmd=autoComplete");
100
101 $this->tpl->setVariable('IMG_MM_SEARCH', ilUtil::img(
102 ilUtil::getImagePath("icon_seas.svg"),
103 $lng->txt("search")
104 ));
105
106 if ($ilUser->getId() != ANONYMOUS_USER_ID) {
107 $this->tpl->setVariable('HREF_SEARCH_LINK', "ilias.php?baseClass=ilSearchController");
108 $this->tpl->setVariable('TXT_SEARCH_LINK', $lng->txt("last_search_result"));
109 }
110
111 // #10555 - we need the overlay for the autocomplete which is always active
112 $this->tpl->setVariable('TXT_SEARCH', $lng->txt("search"));
113 include_once("./Services/UIComponent/Overlay/classes/class.ilOverlayGUI.php");
114 $ov = new ilOverlayGUI("mm_search_menu");
115 //$ov->setTrigger("main_menu_search", "none",
116 // "main_menu_search", "tr", "br");
117 //$ov->setAnchor("main_menu_search", "tr", "br");
118 $ov->setAutoHide(false);
119 $ov->add();
120
121 return $this->tpl->get();
122 }
123}
$_GET["client_id"]
An exception for terminatinating execution or to throw for unit testing.
Add a search box to main menu.
__construct()
Constructor @access public.
static _lookupObjId($a_id)
static _lookupType($a_id, $a_reference=false)
lookup object type
This is a utility class for the yui overlays.
special template class to simplify handling of ITX/PEAR
static img($a_src, $a_alt="", $a_width="", $a_height="", $a_border=0, $a_id="", $a_class="")
Build img tag.
static getImagePath($img, $module_path="", $mode="output", $offline=false)
get image path (for images located in a template directory)
static initjQueryUI($a_tpl=null)
inits and adds the jQuery-UI JS-File to the global template (see included_components....
static initjQuery($a_tpl=null)
inits and adds the jQuery JS-File to the global or a passed template
global $ilCtrl
Definition: ilias.php:18
$ilUser
Definition: imgupload.php:18