ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
ilMainMenuSearchGUI Class Reference

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

+ Collaboration diagram for ilMainMenuSearchGUI:

Public Member Functions

 __construct ()
 Constructor 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 public.

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

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

29  {
30  global $DIC;
31 
32  $lng = $DIC['lng'];
33  $objDefinition = $DIC['objDefinition'];
34  $tree = $DIC['tree'];
35 
36  $this->lng = $lng;
37 
38  if (isset($_GET['ref_id'])) {
39  $this->ref_id = (int) $_GET['ref_id'];
40  }
41  $this->obj_id = ilObject::_lookupObjId($this->ref_id);
42  $this->type = ilObject::_lookupType($this->obj_id);
43 
44  $lng->loadLanguageModule("search");
45 
46  /*
47  if(!$objDefinition->isContainer($this->type))
48  {
49  $this->isContainer = false;
50  $parent_id = $tree->getParentId($this->ref_id);
51  $this->obj_id = ilObject::_lookupObjId($parent_id);
52  $this->type = ilObject::_lookupType($this->obj_id);
53  }
54  */
55  }
global $DIC
Definition: saml.php:7
$_GET["client_id"]
static _lookupObjId($a_id)
static _lookupType($a_id, $a_reference=false)
lookup object type
+ Here is the call graph for this function:

Member Function Documentation

◆ getHTML()

ilMainMenuSearchGUI::getHTML ( )

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

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

58  {
59  global $DIC;
60 
61  $ilCtrl = $DIC['ilCtrl'];
62  $tpl = $DIC['tpl'];
63  $lng = $DIC['lng'];
64  $ilUser = $DIC['ilUser'];
65 
66  if (!$this->isContainer) {
67  #return '';
68  }
69  if ($_GET['baseClass'] == 'ilSearchController') {
70  // return '';
71  }
72 
73  include_once "Services/jQuery/classes/class.iljQueryUtil.php";
76  $this->tpl = new ilTemplate('tpl.main_menu_search.html', true, true, 'Services/Search');
77 
78  if ($ilUser->getId() != ANONYMOUS_USER_ID) {
79  $this->tpl->setVariable('LABEL_SEARCH_OPTIONS', $lng->txt("label_search_options"));
80  if (ilSearchSettings::getInstance()->isLuceneUserSearchEnabled() or (int) $_GET['ref_id']) {
81  $this->tpl->setCurrentBlock("position");
82  $this->tpl->setVariable('TXT_GLOBALLY', $lng->txt("search_globally"));
83  $this->tpl->setVariable('ROOT_ID', ROOT_FOLDER_ID);
84  $this->tpl->parseCurrentBlock();
85  } else {
86  $this->tpl->setCurrentBlock("position_hid");
87  $this->tpl->setVariable('ROOT_ID_HID', ROOT_FOLDER_ID);
88  $this->tpl->parseCurrentBlock();
89  }
90  if ((int) $_GET['ref_id']) {
91  $this->tpl->setCurrentBlock('position_rep');
92  $this->tpl->setVariable('TXT_CURRENT_POSITION', $lng->txt("search_at_current_position"));
93  $this->tpl->setVariable('REF_ID', (int) $_GET["ref_id"]);
94  $this->tpl->parseCurrentBlock();
95  }
96  }
97 
98  if ($ilUser->getId() != ANONYMOUS_USER_ID && ilSearchSettings::getInstance()->isLuceneUserSearchEnabled()) {
99  $this->tpl->setCurrentBlock('usr_search');
100  $this->tpl->setVariable('TXT_USR_SEARCH', $this->lng->txt('search_users'));
101  $this->tpl->parseCurrentBlock();
102  }
103 
104  $this->tpl->setVariable('FORMACTION', 'ilias.php?baseClass=ilSearchController&cmd=post' .
105  '&rtoken=' . $ilCtrl->getRequestToken() . '&fallbackCmd=remoteSearch');
106  $this->tpl->setVariable('BTN_SEARCH', $this->lng->txt('search'));
107  $this->tpl->setVariable('SEARCH_INPUT_LABEL', $this->lng->txt('search_field'));
108  $this->tpl->setVariable('SEARCH_DROPDOWN_LABEL', $this->lng->txt('search_dropdown'));
109  $this->tpl->setVariable('AC_DATASOURCE', "ilias.php?baseClass=ilSearchController&cmd=autoComplete");
110 
111  $this->tpl->setVariable('IMG_MM_SEARCH', ilUtil::img(
112  ilUtil::getImagePath("icon_seas.svg"),
113  $lng->txt("search")
114  ));
115 
116  if ($ilUser->getId() != ANONYMOUS_USER_ID) {
117  $this->tpl->setVariable('HREF_SEARCH_LINK', "ilias.php?baseClass=ilSearchController");
118  $this->tpl->setVariable('TXT_SEARCH_LINK', $lng->txt("last_search_result"));
119  }
120 
121  // #10555 - we need the overlay for the autocomplete which is always active
122  $this->tpl->setVariable('TXT_SEARCH', $lng->txt("search"));
123  include_once("./Services/UIComponent/Overlay/classes/class.ilOverlayGUI.php");
124  $ov = new ilOverlayGUI("mm_search_menu");
125  //$ov->setTrigger("main_menu_search", "none",
126  // "main_menu_search", "tr", "br");
127  //$ov->setAnchor("main_menu_search", "tr", "br");
128  $ov->setAutoHide(false);
129  $ov->add();
130 
131  return $this->tpl->get();
132  }
global $DIC
Definition: saml.php:7
$_GET["client_id"]
global $ilCtrl
Definition: ilias.php:18
static getImagePath($img, $module_path="", $mode="output", $offline=false)
get image path (for images located in a template directory)
special template class to simplify handling of ITX/PEAR
This is a utility class for the yui overlays.
$ilUser
Definition: imgupload.php:18
static img($a_src, $a_alt=null, $a_width="", $a_height="", $a_border=0, $a_id="", $a_class="")
Build img tag.
static initjQueryUI($a_tpl=null)
inits and adds the jQuery-UI JS-File to the global template (see included_components.txt for included components)
static initjQuery($a_tpl=null)
inits and adds the jQuery JS-File to the global or a passed template
+ 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: