25 include_once
'./Services/Search/classes/Lucene/class.ilLuceneAdvancedSearchSettings.php';
60 $this->lng->loadLanguageModule(
'meta');
71 if(isset(self::$instance) and self::$instance)
85 $lng->loadLanguageModule(
'meta');
87 $fields[
'lom_content'] = $lng->txt(
'content');
89 include_once
'./Services/Search/classes/class.ilSearchSettings.php';
92 $fields[
'general_offline'] = $lng->txt(
'lucene_offline_filter');
95 $fields[
'lom_language'] = $lng->txt(
'language');
96 $fields[
'lom_keyword'] = $lng->txt(
'meta_keyword');
97 $fields[
'lom_coverage'] = $lng->txt(
'meta_coverage');
98 $fields[
'lom_structure'] = $lng->txt(
'meta_structure');
99 $fields[
'lom_status'] = $lng->txt(
'meta_status');
100 $fields[
'lom_version'] = $lng->txt(
'meta_version');
101 $fields[
'lom_contribute'] = $lng->txt(
'meta_contribute');
102 $fields[
'lom_format'] = $lng->txt(
'meta_format');
103 $fields[
'lom_operating_system'] = $lng->txt(
'meta_operating_system');
104 $fields[
'lom_browser'] = $lng->txt(
'meta_browser');
105 $fields[
'lom_interactivity'] = $lng->txt(
'meta_interactivity_type');
106 $fields[
'lom_resource'] = $lng->txt(
'meta_learning_resource_type');
107 $fields[
'lom_level'] = $lng->txt(
'meta_interactivity_level');
108 $fields[
'lom_density'] = $lng->txt(
'meta_semantic_density');
109 $fields[
'lom_user_role'] = $lng->txt(
'meta_intended_end_user_role');
110 $fields[
'lom_context'] = $lng->txt(
'meta_context');
111 $fields[
'lom_difficulty'] = $lng->txt(
'meta_difficulty');
112 $fields[
'lom_costs'] = $lng->txt(
'meta_cost');
113 $fields[
'lom_copyright'] = $lng->txt(
'meta_copyright_and_other_restrictions');
114 $fields[
'lom_purpose'] = $lng->txt(
'meta_purpose');
115 $fields[
'lom_taxon'] = $lng->txt(
'meta_taxon');
118 include_once
'./Services/AdvancedMetaData/classes/class.ilAdvancedMDRecord.php';
119 include_once
'./Services/AdvancedMetaData/classes/class.ilAdvancedMDFieldDefinition.php';
124 $fields[
'adv_'.$def->getFieldId()] = $def->getTitle();
135 return $this->active_fields ? $this->active_fields : array();
140 return $this->active_sections ? $this->active_sections : array();
145 include_once
'./Services/MetaData/classes/class.ilMDUtilSelect.php';
147 $a_post_name =
'query['.$a_field_name.
']';
154 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')),
187 $text =
new ilTextInputGUI($this->active_fields[$a_field_name],$a_post_name);
188 $text->setSubmitFormOnEnter(
true);
189 $text->setValue($a_query[
'lom_keyword']);
191 $text->setMaxLength(255);
195 $text =
new ilTextInputGUI($this->active_fields[$a_field_name],$a_post_name);
196 $text->setSubmitFormOnEnter(
true);
197 $text->setValue($a_query[
'lom_coverage']);
199 $text->setMaxLength(255);
202 case 'lom_structure':
203 $select =
new ilSelectInputGUI($this->active_fields[$a_field_name],$a_post_name);
204 $select->setValue($a_query[
'lom_structure']);
208 array(0 => $this->lng->txt(
'search_any')),
214 $select =
new ilSelectInputGUI($this->active_fields[$a_field_name],$a_post_name);
215 $select->setValue($a_query[
'lom_status']);
219 array(0 => $this->lng->txt(
'search_any')),
224 $text =
new ilTextInputGUI($this->active_fields[$a_field_name],$a_post_name);
225 $text->setSubmitFormOnEnter(
true);
226 $text->setValue($a_query[
'lom_version']);
228 $text->setMaxLength(255);
231 case 'lom_contribute':
232 $select =
new ilSelectInputGUI($this->active_fields[$a_field_name],
'query['.
'lom_role'.
']');
233 $select->setValue($a_query[
'lom_role']);
237 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')),
259 case 'lom_operating_system':
260 $select =
new ilSelectInputGUI($this->active_fields[$a_field_name],$a_post_name);
261 $select->setValue($a_query[
'lom_operating_system']);
265 array(0 => $this->lng->txt(
'search_any')),
270 $select =
new ilSelectInputGUI($this->active_fields[$a_field_name],$a_post_name);
271 $select->setValue($a_query[
'lom_browser']);
275 array(0 => $this->lng->txt(
'search_any')),
280 case 'lom_interactivity':
281 $select =
new ilSelectInputGUI($this->active_fields[$a_field_name],$a_post_name);
282 $select->setValue($a_query[
'lom_interactivity']);
286 array(0 => $this->lng->txt(
'search_any')),
291 $select =
new ilSelectInputGUI($this->active_fields[$a_field_name],$a_post_name);
292 $select->setValue($a_query[
'lom_resource']);
296 array(0 => $this->lng->txt(
'search_any')),
303 $this->lng->txt(
'from'),
305 $a_query[
'lom_level_start'],
306 'query['.
'lom_level_start'.
']',
307 array(0 => $this->lng->txt(
'search_any'))),
308 $this->lng->txt(
'until'),
310 $a_query[
'lom_level_end'],
311 'query['.
'lom_level_end'.
']',
312 array(0 => $this->lng->txt(
'search_any')))
314 $range->setHTML($html);
320 $this->lng->txt(
'from'),
322 $a_query[
'lom_density_start'],
323 'query['.
'lom_density_start'.
']',
324 array(0 => $this->lng->txt(
'search_any'))),
325 $this->lng->txt(
'until'),
327 $a_query[
'lom_density_end'],
328 'query['.
'lom_density_end'.
']',
329 array(0 => $this->lng->txt(
'search_any')))
331 $range->setHTML($html);
335 case 'lom_user_role':
336 $select =
new ilSelectInputGUI($this->active_fields[$a_field_name],$a_post_name);
337 $select->setValue($a_query[
'lom_user_role']);
341 array(0 => $this->lng->txt(
'search_any')),
346 $select =
new ilSelectInputGUI($this->active_fields[$a_field_name],$a_post_name);
347 $select->setValue($a_query[
'lom_context']);
351 array(0 => $this->lng->txt(
'search_any')),
355 case 'lom_difficulty':
358 $this->lng->txt(
'from'),
360 $a_query[
'lom_difficulty_start'],
361 'query['.
'lom_difficulty_start'.
']',
362 array(0 => $this->lng->txt(
'search_any'))),
363 $this->lng->txt(
'until'),
365 $a_query[
'lom_difficulty_end'],
366 'query['.
'lom_difficulty_end'.
']',
367 array(0 => $this->lng->txt(
'search_any')))
369 $range->setHTML($html);
374 $select =
new ilSelectInputGUI($this->active_fields[$a_field_name],$a_post_name);
375 $select->setValue($a_query[
'lom_costs']);
379 array(0 => $this->lng->txt(
'search_any')),
383 case 'lom_copyright':
384 $select =
new ilSelectInputGUI($this->active_fields[$a_field_name],$a_post_name);
385 $select->setValue($a_query[
'lom_copyright']);
389 array(0 => $this->lng->txt(
'search_any')),
397 $select =
new ilSelectInputGUI($this->active_fields[$a_field_name],$a_post_name);
398 $select->setValue($a_query[
'lom_purpose']);
402 array(0 => $this->lng->txt(
'search_any')),
407 $text =
new ilTextInputGUI($this->active_fields[$a_field_name],$a_post_name);
408 $text->setSubmitFormOnEnter(
true);
409 $text->setValue($a_query[
'lom_taxon']);
411 $text->setMaxLength(255);
415 if(substr($a_field_name,0,3) !=
'adv')
419 $field_id = substr($a_field_name,4);
420 include_once
'./Services/AdvancedMetaData/classes/class.ilAdvancedMDFieldDefinition.php';
423 $field_form =
ilADTFactory::getInstance()->getSearchBridgeForDefinitionInstance($field->getADTDefinition(),
true,
false);
424 $field_form->setForm($a_form);
425 $field_form->setElementId($a_post_name);
426 $field_form->setTitle($this->active_fields[$a_field_name]);
427 $field_form->addToForm();
430 if(is_array($a_query) &&
431 array_key_exists($a_field_name, $a_query))
433 $field_form->importFromPost($a_query);
434 $field_form->validate();
454 case 'general_offline':
458 case self::OFFLINE_QUERY:
469 return 'lomLanguage:'.$a_query;
472 return 'lomKeyword:'.$a_query;
475 return 'lomCoverage:'.$a_query;
477 case 'lom_structure':
478 return 'lomStructure:'.$a_query;
482 return 'lomStatus:'.$a_query;
485 return 'lomVersion:'.$a_query;
489 return 'lomRole:'.$a_query;
491 case 'lom_role_entry':
492 return 'lomRoleEntity:'.$a_query;
497 return 'lomFormat:'.$a_query;
499 case 'lom_operating_system':
500 return 'lomOS:'.$a_query;
503 return 'lomBrowser:'.$a_query;
506 case 'lom_interactivity':
507 return 'lomInteractivity:'.$a_query;
510 return 'lomResource:'.$a_query;
512 case 'lom_level_start':
514 include_once
'./Services/MetaData/classes/class.ilMDUtilSelect.php';
516 for($i = $a_query; $i <= count(
$options); $i++)
518 if(strlen($q_string))
522 $q_string .= (
'lomLevel:"'.$options[$i].
'" ');
526 case 'lom_level_end':
528 include_once
'./Services/MetaData/classes/class.ilMDUtilSelect.php';
530 for($i = 1; $i <= $a_query; $i++)
532 if(strlen($q_string))
536 $q_string .= (
'lomLevel:"'.$options[$i].
'" ');
540 case 'lom_density_start':
542 include_once
'./Services/MetaData/classes/class.ilMDUtilSelect.php';
544 for($i = $a_query; $i <= count(
$options); $i++)
546 if(strlen($q_string))
550 $q_string .= (
'lomDensity:"'.$options[$i].
'" ');
554 case 'lom_density_end':
556 include_once
'./Services/MetaData/classes/class.ilMDUtilSelect.php';
558 for($i = 1; $i <= $a_query; $i++)
560 if(strlen($q_string))
564 $q_string .= (
'lomDensity:"'.$options[$i].
'" ');
568 case 'lom_user_role':
569 return 'lomUserRole:'.$a_query;
572 return 'lomContext:'.$a_query;
574 case 'lom_difficulty_start':
576 include_once
'./Services/MetaData/classes/class.ilMDUtilSelect.php';
578 for($i = $a_query; $i <= count(
$options); $i++)
580 if(strlen($q_string))
584 $q_string .= (
'lomDifficulty:"'.$options[$i].
'" ');
588 case 'lom_difficulty_end':
590 include_once
'./Services/MetaData/classes/class.ilMDUtilSelect.php';
592 for($i = 1; $i <= $a_query; $i++)
594 if(strlen($q_string))
598 $q_string .= (
'lomDifficulty:"'.$options[$i].
'" ');
604 return 'lomCosts:'.$a_query;
606 case 'lom_copyright':
607 return 'lomCopyright:'.$a_query;
611 return 'lomPurpose:'.$a_query;
614 return 'lomTaxon:'.$a_query;
617 if(substr($a_field,0,3) !=
'adv')
621 $field_id = substr($a_field,4);
622 include_once
'./Services/AdvancedMetaData/classes/class.ilAdvancedMDFieldDefinition.php';
633 $adv_query = $field->getLuceneSearchString($a_query);
637 if(!is_array($adv_query))
639 return 'advancedMetaData_'.$field_id.
': '.$adv_query;
644 foreach($adv_query as $adv_query_item)
646 $res[] =
'advancedMetaData_'.$field_id.
': '.$adv_query_item;
648 return '('.implode(
' OR ',
$res).
')';
660 foreach(self::getFields() as $name => $translation)
662 if($this->settings->isActive($name))
664 $this->active_fields[$name] = $translation;
680 $this->active_sections[
'default'][
'fields'][] =
'lom_content';
681 $this->active_sections[
'default'][
'name'] =
'';
684 case 'general_offline':
685 $this->active_sections[
'default'][
'fields'][] =
'general_offline';
686 $this->active_sections[
'default'][
'name'] =
'';
690 $this->active_sections[
'default'][
'fields'][] =
'lom_type';
691 $this->active_sections[
'default'][
'name'] =
'';
696 $this->active_sections[
'general'][
'fields'][] =
'lom_language';
697 $this->active_sections[
'general'][
'name'] = $this->lng->txt(
'meta_general');
700 $this->active_sections[
'general'][
'fields'][] =
'lom_keyword';
701 $this->active_sections[
'general'][
'name'] = $this->lng->txt(
'meta_general');
704 $this->active_sections[
'general'][
'fields'][] =
'lom_coverage';
705 $this->active_sections[
'general'][
'name'] = $this->lng->txt(
'meta_general');
707 case 'lom_structure':
708 $this->active_sections[
'general'][
'fields'][] =
'lom_structure';
709 $this->active_sections[
'general'][
'name'] = $this->lng->txt(
'meta_general');
714 $this->active_sections[
'lifecycle'][
'fields'][] =
'lom_status';
715 $this->active_sections[
'lifecycle'][
'name'] = $this->lng->txt(
'meta_lifecycle');
718 $this->active_sections[
'lifecycle'][
'fields'][] =
'lom_version';
719 $this->active_sections[
'lifecycle'][
'name'] = $this->lng->txt(
'meta_lifecycle');
721 case 'lom_contribute':
722 $this->active_sections[
'lifecycle'][
'fields'][] =
'lom_contribute';
723 $this->active_sections[
'lifecycle'][
'name'] = $this->lng->txt(
'meta_lifecycle');
728 $this->active_sections[
'technical'][
'fields'][] =
'lom_format';
729 $this->active_sections[
'technical'][
'name'] = $this->lng->txt(
'meta_technical');
731 case 'lom_operating_system':
732 $this->active_sections[
'technical'][
'fields'][] =
'lom_operating_system';
733 $this->active_sections[
'technical'][
'name'] = $this->lng->txt(
'meta_technical');
736 $this->active_sections[
'technical'][
'fields'][] =
'lom_browser';
737 $this->active_sections[
'technical'][
'name'] = $this->lng->txt(
'meta_technical');
741 case 'lom_interactivity':
742 $this->active_sections[
'education'][
'fields'][] =
'lom_interactivity';
743 $this->active_sections[
'education'][
'name'] = $this->lng->txt(
'meta_education');
746 $this->active_sections[
'education'][
'fields'][] =
'lom_resource';
747 $this->active_sections[
'education'][
'name'] = $this->lng->txt(
'meta_education');
750 $this->active_sections[
'education'][
'fields'][] =
'lom_level';
751 $this->active_sections[
'education'][
'name'] = $this->lng->txt(
'meta_education');
754 $this->active_sections[
'education'][
'fields'][] =
'lom_density';
755 $this->active_sections[
'education'][
'name'] = $this->lng->txt(
'meta_education');
757 case 'lom_user_role':
758 $this->active_sections[
'education'][
'fields'][] =
'lom_user_role';
759 $this->active_sections[
'education'][
'name'] = $this->lng->txt(
'meta_education');
762 $this->active_sections[
'education'][
'fields'][] =
'lom_context';
763 $this->active_sections[
'education'][
'name'] = $this->lng->txt(
'meta_education');
765 case 'lom_difficulty':
766 $this->active_sections[
'education'][
'fields'][] =
'lom_difficulty';
767 $this->active_sections[
'education'][
'name'] = $this->lng->txt(
'meta_education');
772 $this->active_sections[
'rights'][
'fields'][] =
'lom_costs';
773 $this->active_sections[
'rights'][
'name'] = $this->lng->txt(
'meta_rights');
775 case 'lom_copyright':
776 $this->active_sections[
'rights'][
'fields'][] =
'lom_copyright';
777 $this->active_sections[
'rights'][
'name'] = $this->lng->txt(
'meta_rights');
782 $this->active_sections[
'classification'][
'fields'][] =
'lom_purpose';
783 $this->active_sections[
'classification'][
'name'] = $this->lng->txt(
'meta_classification');
786 $this->active_sections[
'classification'][
'fields'][] =
'lom_taxon';
787 $this->active_sections[
'classification'][
'name'] = $this->lng->txt(
'meta_classification');
791 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();
801 $this->active_sections[
'adv_record_'.$record_id][
'fields'][] = $field_name;
811 protected function getRangeSelect($txt_from,$select_from,$txt_until,$select_until)
813 $tpl =
new ilTemplate(
'tpl.range_search.html',
true,
true,
'Services/Search');
814 $tpl->setVariable(
'TXT_FROM',$txt_from);
815 $tpl->setVariable(
'FROM',$select_from);
816 $tpl->setVariable(
'TXT_UPTO',$txt_until);
817 $tpl->setVariable(
'UPTO',$select_until);