ILIAS  release_5-1 Revision 5.0.0-5477-g43f3e3fab5f
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
 ilSearchBaseGUI ()
 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...
 
 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...
 

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 ()
 

Protected Attributes

 $ilTabs
 
- Protected Attributes inherited from ilSearchBaseGUI
 $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
 
 $settings = null
 
 $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.

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
60 }
static getInstance()
Get singleton instance.
initUserSearchCache()
Init user search cache.
$errors fields
Definition: imgupload.php:48

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 534 of file class.ilLuceneSearchGUI.php.

535 {
536 $this->admin_panel_commands[] =
537 array("cmd" => $a_cmd, "txt" => $a_txt);
538 }

◆ executeCommand()

ilLuceneSearchGUI::executeCommand ( )

Execute Command.

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

66 {
67 global $ilBench, $ilCtrl;
68
69 $ilBench->start('Lucene','0900_executeCommand');
70 $next_class = $this->ctrl->getNextClass($this);
71 $cmd = $this->ctrl->getCmd();
72
73 $this->prepareOutput();
74 switch($next_class)
75 {
76 case "ilpropertyformgui":
77 /*$this->initStandardSearchForm(ilSearchBaseGUI::SEARCH_FORM_LUCENE);
78 $ilCtrl->setReturn($this, 'storeRoot');
79 $ilCtrl->forwardCommand($this->form);*/
80 $form = $this->getSearchAreaForm();
81 $ilCtrl->setReturn($this, 'storeRoot');
82 $ilCtrl->forwardCommand($form);
83 break;
84
85 case 'ilobjectcopygui':
86 $this->ctrl->setReturn($this,'');
87 include_once './Services/Object/classes/class.ilObjectCopyGUI.php';
88 $cp = new ilObjectCopyGUI($this);
89 $this->ctrl->forwardCommand($cp);
90 break;
91
92 default:
94 if(!$cmd)
95 {
96 $cmd = "showSavedResults";
97 }
98 $this->handleCommand($cmd);
99 break;
100 }
101 $ilBench->stop('Lucene','0900_executeCommand');
102 return true;
103 }
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
$cmd
Definition: sahs_server.php:35

References $cmd, $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 458 of file class.ilLuceneSearchGUI.php.

459 {
460 global $lng;
461
462 $adm_view_cmp = $adm_cmds = $creation_selector = $adm_view = false;
463
464 // admin panel commands
465 if ((count($this->admin_panel_commands) > 0))
466 {
467 foreach($this->admin_panel_commands as $cmd)
468 {
469 $this->tpl->setCurrentBlock("lucene_admin_panel_cmd");
470 $this->tpl->setVariable("LUCENE_PANEL_CMD", $cmd["cmd"]);
471 $this->tpl->setVariable("LUCENE_TXT_PANEL_CMD", $cmd["txt"]);
472 $this->tpl->parseCurrentBlock();
473 }
474
475 $adm_cmds = true;
476 }
477 if ($adm_cmds)
478 {
479 $this->tpl->setCurrentBlock("lucene_adm_view_components");
480 $this->tpl->setVariable("LUCENE_ADM_IMG_ARROW", ilUtil::getImagePath("arrow_upright.svg"));
481 $this->tpl->setVariable("LUCENE_ADM_ALT_ARROW", $lng->txt("actions"));
482 $this->tpl->parseCurrentBlock();
483 $adm_view_cmp = true;
484 }
485
486 // admin view button
487 if (is_array($this->admin_view_button))
488 {
489 if (is_array($this->admin_view_button))
490 {
491 $this->tpl->setCurrentBlock("lucene_admin_button");
492 $this->tpl->setVariable("LUCENE_ADMIN_MODE_LINK",
493 $this->admin_view_button["link"]);
494 $this->tpl->setVariable("LUCENE_TXT_ADMIN_MODE",
495 $this->admin_view_button["txt"]);
496 $this->tpl->parseCurrentBlock();
497 }
498 $this->tpl->setCurrentBlock("lucene_admin_view");
499 $this->tpl->parseCurrentBlock();
500 $adm_view = true;
501 }
502
503 // creation selector
504 if (is_array($this->creation_selector))
505 {
506 $this->tpl->setCurrentBlock("lucene_add_commands");
507 if ($adm_cmds)
508 {
509 $this->tpl->setVariable("LUCENE_ADD_COM_WIDTH", 'width="1"');
510 }
511 $this->tpl->setVariable("LUCENE_SELECT_OBJTYPE_REPOS",
512 $this->creation_selector["options"]);
513 $this->tpl->setVariable("LUCENE_BTN_NAME_REPOS",
514 $this->creation_selector["command"]);
515 $this->tpl->setVariable("LUCENE_TXT_ADD_REPOS",
516 $this->creation_selector["txt"]);
517 $this->tpl->parseCurrentBlock();
518 $creation_selector = true;
519 }
520 if ($adm_view || $creation_selector)
521 {
522 $this->tpl->setCurrentBlock("lucene_adm_panel");
523 if ($adm_view_cmp)
524 {
525 $this->tpl->setVariable("LUCENE_ADM_TBL_WIDTH", 'width:"100%";');
526 }
527 $this->tpl->parseCurrentBlock();
528 }
529 }
static getImagePath($img, $module_path="", $mode="output", $offline=false)
get image path (for images located in a template directory)

References $cmd, 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 134 of file class.ilLuceneSearchGUI.php.

135 {
136 return (array) $this->search_cache->getItemFilter();
137 }

◆ getMimeDetails()

ilLuceneSearchGUI::getMimeDetails ( )
protected

Needed for base class search form.

Todo:
rename
Returns
type

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

145 {
146 return (array) $this->search_cache->getMimeFilter();
147 }

◆ getTabs()

ilLuceneSearchGUI::getTabs ( )
protected

get tabs

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

373 {
374 global $ilHelp;
375
376 $ilHelp->setScreenIdComponent("src_luc");
377
378 $this->tabs_gui->addTarget('search',$this->ctrl->getLinkTarget($this));
379
380 if(ilSearchSettings::getInstance()->isLuceneUserSearchEnabled())
381 {
382 $this->tabs_gui->addTarget('search_user',$this->ctrl->getLinkTargetByClass('illuceneusersearchgui'));
383 }
384
385 if($this->fields->getActiveFields() && !ilSearchSettings::getInstance()->getHideAdvancedSearch())
386 {
387 $this->tabs_gui->addTarget('search_advanced',$this->ctrl->getLinkTargetByClass('illuceneAdvancedSearchgui'));
388 }
389
390 $this->tabs_gui->setTabActive('search');
391
392 }

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 120 of file class.ilLuceneSearchGUI.php.

121 {
122 if(count($this->search_cache))
123 {
125 }
127 }

References ilSearchBaseGUI\SEARCH_DETAILS, and ilSearchBaseGUI\SEARCH_FAST.

◆ initUserSearchCache()

ilLuceneSearchGUI::initUserSearchCache ( )
protected

Init user search cache.

@access private

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

401 {
402 global $ilUser;
403
404 include_once('Services/Search/classes/class.ilUserSearchCache.php');
405 $this->search_cache = ilUserSearchCache::_getInstance($ilUser->getId());
406 $this->search_cache->switchSearchType(ilUserSearchCache::LUCENE_DEFAULT);
407 if((int) $_GET['page_number'])
408 {
409 $this->search_cache->setResultPageNumber((int) $_GET['page_number']);
410 }
411 if(isset($_POST['term']))
412 {
413 $this->search_cache->setQuery(ilUtil::stripSlashes($_POST['term']));
414 if($_POST['item_filter_enabled'])
415 {
416 $filtered = array();
417 foreach(ilSearchSettings::getInstance()->getEnabledLuceneItemFilterDefinitions() as $type => $data)
418 {
419 if($_POST['filter_type'][$type])
420 {
421 $filtered[$type] = 1;
422 }
423 }
424 $this->search_cache->setItemFilter($filtered);
425
426 // Mime filter
427 $mime = array();
428 foreach(ilSearchSettings::getInstance()->getEnabledLuceneMimeFilterDefinitions() as $type => $data)
429 {
430 if($_POST['filter_type'][$type])
431 {
432 $mime[$type] = 1;
433 }
434 }
435 $this->search_cache->setMimeFilter($mime);
436
437
438 }
439 $this->search_cache->setCreationFilter($this->loadCreationFilter());
440 if(!$_POST['item_filter_enabled'])
441 {
442 // @todo: keep item filter settings
443 $this->search_cache->setItemFilter(array());
444 $this->search_cache->setMimeFilter(array());
445 }
446 if(!$_POST['screation'])
447 {
448 $this->search_cache->setCreationFilter(array());
449 }
450 }
451 }
$_GET["client_id"]
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
$_POST['username']
Definition: cron.php:12
$data
global $ilUser
Definition: imgupload.php:15

References $_GET, $_POST, $data, $ilUser, 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 617 of file class.ilLuceneSearchGUI.php.

618 {
619 $options = $this->search_cache->getCreationFilter();
620
621 if(!$options['enabled'])
622 {
623 return '';
624 }
625 $limit = new ilDate($options['date'],IL_CAL_UNIX);
626
627 switch($options['ontype'])
628 {
629 case 1:
630 // after
631 $limit->increment(IL_CAL_DAY, 1);
632 $now = new ilDate(time(),IL_CAL_UNIX);
633 return '+(cdate:['.$limit->get(IL_CAL_DATE).' TO '.$now->get(IL_CAL_DATE).'*]) ';
634
635 case 2:
636 // before
637 return '+(cdate:[* TO '.$limit->get(IL_CAL_DATE).']) ';
638
639 case 3:
640 // on
641 return '+(cdate:'.$limit->get(IL_CAL_DATE).'*) ';
642
643 }
644 return '';
645 }
const IL_CAL_DATE
const IL_CAL_UNIX
const IL_CAL_DAY
Class for single dates.
if(!is_array($argv)) $options

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 250 of file class.ilLuceneSearchGUI.php.

251 {
252 global $ilUser,$ilBench;
253
254 unset($_SESSION['vis_references']);
255
256 $filter_query = '';
257 if($this->search_cache->getItemFilter() and ilSearchSettings::getInstance()->isLuceneItemFilterEnabled())
258 {
259 $filter_settings = ilSearchSettings::getInstance()->getEnabledLuceneItemFilterDefinitions();
260 foreach((array) $this->search_cache->getItemFilter() as $obj => $value)
261 {
262 if(!$filter_query)
263 {
264 $filter_query .= '+( ';
265 }
266 else
267 {
268 $filter_query .= 'OR';
269 }
270 $filter_query .= (' '. (string) $filter_settings[$obj]['filter'].' ');
271 }
272 $filter_query .= ') ';
273 }
274 // begin-patch mime_filter
275 $mime_query = '';
276 if($this->search_cache->getMimeFilter() and ilSearchSettings::getInstance()->isLuceneMimeFilterEnabled())
277 {
278 $filter_settings = ilSearchSettings::getInstance()->getEnabledLuceneMimeFilterDefinitions();
279 foreach($this->search_cache->getMimeFilter() as $mime => $value)
280 {
281 if(!$mime_query)
282 {
283 $mime_query .= '+( ';
284 }
285 else
286 {
287 $mime_query .= 'OR';
288 }
289 $mime_query .= (' '. (string) $filter_settings[$mime]['filter'].' ');
290 }
291 $mime_query .= ') ';
292 }
293
294 // begin-patch creation_date
295 $cdate_query = $this->parseCreationFilter();
296
297
298
299 $filter_query = $filter_query . ' '. $mime_query.' '.$cdate_query;
300
301 include_once './Services/Search/classes/Lucene/class.ilLuceneSearcher.php';
302 include_once './Services/Search/classes/Lucene/class.ilLuceneQueryParser.php';
303
304 $query = $this->search_cache->getQuery();
305 if($query)
306 {
307 $query = ' +('.$query.')';
308 }
309 $qp = new ilLuceneQueryParser($filter_query.$query);
310 $qp->parse();
311 $searcher = ilLuceneSearcher::getInstance($qp);
312 $searcher->search();
313
314 // Filter results
315 include_once './Services/Search/classes/Lucene/class.ilLuceneSearchResultFilter.php';
316 include_once './Services/Search/classes/Lucene/class.ilLucenePathFilter.php';
318 $filter->addFilter(new ilLucenePathFilter($this->search_cache->getRoot()));
319 $filter->setCandidates($searcher->getResult());
320 $filter->filter();
321
322 if($filter->getResultObjIds()) {
323 $searcher->highlight($filter->getResultObjIds());
324 }
325
326 // Show results
327 $this->showSearchForm();
328
329 include_once './Services/Search/classes/class.ilSearchResultPresentation.php';
330 $presentation = new ilSearchResultPresentation($this);
331 $presentation->setResults($filter->getResultIds());
332 $presentation->setSearcher($searcher);
333
334 // TODO: other handling required
335 $ilBench->start('Lucene','1500_fo');
336 $this->addPager($filter,'max_page');
337 $ilBench->stop('Lucene','1500_fo');
338
339 $presentation->setPreviousNext($this->prev_link, $this->next_link);
340
341 if($presentation->render())
342 {
343 $this->tpl->setVariable('SEARCH_RESULTS',$presentation->getHTML(true));
344 }
345 else
346 {
347 ilUtil::sendInfo(sprintf($this->lng->txt('search_no_match_hint'),$this->search_cache->getQuery()));
348 }
349 }
$_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.

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

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 108 of file class.ilLuceneSearchGUI.php.

109 {
110 parent::prepareOutput();
111 $this->getTabs();
112 return true;
113 }

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 152 of file class.ilLuceneSearchGUI.php.

153 {
154 $query = trim(ilUtil::stripSlashes($_POST['queryString']));
155
156 include_once './Services/Search/classes/Lucene/class.ilLuceneQueryParser.php';
157 $qp = new ilLuceneQueryParser($query);
158 $qp->parseAutoWildcard();
159
160 $query = $qp->getQuery();
161
162 $this->search_cache->setRoot((int) $_POST['root_id']);
163 $this->search_cache->setQuery(ilUtil::stripSlashes($query));
164 $this->search_cache->save();
165
166 $this->search();
167 }
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 225 of file class.ilLuceneSearchGUI.php.

226 {
227 if(!$this->form->checkInput())
228 {
229 $this->search_cache->deleteCachedEntries();
230 // Reset details
231 include_once './Services/Object/classes/class.ilSubItemListGUI.php';
233 $this->showSearchForm();
234 return false;
235 }
236
237 unset($_SESSION['max_page']);
238 $this->search_cache->deleteCachedEntries();
239
240 // Reset details
241 include_once './Services/Object/classes/class.ilSubItemListGUI.php';
243
244 $this->performSearch();
245 }
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 543 of file class.ilLuceneSearchGUI.php.

544 {
545 $this->admin_view_button =
546 array("link" => $a_link, "txt" => $a_txt);
547 }

◆ setPageFormAction()

ilLuceneSearchGUI::setPageFormAction (   $a_action)
protected

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

550 {
551 $this->page_form_action = $a_action;
552 }

◆ showSavedResults()

ilLuceneSearchGUI::showSavedResults ( )
protected

Show saved results.

Returns

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

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

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

+ Here is the call graph for this function:

◆ showSearchForm()

ilLuceneSearchGUI::showSearchForm ( )
protected

Show search form.

Returns
boolean

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

559 {
560 global $ilCtrl, $lng;
561
562 $this->tpl->addBlockFile('ADM_CONTENT','adm_content','tpl.lucene_search.html','Services/Search');
563
564 // include js needed
565 include_once("./Services/UIComponent/Overlay/classes/class.ilOverlayGUI.php");
567 $this->tpl->addJavascript("./Services/Search/js/Search.js");
568
569 include_once("./Services/UIComponent/Glyph/classes/class.ilGlyphGUI.php");
570
571 $this->tpl->setVariable("FORM_ACTION", $ilCtrl->getFormAction($this,'performSearch'));
572 $this->tpl->setVariable("TERM", ilUtil::prepareFormOutput($this->search_cache->getQuery()));
573 include_once("./Services/UIComponent/Button/classes/class.ilSubmitButton.php");
575 $btn->setCommand("performSearch");
576 $btn->setCaption("search");
577 $this->tpl->setVariable("SUBMIT_BTN",$btn->render());
578 $this->tpl->setVariable("TXT_OPTIONS", $lng->txt("options"));
579 $this->tpl->setVariable("ARR_IMG", ilGlyphGUI::get(ilGlyphGUI::CARET));
580 $this->tpl->setVariable("TXT_COMBINATION", $lng->txt("search_term_combination"));
581 $this->tpl->setVariable('TXT_COMBINATION_DEFAULT', ilSearchSettings::getInstance()->getDefaultOperator() == ilSearchSettings::OPERATOR_AND ? $lng->txt('search_all_words') : $lng->txt('search_any_word'));
582 $this->tpl->setVariable("TXT_AREA", $lng->txt("search_area"));
583
584 if (ilSearchSettings::getInstance()->isLuceneItemFilterEnabled())
585 {
586 $this->tpl->setCurrentBlock("type_sel");
587 $this->tpl->setVariable('TXT_TYPE_DEFAULT',$lng->txt("search_off"));
588 $this->tpl->setVariable("ARR_IMGT", ilGlyphGUI::get(ilGlyphGUI::CARET));
589 $this->tpl->setVariable("TXT_FILTER_BY_TYPE", $lng->txt("search_filter_by_type"));
590 $this->tpl->setVariable('FORM',$this->form->getHTML());
591 $this->tpl->parseCurrentBlock();
592 }
593
594 // search area form
595 $this->tpl->setVariable('SEARCH_AREA_FORM', $this->getSearchAreaForm()->getHTML());
596 $this->tpl->setVariable("TXT_CHANGE", $lng->txt("change"));
597
598 if(ilSearchSettings::getInstance()->isDateFilterEnabled())
599 {
600 // begin-patch creation_date
601 $this->tpl->setVariable('TXT_FILTER_BY_CDATE',$this->lng->txt('search_filter_cd'));
602 $this->tpl->setVariable('TXT_CD_OFF',$this->lng->txt('search_off'));
603 $this->tpl->setVariable('FORM_CD',$this->getCreationDateForm()->getHTML());
604 $this->tpl->setVariable("ARR_IMG_CD", ilGlyphGUI::get(ilGlyphGUI::CARET));
605 // end-patch creation_date
606 }
607
608
609 return true;
610 }
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 354 of file class.ilLuceneSearchGUI.php.

355 {
356 $form = $this->getSearchAreaForm();
357
358 $this->root_node = $form->getItemByPostVar('area')->getValue();
359 $this->search_cache->setRoot($this->root_node);
360 $this->search_cache->save();
361 $this->search_cache->deleteCachedEntries();
362
363 include_once './Services/Object/classes/class.ilSubItemListGUI.php';
365
366 $this->performSearch();
367 }

References 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: