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);
157 if(!isset(
$_GET[
'page_number']) and $this->search_mode !=
'in_results' )
160 $this->search_cache->delete();
163 if(isset(
$_POST[
'query']))
165 $this->search_cache->setQuery(
$_POST[
'query']);
169 include_once
'Services/Search/classes/class.ilSearchResult.php';
228 if($this->search_mode ==
'in_results')
230 include_once
'Services/Search/classes/class.ilSearchResult.php';
235 $res->diffEntriesFromResult($old_result_obj);
243 if(!count(
$res->getResults()))
248 if(
$res->isLimitReached())
250 #$message = sprintf($this->lng->txt('search_limit_reached'),$this->settings->getMaxHits());
251 #ilUtil::sendInfo($message);
256 include_once
'./Services/Search/classes/class.ilSearchResultPresentation.php';
258 $presentation->setResults(
$res->getResultsForPresentation());
259 $presentation->setPreviousNext($this->prev_link, $this->next_link);
261 if($presentation->render())
263 $this->tpl->setVariable(
'RESULTS',$presentation->getHTML(
true));
275 if(is_object($this->form))
280 include_once(
'Services/AdvancedMetaData/classes/class.ilAdvancedMDRecord.php');
281 include_once(
'Services/Form/classes/class.ilPropertyFormGUI.php');
283 $this->form->setFormAction($this->ctrl->getFormAction($this,
'performAdvMDSearch'));
284 $this->form->setTitle($this->lng->txt(
'adv_md_search_title'));
285 $this->form->addCommandButton(
'performAdvMDSearch',$this->lng->txt(
'search'));
286 #$this->form->setSubformMode('right');
289 $this->lng->txt(
'meta_keyword').
'/'.
290 $this->lng->txt(
'meta_description'),
'title');
291 $content->
setValue($this->options[
'title']);
292 $content->setSize(30);
293 $content->setMaxLength(255);
296 $group->setValue($this->options[
'title_ao']);
297 $radio_option =
new ilRadioOption($this->lng->txt(
"search_any_word"),0);
298 $group->addOption($radio_option);
299 $radio_option =
new ilRadioOption($this->lng->txt(
"search_all_words"),1);
300 $group->addOption($radio_option);
302 $this->form->addItem($content);
305 $options[
'adv_all'] = $this->lng->txt(
'search_any');
308 $options[$obj_type] = $this->lng->txt(
'objs_'.$obj_type);
310 $type->setOptions($options);
311 $type->setValue($this->options[
'type']);
312 $this->form->addItem(
$type);
314 include_once(
'Services/AdvancedMetaData/classes/class.ilAdvancedMDRecordGUI.php');
316 $record_gui->setPropertyForm($this->form);
317 $record_gui->setSearchValues($this->options);
318 $record_gui->parse();
331 if(!isset(
$_GET[
'page_number']) and $this->search_mode !=
'in_results' )
334 $this->search_cache->delete();
337 include_once
'Services/Search/classes/class.ilSearchResult.php';
346 if($this->search_mode ==
'in_results')
348 include_once
'Services/Search/classes/class.ilSearchResult.php';
353 $res->diffEntriesFromResult($old_result_obj);
361 if(!count(
$res->getResults()))
366 if(
$res->isLimitReached())
368 #$message = sprintf($this->lng->txt('search_limit_reached'),$this->settings->getMaxHits());
369 #ilUtil::sendInfo($message);
374 include_once
'./Services/Search/classes/class.ilSearchResultPresentation.php';
376 $presentation->setResults(
$res->getResultsForPresentation());
377 $presentation->setPreviousNext($this->prev_link, $this->next_link);
379 if($presentation->render())
381 $this->tpl->setVariable(
'RESULTS',$presentation->getHTML(
true));
397 $this->options =
$_SESSION[
'search_adv_md'];
400 $this->tabs_gui->setSubTabActive(
'search_adv_md');
402 $this->tpl->addBlockFile(
'ADM_CONTENT',
'adm_content',
'tpl.advanced_adv_search.html',
'Services/Search');
405 $this->tpl->setVariable(
'SEARCH_FORM',$this->form->getHTML());
416 include_once
'./Services/Form/classes/class.ilPropertyFormGUI.php';
419 $this->form->setFormAction($this->ctrl->getFormAction($this,
'performSearch'));
420 $this->form->setTitle($this->lng->txt(
'search_advanced'));
421 $this->form->addCommandButton(
'performSearch',$this->lng->txt(
'search'));
422 $this->form->addCommandButton(
'reset',$this->lng->txt(
'reset'));
424 foreach($this->fields->getActiveSections() as $definition)
426 if($definition[
'name'] !=
'default')
429 $section->setTitle($definition[
'name']);
433 foreach($definition[
'fields'] as $field_name)
435 if(is_object($element = $this->fields->getFormElement($this->search_cache->getQuery(),$field_name)))
437 $this->form->addItem($element);
451 $this->tabs_gui->setSubTabActive(
'search_lom');
453 $this->tpl->addBlockFile(
'ADM_CONTENT',
'adm_content',
'tpl.advanced_search.html',
'Services/Search');
456 $this->tpl->setVariable(
'SEARCH_FORM',$this->form->getHTML());
468 $ilTabs->addTab(
"search", $this->lng->txt(
"search"),
469 $this->ctrl->getLinkTargetByClass(
'ilsearchgui'));
470 $ilTabs->addTab(
"adv_search", $this->lng->txt(
"search_advanced"),
471 $this->ctrl->getLinkTarget($this));
472 $ilTabs->activateTab(
"adv_search");
499 include_once
'Services/Search/classes/class.ilSearchResult.php';
508 if(count($result_obj->getResults()))
510 $this->
addPager($result_obj,
'adv_max_page');
512 include_once
'./Services/Search/classes/class.ilSearchResultPresentation.php';
514 $presentation->setResults($result_obj->getResultsForPresentation());
515 $presentation->setPreviousNext($this->prev_link, $this->next_link);
517 if($presentation->render())
519 $this->tpl->setVariable(
'RESULTS',$presentation->getHTML(
true));
532 include_once
'Services/Search/classes/class.ilSearchResult.php';
541 if(count($result_obj->getResults()))
543 $this->
addPager($result_obj,
'adv_max_page');
545 include_once
'./Services/Search/classes/class.ilSearchResultPresentation.php';
547 $presentation->setResults($result_obj->getResultsForPresentation());
548 $presentation->setPreviousNext($this->prev_link, $this->next_link);
550 if($presentation->render())
552 $this->tpl->setVariable(
'RESULTS',$presentation->getHTML(
true));
561 include_once
'Services/Search/classes/class.ilObjectSearchFactory.php';
562 include_once
'Services/Search/classes/class.ilQueryParser.php';
563 include_once
'Services/Search/classes/class.ilSearchResult.php';
565 if(!$this->options[
'lom_content'])
573 #$query_parser->setCombination($this->options['content_ao']);
575 $query_parser->parse();
577 if($this->options[
'type'] ==
'all' or $this->options[
'type'] ==
'lms')
581 $res_cont =& $lm_search->performSearch();
582 $res->mergeEntries($res_cont);
584 if($this->options[
'type'] ==
'all' or $this->options[
'type'] ==
'tst')
587 $res_tes =& $tst_search->performSearch();
588 $res->mergeEntries($res_tes);
590 if($this->options[
'type'] ==
'all' or $this->options[
'type'] ==
'mep')
593 $res_med =& $med_search->performSearch();
594 $res->mergeEntries($res_med);
596 if($this->options[
'type'] ==
'all' or $this->options[
'type'] ==
'glo')
599 $res_glo =& $glo_search->performSearch();
600 $res->mergeEntries($res_glo);
602 if($this->options[
'type'] ==
'all' or $this->options[
'type'] ==
'webr')
605 $res_web =& $web_search->performSearch();
606 $res->mergeEntries($res_web);
610 $res->mergeEntries($tit_res);
619 if(!$this->options[
'lom_content'])
624 include_once
'Services/Search/classes/class.ilObjectSearchFactory.php';
625 include_once
'Services/Search/classes/class.ilQueryParser.php';
628 #$query_parser->setCombination($this->options['title_ao']);
630 $query_parser->parse();
633 $meta_search->setFilter($this->filter);
634 $meta_search->setMode(
'title_description');
635 $meta_search->setOptions($this->options);
636 $res_tit =& $meta_search->performSearch();
638 $meta_search->setMode(
'keyword_all');
639 $res_key =& $meta_search->performSearch();
642 $res_tit->mergeEntries($res_key);
652 if(!$this->options[
'lom_coverage'] and !$this->options[
'lom_structure'])
657 include_once
'Services/Search/classes/class.ilObjectSearchFactory.php';
658 include_once
'Services/Search/classes/class.ilQueryParser.php';
660 if($this->options[
'lom_coverage'])
663 #$query_parser->setCombination($this->options['coverage_ao']);
665 $query_parser->parse();
672 $meta_search->setFilter($this->filter);
673 $meta_search->setMode(
'general');
674 $meta_search->setOptions($this->options);
675 $res =& $meta_search->performSearch();
683 if(!$this->options[
'lom_status'] and !$this->options[
'lom_version'])
687 include_once
'Services/Search/classes/class.ilObjectSearchFactory.php';
688 include_once
'Services/Search/classes/class.ilQueryParser.php';
691 #$query_parser->setCombination($this->options['version_ao']);
693 $query_parser->parse();
696 $meta_search->setFilter($this->filter);
697 $meta_search->setMode(
'lifecycle');
698 $meta_search->setOptions($this->options);
699 $res =& $meta_search->performSearch();
705 if(!$this->options[
'lom_language'])
709 include_once
'Services/Search/classes/class.ilObjectSearchFactory.php';
710 include_once
'Services/Search/classes/class.ilQueryParser.php';
714 $meta_search->setFilter($this->filter);
715 $meta_search->setMode(
'language');
716 $meta_search->setOptions($this->options);
717 $res =& $meta_search->performSearch();
723 if(!strlen($this->options[
'lom_role']))
727 include_once
'Services/Search/classes/class.ilObjectSearchFactory.php';
728 include_once
'Services/Search/classes/class.ilQueryParser.php';
732 $meta_search->setFilter($this->filter);
733 $meta_search->setMode(
'contribute');
734 $meta_search->setOptions($this->options);
735 $res =& $meta_search->performSearch();
742 if(!$this->options[
'lom_role_entry'])
747 include_once
'Services/Search/classes/class.ilObjectSearchFactory.php';
748 include_once
'Services/Search/classes/class.ilQueryParser.php';
751 #$query_parser->setCombination($this->options['entity_ao']);
753 $query_parser->parse();
756 $meta_search->setFilter($this->filter);
757 $meta_search->setMode(
'entity');
758 $meta_search->setOptions($this->options);
759 $res =& $meta_search->performSearch();
767 include_once
'Services/Search/classes/class.ilObjectSearchFactory.php';
768 include_once
'Services/Search/classes/class.ilQueryParser.php';
772 $meta_search->setFilter($this->filter);
773 $meta_search->setMode(
'requirement');
774 $meta_search->setOptions($this->options);
775 $res =& $meta_search->performSearch();
781 include_once
'Services/Search/classes/class.ilObjectSearchFactory.php';
782 include_once
'Services/Search/classes/class.ilQueryParser.php';
786 $meta_search->setFilter($this->filter);
787 $meta_search->setMode(
'format');
788 $meta_search->setOptions($this->options);
789 $res =& $meta_search->performSearch();
795 include_once
'Services/Search/classes/class.ilObjectSearchFactory.php';
796 include_once
'Services/Search/classes/class.ilQueryParser.php';
800 $meta_search->setFilter($this->filter);
801 $meta_search->setMode(
'educational');
802 $meta_search->setOptions($this->options);
803 $res =& $meta_search->performSearch();
809 include_once
'Services/Search/classes/class.ilObjectSearchFactory.php';
810 include_once
'Services/Search/classes/class.ilQueryParser.php';
814 $meta_search->setFilter($this->filter);
815 $meta_search->setMode(
'typical_age_range');
816 $meta_search->setOptions($this->options);
817 $res =& $meta_search->performSearch();
823 if(!$this->options[
'lom_copyright'] and !$this->options[
'lom_costs'])
827 include_once
'Services/Search/classes/class.ilObjectSearchFactory.php';
828 include_once
'Services/Search/classes/class.ilQueryParser.php';
832 $meta_search->setFilter($this->filter);
833 $meta_search->setMode(
'rights');
834 $meta_search->setOptions($this->options);
835 $res =& $meta_search->performSearch();
843 if(!$this->options[
'lom_purpose'])
847 include_once
'Services/Search/classes/class.ilObjectSearchFactory.php';
848 include_once
'Services/Search/classes/class.ilQueryParser.php';
852 $meta_search->setFilter($this->filter);
853 $meta_search->setMode(
'classification');
854 $meta_search->setOptions($this->options);
855 $res =& $meta_search->performSearch();
863 if(!$this->options[
'lom_taxon'])
867 include_once
'Services/Search/classes/class.ilObjectSearchFactory.php';
868 include_once
'Services/Search/classes/class.ilQueryParser.php';
872 $query_parser->parse();
875 $meta_search->setFilter($this->filter);
876 $meta_search->setMode(
'taxon');
877 $meta_search->setOptions($this->options);
878 $res =& $meta_search->performSearch();
892 include_once(
'Services/AdvancedMetaData/classes/class.ilAdvancedMDFieldDefinition.php');
895 if(!is_numeric(
$key))
905 include_once
'Services/Search/classes/class.ilObjectSearchFactory.php';
906 include_once
'Services/Search/classes/class.ilQueryParser.php';
910 $value = (int) $value;
933 $query_parser->setCombination(
'and');
937 $query_parser->setCombination(
'or');
939 $query_parser->parse();
942 $adv_md_search->setDefinition($def);
943 $adv_md_search->setTimeRange(
$start,$end);
944 $adv_md_search->setFilter($this->filter);
945 $res_field = $adv_md_search->performSearch();
955 if(!$this->options[
'lom_keyword'])
959 include_once
'Services/Search/classes/class.ilObjectSearchFactory.php';
960 include_once
'Services/Search/classes/class.ilQueryParser.php';
963 #$query_parser->setCombination($this->options['keyword_ao']);
965 $query_parser->parse();
968 $meta_search->setFilter($this->filter);
969 $meta_search->setMode(
'keyword');
970 $meta_search->setOptions($this->options);
971 $res =& $meta_search->performSearch();
978 if(isset(
$_POST[
'cmd'][
'performSearch']))
988 $this->options =
$_SESSION[
'search_adv'];
993 $this->filter = array();
995 $this->options[
'type'] =
'all';
996 switch($this->options[
'type'])
999 $this->filter[] =
'cat';
1003 $this->filter[] =
'webr';
1007 $this->filter[] =
'lm';
1008 $this->filter[] =
'dbk';
1009 $this->filter[] =
'pg';
1010 $this->filter[] =
'st';
1011 $this->filter[] =
'sahs';
1012 $this->filter[] =
'htlm';
1016 $this->filter[] =
'glo';
1020 $this->filter[] =
'tst';
1021 $this->filter[] =
'svy';
1022 $this->filter[] =
'qpl';
1023 $this->filter[] =
'spl';
1027 $this->filter[] =
'mep';
1031 $this->filter[] =
'crs';
1035 $this->filter[] =
'file';
1039 include_once(
'Services/AdvancedMetaData/classes/class.ilAdvancedMDRecord.php');
1045 $this->filter[] =
'webr';
1046 $this->filter[] =
'crs';
1047 $this->filter[] =
'mep';
1048 $this->filter[] =
'tst';
1049 $this->filter[] =
'svy';
1050 $this->filter[] =
'qpl';
1051 $this->filter[] =
'spl';
1052 $this->filter[] =
'glo';
1053 $this->filter[] =
'lm';
1054 $this->filter[] =
'dbk';
1055 $this->filter[] =
'pg';
1056 $this->filter[] =
'st';
1057 $this->filter[] =
'sahs';
1058 $this->filter[] =
'htlm';
1059 $this->filter[] =
'file';
1066 $options = array(
'all' => $this->lng->txt(
'search_any'),
1067 'crs' => $this->lng->txt(
'objs_crs'),
1068 'lms' => $this->lng->txt(
'learning_resources'),
1069 'glo' => $this->lng->txt(
'objs_glo'),
1070 'mep' => $this->lng->txt(
'objs_mep'),
1071 'tst' => $this->lng->txt(
'search_tst_svy'),
1072 'file'=> $this->lng->txt(
'objs_file'),
1073 'webr' => $this->lng->txt(
'objs_webr'));
1082 if($this->stored ==
false)
1084 $res->mergeEntries($new_res);
1085 $this->stored =
true;
1091 $res->intersectEntries($new_res);
1106 include_once(
'Services/Search/classes/class.ilUserSearchCache.php');
1109 if(
$_GET[
'page_number'])
1111 $this->search_cache->setResultPageNumber((
int)
$_GET[
'page_number']);
1125 include_once(
'Services/AdvancedMetaData/classes/class.ilAdvancedMDFieldDefinition.php');
1130 $ilTabs->addSubTabTarget(
'search_lom',$this->ctrl->getLinkTarget($this,
'showSavedResults'));
1131 #$ilTabs->addSubTabTarget('search_adv_md',$this->ctrl->getLinkTarget($this,'showSavedAdvMDResults'));
1144 return mktime($time[
'h'],$time[
'm'],0,$date[
'm'],$date[
'd'],$date[
'y']);
1156 if(
$type == self::TYPE_LOM)