25 include_once
'./Services/Search/classes/Lucene/class.ilLuceneAdvancedSearchSettings.php';
62 $this->lng->loadLanguageModule(
'meta');
73 if (isset(self::$instance) and self::$instance) {
74 return self::$instance;
86 $lng = $DIC->language();
88 $lng->loadLanguageModule(
'meta');
92 include_once
'./Services/Search/classes/class.ilSearchSettings.php';
94 $fields[
'general_offline'] =
$lng->txt(
'lucene_offline_filter');
99 $fields[
'lom_coverage'] =
$lng->txt(
'meta_coverage');
100 $fields[
'lom_structure'] =
$lng->txt(
'meta_structure');
102 $fields[
'lom_version'] =
$lng->txt(
'meta_version');
103 $fields[
'lom_contribute'] =
$lng->txt(
'meta_contribute');
105 $fields[
'lom_operating_system'] =
$lng->txt(
'meta_operating_system');
106 $fields[
'lom_browser'] =
$lng->txt(
'meta_browser');
107 $fields[
'lom_interactivity'] =
$lng->txt(
'meta_interactivity_type');
108 $fields[
'lom_resource'] =
$lng->txt(
'meta_learning_resource_type');
109 $fields[
'lom_level'] =
$lng->txt(
'meta_interactivity_level');
110 $fields[
'lom_density'] =
$lng->txt(
'meta_semantic_density');
111 $fields[
'lom_user_role'] =
$lng->txt(
'meta_intended_end_user_role');
112 $fields[
'lom_context'] =
$lng->txt(
'meta_context');
113 $fields[
'lom_difficulty'] =
$lng->txt(
'meta_difficulty');
115 $fields[
'lom_copyright'] =
$lng->txt(
'meta_copyright_and_other_restrictions');
116 $fields[
'lom_purpose'] =
$lng->txt(
'meta_purpose');
120 include_once
'./Services/AdvancedMetaData/classes/class.ilAdvancedMDRecord.php';
121 include_once
'./Services/AdvancedMetaData/classes/class.ilAdvancedMDFieldDefinition.php';
125 $fields[
'adv_' . $def->getFieldId()] = $field_translations->getTitleForLanguage($def->getFieldId(),
$lng->getLangKey());
136 return $this->active_fields ? $this->active_fields : array();
141 return $this->active_sections ? $this->active_sections : array();
146 include_once
'./Services/MetaData/classes/class.ilMDUtilSelect.php';
148 $a_post_name =
'query[' . $a_field_name .
']';
151 if (!is_array($a_query)) {
155 switch ($a_field_name) {
156 case 'general_offline':
157 $offline_options = array(
158 '0' => $this->lng->txt(
'search_any'),
159 self::ONLINE_QUERY => $this->lng->txt(
'search_option_online'),
160 self::OFFLINE_QUERY => $this->lng->txt(
'search_option_offline')
162 $offline =
new ilSelectInputGUI($this->active_fields[$a_field_name], $a_post_name);
163 $offline->setOptions($offline_options);
164 $offline->setValue($a_query[
'general_offline']);
168 $text =
new ilTextInputGUI($this->active_fields[$a_field_name], $a_post_name);
169 $text->setSubmitFormOnEnter(
true);
170 $text->setValue($a_query[
'lom_content']);
172 $text->setMaxLength(255);
177 $select =
new ilSelectInputGUI($this->active_fields[$a_field_name], $a_post_name);
178 $select->setValue($a_query[
'lom_language']);
182 array(0 => $this->lng->txt(
'search_any')),
188 $text =
new ilTextInputGUI($this->active_fields[$a_field_name], $a_post_name);
189 $text->setSubmitFormOnEnter(
true);
190 $text->setValue($a_query[
'lom_keyword']);
192 $text->setMaxLength(255);
196 $text =
new ilTextInputGUI($this->active_fields[$a_field_name], $a_post_name);
197 $text->setSubmitFormOnEnter(
true);
198 $text->setValue($a_query[
'lom_coverage']);
200 $text->setMaxLength(255);
203 case 'lom_structure':
204 $select =
new ilSelectInputGUI($this->active_fields[$a_field_name], $a_post_name);
205 $select->setValue($a_query[
'lom_structure']);
209 array(0 => $this->lng->txt(
'search_any')),
216 $select =
new ilSelectInputGUI($this->active_fields[$a_field_name], $a_post_name);
217 $select->setValue($a_query[
'lom_status']);
221 array(0 => $this->lng->txt(
'search_any')),
227 $text =
new ilTextInputGUI($this->active_fields[$a_field_name], $a_post_name);
228 $text->setSubmitFormOnEnter(
true);
229 $text->setValue($a_query[
'lom_version']);
231 $text->setMaxLength(255);
234 case 'lom_contribute':
235 $select =
new ilSelectInputGUI($this->active_fields[$a_field_name],
'query[' .
'lom_role' .
']');
236 $select->setValue($a_query[
'lom_role']);
240 array(0 => $this->lng->txt(
'search_any')),
244 $text =
new ilTextInputGUI($this->lng->txt(
'meta_entry'),
'query[' .
'lom_role_entry' .
']');
245 $text->setValue($a_query[
'lom_role_entry']);
247 $text->setMaxLength(255);
249 $select->addSubItem($text);
254 $select =
new ilSelectInputGUI($this->active_fields[$a_field_name], $a_post_name);
255 $select->setValue($a_query[
'lom_format']);
259 array(0 => $this->lng->txt(
'search_any')),
264 case 'lom_operating_system':
265 $select =
new ilSelectInputGUI($this->active_fields[$a_field_name], $a_post_name);
266 $select->setValue($a_query[
'lom_operating_system']);
270 array(0 => $this->lng->txt(
'search_any')),
276 $select =
new ilSelectInputGUI($this->active_fields[$a_field_name], $a_post_name);
277 $select->setValue($a_query[
'lom_browser']);
281 array(0 => $this->lng->txt(
'search_any')),
287 case 'lom_interactivity':
288 $select =
new ilSelectInputGUI($this->active_fields[$a_field_name], $a_post_name);
289 $select->setValue($a_query[
'lom_interactivity']);
293 array(0 => $this->lng->txt(
'search_any')),
299 $select =
new ilSelectInputGUI($this->active_fields[$a_field_name], $a_post_name);
300 $select->setValue($a_query[
'lom_resource']);
304 array(0 => $this->lng->txt(
'search_any')),
312 $this->lng->txt(
'from'),
314 $a_query[
'lom_level_start'],
315 'query[' .
'lom_level_start' .
']',
316 array(0 => $this->lng->txt(
'search_any'))
318 $this->lng->txt(
'until'),
320 $a_query[
'lom_level_end'],
321 'query[' .
'lom_level_end' .
']',
322 array(0 => $this->lng->txt(
'search_any'))
325 $range->setHTML($html);
331 $this->lng->txt(
'from'),
333 $a_query[
'lom_density_start'],
334 'query[' .
'lom_density_start' .
']',
335 array(0 => $this->lng->txt(
'search_any'))
337 $this->lng->txt(
'until'),
339 $a_query[
'lom_density_end'],
340 'query[' .
'lom_density_end' .
']',
341 array(0 => $this->lng->txt(
'search_any'))
344 $range->setHTML($html);
348 case 'lom_user_role':
349 $select =
new ilSelectInputGUI($this->active_fields[$a_field_name], $a_post_name);
350 $select->setValue($a_query[
'lom_user_role']);
354 array(0 => $this->lng->txt(
'search_any')),
360 $select =
new ilSelectInputGUI($this->active_fields[$a_field_name], $a_post_name);
361 $select->setValue($a_query[
'lom_context']);
365 array(0 => $this->lng->txt(
'search_any')),
370 case 'lom_difficulty':
373 $this->lng->txt(
'from'),
375 $a_query[
'lom_difficulty_start'],
376 'query[' .
'lom_difficulty_start' .
']',
377 array(0 => $this->lng->txt(
'search_any'))
379 $this->lng->txt(
'until'),
381 $a_query[
'lom_difficulty_end'],
382 'query[' .
'lom_difficulty_end' .
']',
383 array(0 => $this->lng->txt(
'search_any'))
386 $range->setHTML($html);
391 $select =
new ilSelectInputGUI($this->active_fields[$a_field_name], $a_post_name);
392 $select->setValue($a_query[
'lom_costs']);
396 array(0 => $this->lng->txt(
'search_any')),
401 case 'lom_copyright':
402 $select =
new ilSelectInputGUI($this->active_fields[$a_field_name], $a_post_name);
403 $select->setValue($a_query[
'lom_copyright']);
407 array(0 => $this->lng->txt(
'search_any')),
416 $select =
new ilSelectInputGUI($this->active_fields[$a_field_name], $a_post_name);
417 $select->setValue($a_query[
'lom_purpose']);
421 array(0 => $this->lng->txt(
'search_any')),
427 $text =
new ilTextInputGUI($this->active_fields[$a_field_name], $a_post_name);
428 $text->setSubmitFormOnEnter(
true);
429 $text->setValue($a_query[
'lom_taxon']);
431 $text->setMaxLength(255);
435 if (substr($a_field_name, 0, 3) !=
'adv') {
440 $field_id = substr($a_field_name, 4);
441 include_once
'./Services/AdvancedMetaData/classes/class.ilAdvancedMDFieldDefinition.php';
444 $field_form =
ilADTFactory::getInstance()->getSearchBridgeForDefinitionInstance($field->getADTDefinition(),
true,
false);
445 $field_form->setForm($a_form);
446 $field_form->setElementId($a_post_name);
447 $field_form->setTitle($this->active_fields[$a_field_name]);
448 $field_form->addToForm();
451 if (is_array($a_query) &&
452 array_key_exists($a_field_name, $a_query)) {
453 $field_form->importFromPost((array) $a_query);
454 $field_form->validate();
473 case 'general_offline':
476 case self::OFFLINE_QUERY:
487 return 'lomLanguage:' . $a_query;
490 return 'lomKeyword:' . $a_query;
493 return 'lomCoverage:' . $a_query;
495 case 'lom_structure':
496 return 'lomStructure:' . $a_query;
500 return 'lomStatus:' . $a_query;
503 return 'lomVersion:' . $a_query;
507 return 'lomRole:' . $a_query;
509 case 'lom_role_entry':
510 return 'lomRoleEntity:' . $a_query;
515 return 'lomFormat:' . $a_query;
517 case 'lom_operating_system':
518 return 'lomOS:' . $a_query;
521 return 'lomBrowser:' . $a_query;
524 case 'lom_interactivity':
525 return 'lomInteractivity:' . $a_query;
528 return 'lomResource:' . $a_query;
530 case 'lom_level_start':
532 include_once
'./Services/MetaData/classes/class.ilMDUtilSelect.php';
534 for (
$i = $a_query;
$i <= count($options);
$i++) {
535 if (strlen($q_string)) {
538 $q_string .= (
'lomLevel:"' . $options[
$i] .
'" ');
542 case 'lom_level_end':
544 include_once
'./Services/MetaData/classes/class.ilMDUtilSelect.php';
546 for (
$i = 1;
$i <= $a_query;
$i++) {
547 if (strlen($q_string)) {
550 $q_string .= (
'lomLevel:"' . $options[
$i] .
'" ');
554 case 'lom_density_start':
556 include_once
'./Services/MetaData/classes/class.ilMDUtilSelect.php';
558 for (
$i = $a_query;
$i <= count($options);
$i++) {
559 if (strlen($q_string)) {
562 $q_string .= (
'lomDensity:"' . $options[
$i] .
'" ');
566 case 'lom_density_end':
568 include_once
'./Services/MetaData/classes/class.ilMDUtilSelect.php';
570 for (
$i = 1;
$i <= $a_query;
$i++) {
571 if (strlen($q_string)) {
574 $q_string .= (
'lomDensity:"' . $options[
$i] .
'" ');
578 case 'lom_user_role':
579 return 'lomUserRole:' . $a_query;
582 return 'lomContext:' . $a_query;
584 case 'lom_difficulty_start':
586 include_once
'./Services/MetaData/classes/class.ilMDUtilSelect.php';
588 for (
$i = $a_query;
$i <= count($options);
$i++) {
589 if (strlen($q_string)) {
592 $q_string .= (
'lomDifficulty:"' . $options[
$i] .
'" ');
596 case 'lom_difficulty_end':
598 include_once
'./Services/MetaData/classes/class.ilMDUtilSelect.php';
600 for (
$i = 1;
$i <= $a_query;
$i++) {
601 if (strlen($q_string)) {
604 $q_string .= (
'lomDifficulty:"' . $options[
$i] .
'" ');
610 return 'lomCosts:' . $a_query;
612 case 'lom_copyright':
613 return 'lomCopyright:' . $a_query;
617 return 'lomPurpose:' . $a_query;
620 return 'lomTaxon:' . $a_query;
623 if (substr($a_field, 0, 3) !=
'adv') {
628 $field_id = substr($a_field, 4);
629 include_once
'./Services/AdvancedMetaData/classes/class.ilAdvancedMDFieldDefinition.php';
637 $adv_query = $field->getLuceneSearchString($a_query);
640 if (!is_array($adv_query)) {
641 return 'advancedMetaData_' . $field_id .
': ' . $adv_query;
644 foreach ($adv_query as $adv_query_item) {
645 $res[] =
'advancedMetaData_' . $field_id .
': ' . $adv_query_item;
647 return '(' . implode(
' OR ',
$res) .
')';
659 foreach (self::getFields() as
$name => $translation) {
661 $this->active_fields[
$name] = $translation;
673 $user = $DIC->user();
676 switch ($field_name) {
679 $this->active_sections[
'default'][
'fields'][] =
'lom_content';
680 $this->active_sections[
'default'][
'name'] =
'';
683 case 'general_offline':
684 $this->active_sections[
'default'][
'fields'][] =
'general_offline';
685 $this->active_sections[
'default'][
'name'] =
'';
689 $this->active_sections[
'default'][
'fields'][] =
'lom_type';
690 $this->active_sections[
'default'][
'name'] =
'';
695 $this->active_sections[
'general'][
'fields'][] =
'lom_language';
696 $this->active_sections[
'general'][
'name'] = $this->lng->txt(
'meta_general');
699 $this->active_sections[
'general'][
'fields'][] =
'lom_keyword';
700 $this->active_sections[
'general'][
'name'] = $this->lng->txt(
'meta_general');
703 $this->active_sections[
'general'][
'fields'][] =
'lom_coverage';
704 $this->active_sections[
'general'][
'name'] = $this->lng->txt(
'meta_general');
706 case 'lom_structure':
707 $this->active_sections[
'general'][
'fields'][] =
'lom_structure';
708 $this->active_sections[
'general'][
'name'] = $this->lng->txt(
'meta_general');
713 $this->active_sections[
'lifecycle'][
'fields'][] =
'lom_status';
714 $this->active_sections[
'lifecycle'][
'name'] = $this->lng->txt(
'meta_lifecycle');
717 $this->active_sections[
'lifecycle'][
'fields'][] =
'lom_version';
718 $this->active_sections[
'lifecycle'][
'name'] = $this->lng->txt(
'meta_lifecycle');
720 case 'lom_contribute':
721 $this->active_sections[
'lifecycle'][
'fields'][] =
'lom_contribute';
722 $this->active_sections[
'lifecycle'][
'name'] = $this->lng->txt(
'meta_lifecycle');
727 $this->active_sections[
'technical'][
'fields'][] =
'lom_format';
728 $this->active_sections[
'technical'][
'name'] = $this->lng->txt(
'meta_technical');
730 case 'lom_operating_system':
731 $this->active_sections[
'technical'][
'fields'][] =
'lom_operating_system';
732 $this->active_sections[
'technical'][
'name'] = $this->lng->txt(
'meta_technical');
735 $this->active_sections[
'technical'][
'fields'][] =
'lom_browser';
736 $this->active_sections[
'technical'][
'name'] = $this->lng->txt(
'meta_technical');
740 case 'lom_interactivity':
741 $this->active_sections[
'education'][
'fields'][] =
'lom_interactivity';
742 $this->active_sections[
'education'][
'name'] = $this->lng->txt(
'meta_education');
745 $this->active_sections[
'education'][
'fields'][] =
'lom_resource';
746 $this->active_sections[
'education'][
'name'] = $this->lng->txt(
'meta_education');
749 $this->active_sections[
'education'][
'fields'][] =
'lom_level';
750 $this->active_sections[
'education'][
'name'] = $this->lng->txt(
'meta_education');
753 $this->active_sections[
'education'][
'fields'][] =
'lom_density';
754 $this->active_sections[
'education'][
'name'] = $this->lng->txt(
'meta_education');
756 case 'lom_user_role':
757 $this->active_sections[
'education'][
'fields'][] =
'lom_user_role';
758 $this->active_sections[
'education'][
'name'] = $this->lng->txt(
'meta_education');
761 $this->active_sections[
'education'][
'fields'][] =
'lom_context';
762 $this->active_sections[
'education'][
'name'] = $this->lng->txt(
'meta_education');
764 case 'lom_difficulty':
765 $this->active_sections[
'education'][
'fields'][] =
'lom_difficulty';
766 $this->active_sections[
'education'][
'name'] = $this->lng->txt(
'meta_education');
771 $this->active_sections[
'rights'][
'fields'][] =
'lom_costs';
772 $this->active_sections[
'rights'][
'name'] = $this->lng->txt(
'meta_rights');
774 case 'lom_copyright':
775 $this->active_sections[
'rights'][
'fields'][] =
'lom_copyright';
776 $this->active_sections[
'rights'][
'name'] = $this->lng->txt(
'meta_rights');
781 $this->active_sections[
'classification'][
'fields'][] =
'lom_purpose';
782 $this->active_sections[
'classification'][
'name'] = $this->lng->txt(
'meta_classification');
785 $this->active_sections[
'classification'][
'fields'][] =
'lom_taxon';
786 $this->active_sections[
'classification'][
'name'] = $this->lng->txt(
'meta_classification');
790 if (substr($field_name, 0, 3) !=
'adv') {
795 $field_id = substr($field_name, 4);
796 include_once
'./Services/AdvancedMetaData/classes/class.ilAdvancedMDFieldDefinition.php';
797 include_once
'./Services/AdvancedMetaData/classes/class.ilAdvancedMDRecord.php';
799 $record_id = $field->getRecordId();
802 $this->active_sections[
'adv_record_' . $record_id][
'fields'][] = $field_name;
803 $this->active_sections[
'adv_record_' . $record_id][
'name'] = $translations->getTitleForLanguage($user->getLanguage());
812 protected function getRangeSelect($txt_from, $select_from, $txt_until, $select_until)
814 $tpl =
new ilTemplate(
'tpl.range_search.html',
true,
true,
'Services/Search');
815 $tpl->setVariable(
'TXT_FROM', $txt_from);
816 $tpl->setVariable(
'FROM', $select_from);
817 $tpl->setVariable(
'TXT_UPTO', $txt_until);
818 $tpl->setVariable(
'UPTO', $select_until);
static _getCopyrightAndOtherRestrictionsSelect($a_selected, $a_name, $prepend=array(), $a_options_only=false)
Prepare a meta rights copyright and other restrictions All possible entries in meta_format are shown...
static _getIntendedEndUserRoleSelect($a_selected, $a_name, $prepend=array(), $a_options_only=false)
Prepare a meta educational intended end user role All possible entries in meta_format are shown...
getActiveFields()
Get all active fields.
static _getCostsSelect($a_selected, $a_name, $prepend=array(), $a_options_only=false)
Prepare a meta rights costs All possible entries in meta_format are shown.
static _getSemanticDensitySelect($a_selected, $a_name, $prepend=array(), $a_options_only=false)
Prepare a meta educational semantic density All possible entries in meta_format are shown...
static _getLanguageSelect($a_selected, $a_name, $prepend=array(), $a_options_only=false)
Prepare a meta data language selector.
static _getRecords()
Get records.
static _getInteractivityLevelSelect($a_selected, $a_name, $prepend=array(), $a_options_only=false)
Prepare a meta educational interactivity level All possible entries in meta_format are shown...
static getInstance()
Get singleton.
static _getLearningResourceTypeSelect($a_selected, $a_name, $prepend=array(), $a_options_only=false)
Prepare a meta educational learning resource type All possible entries in meta_format are shown...
static _getStatusSelect($a_selected, $a_name, $prepend=array(), $a_options_only=false)
Prepare a meta lifecycle status selector.
static _getFormatSelect($a_selected, $a_name, $prepend=array(), $a_options_only=false)
Prepare a meta technical format selector All possible entries in meta_format are shown.
foreach($_POST as $key=> $value) $res
static _getBrowserSelect($a_selected, $a_name, $prepend=array(), $a_options_only=false)
Prepare a meta technical browser selector.
readFields()
Read active fields.
static _getDifficultySelect($a_selected, $a_name, $prepend=array(), $a_options_only=false)
Prepare a meta educational difficulty All possible entries in meta_format are shown.
getFormElement($a_query, $a_field_name, ilPropertyFormGUI $a_form)
static getInstanceByRecordId(int $record_id)
static _getStructureSelect($a_selected, $a_name, $prepend=array(), $a_options_only=false)
Prepare a meta general structure selector.
static _getOperatingSystemSelect($a_selected, $a_name, $prepend=array(), $a_options_only=false)
Prepare a meta technical os selector.
static _getContextSelect($a_selected, $a_name, $prepend=array(), $a_options_only=false)
Prepare a meta context.
getRangeSelect($txt_from, $select_from, $txt_until, $select_until)
get a range selection
static _getPurposeSelect($a_selected, $a_name, $prepend=array(), $a_options_only=false)
Prepare a meta rights copyright and other restrictions All possible entries in meta_format are shown...
static getInstance($a_field_id, $a_type=null, string $language='')
Get definition instance by type.
static getFields()
Return an array of all meta data fields.
static getLogger($a_component_id)
Get component logger.
static _getRoleSelect($a_selected, $a_name, $prepend=array(), $a_options_only=false)
Prepare a meta lifecycle status selector.
static getInstance()
Get singleton instance.
if($DIC->http() ->request() ->getMethod()=="GET" &&isset($DIC->http() ->request() ->getQueryParams()['tex'])) $tpl
parseFieldQuery($a_field, $a_query)
Called from ilLuceneAdvancedQueryParser Parse a field specific query.
readSections()
Read active sections.
Field definitions of advanced meta data search.
static getInstancesByRecordId($a_record_id, $a_only_searchable=false, string $language='')
Get definitions by record id.
static _getInteractivityTypeSelect($a_selected, $a_name, $prepend=array(), $a_options_only=false)
Prepare a meta educational interactivity type All possible entries in meta_format are shown...
static getInstanceByRecordId(int $record_id)