ILIAS  release_8 Revision v8.19
All Data Structures Namespaces Files Functions Variables Modules Pages
ilLuceneAdvancedSearchGUI Class Reference

This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Learning e.V. 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 ()
 
 prepareOutput ()
 
 initStandardSearchForm (int $a_mode)
 
 getSearchAreaForm ()
 
 handleCommand (string $a_cmd)
 
 addToDeskObject ()
 Add desktop item public. More...
 
 removeFromDeskObject ()
 Remove from desktop public. More...
 
 delete ()
 Show delete confirmation. More...
 
 cancelDelete ()
 Cancel delete. More...
 
 cancelObject ()
 
 cancelMoveLinkObject ()
 
 performDelete ()
 
 cut ()
 
 link ()
 
 paste ()
 
 showLinkIntoMultipleObjectsTree ()
 
 showPasteTree ()
 
 showMoveIntoObjectTree ()
 
 performPasteIntoMultipleObjects ()
 
 clear ()
 clear clipboard More...
 
 enableAdministrationPanel ()
 
 disableAdministrationPanel ()
 
 keepObjectsInClipboardObject ()
 
 addLocator ()
 
 autoComplete ()
 
- Public Member Functions inherited from ILIAS\Object\ImplementsCreationCallback
 callCreationCallback (\ilObject $object, \ilObjectDefinition $obj_definition, int $requested_crtcb)
 

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 ()
 
- Protected Member Functions inherited from ilSearchBaseGUI
 initPageNumberFromQuery ()
 
 addPager ($result, string $a_session_key)
 
 buildSearchAreaPath (int $a_root_node)
 
 getCreationDateForm ()
 
 getSearchCache ()
 
 loadCreationFilter ()
 

Protected Attributes

ilTabsGUI $tabs_gui
 
ilHelpGUI $help
 
ilLuceneAdvancedSearchFields $fields
 
array $admin_panel_commands
 
array $admin_view_button
 
array $creation_selector
 
string $page_form_action
 
- Protected Attributes inherited from ilSearchBaseGUI
ilUserSearchCache $search_cache
 
string $search_mode = ''
 
ilSearchSettings $settings
 
ilPropertyFormGUI $form = null
 
ClipboardManager $clipboard
 
ViewManager $container_view_manager
 
ilFavouritesManager $favourites
 
ilCtrl $ctrl
 
ILIAS $ilias
 
ilLanguage $lng
 
ilGlobalTemplateInterface $tpl
 
ilLocatorGUI $locator
 
ilObjUser $user
 
ilTree $tree
 
GlobalHttpState $http
 
Factory $refinery
 
ilLogger $logger
 
string $prev_link = ''
 
string $next_link = ''
 

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
 

Detailed Description

This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Learning e.V.

ILIAS is licensed with the GPL-3.0, see https://www.gnu.org/licenses/gpl-3.0.en.html You should have received a copy of said license along with the source code, too.

If this is not the case or you just want to try ILIAS, you'll find us at: https://www.ilias.de https://github.com/ILIAS-eLearning Meta Data search GUI

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

ilLuceneAdvancedSearchGUI: ilSearchControllerGUI ilLuceneAdvancedSearchGUI: ilObjectGUI, ilContainerGUI ilLuceneAdvancedSearchGUI: ilObjCategoryGUI, ilObjCourseGUI, ilObjFolderGUI, ilObjGroupGUI ilLuceneAdvancedSearchGUI: ilObjStudyProgrammeGUI ilLuceneAdvancedSearchGUI: ilObjRootFolderGUI, ilObjectCopyGUI

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

Constructor & Destructor Documentation

◆ __construct()

ilLuceneAdvancedSearchGUI::__construct ( )

Constructor.

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

References $DIC, ILIAS\GlobalScreen\Provider\__construct(), fields, ilLuceneAdvancedSearchFields\getInstance(), ILIAS\Repository\help(), and initUserSearchCache().

52  {
53  global $DIC;
54 
55  $this->tabs_gui = $DIC->tabs();
56  $this->help = $DIC['ilHelp'];
58 
60  $this->initUserSearchCache();
61  }
$errors fields
Definition: imgupload.php:67
global $DIC
Definition: feed.php:28
initUserSearchCache()
Init user search cache.
__construct(Container $dic, ilPlugin $plugin)
+ Here is the call graph for this function:

Member Function Documentation

◆ executeCommand()

ilLuceneAdvancedSearchGUI::executeCommand ( )

Execute Command.

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

References ILIAS\Repository\ctrl(), ilSearchBaseGUI\handleCommand(), and prepareOutput().

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

◆ fillAdminPanel()

ilLuceneAdvancedSearchGUI::fillAdminPanel ( )
protected
Todo:
Couldn't find any of these template variables anywhere.

Is this still currently used?

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

References ilUtil\getImagePath(), and ILIAS\Repository\lng().

Referenced by performSearch(), and showSavedResults().

317  : void
318  {
319  $adm_view_cmp = $adm_cmds = $creation_selector = $adm_view = false;
320 
321  // admin panel commands
322  if (isset($this->admin_panel_commands) && (count((array) $this->admin_panel_commands) > 0)) {
323  foreach ($this->admin_panel_commands as $cmd) {
324  $this->tpl->setCurrentBlock("lucene_admin_panel_cmd");
325  $this->tpl->setVariable("LUCENE_PANEL_CMD", $cmd["cmd"]);
326  $this->tpl->setVariable("LUCENE_TXT_PANEL_CMD", $cmd["txt"]);
327  $this->tpl->parseCurrentBlock();
328  }
329 
330  $adm_cmds = true;
331  }
332  if ($adm_cmds) {
333  $this->tpl->setCurrentBlock("lucene_adm_view_components");
334  $this->tpl->setVariable("LUCENE_ADM_IMG_ARROW", ilUtil::getImagePath("arrow_upright.svg"));
335  $this->tpl->setVariable("LUCENE_ADM_ALT_ARROW", $this->lng->txt("actions"));
336  $this->tpl->parseCurrentBlock();
337  $adm_view_cmp = true;
338  }
339 
340  // admin view button
341  if (isset($this->admin_view_button) && is_array($this->admin_view_button)) {
342  if (is_array($this->admin_view_button)) {
343  $this->tpl->setCurrentBlock("lucene_admin_button");
344  $this->tpl->setVariable(
345  "LUCENE_ADMIN_MODE_LINK",
346  $this->admin_view_button["link"]
347  );
348  $this->tpl->setVariable(
349  "LUCENE_TXT_ADMIN_MODE",
350  $this->admin_view_button["txt"]
351  );
352  $this->tpl->parseCurrentBlock();
353  }
354  $this->tpl->setCurrentBlock("lucene_admin_view");
355  $this->tpl->parseCurrentBlock();
356  $adm_view = true;
357  }
358 
359  // creation selector
360  if (isset($this->creation_selector) && is_array($this->creation_selector)) {
361  $this->tpl->setCurrentBlock("lucene_add_commands");
362  if ($adm_cmds) {
363  $this->tpl->setVariable("LUCENE_ADD_COM_WIDTH", 'width="1"');
364  }
365  $this->tpl->setVariable(
366  "LUCENE_SELECT_OBJTYPE_REPOS",
367  $this->creation_selector["options"]
368  );
369  $this->tpl->setVariable(
370  "LUCENE_BTN_NAME_REPOS",
371  $this->creation_selector["command"]
372  );
373  $this->tpl->setVariable(
374  "LUCENE_TXT_ADD_REPOS",
375  $this->creation_selector["txt"]
376  );
377  $this->tpl->parseCurrentBlock();
378  $creation_selector = true;
379  }
380  if ($adm_view || $creation_selector) {
381  $this->tpl->setCurrentBlock("lucene_adm_panel");
382  if ($adm_view_cmp) {
383  $this->tpl->setVariable("LUCENE_ADM_TBL_WIDTH", 'width:"100%";');
384  }
385  $this->tpl->parseCurrentBlock();
386  }
387  }
static getImagePath(string $img, string $module_path="", string $mode="output", bool $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 276 of file class.ilLuceneAdvancedSearchGUI.php.

References ILIAS\Repository\ctrl(), fields, ilSearchSettings\getInstance(), and ILIAS\Repository\help().

Referenced by prepareOutput().

276  : void
277  {
278  $this->help->setScreenIdComponent("src_luc");
279 
280  $this->tabs_gui->addTarget('search', $this->ctrl->getLinkTargetByClass('illucenesearchgui'));
281 
282  if (ilSearchSettings::getInstance()->isLuceneUserSearchEnabled()) {
283  $this->tabs_gui->addTarget('search_user', $this->ctrl->getLinkTargetByClass('illuceneusersearchgui'));
284  }
285 
286  if (
287  !ilSearchSettings::getInstance()->getHideAdvancedSearch() and
288  $this->fields->getActiveFields()) {
289  $this->tabs_gui->addTarget('search_advanced', $this->ctrl->getLinkTarget($this));
290  }
291 
292  $this->tabs_gui->setTabActive('search_advanced');
293  }
$errors fields
Definition: imgupload.php:67
+ 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 137 of file class.ilLuceneAdvancedSearchGUI.php.

References ilSearchBaseGUI\$form, ILIAS\Repository\ctrl(), fields, ILIAS\Repository\form(), and ILIAS\Repository\lng().

Referenced by performSearch(), and showSavedResults().

137  : void
138  {
139  $this->form = new ilPropertyFormGUI();
140  $this->form->setFormAction($this->ctrl->getFormAction($this, 'search'));
141  $this->form->setTitle($this->lng->txt('search_advanced'));
142  $this->form->addCommandButton('search', $this->lng->txt('search'));
143  $this->form->addCommandButton('reset', $this->lng->txt('reset'));
144 
145  foreach ($this->fields->getActiveSections() as $definition) {
146  if ($definition['name'] != 'default') {
147  $section = new ilFormSectionHeaderGUI();
148  $section->setTitle($definition['name']);
149  $this->form->addItem($section);
150  }
151 
152  foreach ($definition['fields'] as $field_name) {
153  if (is_object($element = $this->fields->getFormElement($this->search_cache->getQuery(), $field_name, $this->form))) {
154  $this->form->addItem($element);
155  }
156  }
157  }
158  }
$errors fields
Definition: imgupload.php:67
ilPropertyFormGUI $form
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
form( $class_path, string $cmd)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ initUserSearchCache()

ilLuceneAdvancedSearchGUI::initUserSearchCache ( )
protected

Init user search cache.

private

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

References ilUserSearchCache\_getInstance(), ILIAS\FileDelivery\http(), ilSearchBaseGUI\initPageNumberFromQuery(), ilUserSearchCache\LUCENE_ADVANCED, and ILIAS\Repository\user().

Referenced by __construct().

301  : void
302  {
303  $this->search_cache = ilUserSearchCache::_getInstance($this->user->getId());
304  $this->search_cache->switchSearchType(ilUserSearchCache::LUCENE_ADVANCED);
305  $page_number = $this->initPageNumberFromQuery();
306  if ($page_number) {
307  $this->search_cache->setResultPageNumber($page_number);
308  }
309  if ($this->http->wrapper()->post()->has('query')) {
310  $this->search_cache->setQuery($this->http->request()->getParsedBody()['query'] ?? []);
311  }
312  }
static _getInstance(int $a_usr_id)
static http()
Fetches the global http state from ILIAS.
+ 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 215 of file class.ilLuceneAdvancedSearchGUI.php.

References ilSearchBaseGUI\addPager(), ilSession\clear(), fillAdminPanel(), ILIAS\Repository\form(), ilLuceneSearcher\getInstance(), ilLuceneSearchResultFilter\getInstance(), initFormSearch(), ILIAS\Repository\lng(), ilLuceneAdvancedQueryParser\parse(), showSavedResults(), and ILIAS\Repository\user().

Referenced by search().

215  : void
216  {
217  ilSession::clear('vis_references');
218  $qp = new ilLuceneAdvancedQueryParser($this->search_cache->getQuery());
219  $qp->parse();
220  if (!strlen(trim($qp->getQuery()))) {
221  $this->tpl->setOnScreenMessage('info', $this->lng->txt('msg_no_search_string'));
222  $this->showSavedResults();
223  return;
224  }
225 
226  $searcher = ilLuceneSearcher::getInstance($qp);
227  $searcher->search();
228 
229  // Filter results
230  $filter = ilLuceneSearchResultFilter::getInstance($this->user->getId());
231  $filter->addFilter(new ilLucenePathFilter($this->search_cache->getRoot()));
232  $filter->setCandidates($searcher->getResult());
233  $filter->filter();
234 
235  if ($filter->getResultObjIds()) {
236  $searcher->highlight($filter->getResultObjIds());
237  }
238 
239  // Show results
240  $this->tpl->addBlockFile('ADM_CONTENT', 'adm_content', 'tpl.lucene_adv_search.html', 'Services/Search');
241  $presentation = new ilSearchResultPresentation($this);
242  $presentation->setResults($filter->getResultIds());
243  $presentation->setSearcher($searcher);
244 
245  // TODO: other handling required
246  $this->addPager($filter, 'max_page');
247  $presentation->setPreviousNext($this->prev_link, $this->next_link);
248 
249  if ($presentation->render()) {
250  $this->tpl->setVariable('SEARCH_RESULTS', $presentation->getHTML());
251  } else {
252  $this->tpl->setOnScreenMessage('info', $this->lng->txt('search_no_match'));
253  }
254 
255  // and finally add search form
256  $this->initFormSearch();
257  $this->tpl->setVariable('SEARCH_TABLE', $this->form->getHTML());
258 
259  if ($filter->getResultIds()) {
260  $this->fillAdminPanel();
261  }
262  }
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
static getInstance(ilLuceneQueryParser $qp)
Get singleton instance.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
form( $class_path, string $cmd)
addPager($result, string $a_session_key)
static clear(string $a_var)
+ 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 267 of file class.ilLuceneAdvancedSearchGUI.php.

References getTabs().

Referenced by executeCommand().

267  : void
268  {
269  parent::prepareOutput();
270  $this->getTabs();
271  }
+ 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 163 of file class.ilLuceneAdvancedSearchGUI.php.

References ILIAS\FileDelivery\http(), ILIAS\Repository\refinery(), and search().

163  : void
164  {
165  $root_id = 0;
166  if ($this->http->wrapper()->post()->has('root_id')) {
167  $root_id = $this->http->wrapper()->post()->retrieve(
168  'root_id',
169  $this->refinery->kindlyTo()->int()
170  );
171  }
172  $queryString = '';
173  if ($this->http->wrapper()->post()->has('queryString')) {
174  $queryString = $this->http->wrapper()->post()->retrieve(
175  'queryString',
176  $this->refinery->kindlyTo()->string()
177  );
178  }
179  $this->search_cache->setRoot($root_id);
180  $this->search_cache->setQuery(['lom_content' => $queryString]);
181  $this->search_cache->save();
182  $this->search();
183  }
static http()
Fetches the global http state from ILIAS.
+ Here is the call graph for this function:

◆ reset()

ilLuceneAdvancedSearchGUI::reset ( )
protected

Reset search form.

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

References showSavedResults().

205  : void
206  {
207  $this->search_cache->setQuery(array());
208  $this->search_cache->save();
209  $this->showSavedResults();
210  }
+ Here is the call graph for this function:

◆ search()

ilLuceneAdvancedSearchGUI::search ( )
protected

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

References ilSession\clear(), ILIAS\Repository\lng(), performSearch(), ilSubItemListGUI\resetDetails(), and showSavedResults().

Referenced by remoteSearch().

185  : void
186  {
187  if (!is_array($this->search_cache->getQuery())) {
188  // TOD: handle empty advances search
189  $this->tpl->setOnScreenMessage('info', $this->lng->txt('msg_no_search_string'));
190  $this->showSavedResults();
191  return;
192  }
193  ilSession::clear('max_page');
194  $this->search_cache->deleteCachedEntries();
195 
196  // Reset details
198 
199  $this->performSearch();
200  }
static resetDetails()
As long as static::resetDetails is not possible this method is final.
static clear(string $a_var)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ showSavedResults()

ilLuceneAdvancedSearchGUI::showSavedResults ( )

Show saved results.

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

References ilSearchBaseGUI\addPager(), fillAdminPanel(), ILIAS\Repository\form(), ilLuceneSearcher\getInstance(), ilLuceneSearchResultFilter\getInstance(), initFormSearch(), ILIAS\Repository\lng(), ilLuceneAdvancedQueryParser\parse(), and ILIAS\Repository\user().

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

93  : void
94  {
95  $qp = new ilLuceneAdvancedQueryParser($this->search_cache->getQuery());
96  $qp->parse();
97  $searcher = ilLuceneSearcher::getInstance($qp);
98  $searcher->search();
99 
100  // Load saved results
101  $filter = ilLuceneSearchResultFilter::getInstance($this->user->getId());
102  $filter->loadFromDb();
103 
104  // Highlight
105  if ($filter->getResultObjIds()) {
106  $searcher->highlight($filter->getResultObjIds());
107  }
108 
109  $this->tpl->addBlockFile('ADM_CONTENT', 'adm_content', 'tpl.lucene_adv_search.html', 'Services/Search');
110  $presentation = new ilSearchResultPresentation($this);
111  $presentation->setResults($filter->getResultIds());
112  $presentation->setSearcher($searcher);
113 
114 
115  // TODO: other handling required
116  $this->addPager($filter, 'max_page');
117  $presentation->setPreviousNext($this->prev_link, $this->next_link);
118 
119  if ($presentation->render()) {
120  $this->tpl->setVariable('SEARCH_RESULTS', $presentation->getHTML());
121  } elseif (strlen(trim($qp->getQuery()))) {
122  $this->tpl->setOnScreenMessage('info', $this->lng->txt('search_no_match'));
123  }
124 
125  // and finally add search form
126  $this->initFormSearch();
127  $this->tpl->setVariable('SEARCH_TABLE', $this->form->getHTML());
128 
129  if ($filter->getResultIds()) {
130  $this->fillAdminPanel();
131  }
132  }
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
static getInstance(ilLuceneQueryParser $qp)
Get singleton instance.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
form( $class_path, string $cmd)
addPager($result, string $a_session_key)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Field Documentation

◆ $admin_panel_commands

array ilLuceneAdvancedSearchGUI::$admin_panel_commands
protected

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

◆ $admin_view_button

array ilLuceneAdvancedSearchGUI::$admin_view_button
protected

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

◆ $creation_selector

array ilLuceneAdvancedSearchGUI::$creation_selector
protected

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

◆ $fields

ilLuceneAdvancedSearchFields ilLuceneAdvancedSearchGUI::$fields
protected

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

◆ $help

ilHelpGUI ilLuceneAdvancedSearchGUI::$help
protected

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

◆ $page_form_action

string ilLuceneAdvancedSearchGUI::$page_form_action
protected

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

◆ $tabs_gui

ilTabsGUI ilLuceneAdvancedSearchGUI::$tabs_gui
protected

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


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