3 declare(strict_types=1);
54 $this->tabs_gui = $DIC->tabs();
55 $this->help_gui = $DIC->help();
56 $this->
lng->loadLanguageModule(
"search");
58 $post_search = (array) ($this->
http->request()->getParsedBody()[
'search'] ?? []);
59 $post_filter_type = (array) ($this->
http->request()->getParsedBody()[
'filter_type'] ?? []);
60 $post_cmd = (array) ($this->
http->request()->getParsedBody()[
'cmd'] ?? []);
61 $new_search = (bool) ($post_cmd[
'performSearch'] ??
false);
68 $this->
form->checkInput();
72 foreach ($enabled_types as $type => $pval) {
73 if (isset($post_filter_type[$type]) && $post_filter_type[$type] == 1) {
74 $post_search[
"details"][
$type] = $post_filter_type[
$type];
78 $post_term = $this->
http->wrapper()->post()->retrieve(
81 $this->refinery->kindlyTo()->string(),
85 $post_combination = $this->
http->wrapper()->post()->retrieve(
88 $this->refinery->kindlyTo()->string(),
92 $post_type = $this->
http->wrapper()->post()->retrieve(
95 $this->refinery->kindlyTo()->int(),
99 $post_area = $this->
http->wrapper()->post()->retrieve(
102 $this->refinery->kindlyTo()->int(),
111 $post_search[
"string"] = $post_term;
112 $post_search[
"combination"] = $post_combination;
113 $post_search[
"type"] = $post_type;
125 $this->
setString((
string) ($post_search[
'string'] ?? ($session_search[
'string'] ??
'')));
128 ($post_search[
'details'] ?? []) :
129 ($session_search[
'details'] ?? [])
146 $next_class = $this->
ctrl->getNextClass($this);
147 $cmd = $this->
ctrl->getCmd();
149 switch ($next_class) {
150 case "ilpropertyformgui":
154 $this->
ctrl->setReturn($this,
'storeRoot');
158 case 'ilobjectcopygui':
160 $this->
ctrl->setReturn($this,
'');
162 $this->
ctrl->forwardCommand($cp);
167 $cmd =
"showSavedResults";
182 $session_search[
'type'] = $this->type = $a_type;
197 $session_search[
'combination'] = $this->combination = $a_combination;
211 $session_search[
'string'] = $this->
string = $a_str;
225 $session_search[
'details'] = $this->details = $a_details;
230 return $this->details ?? [];
248 if ($this->
http->wrapper()->post()->has(
'root_id')) {
249 $root_id = $this->
http->wrapper()->post()->retrieve(
255 if ($this->
http->wrapper()->post()->has(
'queryString')) {
256 $queryString = $this->
http->wrapper()->post()->retrieve(
258 $this->
refinery->kindlyTo()->string()
274 $this->search_cache->setRoot($this->root_node);
275 $this->search_cache->save();
276 $this->search_cache->deleteCachedEntries();
287 if ($this->
http->wrapper()->post()->has(
'term')) {
288 $query = $this->
http->wrapper()->post()->retrieve(
290 $this->
refinery->kindlyTo()->string()
292 } elseif ($this->
http->wrapper()->query()->has(
'term')) {
293 $query = $this->
http->wrapper()->query()->retrieve(
295 $this->
refinery->kindlyTo()->string()
299 if ($this->
http->wrapper()->post()->has(
'search_type')) {
300 $search_type = $this->
http->wrapper()->post()->retrieve(
304 } elseif ($this->
http->wrapper()->query()->has(
'search_type')) {
305 $search_type = $this->
http->wrapper()->query()->retrieve(
310 if ((
int) $search_type === -1) {
311 $a_fields = array(
'login',
'firstname',
'lastname',
'email');
312 $result_field =
'login';
318 $auto->setMoreLinkAvailable(
true);
319 $auto->setSearchFields($a_fields);
320 $auto->setResultField($result_field);
321 $auto->enableFieldSearchableCheck(
true);
322 $auto->setUserLimitations(
true);
325 $res_obj = json_decode(
$res);
326 if (is_array($res_obj->items)) {
327 echo json_encode($res_obj->items);
339 ilOverlayGUI::initJavascript();
340 $this->tpl->addJavascript(
"./Services/Search/js/Search.js");
343 $this->tpl->addBlockFile(
'ADM_CONTENT',
'adm_content',
'tpl.search.html',
'Services/Search');
344 $this->tpl->setVariable(
"FORM_ACTION", $this->
ctrl->getFormAction($this,
'performSearch'));
346 $this->tpl->setVariable(
"SEARCH_LABEL", $this->
lng->txt(
"search"));
348 $btn->setCommand(
"performSearch");
349 $btn->setCaption(
"search");
350 $this->tpl->setVariable(
"SUBMIT_BTN", $btn->render());
351 $this->tpl->setVariable(
"TXT_OPTIONS", $this->
lng->txt(
"options"));
353 $this->tpl->setVariable(
"TXT_COMBINATION", $this->
lng->txt(
"search_term_combination"));
357 $this->tpl->setCurrentBlock(
"type_sel");
358 $this->tpl->setVariable(
'TXT_TYPE_DEFAULT', $this->
lng->txt(
"search_fast_info"));
359 $this->tpl->setVariable(
"TXT_TYPE", $this->
lng->txt(
"search_type"));
362 $this->tpl->setVariable(
"FORM", $this->
form->getHTML());
363 $this->tpl->parseCurrentBlock();
368 $this->tpl->setVariable(
'TXT_FILTER_BY_CDATE', $this->
lng->txt(
'search_filter_cd'));
369 $this->tpl->setVariable(
'TXT_CD_OFF', $this->
lng->txt(
'search_off'));
376 $this->tpl->setVariable(
"TXT_AREA", $this->
lng->txt(
"search_area"));
379 $this->tpl->setVariable(
'SEARCH_AREA_FORM', $this->
getSearchAreaForm()->getHTML());
394 if (count($result_obj->getResults())) {
395 $this->
addPager($result_obj,
'max_page');
398 $presentation->setResults($result_obj->getResultsForPresentation());
399 $presentation->setSubitemIds($result_obj->getSubitemIds());
400 $presentation->setPreviousNext($this->prev_link, $this->next_link);
401 #$presentation->setSearcher($searcher); 403 if ($presentation->render()) {
405 $this->tpl->setVariable(
'RESULTS_TABLE', $presentation->getHTML());
416 if (!$page_number and $this->search_mode !=
'in_results') {
418 $this->search_cache->deleteCachedEntries();
421 $this->search_cache->setResultPageNumber($page_number);
424 $this->tpl->setOnScreenMessage(
'info', $this->
lng->txt(
'search_choose_object_type'));
431 $this->tpl->setOnScreenMessage(
'info', $query_parser);
440 $result_meta = $this->
__searchMeta($query_parser,
'keyword');
441 $result->mergeEntries($result_meta);
443 $result_meta = $this->
__searchMeta($query_parser,
'contribute');
444 $result->mergeEntries($result_meta);
446 $result_meta = $this->
__searchMeta($query_parser,
'title');
447 $result->mergeEntries($result_meta);
449 $result_meta = $this->
__searchMeta($query_parser,
'description');
450 $result->mergeEntries($result_meta);
457 if ($this->search_mode ==
'in_results') {
459 $old_result_obj->
read();
461 $result->diffEntriesFromResult();
475 if (!count($result->getResults())) {
476 $this->tpl->setOnScreenMessage(
'info', $this->
lng->txt(
'search_no_match'));
479 if ($result->isLimitReached()) {
480 #$message = sprintf($this->lng->txt('search_limit_reached'),$this->settings->getMaxHits()); 481 #ilUtil::sendInfo($message); 485 $this->
addPager($result,
'max_page');
488 $presentation->setResults($result->getResultsForPresentation());
489 $presentation->setSubitemIds($result->getSubitemIds());
490 $presentation->setPreviousNext($this->prev_link, $this->next_link);
492 if ($presentation->render()) {
493 $this->tpl->setVariable(
'RESULTS_TABLE', $presentation->getHTML());
502 parent::prepareOutput();
504 $this->help_gui->setScreenIdComponent(
"src");
506 $this->tabs_gui->addTab(
508 $this->
lng->txt(
"search"),
509 $this->
ctrl->getLinkTarget($this)
512 if (!$this->
settings->getHideAdvancedSearch()) {
513 $this->tabs_gui->addTab(
515 $this->
lng->txt(
"search_advanced"),
516 $this->
ctrl->getLinkTargetByClass(
'iladvancedsearchgui')
520 $this->tabs_gui->activateTab(
"search");
533 $crs_search->setFilter(array(
'crs'));
539 $grp_search->setFilter(array(
'grp'));
546 $result->
mergeEntries($content_search->performSearch());
558 $gdf_search->setFilter(array(
'gdf'));
562 $result->
mergeEntries($gdf_term_search->performSearch());
590 $result->
mergeEntries($mob_search->performKeywordSearch());
618 $query_parser->parse();
620 if (!$query_parser->validate()) {
621 return $query_parser->getMessage();
623 return $query_parser;
635 return $obj_search->performSearch();
643 if (is_null($date) || is_null($operator)) {
655 if (!($options[
'enabled'] ??
false)) {
664 if (!($options[
'enabled'] ??
false)) {
668 switch ($options[
'ontype'] ?? 0) {
697 $meta_search->setMode(
'keyword');
701 $meta_search->setMode(
'contribute');
705 $meta_search->setMode(
'title');
709 $meta_search->setMode(
'description');
712 return $meta_search->performSearch();
setCreationDateFilterOperator(int $a_operator)
static get(string $a_var)
setString(string $a_str)
Set/get search string public.
parseOperatorFromCreationFilter()
read(int $a_type=ilUserSearchCache::DEFAULT_SEARCH)
read search results
__searchMeta(ilQueryParser $query_parser, string $a_type)
Search in object meta data (keyword)
static _getLMContentSearchInstance(ilQueryParser $query_parser)
static _getMediaPoolSearchInstance(ilQueryParser $query_parser)
setCombination(string $a_combination)
Set/get combination of search ('and' or 'or') public.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
__searchObjects(ilQueryParser $query_parser)
Search in obect title,desctiption.
static get(string $a_glyph, string $a_text="")
performSearch()
Perform search.
static getList(string $a_str)
GUI class for the workflow of copying objects.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
static _getMediacastSearchInstance(ilQueryParser $query_parser)
static stripSlashes(string $a_str, bool $a_strip_html=true, string $a_allow="")
const CDATE_OPERATOR_BEFORE
static _getWikiContentSearchInstance(ilQueryParser $query_parser)
__performDetailsSearch(ilQueryParser $query_parser, ilSearchResult $result)
handleCommand(string $a_cmd)
setRootNode(int $a_node_id)
setType(int $a_type)
Set/get type of search (detail or 'fast' search) public.
static _getExerciseSearchInstance(ilQueryParser $query_parser)
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...
const CDATE_OPERATOR_AFTER
static _getGlossaryDefinitionSearchInstance(ilQueryParser $query_parser)
static http()
Fetches the global http state from ILIAS.
__parseQueryString()
parse query string, using query parser instance
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
static _getForumSearchInstance(ilQueryParser $query_parser)
setCreationDateFilterDate(ilDate $day)
parseDateFromCreationFilter()
static _getObjectSearchInstance(ilQueryParser $query_parser)
parseCreationFilter(ilObjectSearch $search)
form( $class_path, string $cmd)
__construct()
Constructor public.
static _getTestSearchInstance(ilQueryParser $query_parser)
mergeEntries(ilSearchResult $result_obj)
merge entries of this instance and another result object
storeRoot()
Store new root node.
addPager($result, string $a_session_key)
initStandardSearchForm(int $a_mode)
__construct(Container $dic, ilPlugin $plugin)
__getFilter()
Get object type for filter (If detail search is enabled)
executeCommand()
Control public.
static _getMetaDataSearchInstance(ilQueryParser $query_parser)
initPageNumberFromQuery()
const SEARCH_FORM_STANDARD
static clear(string $a_var)
static set(string $a_var, $a_val)
Set a value.
setDetails(array $a_details)
Set/get details (object types for details search) public.
autoComplete()
Data resource for autoComplete.