3 declare(strict_types=1);
    51         $this->
lng = $DIC->language();
    52         $this->
lng->loadLanguageModule(
'meta');
    53         $this->
user = $DIC->user();
    64             return self::$instance;
    66         return self::$instance = 
new ilLuceneAdvancedSearchFields();
    77         $lng = $DIC->language();
    81         $fields[
'lom_content'] = $lng->
txt(
'content');
    84             $fields[
'general_offline'] = $lng->
txt(
'lucene_offline_filter');
    87         $fields[
'lom_language'] = $lng->
txt(
'language');
    88         $fields[
'lom_keyword'] = $lng->
txt(
'meta_keyword');
    89         $fields[
'lom_coverage'] = $lng->
txt(
'meta_coverage');
    90         $fields[
'lom_structure'] = $lng->
txt(
'meta_structure');
    91         $fields[
'lom_status'] = $lng->
txt(
'meta_status');
    92         $fields[
'lom_version'] = $lng->
txt(
'meta_version');
    93         $fields[
'lom_contribute'] = $lng->
txt(
'meta_contribute');
    94         $fields[
'lom_format'] = $lng->
txt(
'meta_format');
    95         $fields[
'lom_operating_system'] = $lng->
txt(
'meta_operating_system');
    96         $fields[
'lom_browser'] = $lng->
txt(
'meta_browser');
    97         $fields[
'lom_interactivity'] = $lng->
txt(
'meta_interactivity_type');
    98         $fields[
'lom_resource'] = $lng->
txt(
'meta_learning_resource_type');
    99         $fields[
'lom_level'] = $lng->
txt(
'meta_interactivity_level');
   100         $fields[
'lom_density'] = $lng->
txt(
'meta_semantic_density');
   101         $fields[
'lom_user_role'] = $lng->
txt(
'meta_intended_end_user_role');
   102         $fields[
'lom_context'] = $lng->
txt(
'meta_context');
   103         $fields[
'lom_difficulty'] = $lng->
txt(
'meta_difficulty');
   104         $fields[
'lom_costs'] = $lng->
txt(
'meta_cost');
   105         $fields[
'lom_copyright'] = $lng->
txt(
'meta_copyright_and_other_restrictions');
   106         $fields[
'lom_purpose'] = $lng->
txt(
'meta_purpose');
   107         $fields[
'lom_taxon'] = $lng->
txt(
'meta_taxon');
   111             if ($record->getParentObject() > 0) {
   119                 $fields[
'adv_' . $def->getFieldId()] = $field_translations->getTitleForLanguage($def->getFieldId(), $lng->
getLangKey());
   145         $a_post_name = 
'query[' . $a_field_name . 
']';
   147         if (!is_array($a_query)) {
   151         switch ($a_field_name) {
   152             case 'general_offline':
   153                 $offline_options = array(
   154                     '0' => $this->
lng->txt(
'search_any'),
   155                     self::ONLINE_QUERY => $this->
lng->txt(
'search_option_online'),
   156                     self::OFFLINE_QUERY => $this->
lng->txt(
'search_option_offline')
   158                 $offline = 
new ilSelectInputGUI($this->active_fields[$a_field_name], $a_post_name);
   159                 $offline->setOptions($offline_options);
   160                 $offline->setValue($a_query[
'general_offline'] ?? 
'');
   165                 $text->setSubmitFormOnEnter(
true);
   166                 $text->setValue($a_query[
'lom_content'] ?? 
'');
   168                 $text->setMaxLength(255);
   173                 $select = 
new ilSelectInputGUI($this->active_fields[$a_field_name], $a_post_name);
   174                 $select->setValue($a_query[
'lom_language'] ?? 
'');
   178                     array(0 => $this->
lng->txt(
'search_any')),
   185                 $text->setSubmitFormOnEnter(
true);
   186                 $text->setValue($a_query[
'lom_keyword'] ?? 
'');
   188                 $text->setMaxLength(255);
   193                 $text->setSubmitFormOnEnter(
true);
   194                 $text->setValue($a_query[
'lom_coverage'] ?? 
'');
   196                 $text->setMaxLength(255);
   199             case 'lom_structure':
   200                 $select = 
new ilSelectInputGUI($this->active_fields[$a_field_name], $a_post_name);
   201                 $select->setValue($a_query[
'lom_structure'] ?? 
'');
   205                     array(0 => $this->
lng->txt(
'search_any')),
   212                 $select = 
new ilSelectInputGUI($this->active_fields[$a_field_name], $a_post_name);
   213                 $select->setValue($a_query[
'lom_status'] ?? 
'');
   217                     array(0 => $this->
lng->txt(
'search_any')),
   224                 $text->setSubmitFormOnEnter(
true);
   225                 $text->setValue($a_query[
'lom_version'] ?? 
'');
   227                 $text->setMaxLength(255);
   230             case 'lom_contribute':
   231                 $select = 
new ilSelectInputGUI($this->active_fields[$a_field_name], 
'query[' . 
'lom_role' . 
']');
   232                 $select->setValue($a_query[
'lom_role'] ?? 
'');
   236                     array(0 => $this->
lng->txt(
'search_any')),
   241                     $text->setValue($a_query[
'lom_role_entry'] ?? 
'');
   243                 $text->setMaxLength(255);
   245                 $select->addSubItem(
$text);
   250                 $select = 
new ilSelectInputGUI($this->active_fields[$a_field_name], $a_post_name);
   251                 $select->setValue($a_query[
'lom_format'] ?? 
'');
   255                     array(0 => $this->
lng->txt(
'search_any')),
   260             case 'lom_operating_system':
   261                 $select = 
new ilSelectInputGUI($this->active_fields[$a_field_name], $a_post_name);
   262                 $select->setValue($a_query[
'lom_operating_system'] ?? 
'');
   266                     array(0 => $this->
lng->txt(
'search_any')),
   272                 $select = 
new ilSelectInputGUI($this->active_fields[$a_field_name], $a_post_name);
   273                 $select->setValue($a_query[
'lom_browser'] ?? 
'');
   277                     array(0 => $this->
lng->txt(
'search_any')),
   283             case 'lom_interactivity':
   284                 $select = 
new ilSelectInputGUI($this->active_fields[$a_field_name], $a_post_name);
   285                 $select->setValue($a_query[
'lom_interactivity'] ?? 
'');
   289                     array(0 => $this->
lng->txt(
'search_any')),
   295                 $select = 
new ilSelectInputGUI($this->active_fields[$a_field_name], $a_post_name);
   296                 $select->setValue($a_query[
'lom_resource'] ?? 
'');
   300                     array(0 => $this->
lng->txt(
'search_any')),
   308                     $this->
lng->txt(
'from'),
   310                         $a_query[
'lom_level_start'] ?? 
'',
   311                         'query[' . 
'lom_level_start' . 
']',
   312                         array(0 => $this->
lng->txt(
'search_any'))
   314                     $this->
lng->txt(
'until'),
   316                         $a_query[
'lom_level_end'] ?? 
'',
   317                         'query[' . 
'lom_level_end' . 
']',
   318                         array(0 => $this->
lng->txt(
'search_any'))
   327                     $this->
lng->txt(
'from'),
   329                         $a_query[
'lom_density_start'] ?? 
'',
   330                         'query[' . 
'lom_density_start' . 
']',
   331                         array(0 => $this->
lng->txt(
'search_any'))
   333                     $this->
lng->txt(
'until'),
   335                         $a_query[
'lom_density_end'] ?? 
'',
   336                         'query[' . 
'lom_density_end' . 
']',
   337                         array(0 => $this->
lng->txt(
'search_any'))
   344             case 'lom_user_role':
   345                 $select = 
new ilSelectInputGUI($this->active_fields[$a_field_name], $a_post_name);
   346                 $select->setValue($a_query[
'lom_user_role'] ?? 
'');
   350                     array(0 => $this->
lng->txt(
'search_any')),
   356                 $select = 
new ilSelectInputGUI($this->active_fields[$a_field_name], $a_post_name);
   357                 $select->setValue($a_query[
'lom_context'] ?? 
'');
   361                     array(0 => $this->
lng->txt(
'search_any')),
   366             case 'lom_difficulty':
   369                     $this->
lng->txt(
'from'),
   371                         $a_query[
'lom_difficulty_start'] ?? 
'',
   372                         'query[' . 
'lom_difficulty_start' . 
']',
   373                         array(0 => $this->
lng->txt(
'search_any'))
   375                     $this->
lng->txt(
'until'),
   377                         $a_query[
'lom_difficulty_end'] ?? 
'',
   378                         'query[' . 
'lom_difficulty_end' . 
']',
   379                         array(0 => $this->
lng->txt(
'search_any'))
   387                 $select = 
new ilSelectInputGUI($this->active_fields[$a_field_name], $a_post_name);
   388                 $select->setValue($a_query[
'lom_costs'] ?? 
'');
   392                     array(0 => $this->
lng->txt(
'search_any')),
   397             case 'lom_copyright':
   398                 $select = 
new ilSelectInputGUI($this->active_fields[$a_field_name], $a_post_name);
   399                 $select->setValue($a_query[
'lom_copyright'] ?? 
'');
   403                     array(0 => $this->
lng->txt(
'search_any')),
   412                 $select = 
new ilSelectInputGUI($this->active_fields[$a_field_name], $a_post_name);
   413                 $select->setValue($a_query[
'lom_purpose'] ?? 
'');
   417                     array(0 => $this->
lng->txt(
'search_any')),
   424                 $text->setSubmitFormOnEnter(
true);
   425                 $text->setValue($a_query[
'lom_taxon'] ?? 
'');
   427                 $text->setMaxLength(255);
   431                 if (substr($a_field_name, 0, 3) != 
'adv') {
   436                 $field_id = substr($a_field_name, 4);
   439                 $field_form = 
ilADTFactory::getInstance()->getSearchBridgeForDefinitionInstance($field->getADTDefinition(), 
true, 
false);
   440                 $field_form->setForm($a_form);
   441                 $field_form->setElementId($a_post_name);
   442                 $field_form->setTitle($this->active_fields[$a_field_name]);
   443                 $field_form->addToForm();
   446                 if (is_array($a_query) &&
   447                     array_key_exists($a_field_name, $a_query)) {
   448                     $field_form->importFromPost((array) $a_query);
   449                     $field_form->validate();
   469             case 'general_offline':
   472                     case self::OFFLINE_QUERY:
   482                 return 'lomLanguage:' . $a_query;
   485                 return 'lomKeyword:' . $a_query;
   488                 return 'lomCoverage:' . $a_query;
   490             case 'lom_structure':
   491                 return 'lomStructure:' . $a_query;
   495                 return 'lomStatus:' . $a_query;
   498                 return 'lomVersion:' . $a_query;
   502                 return 'lomRole:' . $a_query;
   504             case 'lom_role_entry':
   505                 return 'lomRoleEntity:' . $a_query;
   510                 return 'lomFormat:' . $a_query;
   512             case 'lom_operating_system':
   513                 return 'lomOS:' . $a_query;
   516                 return 'lomBrowser:' . $a_query;
   519             case 'lom_interactivity':
   520                 return 'lomInteractivity:' . $a_query;
   523                 return 'lomResource:' . $a_query;
   525             case 'lom_level_start':
   528                 for ($i = $a_query; $i <= count($options); $i++) {
   529                     if (strlen($q_string)) {
   532                     $q_string .= (
'lomLevel:"' . $options[$i] . 
'" ');
   536             case 'lom_level_end':
   539                 for ($i = 1; $i <= $a_query; $i++) {
   540                     if (strlen($q_string)) {
   543                     $q_string .= (
'lomLevel:"' . $options[$i] . 
'" ');
   547             case 'lom_density_start':
   550                 for ($i = $a_query; $i <= count($options); $i++) {
   551                     if (strlen($q_string)) {
   554                     $q_string .= (
'lomDensity:"' . $options[$i] . 
'" ');
   558             case 'lom_density_end':
   561                 for ($i = 1; $i <= $a_query; $i++) {
   562                     if (strlen($q_string)) {
   565                     $q_string .= (
'lomDensity:"' . $options[$i] . 
'" ');
   569             case 'lom_user_role':
   570                 return 'lomUserRole:' . $a_query;
   573                 return 'lomContext:' . $a_query;
   575             case 'lom_difficulty_start':
   578                 for ($i = $a_query; $i <= count($options); $i++) {
   579                     if (strlen($q_string)) {
   582                     $q_string .= (
'lomDifficulty:"' . $options[$i] . 
'" ');
   586             case 'lom_difficulty_end':
   589                 for ($i = 1; $i <= $a_query; $i++) {
   590                     if (strlen($q_string)) {
   593                     $q_string .= (
'lomDifficulty:"' . $options[$i] . 
'" ');
   599                 return 'lomCosts:' . $a_query;
   601             case 'lom_copyright':
   602                 return 'lomCopyright:' . $a_query;
   606                 return 'lomPurpose:' . $a_query;
   609                 return 'lomTaxon:' . $a_query;
   612                 if (substr($a_field, 0, 3) != 
'adv') {
   617                 $field_id = substr($a_field, 4);
   625                 $adv_query = $field->getLuceneSearchString($a_query);
   628                     if (!is_array($adv_query)) {
   629                         return 'advancedMetaData_' . $field_id . 
': ' . $adv_query;
   632                         foreach ($adv_query as $adv_query_item) {
   633                             $res[] = 
'advancedMetaData_' . $field_id . 
': ' . $adv_query_item;
   635                         return '(' . implode(
' OR ', 
$res) . 
')';
   648         foreach (self::getFields() as $name => $translation) {
   649             if ($this->
settings->isActive($name)) {
   650                 $this->active_fields[$name] = $translation;
   661             switch ($field_name) {
   664                     $this->active_sections[
'default'][
'fields'][] = 
'lom_content';
   665                     $this->active_sections[
'default'][
'name'] = 
'';
   668                 case 'general_offline':
   669                     $this->active_sections[
'default'][
'fields'][] = 
'general_offline';
   670                     $this->active_sections[
'default'][
'name'] = 
'';
   674                     $this->active_sections[
'default'][
'fields'][] = 
'lom_type';
   675                     $this->active_sections[
'default'][
'name'] = 
'';
   680                     $this->active_sections[
'general'][
'fields'][] = 
'lom_language';
   681                     $this->active_sections[
'general'][
'name'] = $this->
lng->txt(
'meta_general');
   684                     $this->active_sections[
'general'][
'fields'][] = 
'lom_keyword';
   685                     $this->active_sections[
'general'][
'name'] = $this->
lng->txt(
'meta_general');
   688                     $this->active_sections[
'general'][
'fields'][] = 
'lom_coverage';
   689                     $this->active_sections[
'general'][
'name'] = $this->
lng->txt(
'meta_general');
   691                 case 'lom_structure':
   692                     $this->active_sections[
'general'][
'fields'][] = 
'lom_structure';
   693                     $this->active_sections[
'general'][
'name'] = $this->
lng->txt(
'meta_general');
   698                     $this->active_sections[
'lifecycle'][
'fields'][] = 
'lom_status';
   699                     $this->active_sections[
'lifecycle'][
'name'] = $this->
lng->txt(
'meta_lifecycle');
   702                     $this->active_sections[
'lifecycle'][
'fields'][] = 
'lom_version';
   703                     $this->active_sections[
'lifecycle'][
'name'] = $this->
lng->txt(
'meta_lifecycle');
   705                 case 'lom_contribute':
   706                     $this->active_sections[
'lifecycle'][
'fields'][] = 
'lom_contribute';
   707                     $this->active_sections[
'lifecycle'][
'name'] = $this->
lng->txt(
'meta_lifecycle');
   712                     $this->active_sections[
'technical'][
'fields'][] = 
'lom_format';
   713                     $this->active_sections[
'technical'][
'name'] = $this->
lng->txt(
'meta_technical');
   715                 case 'lom_operating_system':
   716                     $this->active_sections[
'technical'][
'fields'][] = 
'lom_operating_system';
   717                     $this->active_sections[
'technical'][
'name'] = $this->
lng->txt(
'meta_technical');
   720                     $this->active_sections[
'technical'][
'fields'][] = 
'lom_browser';
   721                     $this->active_sections[
'technical'][
'name'] = $this->
lng->txt(
'meta_technical');
   725                 case 'lom_interactivity':
   726                     $this->active_sections[
'education'][
'fields'][] = 
'lom_interactivity';
   727                     $this->active_sections[
'education'][
'name'] = $this->
lng->txt(
'meta_education');
   730                     $this->active_sections[
'education'][
'fields'][] = 
'lom_resource';
   731                     $this->active_sections[
'education'][
'name'] = $this->
lng->txt(
'meta_education');
   734                     $this->active_sections[
'education'][
'fields'][] = 
'lom_level';
   735                     $this->active_sections[
'education'][
'name'] = $this->
lng->txt(
'meta_education');
   738                     $this->active_sections[
'education'][
'fields'][] = 
'lom_density';
   739                     $this->active_sections[
'education'][
'name'] = $this->
lng->txt(
'meta_education');
   741                 case 'lom_user_role':
   742                     $this->active_sections[
'education'][
'fields'][] = 
'lom_user_role';
   743                     $this->active_sections[
'education'][
'name'] = $this->
lng->txt(
'meta_education');
   746                     $this->active_sections[
'education'][
'fields'][] = 
'lom_context';
   747                     $this->active_sections[
'education'][
'name'] = $this->
lng->txt(
'meta_education');
   749                 case 'lom_difficulty':
   750                     $this->active_sections[
'education'][
'fields'][] = 
'lom_difficulty';
   751                     $this->active_sections[
'education'][
'name'] = $this->
lng->txt(
'meta_education');
   756                     $this->active_sections[
'rights'][
'fields'][] = 
'lom_costs';
   757                     $this->active_sections[
'rights'][
'name'] = $this->
lng->txt(
'meta_rights');
   759                 case 'lom_copyright':
   760                     $this->active_sections[
'rights'][
'fields'][] = 
'lom_copyright';
   761                     $this->active_sections[
'rights'][
'name'] = $this->
lng->txt(
'meta_rights');
   766                     $this->active_sections[
'classification'][
'fields'][] = 
'lom_purpose';
   767                     $this->active_sections[
'classification'][
'name'] = $this->
lng->txt(
'meta_classification');
   770                     $this->active_sections[
'classification'][
'fields'][] = 
'lom_taxon';
   771                     $this->active_sections[
'classification'][
'name'] = $this->
lng->txt(
'meta_classification');
   775                     if (substr($field_name, 0, 3) != 
'adv') {
   780                     $field_id = substr($field_name, 4);
   782                     $record_id = $field->getRecordId();
   785                     $this->active_sections[
'adv_record_' . $record_id][
'fields'][] = $field_name;
   786                     $this->active_sections[
'adv_record_' . $record_id][
'name'] = $translations->getTitleForLanguage($this->
user->getLanguage());
   801         $tpl = 
new ilTemplate(
'tpl.range_search.html', 
true, 
true, 
'components/ILIAS/Search');
   802         $tpl->setVariable(
'TXT_FROM', $txt_from);
   803         $tpl->setVariable(
'FROM', $select_from);
   804         $tpl->setVariable(
'TXT_UPTO', $txt_until);
   805         $tpl->setVariable(
'UPTO', $select_until);
 
static _getOperatingSystemSelect(string $a_selected, string $a_name, array $prepend=array(), bool $a_options_only=false)
Prepare a meta technical os selector. 
 
static _getCopyrightAndOtherRestrictionsSelect(string $a_selected, string $a_name, array $prepend=array(), bool $a_options_only=false)
Prepare a meta rights copyright and other restrictions All possible entries in meta_format are shown...
 
getActiveFields()
Get all active fields. 
 
static _getPurposeSelect(string $a_selected, string $a_name, array $prepend=array(), bool $a_options_only=false)
Prepare a meta rights copyright and other restrictions All possible entries in meta_format are shown...
 
txt(string $a_topic, string $a_default_lang_fallback_mod="")
gets the text for a given topic if the topic is not in the list, the topic itself with "-" will be re...
 
static _getRecords()
Get records  public. 
 
static _getBrowserSelect(string $a_selected, string $a_name, array $prepend=array(), bool $a_options_only=false)
Prepare a meta technical browser selector. 
 
getFormElement($a_query, string $a_field_name, ilPropertyFormGUI $a_form)
 
static _getLearningResourceTypeSelect(string $a_selected, string $a_name, array $prepend=array(), bool $a_options_only=false)
Prepare a meta educational learning resource type All possible entries in meta_format are shown...
 
getRangeSelect(string $txt_from, string $select_from, string $txt_until, string $select_until)
get a range selection 
 
parseFieldQuery(string $a_field, $a_query)
Called from ilLuceneAdvancedQueryParser Parse a field specific query. 
 
getLangKey()
Return lang key. 
 
static _hasUntrashedReference(int $obj_id)
checks whether an object has at least one reference that is not in trash 
 
loadLanguageModule(string $a_module)
Load language module. 
 
static _getSemanticDensitySelect( $a_selected, string $a_name, array $prepend=array(), bool $a_options_only=false)
Prepare a meta educational semantic density All possible entries in meta_format are shown...
 
static getInstancesByRecordId( $a_record_id, $a_only_searchable=false, string $language='')
Get definitions by record id. 
 
static _getStatusSelect(string $a_selected, string $a_name, array $prepend=array(), bool $a_options_only=false)
Prepare a meta lifecycle status selector. 
 
static getInstance(?int $a_field_id, ?int $a_type=null, string $language='')
 
static _getDifficultySelect( $a_selected, string $a_name, array $prepend=array(), bool $a_options_only=false)
Prepare a meta educational difficulty All possible entries in meta_format are shown. 
 
En/disable single lom/advanced meta data fields. 
 
static _getCostsSelect(string $a_selected, string $a_name, array $prepend=array(), bool $a_options_only=false)
Prepare a meta rights costs All possible entries in meta_format are shown. 
 
ilLuceneAdvancedSearchSettings $settings
 
readFields()
Read active fields. 
 
static _getStructureSelect(string $a_selected, string $a_name, array $prepend=array(), bool $a_options_only=false)
Prepare a meta general structure selector. 
 
static _getInteractivityLevelSelect( $a_selected, string $a_name, array $prepend=array(), bool $a_options_only=false)
Prepare a meta educational interactivity level All possible entries in meta_format are shown...
 
static _getLanguageSelect(string $a_selected, string $a_name, array $prepend=array(), bool $a_options_only=false)
Prepare a meta data language selector. 
 
static ilLuceneAdvancedSearchFields $instance
 
static _getIntendedEndUserRoleSelect(string $a_selected, string $a_name, array $prepend=array(), bool $a_options_only=false)
Prepare a meta educational intended end user role All possible entries in meta_format are shown...
 
static getInstanceByRecordId(int $record_id)
 
static _getRoleSelect(string $a_selected, string $a_name, array $prepend=array(), bool $a_options_only=false)
Prepare a meta lifecycle status selector. 
 
static _getContextSelect(string $a_selected, string $a_name, array $prepend=array(), bool $a_options_only=false)
Prepare a meta context. 
 
static getFields()
Return an array of all meta data fields. 
 
static _getFormatSelect(string $a_selected, string $a_name, array $prepend=array(), bool $a_options_only=false)
Prepare a meta technical format selector All possible entries in meta_format are shown. 
 
readSections()
Read active sections. 
 
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
 
static _getInteractivityTypeSelect(string $a_selected, string $a_name, array $prepend=array(), bool $a_options_only=false)
Prepare a meta educational interactivity type All possible entries in meta_format are shown...
 
static getInstanceByRecordId(int $record_id)