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'] ??
'');
164 $text =
new ilTextInputGUI($this->active_fields[$a_field_name], $a_post_name);
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')),
184 $text =
new ilTextInputGUI($this->active_fields[$a_field_name], $a_post_name);
185 $text->setSubmitFormOnEnter(
true);
186 $text->setValue($a_query[
'lom_keyword'] ??
'');
188 $text->setMaxLength(255);
192 $text =
new ilTextInputGUI($this->active_fields[$a_field_name], $a_post_name);
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')),
223 $text =
new ilTextInputGUI($this->active_fields[$a_field_name], $a_post_name);
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')),
240 $text =
new ilTextInputGUI($this->
lng->txt(
'meta_entry'),
'query[' .
'lom_role_entry' .
']');
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'))
321 $range->setHtml($html);
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'))
340 $range->setHtml($html);
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'))
382 $range->setHtml($html);
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')),
423 $text =
new ilTextInputGUI($this->active_fields[$a_field_name], $a_post_name);
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:
483 return 'lomLanguage:' . $a_query;
486 return 'lomKeyword:' . $a_query;
489 return 'lomCoverage:' . $a_query;
491 case 'lom_structure':
492 return 'lomStructure:' . $a_query;
496 return 'lomStatus:' . $a_query;
499 return 'lomVersion:' . $a_query;
503 return 'lomRole:' . $a_query;
505 case 'lom_role_entry':
506 return 'lomRoleEntity:' . $a_query;
511 return 'lomFormat:' . $a_query;
513 case 'lom_operating_system':
514 return 'lomOS:' . $a_query;
517 return 'lomBrowser:' . $a_query;
520 case 'lom_interactivity':
521 return 'lomInteractivity:' . $a_query;
524 return 'lomResource:' . $a_query;
526 case 'lom_level_start':
529 for (
$i = $a_query;
$i <= count($options);
$i++) {
530 if (strlen($q_string)) {
533 $q_string .= (
'lomLevel:"' . $options[
$i] .
'" ');
537 case 'lom_level_end':
540 for (
$i = 1;
$i <= $a_query;
$i++) {
541 if (strlen($q_string)) {
544 $q_string .= (
'lomLevel:"' . $options[
$i] .
'" ');
548 case 'lom_density_start':
551 for (
$i = $a_query;
$i <= count($options);
$i++) {
552 if (strlen($q_string)) {
555 $q_string .= (
'lomDensity:"' . $options[
$i] .
'" ');
559 case 'lom_density_end':
562 for (
$i = 1;
$i <= $a_query;
$i++) {
563 if (strlen($q_string)) {
566 $q_string .= (
'lomDensity:"' . $options[
$i] .
'" ');
570 case 'lom_user_role':
571 return 'lomUserRole:' . $a_query;
574 return 'lomContext:' . $a_query;
576 case 'lom_difficulty_start':
579 for (
$i = $a_query;
$i <= count($options);
$i++) {
580 if (strlen($q_string)) {
583 $q_string .= (
'lomDifficulty:"' . $options[
$i] .
'" ');
587 case 'lom_difficulty_end':
590 for (
$i = 1;
$i <= $a_query;
$i++) {
591 if (strlen($q_string)) {
594 $q_string .= (
'lomDifficulty:"' . $options[
$i] .
'" ');
600 return 'lomCosts:' . $a_query;
602 case 'lom_copyright':
603 return 'lomCopyright:' . $a_query;
607 return 'lomPurpose:' . $a_query;
610 return 'lomTaxon:' . $a_query;
613 if (substr($a_field, 0, 3) !=
'adv') {
618 $field_id = substr($a_field, 4);
626 $adv_query = $field->getLuceneSearchString($a_query);
629 if (!is_array($adv_query)) {
630 return 'advancedMetaData_' . $field_id .
': ' . $adv_query;
633 foreach ($adv_query as $adv_query_item) {
634 $res[] =
'advancedMetaData_' . $field_id .
': ' . $adv_query_item;
636 return '(' . implode(
' OR ',
$res) .
')';
649 foreach (self::getFields() as
$name => $translation) {
651 $this->active_fields[
$name] = $translation;
662 switch ($field_name) {
665 $this->active_sections[
'default'][
'fields'][] =
'lom_content';
666 $this->active_sections[
'default'][
'name'] =
'';
669 case 'general_offline':
670 $this->active_sections[
'default'][
'fields'][] =
'general_offline';
671 $this->active_sections[
'default'][
'name'] =
'';
675 $this->active_sections[
'default'][
'fields'][] =
'lom_type';
676 $this->active_sections[
'default'][
'name'] =
'';
681 $this->active_sections[
'general'][
'fields'][] =
'lom_language';
682 $this->active_sections[
'general'][
'name'] = $this->
lng->txt(
'meta_general');
685 $this->active_sections[
'general'][
'fields'][] =
'lom_keyword';
686 $this->active_sections[
'general'][
'name'] = $this->
lng->txt(
'meta_general');
689 $this->active_sections[
'general'][
'fields'][] =
'lom_coverage';
690 $this->active_sections[
'general'][
'name'] = $this->
lng->txt(
'meta_general');
692 case 'lom_structure':
693 $this->active_sections[
'general'][
'fields'][] =
'lom_structure';
694 $this->active_sections[
'general'][
'name'] = $this->
lng->txt(
'meta_general');
699 $this->active_sections[
'lifecycle'][
'fields'][] =
'lom_status';
700 $this->active_sections[
'lifecycle'][
'name'] = $this->
lng->txt(
'meta_lifecycle');
703 $this->active_sections[
'lifecycle'][
'fields'][] =
'lom_version';
704 $this->active_sections[
'lifecycle'][
'name'] = $this->
lng->txt(
'meta_lifecycle');
706 case 'lom_contribute':
707 $this->active_sections[
'lifecycle'][
'fields'][] =
'lom_contribute';
708 $this->active_sections[
'lifecycle'][
'name'] = $this->
lng->txt(
'meta_lifecycle');
713 $this->active_sections[
'technical'][
'fields'][] =
'lom_format';
714 $this->active_sections[
'technical'][
'name'] = $this->
lng->txt(
'meta_technical');
716 case 'lom_operating_system':
717 $this->active_sections[
'technical'][
'fields'][] =
'lom_operating_system';
718 $this->active_sections[
'technical'][
'name'] = $this->
lng->txt(
'meta_technical');
721 $this->active_sections[
'technical'][
'fields'][] =
'lom_browser';
722 $this->active_sections[
'technical'][
'name'] = $this->
lng->txt(
'meta_technical');
726 case 'lom_interactivity':
727 $this->active_sections[
'education'][
'fields'][] =
'lom_interactivity';
728 $this->active_sections[
'education'][
'name'] = $this->
lng->txt(
'meta_education');
731 $this->active_sections[
'education'][
'fields'][] =
'lom_resource';
732 $this->active_sections[
'education'][
'name'] = $this->
lng->txt(
'meta_education');
735 $this->active_sections[
'education'][
'fields'][] =
'lom_level';
736 $this->active_sections[
'education'][
'name'] = $this->
lng->txt(
'meta_education');
739 $this->active_sections[
'education'][
'fields'][] =
'lom_density';
740 $this->active_sections[
'education'][
'name'] = $this->
lng->txt(
'meta_education');
742 case 'lom_user_role':
743 $this->active_sections[
'education'][
'fields'][] =
'lom_user_role';
744 $this->active_sections[
'education'][
'name'] = $this->
lng->txt(
'meta_education');
747 $this->active_sections[
'education'][
'fields'][] =
'lom_context';
748 $this->active_sections[
'education'][
'name'] = $this->
lng->txt(
'meta_education');
750 case 'lom_difficulty':
751 $this->active_sections[
'education'][
'fields'][] =
'lom_difficulty';
752 $this->active_sections[
'education'][
'name'] = $this->
lng->txt(
'meta_education');
757 $this->active_sections[
'rights'][
'fields'][] =
'lom_costs';
758 $this->active_sections[
'rights'][
'name'] = $this->
lng->txt(
'meta_rights');
760 case 'lom_copyright':
761 $this->active_sections[
'rights'][
'fields'][] =
'lom_copyright';
762 $this->active_sections[
'rights'][
'name'] = $this->
lng->txt(
'meta_rights');
767 $this->active_sections[
'classification'][
'fields'][] =
'lom_purpose';
768 $this->active_sections[
'classification'][
'name'] = $this->
lng->txt(
'meta_classification');
771 $this->active_sections[
'classification'][
'fields'][] =
'lom_taxon';
772 $this->active_sections[
'classification'][
'name'] = $this->
lng->txt(
'meta_classification');
776 if (substr($field_name, 0, 3) !=
'adv') {
781 $field_id = substr($field_name, 4);
783 $record_id = $field->getRecordId();
786 $this->active_sections[
'adv_record_' . $record_id][
'fields'][] = $field_name;
787 $this->active_sections[
'adv_record_' . $record_id][
'name'] = $translations->getTitleForLanguage($this->
user->getLanguage());
802 $tpl =
new ilTemplate(
'tpl.range_search.html',
true,
true,
'Services/Search');
803 $tpl->setVariable(
'TXT_FROM', $txt_from);
804 $tpl->setVariable(
'FROM', $select_from);
805 $tpl->setVariable(
'TXT_UPTO', $txt_until);
806 $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.
if($DIC->http() ->request() ->getMethod()=="GET" &&isset($DIC->http() ->request() ->getQueryParams()['tex'])) $tpl
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)