ILIAS  release_5-1 Revision 5.0.0-5477-g43f3e3fab5f
ilMainMenuSearchGUI Class Reference

Add a search box to main menu. More...

+ Collaboration diagram for ilMainMenuSearchGUI:

Public Member Functions

 __construct ()
 Constructor @access public. More...
 
 getHTML ()
 

Protected Attributes

 $tpl = null
 
 $lng = null
 

Private Attributes

 $ref_id = ROOT_FOLDER_ID
 
 $obj_id = 0
 
 $type = ''
 
 $isContainer = true
 

Detailed Description

Add a search box to main menu.

Author
Stefan Meyer meyer.nosp@m.@lei.nosp@m.fos.c.nosp@m.om
Version
$Id$

Definition at line 14 of file class.ilMainMenuSearchGUI.php.

Constructor & Destructor Documentation

◆ __construct()

ilMainMenuSearchGUI::__construct ( )

Constructor @access public.

Definition at line 28 of file class.ilMainMenuSearchGUI.php.

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 }
$_GET["client_id"]
static _lookupObjId($a_id)
static _lookupType($a_id, $a_reference=false)
lookup object type

References $_GET, $lng, ilObject\_lookupObjId(), and ilObject\_lookupType().

+ Here is the call graph for this function:

Member Function Documentation

◆ getHTML()

ilMainMenuSearchGUI::getHTML ( )

Definition at line 54 of file class.ilMainMenuSearchGUI.php.

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/jQuery/classes/class.iljQueryUtil.php";
70 $this->tpl = new ilTemplate('tpl.main_menu_search.html',true,true,'Services/Search');
71
72 if ($ilUser->getId() != ANONYMOUS_USER_ID)
73 {
74 if(ilSearchSettings::getInstance()->isLuceneUserSearchEnabled() or (int) $_GET['ref_id'])
75 {
76 $this->tpl->setCurrentBlock("position");
77 $this->tpl->setVariable('TXT_GLOBALLY', $lng->txt("search_globally"));
78 $this->tpl->setVariable('ROOT_ID', ROOT_FOLDER_ID);
79 $this->tpl->parseCurrentBlock();
80 }
81 else
82 {
83 $this->tpl->setCurrentBlock("position_hid");
84 $this->tpl->setVariable('ROOT_ID_HID', ROOT_FOLDER_ID);
85 $this->tpl->parseCurrentBlock();
86 }
87 if((int) $_GET['ref_id'])
88 {
89 $this->tpl->setCurrentBlock('position_rep');
90 $this->tpl->setVariable('TXT_CURRENT_POSITION', $lng->txt("search_at_current_position"));
91 $this->tpl->setVariable('REF_ID', (int) $_GET["ref_id"]);
92 $this->tpl->parseCurrentBlock();
93 }
94 }
95
96 if($ilUser->getId() != ANONYMOUS_USER_ID && ilSearchSettings::getInstance()->isLuceneUserSearchEnabled())
97 {
98 $this->tpl->setCurrentBlock('usr_search');
99 $this->tpl->setVariable('TXT_USR_SEARCH',$this->lng->txt('search_users'));
100 $this->tpl->parseCurrentBlock();
101 }
102
103 $this->tpl->setVariable('FORMACTION','ilias.php?baseClass=ilSearchController&cmd=post'.
104 '&rtoken='.$ilCtrl->getRequestToken().'&fallbackCmd=remoteSearch');
105 $this->tpl->setVariable('BTN_SEARCH',$this->lng->txt('search'));
106
107 // $this->tpl->setVariable('ID_AUTOCOMPLETE', "mm_sr_auto");
108 $this->tpl->setVariable('AC_DATASOURCE', "ilias.php?baseClass=ilSearchController&cmd=autoComplete");
109
110 $this->tpl->setVariable('IMG_MM_SEARCH', ilUtil::img(ilUtil::getImagePath("icon_seas.svg"),
111 $lng->txt("search")));
112
113 if ($ilUser->getId() != ANONYMOUS_USER_ID)
114 {
115 $this->tpl->setVariable('HREF_SEARCH_LINK', "ilias.php?baseClass=ilSearchController");
116 $this->tpl->setVariable('TXT_SEARCH_LINK', $lng->txt("last_search_result"));
117 }
118
119 // #10555 - we need the overlay for the autocomplete which is always active
120 $this->tpl->setVariable('TXT_SEARCH', $lng->txt("search"));
121 include_once("./Services/UIComponent/Overlay/classes/class.ilOverlayGUI.php");
122 $ov = new ilOverlayGUI("mm_search_menu");
123 //$ov->setTrigger("main_menu_search", "none",
124 // "main_menu_search", "tr", "br");
125 //$ov->setAnchor("main_menu_search", "tr", "br");
126 $ov->setAutoHide(false);
127 $ov->add();
128
129 return $this->tpl->get();
130 }
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()
Init jQuery UI (see included_components.txt for included components)
static initjQuery($a_tpl=null)
Init jQuery.
global $ilCtrl
Definition: ilias.php:18
global $ilUser
Definition: imgupload.php:15

References $_GET, $ilCtrl, $ilUser, $lng, $tpl, ilUtil\getImagePath(), ilSearchSettings\getInstance(), ilUtil\img(), iljQueryUtil\initjQuery(), and iljQueryUtil\initjQueryUI().

+ Here is the call graph for this function:

Field Documentation

◆ $isContainer

ilMainMenuSearchGUI::$isContainer = true
private

Definition at line 22 of file class.ilMainMenuSearchGUI.php.

◆ $lng

ilMainMenuSearchGUI::$lng = null
protected

Definition at line 17 of file class.ilMainMenuSearchGUI.php.

Referenced by __construct(), and getHTML().

◆ $obj_id

ilMainMenuSearchGUI::$obj_id = 0
private

Definition at line 20 of file class.ilMainMenuSearchGUI.php.

◆ $ref_id

ilMainMenuSearchGUI::$ref_id = ROOT_FOLDER_ID
private

Definition at line 19 of file class.ilMainMenuSearchGUI.php.

◆ $tpl

ilMainMenuSearchGUI::$tpl = null
protected

Definition at line 16 of file class.ilMainMenuSearchGUI.php.

Referenced by getHTML().

◆ $type

ilMainMenuSearchGUI::$type = ''
private

Definition at line 21 of file class.ilMainMenuSearchGUI.php.


The documentation for this class was generated from the following file: