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());
479 global $ilTabs, $ilHelp;
483 $ilHelp->setScreenIdComponent(
"src");
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");
504 include_once
'Services/Search/classes/class.ilSearchResult.php';
513 if(count($result_obj->getResults()))
515 $this->
addPager($result_obj,
'adv_max_page');
517 include_once
'./Services/Search/classes/class.ilSearchResultPresentation.php';
519 $presentation->setResults($result_obj->getResultsForPresentation());
520 $presentation->setPreviousNext($this->prev_link, $this->next_link);
522 if($presentation->render())
524 $this->tpl->setVariable(
'RESULTS',$presentation->getHTML(
true));
537 include_once
'Services/Search/classes/class.ilSearchResult.php';
546 if(count($result_obj->getResults()))
548 $this->
addPager($result_obj,
'adv_max_page');
550 include_once
'./Services/Search/classes/class.ilSearchResultPresentation.php';
552 $presentation->setResults($result_obj->getResultsForPresentation());
553 $presentation->setPreviousNext($this->prev_link, $this->next_link);
555 if($presentation->render())
557 $this->tpl->setVariable(
'RESULTS',$presentation->getHTML(
true));
566 include_once
'Services/Search/classes/class.ilObjectSearchFactory.php';
567 include_once
'Services/Search/classes/class.ilQueryParser.php';
568 include_once
'Services/Search/classes/class.ilSearchResult.php';
570 if(!$this->options[
'lom_content'])
578 #$query_parser->setCombination($this->options['content_ao']);
580 $query_parser->parse();
582 if($this->options[
'type'] ==
'all' or $this->options[
'type'] ==
'lms')
586 $res_cont =& $lm_search->performSearch();
587 $res->mergeEntries($res_cont);
589 if($this->options[
'type'] ==
'all' or $this->options[
'type'] ==
'tst')
592 $res_tes =& $tst_search->performSearch();
593 $res->mergeEntries($res_tes);
595 if($this->options[
'type'] ==
'all' or $this->options[
'type'] ==
'mep')
598 $res_med =& $med_search->performSearch();
599 $res->mergeEntries($res_med);
601 if($this->options[
'type'] ==
'all' or $this->options[
'type'] ==
'glo')
604 $res_glo =& $glo_search->performSearch();
605 $res->mergeEntries($res_glo);
607 if($this->options[
'type'] ==
'all' or $this->options[
'type'] ==
'webr')
610 $res_web =& $web_search->performSearch();
611 $res->mergeEntries($res_web);
615 $res->mergeEntries($tit_res);
624 if(!$this->options[
'lom_content'])
629 include_once
'Services/Search/classes/class.ilObjectSearchFactory.php';
630 include_once
'Services/Search/classes/class.ilQueryParser.php';
633 #$query_parser->setCombination($this->options['title_ao']);
635 $query_parser->parse();
638 $meta_search->setFilter($this->filter);
639 $meta_search->setMode(
'title_description');
640 $meta_search->setOptions($this->options);
641 $res_tit =& $meta_search->performSearch();
643 $meta_search->setMode(
'keyword_all');
644 $res_key =& $meta_search->performSearch();
647 $res_tit->mergeEntries($res_key);
657 if(!$this->options[
'lom_coverage'] and !$this->options[
'lom_structure'])
662 include_once
'Services/Search/classes/class.ilObjectSearchFactory.php';
663 include_once
'Services/Search/classes/class.ilQueryParser.php';
665 if($this->options[
'lom_coverage'])
668 #$query_parser->setCombination($this->options['coverage_ao']);
670 $query_parser->parse();
677 $meta_search->setFilter($this->filter);
678 $meta_search->setMode(
'general');
679 $meta_search->setOptions($this->options);
680 $res =& $meta_search->performSearch();
688 if(!$this->options[
'lom_status'] and !$this->options[
'lom_version'])
692 include_once
'Services/Search/classes/class.ilObjectSearchFactory.php';
693 include_once
'Services/Search/classes/class.ilQueryParser.php';
696 #$query_parser->setCombination($this->options['version_ao']);
698 $query_parser->parse();
701 $meta_search->setFilter($this->filter);
702 $meta_search->setMode(
'lifecycle');
703 $meta_search->setOptions($this->options);
704 $res =& $meta_search->performSearch();
710 if(!$this->options[
'lom_language'])
714 include_once
'Services/Search/classes/class.ilObjectSearchFactory.php';
715 include_once
'Services/Search/classes/class.ilQueryParser.php';
719 $meta_search->setFilter($this->filter);
720 $meta_search->setMode(
'language');
721 $meta_search->setOptions($this->options);
722 $res =& $meta_search->performSearch();
728 if(!strlen($this->options[
'lom_role']))
732 include_once
'Services/Search/classes/class.ilObjectSearchFactory.php';
733 include_once
'Services/Search/classes/class.ilQueryParser.php';
737 $meta_search->setFilter($this->filter);
738 $meta_search->setMode(
'contribute');
739 $meta_search->setOptions($this->options);
740 $res =& $meta_search->performSearch();
747 if(!$this->options[
'lom_role_entry'])
752 include_once
'Services/Search/classes/class.ilObjectSearchFactory.php';
753 include_once
'Services/Search/classes/class.ilQueryParser.php';
756 #$query_parser->setCombination($this->options['entity_ao']);
758 $query_parser->parse();
761 $meta_search->setFilter($this->filter);
762 $meta_search->setMode(
'entity');
763 $meta_search->setOptions($this->options);
764 $res =& $meta_search->performSearch();
772 include_once
'Services/Search/classes/class.ilObjectSearchFactory.php';
773 include_once
'Services/Search/classes/class.ilQueryParser.php';
777 $meta_search->setFilter($this->filter);
778 $meta_search->setMode(
'requirement');
779 $meta_search->setOptions($this->options);
780 $res =& $meta_search->performSearch();
786 include_once
'Services/Search/classes/class.ilObjectSearchFactory.php';
787 include_once
'Services/Search/classes/class.ilQueryParser.php';
791 $meta_search->setFilter($this->filter);
792 $meta_search->setMode(
'format');
793 $meta_search->setOptions($this->options);
794 $res =& $meta_search->performSearch();
800 include_once
'Services/Search/classes/class.ilObjectSearchFactory.php';
801 include_once
'Services/Search/classes/class.ilQueryParser.php';
805 $meta_search->setFilter($this->filter);
806 $meta_search->setMode(
'educational');
807 $meta_search->setOptions($this->options);
808 $res =& $meta_search->performSearch();
814 include_once
'Services/Search/classes/class.ilObjectSearchFactory.php';
815 include_once
'Services/Search/classes/class.ilQueryParser.php';
819 $meta_search->setFilter($this->filter);
820 $meta_search->setMode(
'typical_age_range');
821 $meta_search->setOptions($this->options);
822 $res =& $meta_search->performSearch();
828 if(!$this->options[
'lom_copyright'] and !$this->options[
'lom_costs'])
832 include_once
'Services/Search/classes/class.ilObjectSearchFactory.php';
833 include_once
'Services/Search/classes/class.ilQueryParser.php';
837 $meta_search->setFilter($this->filter);
838 $meta_search->setMode(
'rights');
839 $meta_search->setOptions($this->options);
840 $res =& $meta_search->performSearch();
848 if(!$this->options[
'lom_purpose'])
852 include_once
'Services/Search/classes/class.ilObjectSearchFactory.php';
853 include_once
'Services/Search/classes/class.ilQueryParser.php';
857 $meta_search->setFilter($this->filter);
858 $meta_search->setMode(
'classification');
859 $meta_search->setOptions($this->options);
860 $res =& $meta_search->performSearch();
868 if(!$this->options[
'lom_taxon'])
872 include_once
'Services/Search/classes/class.ilObjectSearchFactory.php';
873 include_once
'Services/Search/classes/class.ilQueryParser.php';
877 $query_parser->parse();
880 $meta_search->setFilter($this->filter);
881 $meta_search->setMode(
'taxon');
882 $meta_search->setOptions($this->options);
883 $res =& $meta_search->performSearch();
897 include_once(
'Services/AdvancedMetaData/classes/class.ilAdvancedMDFieldDefinition.php');
898 foreach(
$_POST as $key => $value)
900 if(!is_numeric($key))
910 include_once
'Services/Search/classes/class.ilObjectSearchFactory.php';
911 include_once
'Services/Search/classes/class.ilQueryParser.php';
915 $value = (int) $value;
936 if(
$_POST[
'boolean'][$key] == 1)
938 $query_parser->setCombination(
'and');
942 $query_parser->setCombination(
'or');
944 $query_parser->parse();
947 $adv_md_search->setDefinition($def);
948 $adv_md_search->setTimeRange($start,$end);
949 $adv_md_search->setFilter($this->filter);
950 $res_field = $adv_md_search->performSearch();
960 if(!$this->options[
'lom_keyword'])
964 include_once
'Services/Search/classes/class.ilObjectSearchFactory.php';
965 include_once
'Services/Search/classes/class.ilQueryParser.php';
968 #$query_parser->setCombination($this->options['keyword_ao']);
970 $query_parser->parse();
973 $meta_search->setFilter($this->filter);
974 $meta_search->setMode(
'keyword');
975 $meta_search->setOptions($this->options);
976 $res =& $meta_search->performSearch();
983 if(isset(
$_POST[
'cmd'][
'performSearch']))
987 elseif(isset(
$_POST[
'cmd'][
'performAdvMDSearch']))
993 $this->options =
$_SESSION[
'search_adv'];
998 $this->filter = array();
1000 $this->options[
'type'] =
'all';
1001 switch($this->options[
'type'])
1004 $this->filter[] =
'cat';
1008 $this->filter[] =
'webr';
1012 $this->filter[] =
'lm';
1013 $this->filter[] =
'dbk';
1014 $this->filter[] =
'pg';
1015 $this->filter[] =
'st';
1016 $this->filter[] =
'sahs';
1017 $this->filter[] =
'htlm';
1021 $this->filter[] =
'glo';
1025 $this->filter[] =
'tst';
1026 $this->filter[] =
'svy';
1027 $this->filter[] =
'qpl';
1028 $this->filter[] =
'spl';
1032 $this->filter[] =
'mep';
1036 $this->filter[] =
'crs';
1040 $this->filter[] =
'file';
1044 include_once(
'Services/AdvancedMetaData/classes/class.ilAdvancedMDRecord.php');
1050 $this->filter[] =
'webr';
1051 $this->filter[] =
'crs';
1052 $this->filter[] =
'mep';
1053 $this->filter[] =
'tst';
1054 $this->filter[] =
'svy';
1055 $this->filter[] =
'qpl';
1056 $this->filter[] =
'spl';
1057 $this->filter[] =
'glo';
1058 $this->filter[] =
'lm';
1059 $this->filter[] =
'dbk';
1060 $this->filter[] =
'pg';
1061 $this->filter[] =
'st';
1062 $this->filter[] =
'sahs';
1063 $this->filter[] =
'htlm';
1064 $this->filter[] =
'file';
1071 $options = array(
'all' => $this->lng->txt(
'search_any'),
1072 'crs' => $this->lng->txt(
'objs_crs'),
1073 'lms' => $this->lng->txt(
'learning_resources'),
1074 'glo' => $this->lng->txt(
'objs_glo'),
1075 'mep' => $this->lng->txt(
'objs_mep'),
1076 'tst' => $this->lng->txt(
'search_tst_svy'),
1077 'file'=> $this->lng->txt(
'objs_file'),
1078 'webr' => $this->lng->txt(
'objs_webr'));
1087 if($this->stored ==
false)
1089 $res->mergeEntries($new_res);
1090 $this->stored =
true;
1096 $res->intersectEntries($new_res);
1111 include_once(
'Services/Search/classes/class.ilUserSearchCache.php');
1114 if(
$_GET[
'page_number'])
1116 $this->search_cache->setResultPageNumber((
int)
$_GET[
'page_number']);
1118 if(
$_POST[
'cmd'][
'performSearch'])
1121 $this->search_cache->save();
1135 include_once(
'Services/AdvancedMetaData/classes/class.ilAdvancedMDFieldDefinition.php');
1140 $ilTabs->addSubTabTarget(
'search_lom',$this->ctrl->getLinkTarget($this,
'showSavedResults'));
1141 #$ilTabs->addSubTabTarget('search_adv_md',$this->ctrl->getLinkTarget($this,'showSavedAdvMDResults'));
1154 return mktime($time[
'h'],$time[
'm'],0,$date[
'm'],$date[
'd'],$date[
'y']);
1166 if($type == self::TYPE_LOM)