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 if($def->isSearchable())
126 $fields[
'adv_'.$def->getFieldId()] = $def->getTitle();
138 return $this->active_fields ? $this->active_fields : array();
143 return $this->active_sections ? $this->active_sections : array();
148 include_once
'./Services/MetaData/classes/class.ilMDUtilSelect.php';
150 $a_post_name =
'query['.$a_field_name.
']';
152 switch($a_field_name)
154 case 'general_offline':
155 $offline_options = array(
156 '0' => $this->lng->txt(
'search_any'),
157 self::ONLINE_QUERY => $this->lng->txt(
'search_option_online'),
158 self::OFFLINE_QUERY => $this->lng->txt(
'search_option_offline')
160 $offline =
new ilSelectInputGUI($this->active_fields[$a_field_name],$a_post_name);
161 $offline->setOptions($offline_options);
162 $offline->setValue($a_query[
'general_offline']);
166 $text =
new ilTextInputGUI($this->active_fields[$a_field_name],$a_post_name);
167 $text->setSubmitFormOnEnter(
true);
168 $text->setValue($a_query[
'lom_content']);
170 $text->setMaxLength(255);
175 $select =
new ilSelectInputGUI($this->active_fields[$a_field_name],$a_post_name);
176 $select->setValue($a_query[
'lom_language']);
180 array(0 => $this->lng->txt(
'search_any')),
185 $text =
new ilTextInputGUI($this->active_fields[$a_field_name],$a_post_name);
186 $text->setSubmitFormOnEnter(
true);
187 $text->setValue($a_query[
'lom_keyword']);
189 $text->setMaxLength(255);
193 $text =
new ilTextInputGUI($this->active_fields[$a_field_name],$a_post_name);
194 $text->setSubmitFormOnEnter(
true);
195 $text->setValue($a_query[
'lom_coverage']);
197 $text->setMaxLength(255);
200 case 'lom_structure':
201 $select =
new ilSelectInputGUI($this->active_fields[$a_field_name],$a_post_name);
202 $select->setValue($a_query[
'lom_structure']);
206 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')),
222 $text =
new ilTextInputGUI($this->active_fields[$a_field_name],$a_post_name);
223 $text->setSubmitFormOnEnter(
true);
224 $text->setValue($a_query[
'lom_version']);
226 $text->setMaxLength(255);
229 case 'lom_contribute':
230 $select =
new ilSelectInputGUI($this->active_fields[$a_field_name],
'query['.
'lom_role'.
']');
231 $select->setValue($a_query[
'lom_role']);
235 array(0 => $this->lng->txt(
'search_any')),
238 $text =
new ilTextInputGUI($this->lng->txt(
'meta_entry'),
'query['.
'lom_role_entry'.
']');
239 $text->
setValue($a_query[
'lom_role_entry']);
241 $text->setMaxLength(255);
243 $select->addSubItem($text);
248 $select =
new ilSelectInputGUI($this->active_fields[$a_field_name],$a_post_name);
249 $select->setValue($a_query[
'lom_format']);
253 array(0 => $this->lng->txt(
'search_any')),
257 case 'lom_operating_system':
258 $select =
new ilSelectInputGUI($this->active_fields[$a_field_name],$a_post_name);
259 $select->setValue($a_query[
'lom_operating_system']);
263 array(0 => $this->lng->txt(
'search_any')),
268 $select =
new ilSelectInputGUI($this->active_fields[$a_field_name],$a_post_name);
269 $select->setValue($a_query[
'lom_browser']);
273 array(0 => $this->lng->txt(
'search_any')),
278 case 'lom_interactivity':
279 $select =
new ilSelectInputGUI($this->active_fields[$a_field_name],$a_post_name);
280 $select->setValue($a_query[
'lom_interactivity']);
284 array(0 => $this->lng->txt(
'search_any')),
289 $select =
new ilSelectInputGUI($this->active_fields[$a_field_name],$a_post_name);
290 $select->setValue($a_query[
'lom_resource']);
294 array(0 => $this->lng->txt(
'search_any')),
301 $this->lng->txt(
'from'),
303 $a_query[
'lom_level_start'],
304 'query['.
'lom_level_start'.
']',
305 array(0 => $this->lng->txt(
'search_any'))),
306 $this->lng->txt(
'until'),
308 $a_query[
'lom_level_end'],
309 'query['.
'lom_level_end'.
']',
310 array(0 => $this->lng->txt(
'search_any')))
312 $range->setHTML($html);
318 $this->lng->txt(
'from'),
320 $a_query[
'lom_density_start'],
321 'query['.
'lom_density_start'.
']',
322 array(0 => $this->lng->txt(
'search_any'))),
323 $this->lng->txt(
'until'),
325 $a_query[
'lom_density_end'],
326 'query['.
'lom_density_end'.
']',
327 array(0 => $this->lng->txt(
'search_any')))
329 $range->setHTML($html);
333 case 'lom_user_role':
334 $select =
new ilSelectInputGUI($this->active_fields[$a_field_name],$a_post_name);
335 $select->setValue($a_query[
'lom_user_role']);
339 array(0 => $this->lng->txt(
'search_any')),
344 $select =
new ilSelectInputGUI($this->active_fields[$a_field_name],$a_post_name);
345 $select->setValue($a_query[
'lom_context']);
349 array(0 => $this->lng->txt(
'search_any')),
353 case 'lom_difficulty':
356 $this->lng->txt(
'from'),
358 $a_query[
'lom_difficulty_start'],
359 'query['.
'lom_difficulty_start'.
']',
360 array(0 => $this->lng->txt(
'search_any'))),
361 $this->lng->txt(
'until'),
363 $a_query[
'lom_difficulty_end'],
364 'query['.
'lom_difficulty_end'.
']',
365 array(0 => $this->lng->txt(
'search_any')))
367 $range->setHTML($html);
372 $select =
new ilSelectInputGUI($this->active_fields[$a_field_name],$a_post_name);
373 $select->setValue($a_query[
'lom_costs']);
377 array(0 => $this->lng->txt(
'search_any')),
381 case 'lom_copyright':
382 $select =
new ilSelectInputGUI($this->active_fields[$a_field_name],$a_post_name);
383 $select->setValue($a_query[
'lom_copyright']);
387 array(0 => $this->lng->txt(
'search_any')),
395 $select =
new ilSelectInputGUI($this->active_fields[$a_field_name],$a_post_name);
396 $select->setValue($a_query[
'lom_purpose']);
400 array(0 => $this->lng->txt(
'search_any')),
405 $text =
new ilTextInputGUI($this->active_fields[$a_field_name],$a_post_name);
406 $text->setSubmitFormOnEnter(
true);
407 $text->setValue($a_query[
'lom_taxon']);
409 $text->setMaxLength(255);
413 if(substr($a_field_name,0,3) !=
'adv')
417 $field_id = substr($a_field_name,4);
418 include_once
'./Services/AdvancedMetaData/classes/class.ilAdvancedMDFieldDefinition.php';
421 switch($field->getFieldType())
424 $text =
new ilTextInputGUI($this->active_fields[$a_field_name],$a_post_name);
425 $text->setSubmitFormOnEnter(
true);
426 $text->setValue($a_query[$a_field_name]);
428 $text->setMaxLength(255);
432 $select =
new ilSelectInputGUI($this->active_fields[$a_field_name],$a_post_name);
433 $select->setValue($a_query[$a_field_name]);
434 $select->setOptions($field->getFieldValuesForSearch());
442 $check->setChecked($a_query[$a_field_name]);
447 $check->addSubItem($time);
452 $check->addSubItem($time);
471 case 'general_offline':
475 case self::OFFLINE_QUERY:
486 return 'lomLanguage:'.$a_query;
489 return 'lomKeyword:'.$a_query;
492 return 'lomCoverage:'.$a_query;
494 case 'lom_structure':
495 return 'lomStructure:'.$a_query;
499 return 'lomStatus:'.$a_query;
502 return 'lomVersion:'.$a_query;
506 return 'lomRole:'.$a_query;
508 case 'lom_role_entry':
509 return 'lomRoleEntity:'.$a_query;
514 return 'lomFormat:'.$a_query;
516 case 'lom_operating_system':
517 return 'lomOS:'.$a_query;
520 return 'lomBrowser:'.$a_query;
523 case 'lom_interactivity':
524 return 'lomInteractivity:'.$a_query;
527 return 'lomResource:'.$a_query;
529 case 'lom_level_start':
531 include_once
'./Services/MetaData/classes/class.ilMDUtilSelect.php';
533 for($i = $a_query; $i <= count(
$options); $i++)
535 if(strlen($q_string))
539 $q_string .= (
'lomLevel:"'.$options[$i].
'" ');
543 case 'lom_level_end':
545 include_once
'./Services/MetaData/classes/class.ilMDUtilSelect.php';
547 for($i = 1; $i <= $a_query; $i++)
549 if(strlen($q_string))
553 $q_string .= (
'lomLevel:"'.$options[$i].
'" ');
557 case 'lom_density_start':
559 include_once
'./Services/MetaData/classes/class.ilMDUtilSelect.php';
561 for($i = $a_query; $i <= count(
$options); $i++)
563 if(strlen($q_string))
567 $q_string .= (
'lomDensity:"'.$options[$i].
'" ');
571 case 'lom_density_end':
573 include_once
'./Services/MetaData/classes/class.ilMDUtilSelect.php';
575 for($i = 1; $i <= $a_query; $i++)
577 if(strlen($q_string))
581 $q_string .= (
'lomDensity:"'.$options[$i].
'" ');
585 case 'lom_user_role':
586 return 'lomUserRole:'.$a_query;
589 return 'lomContext:'.$a_query;
591 case 'lom_difficulty_start':
593 include_once
'./Services/MetaData/classes/class.ilMDUtilSelect.php';
595 for($i = $a_query; $i <= count(
$options); $i++)
597 if(strlen($q_string))
601 $q_string .= (
'lomDifficulty:"'.$options[$i].
'" ');
605 case 'lom_difficulty_end':
607 include_once
'./Services/MetaData/classes/class.ilMDUtilSelect.php';
609 for($i = 1; $i <= $a_query; $i++)
611 if(strlen($q_string))
615 $q_string .= (
'lomDifficulty:"'.$options[$i].
'" ');
621 return 'lomCosts:'.$a_query;
623 case 'lom_copyright':
624 return 'lomCopyright:'.$a_query;
628 return 'lomPurpose:'.$a_query;
631 return 'lomTaxon:'.$a_query;
634 if(substr($a_field,0,3) !=
'adv')
638 $field_id = substr($a_field,4);
639 include_once
'./Services/AdvancedMetaData/classes/class.ilAdvancedMDFieldDefinition.php';
642 switch($field->getFieldType())
646 return 'advancedMetaData_'.$field_id.
':'.$a_query;
650 $value =
$_POST[
'adv_'.$field_id.
'_start'];
651 $dt[
'year'] = (int) $value[
'date'][
'y'];
652 $dt[
'mon'] = (int) $value[
'date'][
'm'];
653 $dt[
'mday'] = (int) $value[
'date'][
'd'];
654 $dt[
'hours'] = (int) 0;
655 $dt[
'minutes'] = (int) 0;
656 $dt[
'seconds'] = (int) 0;
660 $value =
$_POST[
'adv_'.$field_id.
'_end'];
661 $dt[
'year'] = (int) $value[
'date'][
'y'];
662 $dt[
'mon'] = (int) $value[
'date'][
'm'];
663 $dt[
'mday'] = (int) $value[
'date'][
'd'];
664 $dt[
'hours'] = (int) 0;
665 $dt[
'minutes'] = (int) 0;
666 $dt[
'seconds'] = (int) 0;
670 return 'advancedMetaData_'.$field_id.
':{'.$ustart.
' TO '.$uend.
'}';
674 $value =
$_POST[
'adv_'.$field_id.
'_start'];
675 $dt[
'year'] = (int) $value[
'date'][
'y'];
676 $dt[
'mon'] = (int) $value[
'date'][
'm'];
677 $dt[
'mday'] = (int) $value[
'date'][
'd'];
678 $dt[
'hours'] = (int) $value[
'time'][
'h'];
679 $dt[
'minutes'] = (int) $value[
'time'][
'm'];
680 $dt[
'seconds'] = (int) 0;
684 $value =
$_POST[
'adv_'.$field_id.
'_end'];
685 $dt[
'year'] = (int) $value[
'date'][
'y'];
686 $dt[
'mon'] = (int) $value[
'date'][
'm'];
687 $dt[
'mday'] = (int) $value[
'date'][
'd'];
688 $dt[
'hours'] = (int) $value[
'time'][
'h'];
689 $dt[
'minutes'] = (int) $value[
'time'][
'm'];
690 $dt[
'seconds'] = (int) 0;
694 return 'advancedMetaData_'.$field_id.
':{'.$ustart.
' TO '.$uend.
'}';
708 foreach(self::getFields() as $name => $translation)
710 if($this->settings->isActive($name))
712 $this->active_fields[$name] = $translation;
728 $this->active_sections[
'default'][
'fields'][] =
'lom_content';
729 $this->active_sections[
'default'][
'name'] =
'';
732 case 'general_offline':
733 $this->active_sections[
'default'][
'fields'][] =
'general_offline';
734 $this->active_sections[
'default'][
'name'] =
'';
738 $this->active_sections[
'default'][
'fields'][] =
'lom_type';
739 $this->active_sections[
'default'][
'name'] =
'';
744 $this->active_sections[
'general'][
'fields'][] =
'lom_language';
745 $this->active_sections[
'general'][
'name'] = $this->lng->txt(
'meta_general');
748 $this->active_sections[
'general'][
'fields'][] =
'lom_keyword';
749 $this->active_sections[
'general'][
'name'] = $this->lng->txt(
'meta_general');
752 $this->active_sections[
'general'][
'fields'][] =
'lom_coverage';
753 $this->active_sections[
'general'][
'name'] = $this->lng->txt(
'meta_general');
755 case 'lom_structure':
756 $this->active_sections[
'general'][
'fields'][] =
'lom_structure';
757 $this->active_sections[
'general'][
'name'] = $this->lng->txt(
'meta_general');
762 $this->active_sections[
'lifecycle'][
'fields'][] =
'lom_status';
763 $this->active_sections[
'lifecycle'][
'name'] = $this->lng->txt(
'meta_lifecycle');
766 $this->active_sections[
'lifecycle'][
'fields'][] =
'lom_version';
767 $this->active_sections[
'lifecycle'][
'name'] = $this->lng->txt(
'meta_lifecycle');
769 case 'lom_contribute':
770 $this->active_sections[
'lifecycle'][
'fields'][] =
'lom_contribute';
771 $this->active_sections[
'lifecycle'][
'name'] = $this->lng->txt(
'meta_lifecycle');
776 $this->active_sections[
'technical'][
'fields'][] =
'lom_format';
777 $this->active_sections[
'technical'][
'name'] = $this->lng->txt(
'meta_technical');
779 case 'lom_operating_system':
780 $this->active_sections[
'technical'][
'fields'][] =
'lom_operating_system';
781 $this->active_sections[
'technical'][
'name'] = $this->lng->txt(
'meta_technical');
784 $this->active_sections[
'technical'][
'fields'][] =
'lom_browser';
785 $this->active_sections[
'technical'][
'name'] = $this->lng->txt(
'meta_technical');
789 case 'lom_interactivity':
790 $this->active_sections[
'education'][
'fields'][] =
'lom_interactivity';
791 $this->active_sections[
'education'][
'name'] = $this->lng->txt(
'meta_education');
794 $this->active_sections[
'education'][
'fields'][] =
'lom_resource';
795 $this->active_sections[
'education'][
'name'] = $this->lng->txt(
'meta_education');
798 $this->active_sections[
'education'][
'fields'][] =
'lom_level';
799 $this->active_sections[
'education'][
'name'] = $this->lng->txt(
'meta_education');
802 $this->active_sections[
'education'][
'fields'][] =
'lom_density';
803 $this->active_sections[
'education'][
'name'] = $this->lng->txt(
'meta_education');
805 case 'lom_user_role':
806 $this->active_sections[
'education'][
'fields'][] =
'lom_user_role';
807 $this->active_sections[
'education'][
'name'] = $this->lng->txt(
'meta_education');
810 $this->active_sections[
'education'][
'fields'][] =
'lom_context';
811 $this->active_sections[
'education'][
'name'] = $this->lng->txt(
'meta_education');
813 case 'lom_difficulty':
814 $this->active_sections[
'education'][
'fields'][] =
'lom_difficulty';
815 $this->active_sections[
'education'][
'name'] = $this->lng->txt(
'meta_education');
820 $this->active_sections[
'rights'][
'fields'][] =
'lom_costs';
821 $this->active_sections[
'rights'][
'name'] = $this->lng->txt(
'meta_rights');
823 case 'lom_copyright':
824 $this->active_sections[
'rights'][
'fields'][] =
'lom_copyright';
825 $this->active_sections[
'rights'][
'name'] = $this->lng->txt(
'meta_rights');
830 $this->active_sections[
'classification'][
'fields'][] =
'lom_purpose';
831 $this->active_sections[
'classification'][
'name'] = $this->lng->txt(
'meta_classification');
834 $this->active_sections[
'classification'][
'fields'][] =
'lom_taxon';
835 $this->active_sections[
'classification'][
'name'] = $this->lng->txt(
'meta_classification');
839 if(substr($field_name,0,3) !=
'adv')
843 $field_id = substr($field_name,4);
844 include_once
'./Services/AdvancedMetaData/classes/class.ilAdvancedMDFieldDefinition.php';
845 include_once
'./Services/AdvancedMetaData/classes/class.ilAdvancedMDRecord.php';
847 $record_id = $field->getRecordId();
849 $this->active_sections[
'adv_record_'.$record_id][
'fields'][] = $field_name;
859 protected function getRangeSelect($txt_from,$select_from,$txt_until,$select_until)
861 $tpl =
new ilTemplate(
'tpl.range_search.html',
true,
true,
'Services/Search');
862 $tpl->setVariable(
'TXT_FROM',$txt_from);
863 $tpl->setVariable(
'FROM',$select_from);
864 $tpl->setVariable(
'TXT_UPTO',$txt_until);
865 $tpl->setVariable(
'UPTO',$select_until);