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';
248 if($this->search_mode ==
'in_results')
250 include_once
'Services/Search/classes/class.ilSearchResult.php';
255 $res->diffEntriesFromResult($old_result_obj);
262 if(!count(
$res->getResults()))
267 if(
$res->isLimitReached())
269 #$message = sprintf($this->lng->txt('search_limit_reached'),$this->settings->getMaxHits());
270 #ilUtil::sendInfo($message);
275 include_once
'./Services/Search/classes/class.ilSearchResultPresentation.php';
277 $presentation->setResults(
$res->getResultsForPresentation());
278 $presentation->setPreviousNext($this->prev_link, $this->next_link);
280 if($presentation->render())
282 $this->tpl->setVariable(
'RESULTS',$presentation->getHTML(
true));
294 if(is_object($this->form))
299 include_once(
'Services/AdvancedMetaData/classes/class.ilAdvancedMDRecord.php');
300 include_once(
'Services/Form/classes/class.ilPropertyFormGUI.php');
302 $this->form->setFormAction($this->ctrl->getFormAction($this,
'performAdvMDSearch'));
303 $this->form->setTitle($this->lng->txt(
'adv_md_search_title'));
304 $this->form->addCommandButton(
'performAdvMDSearch',$this->lng->txt(
'search'));
305 #$this->form->setSubformMode('right');
308 $this->lng->txt(
'meta_keyword').
'/'.
309 $this->lng->txt(
'meta_description'),
'title');
310 $content->
setValue($this->options[
'title']);
311 $content->setSize(30);
312 $content->setMaxLength(255);
315 $group->setValue($this->options[
'title_ao']);
316 $radio_option =
new ilRadioOption($this->lng->txt(
"search_any_word"),0);
317 $group->addOption($radio_option);
318 $radio_option =
new ilRadioOption($this->lng->txt(
"search_all_words"),1);
319 $group->addOption($radio_option);
321 $this->form->addItem($content);
324 $options[
'adv_all'] = $this->lng->txt(
'search_any');
327 $options[$obj_type] = $this->lng->txt(
'objs_'.$obj_type);
330 $type->setValue($this->options[
'type']);
331 $this->form->addItem($type);
333 include_once(
'Services/AdvancedMetaData/classes/class.ilAdvancedMDRecordGUI.php');
335 $record_gui->setPropertyForm($this->form);
336 $record_gui->setSearchValues($this->options);
337 $record_gui->parse();
350 if(!isset(
$_GET[
'page_number']) and $this->search_mode !=
'in_results' )
353 $this->search_cache->delete();
356 include_once
'Services/Search/classes/class.ilSearchResult.php';
365 if($this->search_mode ==
'in_results')
367 include_once
'Services/Search/classes/class.ilSearchResult.php';
372 $res->diffEntriesFromResult($old_result_obj);
380 if(!count(
$res->getResults()))
385 if(
$res->isLimitReached())
387 #$message = sprintf($this->lng->txt('search_limit_reached'),$this->settings->getMaxHits());
388 #ilUtil::sendInfo($message);
393 include_once
'./Services/Search/classes/class.ilSearchResultPresentation.php';
395 $presentation->setResults(
$res->getResultsForPresentation());
396 $presentation->setPreviousNext($this->prev_link, $this->next_link);
398 if($presentation->render())
400 $this->tpl->setVariable(
'RESULTS',$presentation->getHTML(
true));
416 $this->options =
$_SESSION[
'search_adv_md'];
419 $this->tabs_gui->setSubTabActive(
'search_adv_md');
421 $this->tpl->addBlockFile(
'ADM_CONTENT',
'adm_content',
'tpl.advanced_adv_search.html',
'Services/Search');
424 $this->tpl->setVariable(
'SEARCH_FORM',$this->form->getHTML());
435 include_once
'./Services/Form/classes/class.ilPropertyFormGUI.php';
438 $this->form->setFormAction($this->ctrl->getFormAction($this,
'performSearch'));
439 $this->form->setTitle($this->lng->txt(
'search_advanced'));
440 $this->form->addCommandButton(
'performSearch',$this->lng->txt(
'search'));
441 $this->form->addCommandButton(
'reset',$this->lng->txt(
'reset'));
443 foreach($this->
fields->getActiveSections() as $definition)
445 if($definition[
'name'] !=
'default')
448 $section->setTitle($definition[
'name']);
452 foreach($definition[
'fields'] as $field_name)
454 if(is_object($element = $this->
fields->getFormElement($this->search_cache->getQuery(),$field_name,$this->form)))
456 $this->form->addItem($element);
470 $this->tabs_gui->setSubTabActive(
'search_lom');
472 $this->tpl->addBlockFile(
'ADM_CONTENT',
'adm_content',
'tpl.advanced_search.html',
'Services/Search');
475 $this->tpl->setVariable(
'SEARCH_FORM',$this->form->getHTML());
481 global $ilTabs, $ilHelp;
485 $ilHelp->setScreenIdComponent(
"src");
487 $ilTabs->addTab(
"search", $this->lng->txt(
"search"),
488 $this->ctrl->getLinkTargetByClass(
'ilsearchgui'));
489 $ilTabs->addTab(
"adv_search", $this->lng->txt(
"search_advanced"),
490 $this->ctrl->getLinkTarget($this));
491 $ilTabs->activateTab(
"adv_search");
506 include_once
'Services/Search/classes/class.ilSearchResult.php';
515 if(count($result_obj->getResults()))
517 $this->
addPager($result_obj,
'adv_max_page');
519 include_once
'./Services/Search/classes/class.ilSearchResultPresentation.php';
521 $presentation->setResults($result_obj->getResultsForPresentation());
522 $presentation->setPreviousNext($this->prev_link, $this->next_link);
524 if($presentation->render())
526 $this->tpl->setVariable(
'RESULTS',$presentation->getHTML(
true));
539 include_once
'Services/Search/classes/class.ilSearchResult.php';
548 if(count($result_obj->getResults()))
550 $this->
addPager($result_obj,
'adv_max_page');
552 include_once
'./Services/Search/classes/class.ilSearchResultPresentation.php';
554 $presentation->setResults($result_obj->getResultsForPresentation());
555 $presentation->setPreviousNext($this->prev_link, $this->next_link);
557 if($presentation->render())
559 $this->tpl->setVariable(
'RESULTS',$presentation->getHTML(
true));
568 include_once
'Services/Search/classes/class.ilObjectSearchFactory.php';
569 include_once
'Services/Search/classes/class.ilQueryParser.php';
570 include_once
'Services/Search/classes/class.ilSearchResult.php';
572 if(!$this->options[
'lom_content'])
580 #$query_parser->setCombination($this->options['content_ao']);
582 $query_parser->parse();
584 if($this->options[
'type'] ==
'all' or $this->options[
'type'] ==
'lms')
588 $res_cont =& $lm_search->performSearch();
589 $res->mergeEntries($res_cont);
591 if($this->options[
'type'] ==
'all' or $this->options[
'type'] ==
'tst')
594 $res_tes =& $tst_search->performSearch();
595 $res->mergeEntries($res_tes);
597 if($this->options[
'type'] ==
'all' or $this->options[
'type'] ==
'mep')
600 $res_med =& $med_search->performSearch();
601 $res->mergeEntries($res_med);
603 if($this->options[
'type'] ==
'all' or $this->options[
'type'] ==
'glo')
606 $res_glo =& $glo_search->performSearch();
607 $res->mergeEntries($res_glo);
609 if($this->options[
'type'] ==
'all' or $this->options[
'type'] ==
'webr')
612 $res_web =& $web_search->performSearch();
613 $res->mergeEntries($res_web);
617 $res->mergeEntries($tit_res);
626 if(!$this->options[
'lom_content'])
631 include_once
'Services/Search/classes/class.ilObjectSearchFactory.php';
632 include_once
'Services/Search/classes/class.ilQueryParser.php';
635 #$query_parser->setCombination($this->options['title_ao']);
637 $query_parser->parse();
640 $meta_search->setFilter($this->filter);
641 $meta_search->setMode(
'title_description');
642 $meta_search->setOptions($this->options);
643 $res_tit =& $meta_search->performSearch();
645 $meta_search->setMode(
'keyword_all');
646 $res_key =& $meta_search->performSearch();
649 $res_tit->mergeEntries($res_key);
659 if(!$this->options[
'lom_coverage'] and !$this->options[
'lom_structure'])
664 include_once
'Services/Search/classes/class.ilObjectSearchFactory.php';
665 include_once
'Services/Search/classes/class.ilQueryParser.php';
667 if($this->options[
'lom_coverage'])
670 #$query_parser->setCombination($this->options['coverage_ao']);
672 $query_parser->parse();
679 $meta_search->setFilter($this->filter);
680 $meta_search->setMode(
'general');
681 $meta_search->setOptions($this->options);
682 $res =& $meta_search->performSearch();
690 if(!$this->options[
'lom_status'] and !$this->options[
'lom_version'])
694 include_once
'Services/Search/classes/class.ilObjectSearchFactory.php';
695 include_once
'Services/Search/classes/class.ilQueryParser.php';
698 #$query_parser->setCombination($this->options['version_ao']);
700 $query_parser->parse();
703 $meta_search->setFilter($this->filter);
704 $meta_search->setMode(
'lifecycle');
705 $meta_search->setOptions($this->options);
706 $res =& $meta_search->performSearch();
712 if(!$this->options[
'lom_language'])
716 include_once
'Services/Search/classes/class.ilObjectSearchFactory.php';
717 include_once
'Services/Search/classes/class.ilQueryParser.php';
721 $meta_search->setFilter($this->filter);
722 $meta_search->setMode(
'language');
723 $meta_search->setOptions($this->options);
724 $res =& $meta_search->performSearch();
730 if(!strlen($this->options[
'lom_role']))
734 include_once
'Services/Search/classes/class.ilObjectSearchFactory.php';
735 include_once
'Services/Search/classes/class.ilQueryParser.php';
739 $meta_search->setFilter($this->filter);
740 $meta_search->setMode(
'contribute');
741 $meta_search->setOptions($this->options);
742 $res =& $meta_search->performSearch();
749 if(!$this->options[
'lom_role_entry'])
754 include_once
'Services/Search/classes/class.ilObjectSearchFactory.php';
755 include_once
'Services/Search/classes/class.ilQueryParser.php';
758 #$query_parser->setCombination($this->options['entity_ao']);
760 $query_parser->parse();
763 $meta_search->setFilter($this->filter);
764 $meta_search->setMode(
'entity');
765 $meta_search->setOptions($this->options);
766 $res =& $meta_search->performSearch();
774 include_once
'Services/Search/classes/class.ilObjectSearchFactory.php';
775 include_once
'Services/Search/classes/class.ilQueryParser.php';
779 $meta_search->setFilter($this->filter);
780 $meta_search->setMode(
'requirement');
781 $meta_search->setOptions($this->options);
782 $res =& $meta_search->performSearch();
788 include_once
'Services/Search/classes/class.ilObjectSearchFactory.php';
789 include_once
'Services/Search/classes/class.ilQueryParser.php';
793 $meta_search->setFilter($this->filter);
794 $meta_search->setMode(
'format');
795 $meta_search->setOptions($this->options);
796 $res =& $meta_search->performSearch();
802 include_once
'Services/Search/classes/class.ilObjectSearchFactory.php';
803 include_once
'Services/Search/classes/class.ilQueryParser.php';
807 $meta_search->setFilter($this->filter);
808 $meta_search->setMode(
'educational');
809 $meta_search->setOptions($this->options);
810 $res =& $meta_search->performSearch();
816 include_once
'Services/Search/classes/class.ilObjectSearchFactory.php';
817 include_once
'Services/Search/classes/class.ilQueryParser.php';
821 $meta_search->setFilter($this->filter);
822 $meta_search->setMode(
'typical_age_range');
823 $meta_search->setOptions($this->options);
824 $res =& $meta_search->performSearch();
830 if(!$this->options[
'lom_copyright'] and !$this->options[
'lom_costs'])
834 include_once
'Services/Search/classes/class.ilObjectSearchFactory.php';
835 include_once
'Services/Search/classes/class.ilQueryParser.php';
839 $meta_search->setFilter($this->filter);
840 $meta_search->setMode(
'rights');
841 $meta_search->setOptions($this->options);
842 $res =& $meta_search->performSearch();
850 if(!$this->options[
'lom_purpose'])
854 include_once
'Services/Search/classes/class.ilObjectSearchFactory.php';
855 include_once
'Services/Search/classes/class.ilQueryParser.php';
859 $meta_search->setFilter($this->filter);
860 $meta_search->setMode(
'classification');
861 $meta_search->setOptions($this->options);
862 $res =& $meta_search->performSearch();
870 if(!$this->options[
'lom_taxon'])
874 include_once
'Services/Search/classes/class.ilObjectSearchFactory.php';
875 include_once
'Services/Search/classes/class.ilQueryParser.php';
879 $query_parser->parse();
882 $meta_search->setFilter($this->filter);
883 $meta_search->setMode(
'taxon');
884 $meta_search->setOptions($this->options);
885 $res =& $meta_search->performSearch();
901 include_once(
'Services/AdvancedMetaData/classes/class.ilAdvancedMDFieldDefinition.php');
902 foreach(array_keys($this->options) as $key)
904 if(substr($key,0,3) !=
'adv')
915 $field_id = substr($key,4);
918 $field_form =
ilADTFactory::getInstance()->getSearchBridgeForDefinitionInstance($field->getADTDefinition(),
true,
false);
919 $field_form->setElementId(
"query[".$key.
"]");
920 $field_form->setForm($this->form);
923 $field_form->importFromPost($this->options);
924 $field_form->validate();
926 $parser_value = $field->getSearchQueryParserValue($field_form);
928 include_once
'Services/Search/classes/class.ilQueryParser.php';
929 include_once
'Services/Search/classes/class.ilObjectSearchFactory.php';
931 $adv_md_search->setFilter($this->filter);
932 $adv_md_search->setDefinition($field);
933 $adv_md_search->setSearchElement($field_form);
934 $res_field = $adv_md_search->performSearch();
945 if(!$this->options[
'lom_keyword'])
949 include_once
'Services/Search/classes/class.ilObjectSearchFactory.php';
950 include_once
'Services/Search/classes/class.ilQueryParser.php';
953 #$query_parser->setCombination($this->options['keyword_ao']);
955 $query_parser->parse();
958 $meta_search->setFilter($this->filter);
959 $meta_search->setMode(
'keyword');
960 $meta_search->setOptions($this->options);
961 $res =& $meta_search->performSearch();
968 if(isset(
$_POST[
'cmd'][
'performSearch']))
972 elseif(isset(
$_POST[
'cmd'][
'performAdvMDSearch']))
978 $this->options =
$_SESSION[
'search_adv'];
983 $this->filter = array();
985 $this->options[
'type'] =
'all';
986 switch($this->options[
'type'])
989 $this->filter[] =
'cat';
993 $this->filter[] =
'webr';
997 $this->filter[] =
'lm';
998 $this->filter[] =
'dbk';
999 $this->filter[] =
'pg';
1000 $this->filter[] =
'st';
1001 $this->filter[] =
'sahs';
1002 $this->filter[] =
'htlm';
1006 $this->filter[] =
'glo';
1010 $this->filter[] =
'tst';
1011 $this->filter[] =
'svy';
1012 $this->filter[] =
'qpl';
1013 $this->filter[] =
'spl';
1017 $this->filter[] =
'mep';
1021 $this->filter[] =
'crs';
1025 $this->filter[] =
'file';
1029 include_once(
'Services/AdvancedMetaData/classes/class.ilAdvancedMDRecord.php');
1035 $this->filter[] =
'webr';
1036 $this->filter[] =
'crs';
1037 $this->filter[] =
'mep';
1038 $this->filter[] =
'tst';
1039 $this->filter[] =
'svy';
1040 $this->filter[] =
'qpl';
1041 $this->filter[] =
'spl';
1042 $this->filter[] =
'glo';
1043 $this->filter[] =
'lm';
1044 $this->filter[] =
'dbk';
1045 $this->filter[] =
'pg';
1046 $this->filter[] =
'st';
1047 $this->filter[] =
'sahs';
1048 $this->filter[] =
'htlm';
1049 $this->filter[] =
'file';
1056 $options = array(
'all' => $this->lng->txt(
'search_any'),
1057 'crs' => $this->lng->txt(
'objs_crs'),
1058 'lms' => $this->lng->txt(
'learning_resources'),
1059 'glo' => $this->lng->txt(
'objs_glo'),
1060 'mep' => $this->lng->txt(
'objs_mep'),
1061 'tst' => $this->lng->txt(
'search_tst_svy'),
1062 'file'=> $this->lng->txt(
'objs_file'),
1063 'webr' => $this->lng->txt(
'objs_webr'));
1072 if($this->stored ==
false)
1074 $res->mergeEntries($new_res);
1075 $this->stored =
true;
1081 $res->intersectEntries($new_res);
1096 include_once(
'Services/Search/classes/class.ilUserSearchCache.php');
1099 if(
$_GET[
'page_number'])
1101 $this->search_cache->setResultPageNumber((
int)
$_GET[
'page_number']);
1103 if(
$_POST[
'cmd'][
'performSearch'])
1106 $this->search_cache->save();
1120 include_once(
'Services/AdvancedMetaData/classes/class.ilAdvancedMDFieldDefinition.php');
1125 $ilTabs->addSubTabTarget(
'search_lom',$this->ctrl->getLinkTarget($this,
'showSavedResults'));
1126 #$ilTabs->addSubTabTarget('search_adv_md',$this->ctrl->getLinkTarget($this,'showSavedAdvMDResults'));
1139 return mktime($time[
'h'],$time[
'm'],0,$date[
'm'],$date[
'd'],$date[
'y']);
1151 if($type == self::TYPE_LOM)