ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
ilLuceneSearchGUI Class Reference

@classDescription GUI for simple Lucene search More...

+ Inheritance diagram for ilLuceneSearchGUI:
+ Collaboration diagram for ilLuceneSearchGUI:

Public Member Functions

 __construct ()
 Constructor. More...
 
 executeCommand ()
 Execute Command. More...
 
 prepareOutput ()
 Add admin panel command. More...
 
- Public Member Functions inherited from ilSearchBaseGUI
 __construct ()
 Constructor @access 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...
 
 showMoveIntoObjectTree ()
 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...
 
 addToDeskObject ()
 Add desktop item @access public. More...
 
 removeFromDeskObject ()
 Remove from desktop @access public. More...
 
 delete ()
 Show delete confirmation. More...
 
 cancelDelete ()
 Cancel delete. More...
 
 performDelete ()
 Perform Delete. More...
 
 cut ()
 Cut object. More...
 
 showLinkIntoMultipleObjectsTree ()
 Target selection link. More...
 
 showMoveIntoObjectTree ()
 Target selection cut. More...
 
 performPasteIntoMultipleObjects ()
 Perform paste into multiple objects. More...
 
 paste ()
 Paste. More...
 
 clear ()
 clear clipboard More...
 
 enableAdministrationPanel ()
 Enable administration panel. More...
 
 disableAdministrationPanel ()
 Disable administration panel. More...
 
 cancelMoveLinkObject ()
 Cancel move/link. More...
 
 keepObjectsInClipboardObject ()
 cancel action but keep objects in clipboard More...
 

Protected Member Functions

 getType ()
 Get type of search (details | fast) More...
 
 getDetails ()
 Needed for base class search form. More...
 
 getMimeDetails ()
 Needed for base class search form. More...
 
 remoteSearch ()
 Search from main menu. More...
 
 showSavedResults ()
 Show saved results. More...
 
 search ()
 Search (button pressed) More...
 
 performSearch ()
 Perform search. More...
 
 storeRoot ()
 Store new root node. More...
 
 getTabs ()
 get tabs More...
 
 initUserSearchCache ()
 Init user search cache. More...
 
 fillAdminPanel ()
 Put admin panel into template: More...
 
 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)
 
 showSearchForm ()
 Show search form. More...
 
 parseCreationFilter ()
 Parse creation date. More...
 
- 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
 
- 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

@classDescription GUI for simple Lucene search

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

@ilCtrl_IsCalledBy ilLuceneSearchGUI: ilSearchController @ilCtrl_Calls ilLuceneSearchGUI: ilPropertyFormGUI @ilCtrl_Calls ilLuceneSearchGUI: ilObjectGUI, ilContainerGUI @ilCtrl_Calls ilLuceneSearchGUI: ilObjCategoryGUI, ilObjCourseGUI, ilObjFolderGUI, ilObjGroupGUI @ilCtrl_Calls ilLuceneSearchGUI: ilObjRootFolderGUI, ilObjectCopyGUI

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

Constructor & Destructor Documentation

◆ __construct()

ilLuceneSearchGUI::__construct ( )

Constructor.

Reimplemented from ilSearchBaseGUI.

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

52 {
53 global $ilTabs;
54
55 $this->tabs_gui = $ilTabs;
56 parent::__construct();
58 $this->initUserSearchCache();
59 }
static getInstance()
Get singleton instance.
initUserSearchCache()
Init user search cache.
$errors fields
Definition: imgupload.php:51

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

+ Here is the call graph for this function:

Member Function Documentation

◆ addAdminPanelCommand()

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

Add a command to the admin panel.

Definition at line 498 of file class.ilLuceneSearchGUI.php.

499 {
500 $this->admin_panel_commands[] =
501 array("cmd" => $a_cmd, "txt" => $a_txt);
502 }

◆ executeCommand()

ilLuceneSearchGUI::executeCommand ( )

Execute Command.

Definition at line 64 of file class.ilLuceneSearchGUI.php.

65 {
66 global $ilBench, $ilCtrl;
67
68 $ilBench->start('Lucene', '0900_executeCommand');
69 $next_class = $this->ctrl->getNextClass($this);
70 $cmd = $this->ctrl->getCmd();
71
72 $this->prepareOutput();
73 switch ($next_class) {
74 case "ilpropertyformgui":
75 /*$this->initStandardSearchForm(ilSearchBaseGUI::SEARCH_FORM_LUCENE);
76 $ilCtrl->setReturn($this, 'storeRoot');
77 $ilCtrl->forwardCommand($this->form);*/
78 $form = $this->getSearchAreaForm();
79 $ilCtrl->setReturn($this, 'storeRoot');
80 $ilCtrl->forwardCommand($form);
81 break;
82
83 case 'ilobjectcopygui':
84 $this->ctrl->setReturn($this, '');
85 include_once './Services/Object/classes/class.ilObjectCopyGUI.php';
86 $cp = new ilObjectCopyGUI($this);
87 $this->ctrl->forwardCommand($cp);
88 break;
89
90 default:
92 if (!$cmd) {
93 $cmd = "showSavedResults";
94 }
95 $this->handleCommand($cmd);
96 break;
97 }
98 $ilBench->stop('Lucene', '0900_executeCommand');
99 return true;
100 }
prepareOutput()
Add admin panel command.
GUI class for the workflow of copying objects.
initStandardSearchForm($a_mode)
Init standard search form.
getSearchAreaForm()
Init standard search form.
handleCommand($a_cmd)
Handle command.
global $ilBench
Definition: ilias.php:18
global $ilCtrl
Definition: ilias.php:18
if(isset($_POST['submit'])) $form

References $form, $ilBench, $ilCtrl, ilSearchBaseGUI\getSearchAreaForm(), ilSearchBaseGUI\handleCommand(), ilSearchBaseGUI\initStandardSearchForm(), prepareOutput(), and ilSearchBaseGUI\SEARCH_FORM_LUCENE.

+ Here is the call graph for this function:

◆ fillAdminPanel()

ilLuceneSearchGUI::fillAdminPanel ( )
protected

Put admin panel into template:

  • creation selector
  • admin view on/off button

Definition at line 421 of file class.ilLuceneSearchGUI.php.

422 {
423 global $lng;
424
425 $adm_view_cmp = $adm_cmds = $creation_selector = $adm_view = false;
426
427 // admin panel commands
428 if ((count($this->admin_panel_commands) > 0)) {
429 foreach ($this->admin_panel_commands as $cmd) {
430 $this->tpl->setCurrentBlock("lucene_admin_panel_cmd");
431 $this->tpl->setVariable("LUCENE_PANEL_CMD", $cmd["cmd"]);
432 $this->tpl->setVariable("LUCENE_TXT_PANEL_CMD", $cmd["txt"]);
433 $this->tpl->parseCurrentBlock();
434 }
435
436 $adm_cmds = true;
437 }
438 if ($adm_cmds) {
439 $this->tpl->setCurrentBlock("lucene_adm_view_components");
440 $this->tpl->setVariable("LUCENE_ADM_IMG_ARROW", ilUtil::getImagePath("arrow_upright.svg"));
441 $this->tpl->setVariable("LUCENE_ADM_ALT_ARROW", $lng->txt("actions"));
442 $this->tpl->parseCurrentBlock();
443 $adm_view_cmp = true;
444 }
445
446 // admin view button
447 if (is_array($this->admin_view_button)) {
448 if (is_array($this->admin_view_button)) {
449 $this->tpl->setCurrentBlock("lucene_admin_button");
450 $this->tpl->setVariable(
451 "LUCENE_ADMIN_MODE_LINK",
452 $this->admin_view_button["link"]
453 );
454 $this->tpl->setVariable(
455 "LUCENE_TXT_ADMIN_MODE",
456 $this->admin_view_button["txt"]
457 );
458 $this->tpl->parseCurrentBlock();
459 }
460 $this->tpl->setCurrentBlock("lucene_admin_view");
461 $this->tpl->parseCurrentBlock();
462 $adm_view = true;
463 }
464
465 // creation selector
466 if (is_array($this->creation_selector)) {
467 $this->tpl->setCurrentBlock("lucene_add_commands");
468 if ($adm_cmds) {
469 $this->tpl->setVariable("LUCENE_ADD_COM_WIDTH", 'width="1"');
470 }
471 $this->tpl->setVariable(
472 "LUCENE_SELECT_OBJTYPE_REPOS",
473 $this->creation_selector["options"]
474 );
475 $this->tpl->setVariable(
476 "LUCENE_BTN_NAME_REPOS",
477 $this->creation_selector["command"]
478 );
479 $this->tpl->setVariable(
480 "LUCENE_TXT_ADD_REPOS",
481 $this->creation_selector["txt"]
482 );
483 $this->tpl->parseCurrentBlock();
484 $creation_selector = true;
485 }
486 if ($adm_view || $creation_selector) {
487 $this->tpl->setCurrentBlock("lucene_adm_panel");
488 if ($adm_view_cmp) {
489 $this->tpl->setVariable("LUCENE_ADM_TBL_WIDTH", 'width:"100%";');
490 }
491 $this->tpl->parseCurrentBlock();
492 }
493 }
static getImagePath($img, $module_path="", $mode="output", $offline=false)
get image path (for images located in a template directory)

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

+ Here is the call graph for this function:

◆ getDetails()

ilLuceneSearchGUI::getDetails ( )
protected

Needed for base class search form.

Todo:
rename
Returns
type

Definition at line 130 of file class.ilLuceneSearchGUI.php.

131 {
132 return (array) $this->search_cache->getItemFilter();
133 }

◆ getMimeDetails()

ilLuceneSearchGUI::getMimeDetails ( )
protected

Needed for base class search form.

Todo:
rename
Returns
type

Definition at line 140 of file class.ilLuceneSearchGUI.php.

141 {
142 return (array) $this->search_cache->getMimeFilter();
143 }

◆ getTabs()

ilLuceneSearchGUI::getTabs ( )
protected

get tabs

Definition at line 349 of file class.ilLuceneSearchGUI.php.

350 {
351 global $ilHelp;
352
353 $ilHelp->setScreenIdComponent("src_luc");
354
355 $this->tabs_gui->addTarget('search', $this->ctrl->getLinkTarget($this));
356
357 if (ilSearchSettings::getInstance()->isLuceneUserSearchEnabled()) {
358 $this->tabs_gui->addTarget('search_user', $this->ctrl->getLinkTargetByClass('illuceneusersearchgui'));
359 }
360
361 if ($this->fields->getActiveFields() && !ilSearchSettings::getInstance()->getHideAdvancedSearch()) {
362 $this->tabs_gui->addTarget('search_advanced', $this->ctrl->getLinkTargetByClass('illuceneAdvancedSearchgui'));
363 }
364
365 $this->tabs_gui->setTabActive('search');
366 }

References fields, and ilSearchSettings\getInstance().

Referenced by prepareOutput().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getType()

ilLuceneSearchGUI::getType ( )
protected

Get type of search (details | fast)

Todo:
rename Needed for base class search form

Definition at line 117 of file class.ilLuceneSearchGUI.php.

118 {
119 if (count($this->search_cache)) {
121 }
123 }

References ilSearchBaseGUI\SEARCH_DETAILS, and ilSearchBaseGUI\SEARCH_FAST.

◆ initUserSearchCache()

ilLuceneSearchGUI::initUserSearchCache ( )
protected

Init user search cache.

@access private

Definition at line 374 of file class.ilLuceneSearchGUI.php.

375 {
376 global $ilUser;
377
378 include_once('Services/Search/classes/class.ilUserSearchCache.php');
379 $this->search_cache = ilUserSearchCache::_getInstance($ilUser->getId());
380 $this->search_cache->switchSearchType(ilUserSearchCache::LUCENE_DEFAULT);
381 if ((int) $_GET['page_number']) {
382 $this->search_cache->setResultPageNumber((int) $_GET['page_number']);
383 }
384 if (isset($_POST['term'])) {
385 $this->search_cache->setQuery(ilUtil::stripSlashes($_POST['term']));
386 if ($_POST['item_filter_enabled']) {
387 $filtered = array();
388 foreach (ilSearchSettings::getInstance()->getEnabledLuceneItemFilterDefinitions() as $type => $data) {
389 if ($_POST['filter_type'][$type]) {
390 $filtered[$type] = 1;
391 }
392 }
393 $this->search_cache->setItemFilter($filtered);
394
395 // Mime filter
396 $mime = array();
397 foreach (ilSearchSettings::getInstance()->getEnabledLuceneMimeFilterDefinitions() as $type => $data) {
398 if ($_POST['filter_type'][$type]) {
399 $mime[$type] = 1;
400 }
401 }
402 $this->search_cache->setMimeFilter($mime);
403 }
404 $this->search_cache->setCreationFilter($this->loadCreationFilter());
405 if (!$_POST['item_filter_enabled']) {
406 // @todo: keep item filter settings
407 $this->search_cache->setItemFilter(array());
408 $this->search_cache->setMimeFilter(array());
409 }
410 if (!$_POST['screation']) {
411 $this->search_cache->setCreationFilter(array());
412 }
413 }
414 }
$_GET["client_id"]
$_POST["username"]
loadCreationFilter()
Load creation date filter.
static _getInstance($a_usr_id)
Get singleton instance.
static stripSlashes($a_str, $a_strip_html=true, $a_allow="")
strip slashes if magic qoutes is enabled
$type
$ilUser
Definition: imgupload.php:18

References $_GET, $_POST, $data, $ilUser, $type, ilUserSearchCache\_getInstance(), ilSearchSettings\getInstance(), ilSearchBaseGUI\loadCreationFilter(), ilUserSearchCache\LUCENE_DEFAULT, and ilUtil\stripSlashes().

Referenced by __construct().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ parseCreationFilter()

ilLuceneSearchGUI::parseCreationFilter ( )
protected

Parse creation date.

Returns
string

Definition at line 579 of file class.ilLuceneSearchGUI.php.

580 {
581 $options = $this->search_cache->getCreationFilter();
582
583 if (!$options['enabled']) {
584 return '';
585 }
586 $limit = new ilDate($options['date'], IL_CAL_UNIX);
587
588 switch ($options['ontype']) {
589 case 1:
590 // after
591 $limit->increment(IL_CAL_DAY, 1);
592 $now = new ilDate(time(), IL_CAL_UNIX);
593 return '+(cdate:[' . $limit->get(IL_CAL_DATE) . ' TO ' . $now->get(IL_CAL_DATE) . '*]) ';
594
595 case 2:
596 // before
597 return '+(cdate:[* TO ' . $limit->get(IL_CAL_DATE) . ']) ';
598
599 case 3:
600 // on
601 return '+(cdate:' . $limit->get(IL_CAL_DATE) . '*) ';
602
603 }
604 return '';
605 }
if(!isset( $_REQUEST[ 'ReturnTo'])) if(!isset($_REQUEST['AuthId'])) $options
Definition: as_login.php:20
const IL_CAL_DATE
const IL_CAL_UNIX
const IL_CAL_DAY
Class for single dates.

References $options, IL_CAL_DATE, IL_CAL_DAY, and IL_CAL_UNIX.

Referenced by performSearch().

+ Here is the caller graph for this function:

◆ performSearch()

ilLuceneSearchGUI::performSearch ( )
protected

Perform search.

Definition at line 241 of file class.ilLuceneSearchGUI.php.

242 {
243 global $ilUser,$ilBench;
244
245 unset($_SESSION['vis_references']);
246
247 $filter_query = '';
248 if ($this->search_cache->getItemFilter() and ilSearchSettings::getInstance()->isLuceneItemFilterEnabled()) {
249 $filter_settings = ilSearchSettings::getInstance()->getEnabledLuceneItemFilterDefinitions();
250 foreach ((array) $this->search_cache->getItemFilter() as $obj => $value) {
251 if (!$filter_query) {
252 $filter_query .= '+( ';
253 } else {
254 $filter_query .= 'OR';
255 }
256 $filter_query .= (' ' . (string) $filter_settings[$obj]['filter'] . ' ');
257 }
258 $filter_query .= ') ';
259 }
260 // begin-patch mime_filter
261 $mime_query = '';
262 if ($this->search_cache->getMimeFilter() and ilSearchSettings::getInstance()->isLuceneMimeFilterEnabled()) {
263 $filter_settings = ilSearchSettings::getInstance()->getEnabledLuceneMimeFilterDefinitions();
264 foreach ($this->search_cache->getMimeFilter() as $mime => $value) {
265 if (!$mime_query) {
266 $mime_query .= '+( ';
267 } else {
268 $mime_query .= 'OR';
269 }
270 $mime_query .= (' ' . (string) $filter_settings[$mime]['filter'] . ' ');
271 }
272 $mime_query .= ') ';
273 }
274
275 // begin-patch creation_date
276 $cdate_query = $this->parseCreationFilter();
277
278
279
280 $filter_query = $filter_query . ' ' . $mime_query . ' ' . $cdate_query;
281
282 include_once './Services/Search/classes/Lucene/class.ilLuceneSearcher.php';
283 include_once './Services/Search/classes/Lucene/class.ilLuceneQueryParser.php';
284
285 $query = $this->search_cache->getQuery();
286 if ($query) {
287 $query = ' +(' . $query . ')';
288 }
289 $qp = new ilLuceneQueryParser($filter_query . $query);
290 $qp->parse();
291 $searcher = ilLuceneSearcher::getInstance($qp);
292 $searcher->search();
293
294 // Filter results
295 include_once './Services/Search/classes/Lucene/class.ilLuceneSearchResultFilter.php';
296 include_once './Services/Search/classes/Lucene/class.ilLucenePathFilter.php';
298 $filter->addFilter(new ilLucenePathFilter($this->search_cache->getRoot()));
299 $filter->setCandidates($searcher->getResult());
300 $filter->filter();
301
302 if ($filter->getResultObjIds()) {
303 $searcher->highlight($filter->getResultObjIds());
304 }
305
306 // Show results
307 $this->showSearchForm();
308
309 include_once './Services/Search/classes/class.ilSearchResultPresentation.php';
310 $presentation = new ilSearchResultPresentation($this);
311 $presentation->setResults($filter->getResultIds());
312 $presentation->setSearcher($searcher);
313
314 // TODO: other handling required
315 $ilBench->start('Lucene', '1500_fo');
316 $this->addPager($filter, 'max_page');
317 $ilBench->stop('Lucene', '1500_fo');
318
319 $presentation->setPreviousNext($this->prev_link, $this->next_link);
320
321 if ($presentation->render()) {
322 $this->tpl->setVariable('SEARCH_RESULTS', $presentation->getHTML(true));
323 } else {
324 ilUtil::sendInfo(sprintf($this->lng->txt('search_no_match_hint'), $this->search_cache->getQuery()));
325 }
326 }
sprintf('%.4f', $callTime)
$_SESSION["AccountId"]
parseCreationFilter()
Parse creation date.
showSearchForm()
Show search form.
static getInstance(ilLuceneQueryParser $qp)
Get singleton instance.
addPager($result, $a_session_key)
Add Pager.
Presentation of search results using object list gui.
static sendInfo($a_info="", $a_keep=false)
Send Info Message to Screen.
$query

References $_SESSION, $ilBench, $ilUser, $query, ilSearchBaseGUI\addPager(), ilLuceneSearchResultFilter\getInstance(), ilSearchSettings\getInstance(), ilLuceneSearcher\getInstance(), parseCreationFilter(), ilUtil\sendInfo(), showSearchForm(), and sprintf.

Referenced by search(), and storeRoot().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ prepareOutput()

ilLuceneSearchGUI::prepareOutput ( )

Add admin panel command.

Reimplemented from ilSearchBaseGUI.

Definition at line 105 of file class.ilLuceneSearchGUI.php.

106 {
107 parent::prepareOutput();
108 $this->getTabs();
109 return true;
110 }

References getTabs().

Referenced by executeCommand().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ remoteSearch()

ilLuceneSearchGUI::remoteSearch ( )
protected

Search from main menu.

Definition at line 148 of file class.ilLuceneSearchGUI.php.

149 {
150 $query = trim(ilUtil::stripSlashes($_POST['queryString']));
151
152 include_once './Services/Search/classes/Lucene/class.ilLuceneQueryParser.php';
153 $qp = new ilLuceneQueryParser($query);
154 $qp->parseAutoWildcard();
155
156 $query = $qp->getQuery();
157
158 $this->search_cache->setRoot((int) $_POST['root_id']);
159 $this->search_cache->setQuery(ilUtil::stripSlashes($query));
160 $this->search_cache->save();
161
162 $this->search();
163 }
search()
Search (button pressed)

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

+ Here is the call graph for this function:

◆ search()

ilLuceneSearchGUI::search ( )
protected

Search (button pressed)

Returns

Definition at line 217 of file class.ilLuceneSearchGUI.php.

218 {
219 if (!$this->form->checkInput()) {
220 $this->search_cache->deleteCachedEntries();
221 // Reset details
222 include_once './Services/Object/classes/class.ilSubItemListGUI.php';
224 $this->showSearchForm();
225 return false;
226 }
227
228 unset($_SESSION['max_page']);
229 $this->search_cache->deleteCachedEntries();
230
231 // Reset details
232 include_once './Services/Object/classes/class.ilSubItemListGUI.php';
234
235 $this->performSearch();
236 }
performSearch()
Perform search.
static resetDetails()
reset details As long as static::resetDetails is not possible this method is final

References $_SESSION, performSearch(), ilSubItemListGUI\resetDetails(), and showSearchForm().

Referenced by remoteSearch().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ setAdminViewButton()

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

Show admin view button.

Definition at line 507 of file class.ilLuceneSearchGUI.php.

508 {
509 $this->admin_view_button =
510 array("link" => $a_link, "txt" => $a_txt);
511 }

◆ setPageFormAction()

ilLuceneSearchGUI::setPageFormAction (   $a_action)
protected

Definition at line 513 of file class.ilLuceneSearchGUI.php.

514 {
515 $this->page_form_action = $a_action;
516 }

◆ showSavedResults()

ilLuceneSearchGUI::showSavedResults ( )
protected

Show saved results.

Returns

Definition at line 169 of file class.ilLuceneSearchGUI.php.

170 {
171 global $ilUser,$ilBench;
172
173 if (!strlen($this->search_cache->getQuery())) {
174 $this->showSearchForm();
175 return false;
176 }
177
178 include_once './Services/Search/classes/Lucene/class.ilLuceneSearcher.php';
179 include_once './Services/Search/classes/Lucene/class.ilLuceneQueryParser.php';
180 $qp = new ilLuceneQueryParser($this->search_cache->getQuery());
181 $qp->parse();
182 $searcher = ilLuceneSearcher::getInstance($qp);
183 $searcher->search();
184
185 // Load saved results
186 include_once './Services/Search/classes/Lucene/class.ilLuceneSearchResultFilter.php';
188 $filter->loadFromDb();
189
190 // Highlight
191 $searcher->highlight($filter->getResultObjIds());
192
193 include_once './Services/Search/classes/class.ilSearchResultPresentation.php';
194 $presentation = new ilSearchResultPresentation($this);
195 $presentation->setResults($filter->getResultIds());
196
197 $presentation->setSearcher($searcher);
198
199 // TODO: other handling required
200 $this->addPager($filter, 'max_page');
201
202 $presentation->setPreviousNext($this->prev_link, $this->next_link);
203
204 $this->showSearchForm();
205
206 if ($presentation->render()) {
207 $this->tpl->setVariable('SEARCH_RESULTS', $presentation->getHTML(true));
208 } elseif (strlen($this->search_cache->getQuery())) {
209 ilUtil::sendInfo(sprintf($this->lng->txt('search_no_match_hint'), $qp->getQuery()));
210 }
211 }

References $ilBench, $ilUser, ilSearchBaseGUI\addPager(), ilLuceneSearchResultFilter\getInstance(), ilLuceneSearcher\getInstance(), ilUtil\sendInfo(), showSearchForm(), and sprintf.

+ Here is the call graph for this function:

◆ showSearchForm()

ilLuceneSearchGUI::showSearchForm ( )
protected

Show search form.

Returns
boolean

Definition at line 522 of file class.ilLuceneSearchGUI.php.

523 {
524 global $ilCtrl, $lng;
525
526 $this->tpl->addBlockFile('ADM_CONTENT', 'adm_content', 'tpl.lucene_search.html', 'Services/Search');
527
528 // include js needed
529 include_once("./Services/UIComponent/Overlay/classes/class.ilOverlayGUI.php");
531 $this->tpl->addJavascript("./Services/Search/js/Search.js");
532
533 include_once("./Services/UIComponent/Glyph/classes/class.ilGlyphGUI.php");
534
535 $this->tpl->setVariable("FORM_ACTION", $ilCtrl->getFormAction($this, 'performSearch'));
536 $this->tpl->setVariable("TERM", ilUtil::prepareFormOutput($this->search_cache->getQuery()));
537 include_once("./Services/UIComponent/Button/classes/class.ilSubmitButton.php");
539 $btn->setCommand("performSearch");
540 $btn->setCaption("search");
541 $this->tpl->setVariable("SUBMIT_BTN", $btn->render());
542 $this->tpl->setVariable("TXT_OPTIONS", $lng->txt("options"));
543 $this->tpl->setVariable("ARR_IMG", ilGlyphGUI::get(ilGlyphGUI::CARET));
544 $this->tpl->setVariable("TXT_COMBINATION", $lng->txt("search_term_combination"));
545 $this->tpl->setVariable('TXT_COMBINATION_DEFAULT', ilSearchSettings::getInstance()->getDefaultOperator() == ilSearchSettings::OPERATOR_AND ? $lng->txt('search_all_words') : $lng->txt('search_any_word'));
546 $this->tpl->setVariable("TXT_AREA", $lng->txt("search_area"));
547
548 if (ilSearchSettings::getInstance()->isLuceneItemFilterEnabled()) {
549 $this->tpl->setCurrentBlock("type_sel");
550 $this->tpl->setVariable('TXT_TYPE_DEFAULT', $lng->txt("search_off"));
551 $this->tpl->setVariable("ARR_IMGT", ilGlyphGUI::get(ilGlyphGUI::CARET));
552 $this->tpl->setVariable("TXT_FILTER_BY_TYPE", $lng->txt("search_filter_by_type"));
553 $this->tpl->setVariable('FORM', $this->form->getHTML());
554 $this->tpl->parseCurrentBlock();
555 }
556
557 // search area form
558 $this->tpl->setVariable('SEARCH_AREA_FORM', $this->getSearchAreaForm()->getHTML());
559 $this->tpl->setVariable("TXT_CHANGE", $lng->txt("change"));
560
561 if (ilSearchSettings::getInstance()->isDateFilterEnabled()) {
562 // begin-patch creation_date
563 $this->tpl->setVariable('TXT_FILTER_BY_CDATE', $this->lng->txt('search_filter_cd'));
564 $this->tpl->setVariable('TXT_CD_OFF', $this->lng->txt('search_off'));
565 $this->tpl->setVariable('FORM_CD', $this->getCreationDateForm()->getHTML());
566 $this->tpl->setVariable("ARR_IMG_CD", ilGlyphGUI::get(ilGlyphGUI::CARET));
567 // end-patch creation_date
568 }
569
570
571 return true;
572 }
static get($a_glyph, $a_text="")
Get glyph html.
static initJavascript()
Init javascript.
static getInstance()
Factory.
static prepareFormOutput($a_str, $a_strip=false)
prepares string output for html forms @access public

References $ilCtrl, ilSearchBaseGUI\$lng, ilGlyphGUI\CARET, ilGlyphGUI\get(), ilSearchBaseGUI\getCreationDateForm(), ilSearchSettings\getInstance(), ilSubmitButton\getInstance(), ilSearchBaseGUI\getSearchAreaForm(), ilOverlayGUI\initJavascript(), ilSearchSettings\OPERATOR_AND, and ilUtil\prepareFormOutput().

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

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ storeRoot()

ilLuceneSearchGUI::storeRoot ( )
protected

Store new root node.

Definition at line 331 of file class.ilLuceneSearchGUI.php.

332 {
333 $form = $this->getSearchAreaForm();
334
335 $this->root_node = $form->getItemByPostVar('area')->getValue();
336 $this->search_cache->setRoot($this->root_node);
337 $this->search_cache->save();
338 $this->search_cache->deleteCachedEntries();
339
340 include_once './Services/Object/classes/class.ilSubItemListGUI.php';
342
343 $this->performSearch();
344 }

References $form, ilSearchBaseGUI\getSearchAreaForm(), performSearch(), and ilSubItemListGUI\resetDetails().

+ Here is the call graph for this function:

Field Documentation

◆ $ilTabs

ilLuceneSearchGUI::$ilTabs
protected

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

Referenced by __construct().


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