3declare(strict_types=1);
56 $this->
tabs = $DIC->tabs();
57 $this->
help = $DIC->help();
69 $next_class = $this->
ctrl->getNextClass($this);
70 $cmd = $this->
ctrl->getCmd();
72 switch ($next_class) {
73 case "ilpropertyformgui":
79 $this->
ctrl->setReturn($this,
'storeRoot');
83 case 'ilobjectcopygui':
85 $this->
ctrl->setReturn($this,
'');
87 $this->
ctrl->forwardCommand($cp);
94 $cmd =
"showSavedResults";
106 parent::prepareOutput();
124 return $this->search_cache->getItemFilter();
133 return $this->search_cache->getMimeFilter();
142 if ($this->
http->wrapper()->post()->has(
'queryString')) {
143 $queryString = $this->
http->wrapper()->post()->retrieve(
145 $this->
refinery->kindlyTo()->string()
149 if ($this->
http->wrapper()->post()->has(
'root_id')) {
150 $root_id = $this->
http->wrapper()->post()->retrieve(
156 $qp->parseAutoWildcard();
160 $this->search_cache->setRoot($root_id);
162 $this->search_cache->save();
172 if (!strlen($this->search_cache->getQuery())) {
184 $filter->loadFromDb();
187 $searcher->highlight($filter->getResultObjIds());
190 $presentation->setResults($filter->getResultIds());
191 $presentation->setSearcher($searcher);
192 $this->
addPager($filter,
'max_page');
193 $presentation->setPreviousNext($this->prev_link, $this->next_link);
197 if ($presentation->render()) {
198 $this->tpl->setVariable(
'SEARCH_RESULTS', $presentation->getHTML());
199 } elseif (strlen($this->search_cache->getQuery())) {
200 $this->tpl->setOnScreenMessage(
203 $this->
lng->txt(
'search_no_match_hint'),
217 if (!$this->
form->checkInput()) {
218 $this->search_cache->deleteCachedEntries();
225 $this->search_cache->deleteCachedEntries();
241 foreach ($this->search_cache->getItemFilter() as $obj => $value) {
242 if (!$filter_query) {
243 $filter_query .=
'+( ';
245 $filter_query .=
'OR';
247 $filter_query .= (
' ' . $filter_settings[$obj][
'filter'] .
' ');
249 $filter_query .=
') ';
255 foreach ($this->search_cache->getMimeFilter() as $mime => $value) {
257 $mime_query .=
'+( ';
261 $mime_query .= (
' ' . $filter_settings[$mime][
'filter'] .
' ');
271 $filter_query = $filter_query .
' ' . $mime_query .
' ' . $cdate_query;
274 $query = $this->search_cache->getQuery();
286 $filter->setCandidates($searcher->getResult());
289 if ($filter->getResultObjIds()) {
290 $searcher->highlight($filter->getResultObjIds());
297 $presentation->setResults($filter->getResultIds());
298 $presentation->setSearcher($searcher);
301 $this->
addPager($filter,
'max_page');
303 $presentation->setPreviousNext($this->prev_link, $this->next_link);
305 if ($presentation->render()) {
306 $this->tpl->setVariable(
'SEARCH_RESULTS', $presentation->getHTML());
308 $this->tpl->setOnScreenMessage(
311 $this->
lng->txt(
'search_no_match_hint'),
326 $this->search_cache->setRoot($this->root_node);
327 $this->search_cache->save();
328 $this->search_cache->deleteCachedEntries();
340 $this->
help->setScreenIdComponent(
"src_luc");
342 $this->
tabs->addTarget(
'search', $this->
ctrl->getLinkTarget($this));
345 $this->
tabs->addTarget(
'search_user', $this->
ctrl->getLinkTargetByClass(
'illuceneusersearchgui'));
349 $this->
tabs->addTarget(
'search_advanced', $this->
ctrl->getLinkTargetByClass(
'illuceneAdvancedSearchgui'));
352 $this->
tabs->setTabActive(
'search');
367 $item_filter_enabled =
false;
368 if ($this->
http->wrapper()->post()->has(
'item_filter_enabled')) {
369 $item_filter_enabled = $this->
http->wrapper()->post()->retrieve(
370 'item_filter_enabled',
374 $post_filter_type = (array) ($this->
http->request()->getParsedBody()[
'filter_type'] ?? []);
376 $this->search_cache->setResultPageNumber($page_number);
378 if ($this->
http->wrapper()->post()->has(
'term')) {
379 $term = $this->
http->wrapper()->post()->retrieve(
381 $this->
refinery->kindlyTo()->string()
383 $this->search_cache->setQuery($term);
384 if ($item_filter_enabled) {
387 if ($post_filter_type[
$type] ??
false) {
388 $filtered[
$type] = 1;
391 $this->search_cache->setItemFilter($filtered);
396 if ($post_filter_type[
$type] ??
false) {
400 $this->search_cache->setMimeFilter($mime);
403 if (!$item_filter_enabled) {
405 $this->search_cache->setItemFilter(array());
406 $this->search_cache->setMimeFilter(array());
408 $post_screation = (array) ($this->
http->request()->getParsedBody()[
'screation'] ?? []);
409 if (!count($post_screation)) {
410 $this->search_cache->setCreationFilter([]);
425 if ((count($this->admin_panel_commands) > 0)) {
426 foreach ($this->admin_panel_commands as $cmd) {
427 $this->tpl->setCurrentBlock(
"lucene_admin_panel_cmd");
428 $this->tpl->setVariable(
"LUCENE_PANEL_CMD", $cmd[
"cmd"]);
429 $this->tpl->setVariable(
"LUCENE_TXT_PANEL_CMD", $cmd[
"txt"]);
430 $this->tpl->parseCurrentBlock();
436 $this->tpl->setCurrentBlock(
"lucene_adm_view_components");
438 $this->tpl->setVariable(
"LUCENE_ADM_ALT_ARROW", $this->
lng->txt(
"actions"));
439 $this->tpl->parseCurrentBlock();
440 $adm_view_cmp =
true;
444 if (is_array($this->admin_view_button)) {
445 if (is_array($this->admin_view_button)) {
446 $this->tpl->setCurrentBlock(
"lucene_admin_button");
447 $this->tpl->setVariable(
448 "LUCENE_ADMIN_MODE_LINK",
449 $this->admin_view_button[
"link"]
451 $this->tpl->setVariable(
452 "LUCENE_TXT_ADMIN_MODE",
453 $this->admin_view_button[
"txt"]
455 $this->tpl->parseCurrentBlock();
457 $this->tpl->setCurrentBlock(
"lucene_admin_view");
458 $this->tpl->parseCurrentBlock();
463 if (is_array($this->creation_selector)) {
464 $this->tpl->setCurrentBlock(
"lucene_add_commands");
466 $this->tpl->setVariable(
"LUCENE_ADD_COM_WIDTH",
'width="1"');
468 $this->tpl->setVariable(
469 "LUCENE_SELECT_OBJTYPE_REPOS",
470 $this->creation_selector[
"options"]
472 $this->tpl->setVariable(
473 "LUCENE_BTN_NAME_REPOS",
474 $this->creation_selector[
"command"]
476 $this->tpl->setVariable(
477 "LUCENE_TXT_ADD_REPOS",
478 $this->creation_selector[
"txt"]
480 $this->tpl->parseCurrentBlock();
484 $this->tpl->setCurrentBlock(
"lucene_adm_panel");
486 $this->tpl->setVariable(
"LUCENE_ADM_TBL_WIDTH",
'width:"100%";');
488 $this->tpl->parseCurrentBlock();
497 $this->admin_panel_commands[] =
498 array(
"cmd" => $a_cmd,
"txt" => $a_txt);
506 $this->admin_view_button =
507 array(
"link" => $a_link,
"txt" => $a_txt);
512 $this->page_form_action = $a_action;
521 $this->tpl->addBlockFile(
'ADM_CONTENT',
'adm_content',
'tpl.lucene_search.html',
'Services/Search');
523 ilOverlayGUI::initJavascript();
524 $this->tpl->addJavascript(
"./Services/Search/js/Search.js");
527 $this->tpl->setVariable(
"FORM_ACTION", $this->
ctrl->getFormAction($this,
'performSearch'));
529 $this->tpl->setVariable(
"SEARCH_LABEL", $this->
lng->txt(
"search"));
531 $btn->setCommand(
"performSearch");
532 $btn->setCaption(
"search");
533 $this->tpl->setVariable(
"SUBMIT_BTN", $btn->render());
534 $this->tpl->setVariable(
"TXT_OPTIONS", $this->
lng->txt(
"options"));
536 $this->tpl->setVariable(
"TXT_COMBINATION", $this->
lng->txt(
"search_term_combination"));
538 $this->tpl->setVariable(
"TXT_AREA", $this->
lng->txt(
"search_area"));
541 $this->tpl->setCurrentBlock(
"type_sel");
542 $this->tpl->setVariable(
'TXT_TYPE_DEFAULT', $this->
lng->txt(
"search_off"));
544 $this->tpl->setVariable(
"TXT_FILTER_BY_TYPE", $this->
lng->txt(
"search_filter_by_type"));
545 $this->tpl->setVariable(
'FORM', $this->
form->getHTML());
546 $this->tpl->parseCurrentBlock();
550 $this->tpl->setVariable(
'SEARCH_AREA_FORM', $this->
getSearchAreaForm()->getHTML());
551 $this->tpl->setVariable(
"TXT_CHANGE", $this->
lng->txt(
"change"));
555 $this->tpl->setVariable(
'TXT_FILTER_BY_CDATE', $this->
lng->txt(
'search_filter_cd'));
556 $this->tpl->setVariable(
'TXT_CD_OFF', $this->
lng->txt(
'search_off'));
569 $options = $this->search_cache->getCreationFilter();
571 if (!($options[
'enabled'] ??
false)) {
576 switch ($options[
'ontype']) {
585 return '+(cdate:[* TO ' . $limit->get(
IL_CAL_DATE) .
']) ';
589 return '+(cdate:' . $limit->get(
IL_CAL_DATE) .
'*) ';
static get(string $a_glyph, string $a_text="")
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...
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
addAdminPanelCommand(string $a_cmd, string $a_txt)
Add a command to the admin panel.
setPageFormAction(string $a_action)
remoteSearch()
Search from main menu.
parseCreationFilter()
Parse creation date.
showSavedResults()
Show saved results.
__construct()
Constructor.
showSearchForm()
Show search form.
fillAdminPanel()
Put admin panel into template:
initUserSearchCache()
Init user search cache.
setAdminViewButton(string $a_link, string $a_txt)
Show admin view button.
array $admin_panel_commands
ilLuceneAdvancedSearchFields $fields
storeRoot()
Store new root node.
getMimeDetails()
Needed for base class search form.
getDetails()
Needed for base class search form.
executeCommand()
Execute Command.
performSearch()
Perform search.
search()
Search (button pressed)
prepareOutput()
Add admin panel command.
static getInstance(int $a_user_id)
static getInstance(ilLuceneQueryParser $qp)
Get singleton instance.
GUI class for the workflow of copying objects.
addPager($result, string $a_session_key)
initStandardSearchForm(int $a_mode)
handleCommand(string $a_cmd)
initPageNumberFromQuery()
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
static clear(string $a_var)
static resetDetails()
As long as static::resetDetails is not possible this method is final.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
static _getInstance(int $a_usr_id)
static getImagePath(string $img, string $module_path="", string $mode="output", bool $offline=false)
get image path (for images located in a template directory)
static stripSlashes(string $a_str, bool $a_strip_html=true, string $a_allow="")
static http()
Fetches the global http state from ILIAS.
__construct(Container $dic, ilPlugin $plugin)
@inheritDoc
form( $class_path, string $cmd)