ILIAS  trunk Revision v11.0_alpha-1749-g1a06bdef097
All Data Structures Namespaces Files Functions Variables Enumerations Enumerator Modules Pages
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 ()
 
 prepareOutput ()
 
 initStandardSearchForm (int $a_mode)
 
 handleCommand (string $a_cmd)
 
 addToDeskObject ()
 
 removeFromDeskObject ()
 
 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)
 
 getSearchCache ()
 
 loadCreationFilter ()
 
 renderSearch (string $term, int $root_node=0)
 
 renderFilter (int $root_node)
 
 initFilter (int $mode)
 
 getStringArrayTransformation ()
 

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
 
ilSearchFilterGUI $search_filter = null
 
array $search_filter_data = 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

Constructor & Destructor Documentation

◆ __construct()

ilLuceneAdvancedSearchGUI::__construct ( )

Constructor.

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

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

51  {
52  global $DIC;
53 
54  $this->tabs_gui = $DIC->tabs();
55  $this->help = $DIC['ilHelp'];
57 
59  $this->initUserSearchCache();
60  }
global $DIC
Definition: shib_login.php:22
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 65 of file class.ilLuceneAdvancedSearchGUI.php.

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

65  : void
66  {
67  $next_class = $this->ctrl->getNextClass($this);
68  $cmd = $this->ctrl->getCmd();
69 
70  $this->prepareOutput();
71  switch ($next_class) {
72  case 'ilobjectcopygui':
73  $this->ctrl->setReturn($this);
74  $cp = new ilObjectCopyGUI($this);
75  $this->ctrl->forwardCommand($cp);
76  break;
77 
78 
79  default:
80  if (!$cmd) {
81  $cmd = "showSavedResults";
82  }
83  $this->handleCommand($cmd);
84  break;
85  }
86  }
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 316 of file class.ilLuceneAdvancedSearchGUI.php.

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

Referenced by performSearch(), and showSavedResults().

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

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

Referenced by prepareOutput().

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

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

Referenced by performSearch(), and showSavedResults().

136  : void
137  {
138  $this->form = new ilPropertyFormGUI();
139  $this->form->setFormAction($this->ctrl->getFormAction($this, 'search'));
140  $this->form->setTitle($this->lng->txt('search_advanced'));
141  $this->form->addCommandButton('search', $this->lng->txt('search'));
142  $this->form->addCommandButton('reset', $this->lng->txt('reset'));
143 
144  foreach ($this->fields->getActiveSections() as $definition) {
145  if ($definition['name'] != 'default') {
146  $section = new ilFormSectionHeaderGUI();
147  $section->setTitle($definition['name']);
148  $this->form->addItem($section);
149  }
150 
151  foreach ($definition['fields'] as $field_name) {
152  if (is_object($element = $this->fields->getFormElement($this->search_cache->getQuery(), $field_name, $this->form))) {
153  $this->form->addItem($element);
154  }
155  }
156  }
157  }
ilPropertyFormGUI $form
form( $class_path, string $cmd, string $submit_caption="")
+ 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 300 of file class.ilLuceneAdvancedSearchGUI.php.

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

Referenced by __construct().

300  : void
301  {
302  $this->search_cache = ilUserSearchCache::_getInstance($this->user->getId());
303  $this->search_cache->switchSearchType(ilUserSearchCache::LUCENE_ADVANCED);
304  $page_number = $this->initPageNumberFromQuery();
305  if ($page_number) {
306  $this->search_cache->setResultPageNumber($page_number);
307  }
308  if ($this->http->wrapper()->post()->has('query')) {
309  $this->search_cache->setQuery($this->http->request()->getParsedBody()['query'] ?? []);
310  }
311  }
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 214 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().

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

References getTabs().

Referenced by executeCommand().

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

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

162  : void
163  {
164  $root_id = 0;
165  if ($this->http->wrapper()->post()->has('root_id')) {
166  $root_id = $this->http->wrapper()->post()->retrieve(
167  'root_id',
168  $this->refinery->kindlyTo()->int()
169  );
170  }
171  $queryString = '';
172  if ($this->http->wrapper()->post()->has('queryString')) {
173  $queryString = $this->http->wrapper()->post()->retrieve(
174  'queryString',
175  $this->refinery->kindlyTo()->string()
176  );
177  }
178  $this->search_cache->setRoot($root_id);
179  $this->search_cache->setQuery(['lom_content' => $queryString]);
180  $this->search_cache->save();
181  $this->search();
182  }
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 204 of file class.ilLuceneAdvancedSearchGUI.php.

References showSavedResults().

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

◆ search()

ilLuceneAdvancedSearchGUI::search ( )
protected

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

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

Referenced by remoteSearch().

184  : void
185  {
186  if (!is_array($this->search_cache->getQuery())) {
187  // TOD: handle empty advances search
188  $this->tpl->setOnScreenMessage('info', $this->lng->txt('msg_no_search_string'));
189  $this->showSavedResults();
190  return;
191  }
192  ilSession::clear('max_page');
193  $this->search_cache->deleteCachedEntries();
194 
195  // Reset details
197 
198  $this->performSearch();
199  }
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 92 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().

92  : void
93  {
94  $qp = new ilLuceneAdvancedQueryParser($this->search_cache->getQuery());
95  $qp->parse();
96  $searcher = ilLuceneSearcher::getInstance($qp);
97  $searcher->search();
98 
99  // Load saved results
100  $filter = ilLuceneSearchResultFilter::getInstance($this->user->getId());
101  $filter->loadFromDb();
102 
103  // Highlight
104  if ($filter->getResultObjIds()) {
105  $searcher->highlight($filter->getResultObjIds());
106  }
107 
108  $this->tpl->addBlockFile('ADM_CONTENT', 'adm_content', 'tpl.lucene_adv_search.html', 'components/ILIAS/Search');
109  $presentation = new ilSearchResultPresentation($this);
110  $presentation->setResults($filter->getResultIds());
111  $presentation->setSearcher($searcher);
112 
113 
114  // TODO: other handling required
115  $this->addPager($filter, 'max_page');
116  $presentation->setPreviousNext($this->prev_link, $this->next_link);
117 
118  if ($presentation->render()) {
119  $this->tpl->setVariable('SEARCH_RESULTS', $presentation->getHTML());
120  } elseif (strlen(trim($qp->getQuery()))) {
121  $this->tpl->setOnScreenMessage('info', $this->lng->txt('search_no_match'));
122  }
123 
124  // and finally add search form
125  $this->initFormSearch();
126  $this->tpl->setVariable('SEARCH_TABLE', $this->form->getHTML());
127 
128  if ($filter->getResultIds()) {
129  $this->fillAdminPanel();
130  }
131  }
static getInstance(ilLuceneQueryParser $qp)
Get singleton instance.
Presentation of search results using object list gui.
form( $class_path, string $cmd, string $submit_caption="")
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 41 of file class.ilLuceneAdvancedSearchGUI.php.

◆ $admin_view_button

array ilLuceneAdvancedSearchGUI::$admin_view_button
protected

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

◆ $creation_selector

array ilLuceneAdvancedSearchGUI::$creation_selector
protected

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

◆ $fields

ilLuceneAdvancedSearchFields ilLuceneAdvancedSearchGUI::$fields
protected

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

◆ $help

ilHelpGUI ilLuceneAdvancedSearchGUI::$help
protected

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

◆ $page_form_action

string ilLuceneAdvancedSearchGUI::$page_form_action
protected

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

◆ $tabs_gui

ilTabsGUI ilLuceneAdvancedSearchGUI::$tabs_gui
protected

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


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