19 declare(strict_types=1);
    59         $this->tabs_gui = $DIC->tabs();
    60         $this->help_gui = $DIC->help();
    65         $this->
lng->loadLanguageModule(
'meta');
    79         $next_class = $this->
ctrl->getNextClass($this);
    80         $cmd = $this->
ctrl->getCmd();
    82         switch ($next_class) {
    83             case "ilpropertyformgui":
    86             case 'ilobjectcopygui':
    88                 $this->
ctrl->setReturn($this, 
'');
    91                 $this->
ctrl->forwardCommand($cp);
    98                     switch ($last_sub_section) {
    99                         case self::TYPE_ADV_MD:
   100                             $cmd = 
"showSavedAdvMDResults";
   104                             $cmd = 
"showSavedResults";
   117         $this->options = array();
   118         $this->search_cache->setQuery(array());
   119         $this->search_cache->save();
   126         $this->search_mode = 
'in_results';
   127         $this->search_cache->setResultPageNumber(1);
   137         if ($this->
http->wrapper()->post()->has(
'root_id')) {
   138             $root_id = $this->
http->wrapper()->post()->retrieve(
   144         if ($this->
http->wrapper()->post()->has(
'queryString')) {
   145             $queryString = $this->
http->wrapper()->post()->retrieve(
   147                 $this->
refinery->kindlyTo()->string()
   150         $this->search_cache->setRoot($root_id);
   151         $this->search_cache->setResultPageNumber(1);
   152         $this->search_cache->setQuery(array(
'lom_content' => $queryString));
   153         $this->search_cache->save();
   155         $this->options = $this->search_cache->getQuery();
   156         $this->options[
'type'] = 
'all';
   168         if (!$page_number and $this->search_mode != 
'in_results') {
   170             $this->search_cache->deleteCachedEntries();
   173         if ($this->
http->wrapper()->post()->has(
'query')) {
   174             $this->search_cache->setQuery(
   224         if ($this->search_mode == 
'in_results') {
   228             $res->diffEntriesFromResult();
   235         if (!count(
$res->getResults())) {
   236             $this->tpl->setOnScreenMessage(
'info', $this->
lng->txt(
'search_no_match'));
   239         if (
$res->isLimitReached()) {
   240             #$message = sprintf($this->lng->txt('search_limit_reached'),$this->settings->getMaxHits());   241             #ilUtil::sendInfo($message);   247         $presentation->setResults(
$res->getResultsForPresentation());
   248         $presentation->setPreviousNext($this->prev_link, $this->next_link);
   250         if ($presentation->render()) {
   251             $this->tpl->setVariable(
'RESULTS', $presentation->getHTML());
   259         if (is_object($this->
form)) {
   263         $this->
form->setFormAction($this->
ctrl->getFormAction($this, 
'performAdvMDSearch'));
   264         $this->
form->setTitle($this->
lng->txt(
'adv_md_search_title'));
   265         $this->
form->addCommandButton(
'performAdvMDSearch', $this->
lng->txt(
'search'));
   266         #$this->form->setSubformMode('right');   269             $this->
lng->txt(
'meta_keyword') . 
'/' .
   270             $this->
lng->txt(
'meta_description'), 
'title');
   271         $content->setValue($this->options[
'title']);
   272         $content->setSize(30);
   273         $content->setMaxLength(255);
   276         $group->setValue($this->options[
'title_ao']);
   278         $group->addOption($radio_option);
   279         $radio_option = 
new ilRadioOption($this->
lng->txt(
"search_all_words"), 
'1');
   280         $group->addOption($radio_option);
   282         $this->
form->addItem($content);
   285         $options[
'adv_all'] = $this->
lng->txt(
'search_any');
   287             $options[$obj_type] = $this->
lng->txt(
'objs_' . $obj_type);
   289         $type->setOptions($options);
   290         $type->setValue($this->options[
'type']);
   291         $this->
form->addItem($type);
   294         $record_gui->setPropertyForm($this->
form);
   295         $record_gui->setSearchValues($this->options);
   296         $record_gui->parse();
   305         if (!$page_number and $this->search_mode != 
'in_results') {
   307             $this->search_cache->delete();
   314         if ($this->search_mode == 
'in_results') {
   318             $res->diffEntriesFromResult();
   324         if (!count(
$res->getResults())) {
   325             $this->tpl->setOnScreenMessage(
'info', $this->
lng->txt(
'search_no_match'));
   328         if (
$res->isLimitReached()) {
   329             #$message = sprintf($this->lng->txt('search_limit_reached'),$this->settings->getMaxHits());   330             #ilUtil::sendInfo($message);   336         $presentation->setResults(
$res->getResultsForPresentation());
   337         $presentation->setPreviousNext($this->prev_link, $this->next_link);
   339         if ($presentation->render()) {
   340             $this->tpl->setVariable(
'RESULTS', $presentation->getHTML());
   349         if ($session_options !== null) {
   350             $this->options = $session_options;
   353         $this->tabs_gui->setSubTabActive(
'search_adv_md');
   355         $this->tpl->addBlockFile(
'ADM_CONTENT', 
'adm_content', 
'tpl.advanced_adv_search.html', 
'components/ILIAS/Search');
   358         $this->tpl->setVariable(
'SEARCH_FORM', $this->
form->getHTML());
   366         $this->
form->setFormAction($this->
ctrl->getFormAction($this, 
'performSearch'));
   367         $this->
form->setTitle($this->
lng->txt(
'search_advanced'));
   368         $this->
form->addCommandButton(
'performSearch', $this->
lng->txt(
'search'));
   369         $this->
form->addCommandButton(
'reset', $this->
lng->txt(
'reset'));
   370         foreach ($this->fields->getActiveSections() as $definition) {
   371             if ($definition[
'name'] != 
'default') {
   373                 $section->setTitle($definition[
'name']);
   374                 $this->
form->addItem($section);
   377             foreach ($definition[
'fields'] as $field_name) {
   378                 if (is_object($element = $this->fields->getFormElement($this->search_cache->getQuery(), $field_name, 
$this->form))) {
   379                     $this->
form->addItem($element);
   391         $this->tabs_gui->setSubTabActive(
'search_lom');
   393         $this->tpl->addBlockFile(
'ADM_CONTENT', 
'adm_content', 
'tpl.advanced_search.html', 
'components/ILIAS/Search');
   396         $this->tpl->setVariable(
'SEARCH_FORM', $this->
form->getHTML());
   402         parent::prepareOutput();
   404         $this->help_gui->setScreenIdComponent(
"src");
   406         $this->tabs_gui->addTab(
   408             $this->
lng->txt(
"search"),
   409             $this->
ctrl->getLinkTargetByClass(
'ilsearchgui')
   411         $this->tabs_gui->addTab(
   413             $this->
lng->txt(
"search_advanced"),
   414             $this->
ctrl->getLinkTarget($this)
   416         $this->tabs_gui->activateTab(
"adv_search");
   429         if (count($result_obj->getResults())) {
   430             $this->
addPager($result_obj, 
'adv_max_page');
   433             $presentation->setResults($result_obj->getResultsForPresentation());
   434             $presentation->setPreviousNext($this->prev_link, $this->next_link);
   436             if ($presentation->render()) {
   437                 $this->tpl->setVariable(
'RESULTS', $presentation->getHTML());
   454         if (count($result_obj->getResults())) {
   455             $this->
addPager($result_obj, 
'adv_max_page');
   458             $presentation->setResults($result_obj->getResultsForPresentation());
   459             $presentation->setPreviousNext($this->prev_link, $this->next_link);
   461             if ($presentation->render()) {
   462                 $this->tpl->setVariable(
'RESULTS', $presentation->getHTML());
   471         if (!($this->options[
'lom_content'] ?? null)) {
   478         #$query_parser->setCombination($this->options['content_ao']);   480         $query_parser->parse();
   482         if (!isset($this->options[
'type'])) {
   484                 $res->mergeEntries($tit_res);
   490         if ($this->options[
'type'] == 
'all' or $this->options[
'type'] == 
'lms') {
   493             $res_cont = $lm_search->performSearch();
   494             $res->mergeEntries($res_cont);
   496         if ($this->options[
'type'] == 
'all' or $this->options[
'type'] == 
'tst') {
   498             $res_tes = $tst_search->performSearch();
   499             $res->mergeEntries($res_tes);
   501         if ($this->options[
'type'] == 
'all' or $this->options[
'type'] == 
'mep') {
   503             $res_med = $med_search->performSearch();
   504             $res->mergeEntries($res_med);
   506         if ($this->options[
'type'] == 
'all' or $this->options[
'type'] == 
'glo') {
   508             $res_glo = $glo_search->performSearch();
   509             $res->mergeEntries($res_glo);
   511         if ($this->options[
'type'] == 
'all' or $this->options[
'type'] == 
'webr') {
   513             $res_web = $web_search->performSearch();
   514             $res->mergeEntries($res_web);
   517             $res->mergeEntries($tit_res);
   526         if (!($this->options[
'lom_content'] ?? null)) {
   532         #$query_parser->setCombination($this->options['title_ao']);   534         $query_parser->parse();
   537         $meta_search->setFilter($this->
filter);
   538         $meta_search->setMode(
'title_description');
   539         $meta_search->setOptions($this->options);
   540         $res_tit = $meta_search->performSearch();
   542         $meta_search->setMode(
'keyword_all');
   543         $res_key = $meta_search->performSearch();
   546         $res_tit->mergeEntries($res_key);
   557             !($this->options[
'lom_coverage'] ?? null) and
   558             !($this->options[
'lom_structure'] ?? null)
   564         if (($this->options[
'lom_coverage'] ?? null)) {
   566             #$query_parser->setCombination($this->options['coverage_ao']);   568             $query_parser->parse();
   573         $meta_search->setFilter($this->
filter);
   574         $meta_search->setMode(
'general');
   575         $meta_search->setOptions($this->options);
   576         $res = $meta_search->performSearch();
   585             !($this->options[
'lom_status'] ?? null) and
   586             !($this->options[
'lom_version'] ?? null)
   592         #$query_parser->setCombination($this->options['version_ao']);   594         $query_parser->parse();
   597         $meta_search->setFilter($this->
filter);
   598         $meta_search->setMode(
'lifecycle');
   599         $meta_search->setOptions($this->options);
   600         $res = $meta_search->performSearch();
   606         if (!($this->options[
'lom_language'] ?? null)) {
   612         $meta_search->setFilter($this->
filter);
   613         $meta_search->setMode(
'language');
   614         $meta_search->setOptions($this->options);
   615         $res = $meta_search->performSearch();
   621         if (!strlen($this->options[
'lom_role'] ?? 
'')) {
   627         $meta_search->setFilter($this->
filter);
   628         $meta_search->setMode(
'contribute');
   629         $meta_search->setOptions($this->options);
   630         $res = $meta_search->performSearch();
   637         if (!($this->options[
'lom_role_entry'] ?? null)) {
   643         #$query_parser->setCombination($this->options['entity_ao']);   645         $query_parser->parse();
   648         $meta_search->setFilter($this->
filter);
   649         $meta_search->setMode(
'entity');
   650         $meta_search->setOptions($this->options);
   651         $res = $meta_search->performSearch();
   660         $meta_search->setFilter($this->
filter);
   661         $meta_search->setMode(
'requirement');
   662         $meta_search->setOptions($this->options);
   663         $res = $meta_search->performSearch();
   670         $meta_search->setFilter($this->
filter);
   671         $meta_search->setMode(
'format');
   672         $meta_search->setOptions($this->options);
   673         $res = $meta_search->performSearch();
   680         $meta_search->setFilter($this->
filter);
   681         $meta_search->setMode(
'educational');
   682         $meta_search->setOptions($this->options);
   683         $res = $meta_search->performSearch();
   690         $meta_search->setFilter($this->
filter);
   691         $meta_search->setMode(
'typical_age_range');
   692         $meta_search->setOptions($this->options);
   693         $res = $meta_search->performSearch();
   700             !($this->options[
'lom_copyright'] ?? null) and
   701             !($this->options[
'lom_costs'] ?? null)
   708         $meta_search->setFilter($this->
filter);
   709         $meta_search->setMode(
'rights');
   710         $meta_search->setOptions($this->options);
   711         $res = $meta_search->performSearch();
   719         if (!($this->options[
'lom_purpose'] ?? null)) {
   725         $meta_search->setFilter($this->
filter);
   726         $meta_search->setMode(
'classification');
   727         $meta_search->setOptions($this->options);
   728         $res = $meta_search->performSearch();
   736         if (!($this->options[
'lom_taxon'] ?? null)) {
   742         $query_parser->parse();
   745         $meta_search->setFilter($this->
filter);
   746         $meta_search->setMode(
'taxon');
   747         $meta_search->setOptions($this->options);
   748         $res = $meta_search->performSearch();
   757         foreach (array_keys($this->options) as $key) {
   758             if (substr((
string) $key, 0, 3) != 
'adv') {
   767             $field_id = substr($key, 4);
   770             $field_form = 
ilADTFactory::getInstance()->getSearchBridgeForDefinitionInstance($field->getADTDefinition(), 
true, 
false);
   771             $field_form->setElementId(
"query[" . $key . 
"]");
   772             $field_form->setForm($this->
form);
   775             $field_form->importFromPost($this->options);
   776             $field_form->validate();
   778             $parser_value = $field->getSearchQueryParserValue($field_form);
   779             if (!strlen($parser_value)) {
   783             $adv_md_search->setFilter($this->
filter);
   784             $adv_md_search->setDefinition($field);
   785             $adv_md_search->setSearchElement($field_form);
   786             $res_field = $adv_md_search->performSearch();
   794         if (!($this->options[
'lom_keyword'] ?? null)) {
   800         $query_parser->parse();
   803         $meta_search->setFilter($this->
filter);
   804         $meta_search->setMode(
'keyword');
   805         $meta_search->setOptions($this->options);
   806         $res = $meta_search->performSearch();
   814         $post_cmd = (array) ($this->
http->request()->getParsedBody()[
'cmd'] ?? []);
   816         if (isset($post_cmd[
'performSearch'])) {
   817             $this->options = $query;
   819         } elseif (isset($post_cmd[
'performAdvMDSearch'])) {
   820             $this->options = (array) $this->
http->request()->getParsedBody();
   827         $this->options[
'type'] = 
'all';
   828         switch ($this->options[
'type']) {
   902         $options = array(
'all' => $this->
lng->txt(
'search_any'),
   903                          'crs' => $this->
lng->txt(
'objs_crs'),
   904                          'lms' => $this->
lng->txt(
'obj_lrss'),
   905                          'glo' => $this->
lng->txt(
'objs_glo'),
   906                          'mep' => $this->
lng->txt(
'objs_mep'),
   907                          'tst' => $this->
lng->txt(
'search_tst_svy'),
   908                          'file' => $this->
lng->txt(
'objs_file'),
   909                          'webr' => $this->
lng->txt(
'objs_webr'),
   910                          'sess' => $this->
lng->txt(
'objs_sess')
   920         if (!$this->stored) {
   922             $this->stored = 
true;
   936             $this->search_cache->setResultPageNumber($page_number);
   938         $post_cmd = (array) ($this->
http->request()->getParsedBody()[
'cmd'] ?? []);
   939         $post_query = (array) ($this->
http->request()->getParsedBody()[
'query'] ?? []);
   940         if ($post_cmd[
'performSearch'] ?? null) {
   941             $this->search_cache->setQuery($post_query[
'lomContent'] ?? 
'');
   942             $this->search_cache->save();
   951         $this->tabs_gui->addSubTabTarget(
'search_lom', $this->
ctrl->getLinkTarget($this, 
'showSavedResults'));
   958         return mktime($time[
'h'], $time[
'm'], 0, $date[
'm'], $date[
'd'], $date[
'y']);
   964         if ($type == self::TYPE_LOM) {
   976         if ($this->
http->wrapper()->post()->has(
'query')) {
   977             $query = $this->
http->wrapper()->post()->retrieve(
   979                 $this->
refinery->kindlyTo()->dictOf(
   981                         $this->refinery->kindlyTo()->string(),
   982                         $this->
refinery->kindlyTo()->dictOf(
   983                             $this->
refinery->kindlyTo()->string()
 static get(string $a_var)
 
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
 
searchAdvancedMD(ilSearchResult $res)
 
read(int $a_type=ilUserSearchCache::DEFAULT_SEARCH)
read search results 
 
static _getLMContentSearchInstance(ilQueryParser $query_parser)
 
static _getMediaPoolSearchInstance(ilQueryParser $query_parser)
 
__performRequirementSearch()
 
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
 
__performLanguageSearch()
 
GUI class for the workflow of copying objects. 
 
__performContributeSearch()
 
static stripSlashes(string $a_str, bool $a_strip_html=true, string $a_allow="")
 
static _getInstance(int $a_usr_id)
 
intersectEntries(ilSearchResult $result_obj)
Build intersection of entries (all entries that are present in both result sets) 
 
handleCommand(string $a_cmd)
 
initSearchType(int $type)
 
static getInstance(?int $a_field_id, ?int $a_type=null, string $language='')
 
toUnixTime(array $date, array $time=array())
 
static _getGlossaryDefinitionSearchInstance(ilQueryParser $query_parser)
 
static http()
Fetches the global http state from ILIAS. 
 
Presentation of search results using object list gui. 
 
static getSearchableDefinitionIds()
Get searchable definition ids (performance is key) 
 
__performLifecycleSearch()
 
__performTypicalAgeRangeSearch()
 
__storeEntries(ilSearchResult $res, ilSearchResult $new_res)
 
form( $class_path, string $cmd, string $submit_caption="")
 
static _getTestSearchInstance(ilQueryParser $query_parser)
 
static _getAdvancedSearchInstance(ilQueryParser $query_parser)
 
ilLuceneAdvancedSearchFields $fields
 
__performClassificationSearch()
 
mergeEntries(ilSearchResult $result_obj)
merge entries of this instance and another result object 
 
addPager($result, string $a_session_key)
 
__construct(Container $dic, ilPlugin $plugin)
 
static _getActivatedObjTypes()
get activated obj types 
 
filter(string $filter_id, $class_path, string $cmd, bool $activated=true, bool $expanded=true)
 
initAdvancedMetaDataForm()
 
initPageNumberFromQuery()
 
static _getAdvancedMDSearchInstance(ilQueryParser $query_parser)
 
static clear(string $a_var)
 
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
 
__performEducationalSearch()
 
static set(string $a_var, $a_val)
Set a value. 
 
static _getWebresourceSearchInstance(ilQueryParser $query_parser)