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

Meta Data search GUI. More...

+ Inheritance diagram for ilLuceneAdvancedSearchGUI:
+ Collaboration diagram for ilLuceneAdvancedSearchGUI:

Public Member Functions

 __construct ()
 Constructor. More...
 
 executeCommand ()
 Execute Command. More...
 
 showSavedResults ()
 Show saved results. More...
 
 prepareOutput ()
 Add admin panel command. More...
 
- Public Member Functions inherited from ilSearchBaseGUI
 __construct ()
 Constructor public. More...
 
 prepareOutput ()
 
 initStandardSearchForm ($a_mode)
 Init standard search form. More...
 
 getSearchAreaForm ()
 Init standard search form. More...
 
 handleCommand ($a_cmd)
 Handle command. More...
 
 addToDeskObject ()
 Interface methods. More...
 
 removeFromDeskObject ()
 Remove from dektop. More...
 
 delete ()
 Show deletion screen. More...
 
 cancelDelete ()
 Cancel delete. More...
 
 cancelMoveLinkObject ()
 Cancel move/link. More...
 
 performDelete ()
 Delete objects. More...
 
 cut ()
 Interface ilAdministrationCommandHandler. More...
 
 link ()
 Interface ilAdministrationCommandHandler. More...
 
 paste ()
 Paste. More...
 
 showLinkIntoMultipleObjectsTree ()
 Target selection link. More...
 
 showPasteTree ()
 Target selection cut. More...
 
 performPasteIntoMultipleObjects ()
 Perform paste into multiple objects. More...
 
 clear ()
 clear clipboard More...
 
 enableAdministrationPanel ()
 Enable administration panel. More...
 
 disableAdministrationPanel ()
 Disable administration panel. More...
 
 keepObjectsInClipboardObject ()
 cancel action but keep objects in clipboard
Returns
void
More...
 
 addLocator ()
 Add Locator. More...
 
 autoComplete ()
 Data resource for autoComplete. More...
 

Protected Member Functions

 initFormSearch ()
 Show search form. More...
 
 remoteSearch ()
 Search from main menu. More...
 
 search ()
 
 reset ()
 Reset search form. More...
 
 performSearch ()
 Perform search. More...
 
 getTabs ()
 get tabs More...
 
 initUserSearchCache ()
 Init user search cache. More...
 
 fillAdminPanel ()
 
 addAdminPanelCommand ($a_cmd, $a_txt)
 Add a command to the admin panel. More...
 
 setAdminViewButton ($a_link, $a_txt)
 Show admin view button. More...
 
 setPageFormAction ($a_action)
 
- Protected Member Functions inherited from ilSearchBaseGUI
 addPager ($result, $a_session_key)
 Add Pager. More...
 
 buildSearchAreaPath ($a_root_node)
 Build path for search area. More...
 
 getCreationDateForm ()
 
 getSearchCache ()
 Get user search cache. More...
 
 loadCreationFilter ()
 Load creation date filter. More...
 

Protected Attributes

 $ilTabs
 
 $fields = null
 
- Protected Attributes inherited from ilSearchBaseGUI
 $settings = null
 
 $ctrl = null
 

Additional Inherited Members

- Data Fields inherited from ilSearchBaseGUI
const SEARCH_FAST = 1
 
const SEARCH_DETAILS = 2
 
const SEARCH_AND = 'and'
 
const SEARCH_OR = 'or'
 
const SEARCH_FORM_LUCENE = 1
 
const SEARCH_FORM_STANDARD = 2
 
const SEARCH_FORM_USER = 3
 
 $ilias = null
 
 $lng = null
 
 $tpl = null
 

Detailed Description

Constructor & Destructor Documentation

◆ __construct()

ilLuceneAdvancedSearchGUI::__construct ( )

Constructor.

Definition at line 51 of file class.ilLuceneAdvancedSearchGUI.php.

References $DIC, $ilTabs, fields, ilLuceneAdvancedSearchFields\getInstance(), and initUserSearchCache().

52  {
53  global $DIC;
54 
55  $ilTabs = $DIC['ilTabs'];
56 
57  $this->tabs_gui = $ilTabs;
58  parent::__construct();
59 
61  $this->initUserSearchCache();
62  }
global $DIC
Definition: saml.php:7
$errors fields
Definition: imgupload.php:51
initUserSearchCache()
Init user search cache.
static getInstance()
Get singleton instance.
+ Here is the call graph for this function:

Member Function Documentation

◆ addAdminPanelCommand()

ilLuceneAdvancedSearchGUI::addAdminPanelCommand (   $a_cmd,
  $a_txt 
)
protected

Add a command to the admin panel.

Definition at line 423 of file class.ilLuceneAdvancedSearchGUI.php.

424  {
425  $this->admin_panel_commands[] =
426  array("cmd" => $a_cmd, "txt" => $a_txt);
427  }

◆ executeCommand()

ilLuceneAdvancedSearchGUI::executeCommand ( )

Execute Command.

Definition at line 67 of file class.ilLuceneAdvancedSearchGUI.php.

References ilSearchBaseGUI\handleCommand(), and prepareOutput().

68  {
69  $next_class = $this->ctrl->getNextClass($this);
70  $cmd = $this->ctrl->getCmd();
71 
72  $this->prepareOutput();
73  switch ($next_class) {
74  case 'ilobjectcopygui':
75  $this->ctrl->setReturn($this);
76  include_once './Services/Object/classes/class.ilObjectCopyGUI.php';
77  $cp = new ilObjectCopyGUI($this, '');
78  $this->ctrl->forwardCommand($cp);
79  break;
80 
81 
82  default:
83  if (!$cmd) {
84  $cmd = "showSavedResults";
85  }
86  $this->handleCommand($cmd);
87  break;
88  }
89  return true;
90  }
GUI class for the workflow of copying objects.
prepareOutput()
Add admin panel command.
handleCommand($a_cmd)
Handle command.
+ Here is the call graph for this function:

◆ fillAdminPanel()

ilLuceneAdvancedSearchGUI::fillAdminPanel ( )
protected

Definition at line 344 of file class.ilLuceneAdvancedSearchGUI.php.

References $DIC, ilSearchBaseGUI\$lng, and ilUtil\getImagePath().

Referenced by performSearch(), and showSavedResults().

345  {
346  global $DIC;
347 
348  $lng = $DIC['lng'];
349 
350  $adm_view_cmp = $adm_cmds = $creation_selector = $adm_view = false;
351 
352  // admin panel commands
353  if ((count((array) $this->admin_panel_commands) > 0)) {
354  foreach ($this->admin_panel_commands as $cmd) {
355  $this->tpl->setCurrentBlock("lucene_admin_panel_cmd");
356  $this->tpl->setVariable("LUCENE_PANEL_CMD", $cmd["cmd"]);
357  $this->tpl->setVariable("LUCENE_TXT_PANEL_CMD", $cmd["txt"]);
358  $this->tpl->parseCurrentBlock();
359  }
360 
361  $adm_cmds = true;
362  }
363  if ($adm_cmds) {
364  $this->tpl->setCurrentBlock("lucene_adm_view_components");
365  $this->tpl->setVariable("LUCENE_ADM_IMG_ARROW", ilUtil::getImagePath("arrow_upright.svg"));
366  $this->tpl->setVariable("LUCENE_ADM_ALT_ARROW", $lng->txt("actions"));
367  $this->tpl->parseCurrentBlock();
368  $adm_view_cmp = true;
369  }
370 
371  // admin view button
372  if (is_array($this->admin_view_button)) {
373  if (is_array($this->admin_view_button)) {
374  $this->tpl->setCurrentBlock("lucene_admin_button");
375  $this->tpl->setVariable(
376  "LUCENE_ADMIN_MODE_LINK",
377  $this->admin_view_button["link"]
378  );
379  $this->tpl->setVariable(
380  "LUCENE_TXT_ADMIN_MODE",
381  $this->admin_view_button["txt"]
382  );
383  $this->tpl->parseCurrentBlock();
384  }
385  $this->tpl->setCurrentBlock("lucene_admin_view");
386  $this->tpl->parseCurrentBlock();
387  $adm_view = true;
388  }
389 
390  // creation selector
391  if (is_array($this->creation_selector)) {
392  $this->tpl->setCurrentBlock("lucene_add_commands");
393  if ($adm_cmds) {
394  $this->tpl->setVariable("LUCENE_ADD_COM_WIDTH", 'width="1"');
395  }
396  $this->tpl->setVariable(
397  "LUCENE_SELECT_OBJTYPE_REPOS",
398  $this->creation_selector["options"]
399  );
400  $this->tpl->setVariable(
401  "LUCENE_BTN_NAME_REPOS",
402  $this->creation_selector["command"]
403  );
404  $this->tpl->setVariable(
405  "LUCENE_TXT_ADD_REPOS",
406  $this->creation_selector["txt"]
407  );
408  $this->tpl->parseCurrentBlock();
409  $creation_selector = true;
410  }
411  if ($adm_view || $creation_selector) {
412  $this->tpl->setCurrentBlock("lucene_adm_panel");
413  if ($adm_view_cmp) {
414  $this->tpl->setVariable("LUCENE_ADM_TBL_WIDTH", 'width:"100%";');
415  }
416  $this->tpl->parseCurrentBlock();
417  }
418  }
global $DIC
Definition: saml.php:7
static getImagePath($img, $module_path="", $mode="output", $offline=false)
get image path (for images located in a template directory)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getTabs()

ilLuceneAdvancedSearchGUI::getTabs ( )
protected

get tabs

Definition at line 299 of file class.ilLuceneAdvancedSearchGUI.php.

References $DIC, fields, and ilSearchSettings\getInstance().

Referenced by prepareOutput().

300  {
301  global $DIC;
302 
303  $ilHelp = $DIC['ilHelp'];
304 
305  $ilHelp->setScreenIdComponent("src_luc");
306 
307  $this->tabs_gui->addTarget('search', $this->ctrl->getLinkTargetByClass('illucenesearchgui'));
308 
309  if (ilSearchSettings::getInstance()->isLuceneUserSearchEnabled()) {
310  $this->tabs_gui->addTarget('search_user', $this->ctrl->getLinkTargetByClass('illuceneusersearchgui'));
311  }
312 
313  if (
314  !ilSearchSettings::getInstance()->getHideAdvancedSearch() and
315  $this->fields->getActiveFields()) {
316  $this->tabs_gui->addTarget('search_advanced', $this->ctrl->getLinkTarget($this));
317  }
318 
319  $this->tabs_gui->setTabActive('search_advanced');
320  }
global $DIC
Definition: saml.php:7
$errors fields
Definition: imgupload.php:51
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ initFormSearch()

ilLuceneAdvancedSearchGUI::initFormSearch ( )
protected

Show search form.

Definition at line 150 of file class.ilLuceneAdvancedSearchGUI.php.

References $DIC, $form, $section, $tree, and fields.

Referenced by performSearch(), and showSavedResults().

151  {
152  global $DIC;
153 
154  $tree = $DIC['tree'];
155 
156  include_once './Services/Form/classes/class.ilPropertyFormGUI.php';
157 
158  $this->form = new ilPropertyFormGUI();
159  $this->form->setFormAction($this->ctrl->getFormAction($this, 'search'));
160  $this->form->setTitle($this->lng->txt('search_advanced'));
161  $this->form->addCommandButton('search', $this->lng->txt('search'));
162  $this->form->addCommandButton('reset', $this->lng->txt('reset'));
163 
164  foreach ($this->fields->getActiveSections() as $definition) {
165  if ($definition['name'] != 'default') {
167  $section->setTitle($definition['name']);
168  $this->form->addItem($section);
169  }
170 
171  foreach ($definition['fields'] as $field_name) {
172  if (is_object($element = $this->fields->getFormElement($this->search_cache->getQuery(), $field_name, $this->form))) {
173  $this->form->addItem($element);
174  }
175  }
176  }
177  return true;
178  }
This class represents a property form user interface.
global $DIC
Definition: saml.php:7
This class represents a section header in a property form.
$errors fields
Definition: imgupload.php:51
$section
Definition: Utf8Test.php:83
if(isset($_POST['submit'])) $form
+ Here is the caller graph for this function:

◆ initUserSearchCache()

ilLuceneAdvancedSearchGUI::initUserSearchCache ( )
protected

Init user search cache.

private

Definition at line 328 of file class.ilLuceneAdvancedSearchGUI.php.

References $_GET, $_POST, $DIC, $ilUser, ilUserSearchCache\_getInstance(), and ilUserSearchCache\LUCENE_ADVANCED.

Referenced by __construct().

329  {
330  global $DIC;
331 
332  $ilUser = $DIC['ilUser'];
333 
334  include_once('Services/Search/classes/class.ilUserSearchCache.php');
335  $this->search_cache = ilUserSearchCache::_getInstance($ilUser->getId());
336  $this->search_cache->switchSearchType(ilUserSearchCache::LUCENE_ADVANCED);
337  if ((int) $_GET['page_number']) {
338  $this->search_cache->setResultPageNumber((int) $_GET['page_number']);
339  }
340  if (isset($_POST['query'])) {
341  $this->search_cache->setQuery($_POST['query']);
342  }
343  }
global $DIC
Definition: saml.php:7
$_GET["client_id"]
static _getInstance($a_usr_id)
Get singleton instance.
$ilUser
Definition: imgupload.php:18
$_POST["username"]
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ performSearch()

ilLuceneAdvancedSearchGUI::performSearch ( )
protected

Perform search.

Definition at line 222 of file class.ilLuceneAdvancedSearchGUI.php.

References $_SESSION, $DIC, $ilBench, $ilUser, ilSearchBaseGUI\addPager(), fillAdminPanel(), ilLuceneSearcher\getInstance(), ilLuceneSearchResultFilter\getInstance(), initFormSearch(), ilLuceneAdvancedQueryParser\parse(), ilUtil\sendInfo(), and showSavedResults().

Referenced by search().

223  {
224  global $DIC;
225 
226  $ilUser = $DIC['ilUser'];
227  $ilBench = $DIC['ilBench'];
228 
229  unset($_SESSION['vis_references']);
230 
231  include_once './Services/Search/classes/Lucene/class.ilLuceneSearcher.php';
232  include_once './Services/Search/classes/Lucene/class.ilLuceneAdvancedQueryParser.php';
233  $qp = new ilLuceneAdvancedQueryParser($this->search_cache->getQuery());
234  $qp->parse();
235  if (!strlen(trim($qp->getQuery()))) {
236  ilUtil::sendInfo($this->lng->txt('msg_no_search_string'));
237  $this->showSavedResults();
238  return false;
239  }
240 
241  $searcher = ilLuceneSearcher::getInstance($qp);
242  $searcher->search();
243 
244  // Filter results
245  $ilBench->start('Lucene', 'ResultFilter');
246  include_once './Services/Search/classes/Lucene/class.ilLuceneSearchResultFilter.php';
247  include_once './Services/Search/classes/Lucene/class.ilLucenePathFilter.php';
249  $filter->addFilter(new ilLucenePathFilter($this->search_cache->getRoot()));
250  $filter->setCandidates($searcher->getResult());
251  $filter->filter();
252  $ilBench->stop('Lucene', 'ResultFilter');
253 
254  if ($filter->getResultObjIds()) {
255  $searcher->highlight($filter->getResultObjIds());
256  }
257 
258  // Show results
259  $this->tpl->addBlockFile('ADM_CONTENT', 'adm_content', 'tpl.lucene_adv_search.html', 'Services/Search');
260  include_once './Services/Search/classes/class.ilSearchResultPresentation.php';
261  $presentation = new ilSearchResultPresentation($this);
262  $presentation->setResults($filter->getResultIds());
263  $presentation->setSearcher($searcher);
264 
265  // TODO: other handling required
266  $ilBench->start('Lucene', '1500_fo');
267  $this->addPager($filter, 'max_page');
268  $ilBench->stop('Lucene', '1500_fo');
269  $presentation->setPreviousNext($this->prev_link, $this->next_link);
270 
271  if ($presentation->render()) {
272  $this->tpl->setVariable('SEARCH_RESULTS', $presentation->getHTML(true));
273  } else {
274  ilUtil::sendInfo($this->lng->txt('search_no_match'));
275  }
276 
277  // and finally add search form
278  $this->initFormSearch();
279  $this->tpl->setVariable('SEARCH_TABLE', $this->form->getHTML());
280 
281  if ($filter->getResultIds()) {
282  $this->fillAdminPanel();
283  }
284  }
$_SESSION["AccountId"]
global $DIC
Definition: saml.php:7
static getInstance(ilLuceneQueryParser $qp)
Get singleton instance.
static sendInfo($a_info="", $a_keep=false)
Send Info Message to Screen.
addPager($result, $a_session_key)
Add Pager.
Presentation of search results using object list gui.
$ilUser
Definition: imgupload.php:18
global $ilBench
Definition: ilias.php:18
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ prepareOutput()

ilLuceneAdvancedSearchGUI::prepareOutput ( )

Add admin panel command.

Definition at line 289 of file class.ilLuceneAdvancedSearchGUI.php.

References getTabs().

Referenced by executeCommand().

290  {
291  parent::prepareOutput();
292  $this->getTabs();
293  return true;
294  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ remoteSearch()

ilLuceneAdvancedSearchGUI::remoteSearch ( )
protected

Search from main menu.

Definition at line 183 of file class.ilLuceneAdvancedSearchGUI.php.

References $_POST, search(), and ilUtil\stripSlashes().

184  {
185  $this->search_cache->setRoot((int) $_POST['root_id']);
186  $this->search_cache->setQuery(array('lom_content' => ilUtil::stripSlashes($_POST['queryString'])));
187  $this->search_cache->save();
188  $this->search();
189  }
static stripSlashes($a_str, $a_strip_html=true, $a_allow="")
strip slashes if magic qoutes is enabled
$_POST["username"]
+ Here is the call graph for this function:

◆ reset()

ilLuceneAdvancedSearchGUI::reset ( )
protected

Reset search form.

Definition at line 212 of file class.ilLuceneAdvancedSearchGUI.php.

References showSavedResults().

213  {
214  $this->search_cache->setQuery(array());
215  $this->search_cache->save();
216  $this->showSavedResults();
217  }
+ Here is the call graph for this function:

◆ search()

ilLuceneAdvancedSearchGUI::search ( )
protected

Definition at line 191 of file class.ilLuceneAdvancedSearchGUI.php.

References $_SESSION, performSearch(), ilSubItemListGUI\resetDetails(), ilUtil\sendInfo(), and showSavedResults().

Referenced by remoteSearch().

192  {
193  if (!is_array($this->search_cache->getQuery())) {
194  // TOD: handle empty advances search
195  ilUtil::sendInfo($this->lng->txt('msg_no_search_string'));
196  $this->showSavedResults();
197  return false;
198  }
199  unset($_SESSION['max_page']);
200  $this->search_cache->deleteCachedEntries();
201 
202  // Reset details
203  include_once './Services/Object/classes/class.ilSubItemListGUI.php';
205 
206  $this->performSearch();
207  }
$_SESSION["AccountId"]
static resetDetails()
reset details As long as static::resetDetails is not possible this method is final ...
static sendInfo($a_info="", $a_keep=false)
Send Info Message to Screen.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ setAdminViewButton()

ilLuceneAdvancedSearchGUI::setAdminViewButton (   $a_link,
  $a_txt 
)
protected

Show admin view button.

Definition at line 432 of file class.ilLuceneAdvancedSearchGUI.php.

433  {
434  $this->admin_view_button =
435  array("link" => $a_link, "txt" => $a_txt);
436  }

◆ setPageFormAction()

ilLuceneAdvancedSearchGUI::setPageFormAction (   $a_action)
protected

Definition at line 438 of file class.ilLuceneAdvancedSearchGUI.php.

439  {
440  $this->page_form_action = $a_action;
441  }

◆ showSavedResults()

ilLuceneAdvancedSearchGUI::showSavedResults ( )

Show saved results.

Returns

Definition at line 97 of file class.ilLuceneAdvancedSearchGUI.php.

References $DIC, $ilBench, $ilUser, ilSearchBaseGUI\addPager(), fillAdminPanel(), ilLuceneSearcher\getInstance(), ilLuceneSearchResultFilter\getInstance(), initFormSearch(), ilLuceneAdvancedQueryParser\parse(), and ilUtil\sendInfo().

Referenced by performSearch(), reset(), and search().

98  {
99  global $DIC;
100 
101  $ilUser = $DIC['ilUser'];
102  $ilBench = $DIC['ilBench'];
103 
104  include_once './Services/Search/classes/Lucene/class.ilLuceneSearcher.php';
105  include_once './Services/Search/classes/Lucene/class.ilLuceneAdvancedQueryParser.php';
106  $qp = new ilLuceneAdvancedQueryParser($this->search_cache->getQuery());
107  $qp->parse();
108  $searcher = ilLuceneSearcher::getInstance($qp);
109  $searcher->search();
110 
111  // Load saved results
112  include_once './Services/Search/classes/Lucene/class.ilLuceneSearchResultFilter.php';
114  $filter->loadFromDb();
115 
116  // Highlight
117  if ($filter->getResultObjIds()) {
118  $searcher->highlight($filter->getResultObjIds());
119  }
120 
121  $this->tpl->addBlockFile('ADM_CONTENT', 'adm_content', 'tpl.lucene_adv_search.html', 'Services/Search');
122  include_once './Services/Search/classes/class.ilSearchResultPresentation.php';
123  $presentation = new ilSearchResultPresentation($this);
124  $presentation->setResults($filter->getResultIds());
125  $presentation->setSearcher($searcher);
126 
127 
128  // TODO: other handling required
129  $this->addPager($filter, 'max_page');
130  $presentation->setPreviousNext($this->prev_link, $this->next_link);
131 
132  if ($presentation->render()) {
133  $this->tpl->setVariable('SEARCH_RESULTS', $presentation->getHTML(true));
134  } elseif (strlen(trim($qp->getQuery()))) {
135  ilUtil::sendInfo($this->lng->txt('search_no_match'));
136  }
137 
138  // and finally add search form
139  $this->initFormSearch();
140  $this->tpl->setVariable('SEARCH_TABLE', $this->form->getHTML());
141 
142  if ($filter->getResultIds()) {
143  $this->fillAdminPanel();
144  }
145  }
global $DIC
Definition: saml.php:7
static getInstance(ilLuceneQueryParser $qp)
Get singleton instance.
static sendInfo($a_info="", $a_keep=false)
Send Info Message to Screen.
addPager($result, $a_session_key)
Add Pager.
Presentation of search results using object list gui.
$ilUser
Definition: imgupload.php:18
global $ilBench
Definition: ilias.php:18
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Field Documentation

◆ $fields

ilLuceneAdvancedSearchGUI::$fields = null
protected

Definition at line 46 of file class.ilLuceneAdvancedSearchGUI.php.

◆ $ilTabs

ilLuceneAdvancedSearchGUI::$ilTabs
protected

Definition at line 44 of file class.ilLuceneAdvancedSearchGUI.php.

Referenced by __construct().


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