39 include_once
'Services/Search/classes/class.ilSearchBaseGUI.php';
40 include_once
'Services/MetaData/classes/class.ilMDUtilSelect.php';
41 include_once
'./Services/Search/classes/Lucene/class.ilLuceneAdvancedSearchFields.php';
70 $this->tabs_gui = $ilTabs;
74 $this->lng->loadLanguageModule(
'meta');
82 return ROOT_FOLDER_ID;
94 $next_class = $this->ctrl->getNextClass($this);
95 $cmd = $this->ctrl->getCmd();
100 case 'ilobjectcopygui':
103 include_once
'./Services/Object/classes/class.ilObjectCopyGUI.php';
105 $this->ctrl->forwardCommand($cp);
112 switch(
$_SESSION[
'search_last_sub_section'])
114 case self::TYPE_ADV_MD:
115 $cmd =
"showSavedAdvMDResults";
119 $cmd =
"showSavedResults";
133 $this->options = array();
134 $this->search_cache->setQuery(array());
135 $this->search_cache->save();
142 $this->search_mode =
'in_results';
143 $this->search_cache->setResultPageNumber(1);
155 $this->search_cache->setRoot((
int)
$_POST[
'root_id']);
156 $this->search_cache->setResultPageNumber(1);
157 $this->search_cache->setQuery(array(
'lom_content' =>
ilUtil::stripSlashes($_POST[
'queryString'])));
158 $this->search_cache->save();
160 $this->options = $this->search_cache->getQuery();
161 $this->options[
'type'] =
'all';
174 if(!isset(
$_GET[
'page_number']) and $this->search_mode !=
'in_results' )
177 $this->search_cache->deleteCachedEntries();
180 if(isset(
$_POST[
'query']))
182 $this->search_cache->setQuery(
$_POST[
'query']);
186 include_once
'Services/Search/classes/class.ilSearchResult.php';
245 if($this->search_mode ==
'in_results')
247 include_once
'Services/Search/classes/class.ilSearchResult.php';
252 $res->diffEntriesFromResult($old_result_obj);
260 if(!count(
$res->getResults()))
265 if(
$res->isLimitReached())
267 #$message = sprintf($this->lng->txt('search_limit_reached'),$this->settings->getMaxHits());
268 #ilUtil::sendInfo($message);
273 include_once
'./Services/Search/classes/class.ilSearchResultPresentation.php';
275 $presentation->setResults(
$res->getResultsForPresentation());
276 $presentation->setPreviousNext($this->prev_link, $this->next_link);
278 if($presentation->render())
280 $this->tpl->setVariable(
'RESULTS',$presentation->getHTML(
true));
292 if(is_object($this->form))
297 include_once(
'Services/AdvancedMetaData/classes/class.ilAdvancedMDRecord.php');
298 include_once(
'Services/Form/classes/class.ilPropertyFormGUI.php');
300 $this->form->setFormAction($this->ctrl->getFormAction($this,
'performAdvMDSearch'));
301 $this->form->setTitle($this->lng->txt(
'adv_md_search_title'));
302 $this->form->addCommandButton(
'performAdvMDSearch',$this->lng->txt(
'search'));
303 #$this->form->setSubformMode('right');
306 $this->lng->txt(
'meta_keyword').
'/'.
307 $this->lng->txt(
'meta_description'),
'title');
308 $content->
setValue($this->options[
'title']);
309 $content->setSize(30);
310 $content->setMaxLength(255);
313 $group->setValue($this->options[
'title_ao']);
314 $radio_option =
new ilRadioOption($this->lng->txt(
"search_any_word"),0);
315 $group->addOption($radio_option);
316 $radio_option =
new ilRadioOption($this->lng->txt(
"search_all_words"),1);
317 $group->addOption($radio_option);
319 $this->form->addItem($content);
322 $options[
'adv_all'] = $this->lng->txt(
'search_any');
325 $options[$obj_type] = $this->lng->txt(
'objs_'.$obj_type);
328 $type->setValue($this->options[
'type']);
329 $this->form->addItem($type);
331 include_once(
'Services/AdvancedMetaData/classes/class.ilAdvancedMDRecordGUI.php');
333 $record_gui->setPropertyForm($this->form);
334 $record_gui->setSearchValues($this->options);
335 $record_gui->parse();
348 if(!isset(
$_GET[
'page_number']) and $this->search_mode !=
'in_results' )
351 $this->search_cache->delete();
354 include_once
'Services/Search/classes/class.ilSearchResult.php';
363 if($this->search_mode ==
'in_results')
365 include_once
'Services/Search/classes/class.ilSearchResult.php';
370 $res->diffEntriesFromResult($old_result_obj);
378 if(!count(
$res->getResults()))
383 if(
$res->isLimitReached())
385 #$message = sprintf($this->lng->txt('search_limit_reached'),$this->settings->getMaxHits());
386 #ilUtil::sendInfo($message);
391 include_once
'./Services/Search/classes/class.ilSearchResultPresentation.php';
393 $presentation->setResults(
$res->getResultsForPresentation());
394 $presentation->setPreviousNext($this->prev_link, $this->next_link);
396 if($presentation->render())
398 $this->tpl->setVariable(
'RESULTS',$presentation->getHTML(
true));
414 $this->options =
$_SESSION[
'search_adv_md'];
417 $this->tabs_gui->setSubTabActive(
'search_adv_md');
419 $this->tpl->addBlockFile(
'ADM_CONTENT',
'adm_content',
'tpl.advanced_adv_search.html',
'Services/Search');
422 $this->tpl->setVariable(
'SEARCH_FORM',$this->form->getHTML());
433 include_once
'./Services/Form/classes/class.ilPropertyFormGUI.php';
436 $this->form->setFormAction($this->ctrl->getFormAction($this,
'performSearch'));
437 $this->form->setTitle($this->lng->txt(
'search_advanced'));
438 $this->form->addCommandButton(
'performSearch',$this->lng->txt(
'search'));
439 $this->form->addCommandButton(
'reset',$this->lng->txt(
'reset'));
441 foreach($this->fields->getActiveSections() as $definition)
443 if($definition[
'name'] !=
'default')
446 $section->setTitle($definition[
'name']);
450 foreach($definition[
'fields'] as $field_name)
452 if(is_object($element = $this->fields->getFormElement($this->search_cache->getQuery(),$field_name)))
454 $this->form->addItem($element);
468 $this->tabs_gui->setSubTabActive(
'search_lom');
470 $this->tpl->addBlockFile(
'ADM_CONTENT',
'adm_content',
'tpl.advanced_search.html',
'Services/Search');
473 $this->tpl->setVariable(
'SEARCH_FORM',$this->form->getHTML());
485 $ilTabs->addTab(
"search", $this->lng->txt(
"search"),
486 $this->ctrl->getLinkTargetByClass(
'ilsearchgui'));
487 $ilTabs->addTab(
"adv_search", $this->lng->txt(
"search_advanced"),
488 $this->ctrl->getLinkTarget($this));
489 $ilTabs->activateTab(
"adv_search");
516 include_once
'Services/Search/classes/class.ilSearchResult.php';
525 if(count($result_obj->getResults()))
527 $this->
addPager($result_obj,
'adv_max_page');
529 include_once
'./Services/Search/classes/class.ilSearchResultPresentation.php';
531 $presentation->setResults($result_obj->getResultsForPresentation());
532 $presentation->setPreviousNext($this->prev_link, $this->next_link);
534 if($presentation->render())
536 $this->tpl->setVariable(
'RESULTS',$presentation->getHTML(
true));
549 include_once
'Services/Search/classes/class.ilSearchResult.php';
558 if(count($result_obj->getResults()))
560 $this->
addPager($result_obj,
'adv_max_page');
562 include_once
'./Services/Search/classes/class.ilSearchResultPresentation.php';
564 $presentation->setResults($result_obj->getResultsForPresentation());
565 $presentation->setPreviousNext($this->prev_link, $this->next_link);
567 if($presentation->render())
569 $this->tpl->setVariable(
'RESULTS',$presentation->getHTML(
true));
578 include_once
'Services/Search/classes/class.ilObjectSearchFactory.php';
579 include_once
'Services/Search/classes/class.ilQueryParser.php';
580 include_once
'Services/Search/classes/class.ilSearchResult.php';
582 if(!$this->options[
'lom_content'])
590 #$query_parser->setCombination($this->options['content_ao']);
592 $query_parser->parse();
594 if($this->options[
'type'] ==
'all' or $this->options[
'type'] ==
'lms')
598 $res_cont =& $lm_search->performSearch();
599 $res->mergeEntries($res_cont);
601 if($this->options[
'type'] ==
'all' or $this->options[
'type'] ==
'tst')
604 $res_tes =& $tst_search->performSearch();
605 $res->mergeEntries($res_tes);
607 if($this->options[
'type'] ==
'all' or $this->options[
'type'] ==
'mep')
610 $res_med =& $med_search->performSearch();
611 $res->mergeEntries($res_med);
613 if($this->options[
'type'] ==
'all' or $this->options[
'type'] ==
'glo')
616 $res_glo =& $glo_search->performSearch();
617 $res->mergeEntries($res_glo);
619 if($this->options[
'type'] ==
'all' or $this->options[
'type'] ==
'webr')
622 $res_web =& $web_search->performSearch();
623 $res->mergeEntries($res_web);
627 $res->mergeEntries($tit_res);
636 if(!$this->options[
'lom_content'])
641 include_once
'Services/Search/classes/class.ilObjectSearchFactory.php';
642 include_once
'Services/Search/classes/class.ilQueryParser.php';
645 #$query_parser->setCombination($this->options['title_ao']);
647 $query_parser->parse();
650 $meta_search->setFilter($this->filter);
651 $meta_search->setMode(
'title_description');
652 $meta_search->setOptions($this->options);
653 $res_tit =& $meta_search->performSearch();
655 $meta_search->setMode(
'keyword_all');
656 $res_key =& $meta_search->performSearch();
659 $res_tit->mergeEntries($res_key);
669 if(!$this->options[
'lom_coverage'] and !$this->options[
'lom_structure'])
674 include_once
'Services/Search/classes/class.ilObjectSearchFactory.php';
675 include_once
'Services/Search/classes/class.ilQueryParser.php';
677 if($this->options[
'lom_coverage'])
680 #$query_parser->setCombination($this->options['coverage_ao']);
682 $query_parser->parse();
689 $meta_search->setFilter($this->filter);
690 $meta_search->setMode(
'general');
691 $meta_search->setOptions($this->options);
692 $res =& $meta_search->performSearch();
700 if(!$this->options[
'lom_status'] and !$this->options[
'lom_version'])
704 include_once
'Services/Search/classes/class.ilObjectSearchFactory.php';
705 include_once
'Services/Search/classes/class.ilQueryParser.php';
708 #$query_parser->setCombination($this->options['version_ao']);
710 $query_parser->parse();
713 $meta_search->setFilter($this->filter);
714 $meta_search->setMode(
'lifecycle');
715 $meta_search->setOptions($this->options);
716 $res =& $meta_search->performSearch();
722 if(!$this->options[
'lom_language'])
726 include_once
'Services/Search/classes/class.ilObjectSearchFactory.php';
727 include_once
'Services/Search/classes/class.ilQueryParser.php';
731 $meta_search->setFilter($this->filter);
732 $meta_search->setMode(
'language');
733 $meta_search->setOptions($this->options);
734 $res =& $meta_search->performSearch();
740 if(!strlen($this->options[
'lom_role']))
744 include_once
'Services/Search/classes/class.ilObjectSearchFactory.php';
745 include_once
'Services/Search/classes/class.ilQueryParser.php';
749 $meta_search->setFilter($this->filter);
750 $meta_search->setMode(
'contribute');
751 $meta_search->setOptions($this->options);
752 $res =& $meta_search->performSearch();
759 if(!$this->options[
'lom_role_entry'])
764 include_once
'Services/Search/classes/class.ilObjectSearchFactory.php';
765 include_once
'Services/Search/classes/class.ilQueryParser.php';
768 #$query_parser->setCombination($this->options['entity_ao']);
770 $query_parser->parse();
773 $meta_search->setFilter($this->filter);
774 $meta_search->setMode(
'entity');
775 $meta_search->setOptions($this->options);
776 $res =& $meta_search->performSearch();
784 include_once
'Services/Search/classes/class.ilObjectSearchFactory.php';
785 include_once
'Services/Search/classes/class.ilQueryParser.php';
789 $meta_search->setFilter($this->filter);
790 $meta_search->setMode(
'requirement');
791 $meta_search->setOptions($this->options);
792 $res =& $meta_search->performSearch();
798 include_once
'Services/Search/classes/class.ilObjectSearchFactory.php';
799 include_once
'Services/Search/classes/class.ilQueryParser.php';
803 $meta_search->setFilter($this->filter);
804 $meta_search->setMode(
'format');
805 $meta_search->setOptions($this->options);
806 $res =& $meta_search->performSearch();
812 include_once
'Services/Search/classes/class.ilObjectSearchFactory.php';
813 include_once
'Services/Search/classes/class.ilQueryParser.php';
817 $meta_search->setFilter($this->filter);
818 $meta_search->setMode(
'educational');
819 $meta_search->setOptions($this->options);
820 $res =& $meta_search->performSearch();
826 include_once
'Services/Search/classes/class.ilObjectSearchFactory.php';
827 include_once
'Services/Search/classes/class.ilQueryParser.php';
831 $meta_search->setFilter($this->filter);
832 $meta_search->setMode(
'typical_age_range');
833 $meta_search->setOptions($this->options);
834 $res =& $meta_search->performSearch();
840 if(!$this->options[
'lom_copyright'] and !$this->options[
'lom_costs'])
844 include_once
'Services/Search/classes/class.ilObjectSearchFactory.php';
845 include_once
'Services/Search/classes/class.ilQueryParser.php';
849 $meta_search->setFilter($this->filter);
850 $meta_search->setMode(
'rights');
851 $meta_search->setOptions($this->options);
852 $res =& $meta_search->performSearch();
860 if(!$this->options[
'lom_purpose'])
864 include_once
'Services/Search/classes/class.ilObjectSearchFactory.php';
865 include_once
'Services/Search/classes/class.ilQueryParser.php';
869 $meta_search->setFilter($this->filter);
870 $meta_search->setMode(
'classification');
871 $meta_search->setOptions($this->options);
872 $res =& $meta_search->performSearch();
880 if(!$this->options[
'lom_taxon'])
884 include_once
'Services/Search/classes/class.ilObjectSearchFactory.php';
885 include_once
'Services/Search/classes/class.ilQueryParser.php';
889 $query_parser->parse();
892 $meta_search->setFilter($this->filter);
893 $meta_search->setMode(
'taxon');
894 $meta_search->setOptions($this->options);
895 $res =& $meta_search->performSearch();
909 include_once(
'Services/AdvancedMetaData/classes/class.ilAdvancedMDFieldDefinition.php');
910 foreach(
$_POST as $key => $value)
912 if(!is_numeric($key))
922 include_once
'Services/Search/classes/class.ilObjectSearchFactory.php';
923 include_once
'Services/Search/classes/class.ilQueryParser.php';
927 $value = (int) $value;
948 if(
$_POST[
'boolean'][$key] == 1)
950 $query_parser->setCombination(
'and');
954 $query_parser->setCombination(
'or');
956 $query_parser->parse();
959 $adv_md_search->setDefinition($def);
960 $adv_md_search->setTimeRange($start,$end);
961 $adv_md_search->setFilter($this->filter);
962 $res_field = $adv_md_search->performSearch();
972 if(!$this->options[
'lom_keyword'])
976 include_once
'Services/Search/classes/class.ilObjectSearchFactory.php';
977 include_once
'Services/Search/classes/class.ilQueryParser.php';
980 #$query_parser->setCombination($this->options['keyword_ao']);
982 $query_parser->parse();
985 $meta_search->setFilter($this->filter);
986 $meta_search->setMode(
'keyword');
987 $meta_search->setOptions($this->options);
988 $res =& $meta_search->performSearch();
995 if(isset(
$_POST[
'cmd'][
'performSearch']))
999 elseif(isset(
$_POST[
'cmd'][
'performAdvMDSearch']))
1005 $this->options =
$_SESSION[
'search_adv'];
1010 $this->filter = array();
1012 $this->options[
'type'] =
'all';
1013 switch($this->options[
'type'])
1016 $this->filter[] =
'cat';
1020 $this->filter[] =
'webr';
1024 $this->filter[] =
'lm';
1025 $this->filter[] =
'dbk';
1026 $this->filter[] =
'pg';
1027 $this->filter[] =
'st';
1028 $this->filter[] =
'sahs';
1029 $this->filter[] =
'htlm';
1033 $this->filter[] =
'glo';
1037 $this->filter[] =
'tst';
1038 $this->filter[] =
'svy';
1039 $this->filter[] =
'qpl';
1040 $this->filter[] =
'spl';
1044 $this->filter[] =
'mep';
1048 $this->filter[] =
'crs';
1052 $this->filter[] =
'file';
1056 include_once(
'Services/AdvancedMetaData/classes/class.ilAdvancedMDRecord.php');
1062 $this->filter[] =
'webr';
1063 $this->filter[] =
'crs';
1064 $this->filter[] =
'mep';
1065 $this->filter[] =
'tst';
1066 $this->filter[] =
'svy';
1067 $this->filter[] =
'qpl';
1068 $this->filter[] =
'spl';
1069 $this->filter[] =
'glo';
1070 $this->filter[] =
'lm';
1071 $this->filter[] =
'dbk';
1072 $this->filter[] =
'pg';
1073 $this->filter[] =
'st';
1074 $this->filter[] =
'sahs';
1075 $this->filter[] =
'htlm';
1076 $this->filter[] =
'file';
1083 $options = array(
'all' => $this->lng->txt(
'search_any'),
1084 'crs' => $this->lng->txt(
'objs_crs'),
1085 'lms' => $this->lng->txt(
'learning_resources'),
1086 'glo' => $this->lng->txt(
'objs_glo'),
1087 'mep' => $this->lng->txt(
'objs_mep'),
1088 'tst' => $this->lng->txt(
'search_tst_svy'),
1089 'file'=> $this->lng->txt(
'objs_file'),
1090 'webr' => $this->lng->txt(
'objs_webr'));
1099 if($this->stored ==
false)
1101 $res->mergeEntries($new_res);
1102 $this->stored =
true;
1108 $res->intersectEntries($new_res);
1123 include_once(
'Services/Search/classes/class.ilUserSearchCache.php');
1126 if(
$_GET[
'page_number'])
1128 $this->search_cache->setResultPageNumber((
int)
$_GET[
'page_number']);
1130 if(
$_POST[
'cmd'][
'performSearch'])
1133 $this->search_cache->save();
1147 include_once(
'Services/AdvancedMetaData/classes/class.ilAdvancedMDFieldDefinition.php');
1152 $ilTabs->addSubTabTarget(
'search_lom',$this->ctrl->getLinkTarget($this,
'showSavedResults'));
1153 #$ilTabs->addSubTabTarget('search_adv_md',$this->ctrl->getLinkTarget($this,'showSavedAdvMDResults'));
1166 return mktime($time[
'h'],$time[
'm'],0,$date[
'm'],$date[
'd'],$date[
'y']);
1178 if($type == self::TYPE_LOM)