35 include_once
'Services/Search/classes/class.ilSearchBaseGUI.php';
37 define(
'SEARCH_FAST',1);
38 define(
'SEARCH_DETAILS',2);
39 define(
'SEARCH_AND',
'and');
40 define(
'SEARCH_OR',
'or');
59 $this->root_node =
$_SESSION[
'search_root'] ?
$_SESSION[
'search_root'] : ROOT_FOLDER_ID;
60 $this->
setType($_POST[
'search'][
'type'] ? $_POST[
'search'][
'type'] :
$_SESSION[
'search'][
'type']);
61 $this->
setCombination($_POST[
'search'][
'combination'] ? $_POST[
'search'][
'combination'] : $_SESSION[
'search'][
'combination']);
62 $this->
setString($_POST[
'search'][
'string'] ? $_POST[
'search'][
'string'] : $_SESSION[
'search'][
'string']);
63 $this->
setDetails($_POST[
'search'][
'details'] ? $_POST[
'search'][
'details'] : $_SESSION[
'search'][
'details']);
75 $_SESSION[
'search'][
'type'] = $this->type = $a_type;
87 $_SESSION[
'search'][
'combination'] = $this->combination = $a_combination;
91 return $this->combination ? $this->combination :
SEARCH_OR;
99 $_SESSION[
'search'][
'string'] = $this->
string = $a_str;
111 $_SESSION[
'search'][
'details'] = $this->details = $a_details;
115 return $this->details ? $this->details : array();
121 return $this->root_node ? $this->root_node : ROOT_FOLDER_ID;
125 $_SESSION[
'search_root'] = $this->root_node = $a_node_id;
137 $next_class = $this->ctrl->getNextClass($this);
138 $cmd = $this->ctrl->getCmd();
146 $cmd =
"showSavedResults";
157 include_once
'Services/Search/classes/class.ilUserResult.php';
158 include_once
'Services/Search/classes/class.ilSearchFolder.php';
162 if(!$_POST[
'folder'])
169 if(!count($_POST[
'id']))
177 $folder_obj =&
new ilSearchFolder($ilUser->getId(),(int) $_POST[
'folder']);
179 foreach($_POST[
'id'] as
$ref_id)
187 $search_res_obj->setTarget($target);
189 $folder_obj->assignResult($search_res_obj);
190 unset($search_res_obj);
202 $this->tpl->addBlockFile(
'ADM_CONTENT',
'adm_content',
'tpl.search.html',
'Services/Search');
204 $this->tpl->setVariable(
"TBL_TITLE",$this->lng->txt(
'search'));
205 $this->tpl->setVariable(
"TXT_SEARCHAREA",$this->lng->txt(
'search_area'));
206 $this->tpl->setVariable(
"SEARCH_ACTION",$this->ctrl->getFormAction($this));
207 $this->tpl->setVariable(
"TXT_SEARCHTERM",$this->lng->txt(
"search_search_term"));
208 $this->tpl->setVariable(
"TXT_AND",$this->lng->txt(
'search_all_words'));
209 $this->tpl->setVariable(
"TXT_OR",$this->lng->txt(
'search_any_word'));
210 $this->tpl->setVariable(
"BTN_SEARCH",$this->lng->txt(
'search'));
215 $this->tpl->setVariable(
"AND_CHECKED",
'checked=checked');
219 $this->tpl->setVariable(
"OR_CHECKED",
'checked=checked');
224 $this->tpl->setVariable(
"HREF_UPDATE_AREA",$this->ctrl->getLinkTarget($this,
'showSelectRoot'));
225 $this->tpl->setVariable(
"UPDATE_AREA",$this->lng->txt(
'search_change'));
228 $this->tpl->setVariable(
"TXT_SEARCH_TYPE",$this->lng->txt(
'search_type'));
229 $this->tpl->setVariable(
"INFO_FAST",$this->lng->txt(
'search_fast_info'));
230 $this->tpl->setVariable(
"INFO_DETAILS",$this->lng->txt(
'search_details_info'));
240 $this->tpl->setVariable(
"LMS",$this->lng->txt(
'learning_resources'));
241 $this->tpl->setVariable(
"GLO",$this->lng->txt(
'objs_glo'));
242 $this->tpl->setVariable(
"MEP",$this->lng->txt(
'objs_mep'));
243 $this->tpl->setVariable(
"TST",$this->lng->txt(
'search_tst_svy'));
244 $this->tpl->setVariable(
"FOR",$this->lng->txt(
'objs_frm'));
245 $this->tpl->setVariable(
"EXC",$this->lng->txt(
'objs_exc'));
246 $this->tpl->setVariable(
"MCST",$this->lng->txt(
'objs_mcst'));
247 $this->tpl->setVariable(
"WIKI",$this->lng->txt(
'objs_wiki'));
248 $this->tpl->setVariable(
"FIL",$this->lng->txt(
'objs_file'));
252 $this->tpl->setVariable(
"CHECK_GLO",
ilUtil::formCheckbox($details[
'glo'] ? 1 : 0,
'search[details][glo]',1));
253 $this->tpl->setVariable(
"CHECK_LMS",
ilUtil::formCheckbox($details[
'lms'] ? 1 : 0,
'search[details][lms]',1));
254 $this->tpl->setVariable(
"CHECK_MEP",
ilUtil::formCheckbox($details[
'mep'] ? 1 : 0,
'search[details][mep]',1));
255 $this->tpl->setVariable(
"CHECK_TST",
ilUtil::formCheckbox($details[
'tst'] ? 1 : 0,
'search[details][tst]',1));
256 $this->tpl->setVariable(
"CHECK_FOR",
ilUtil::formCheckbox($details[
'frm'] ? 1 : 0,
'search[details][frm]',1));
257 $this->tpl->setVariable(
"CHECK_EXC",
ilUtil::formCheckbox($details[
'exc'] ? 1 : 0,
'search[details][exc]',1));
258 $this->tpl->setVariable(
"CHECK_FIL",
ilUtil::formCheckbox($details[
'fil'] ? 1 : 0,
'search[details][fil]',1));
259 $this->tpl->setVariable(
"CHECK_MCST",
ilUtil::formCheckbox($details[
'mcst'] ? 1 : 0,
'search[details][mcst]',1));
260 $this->tpl->setVariable(
"CHECK_WIKI",
ilUtil::formCheckbox($details[
'wiki'] ? 1 : 0,
'search[details][wiki]',1));
267 $this->tpl->setVariable(
"SEARCHAREA",$this->lng->txt(
'search_in_magazin'));
271 $text = $this->lng->txt(
'search_below').
" '";
274 $this->tpl->setVariable(
"SEARCHAREA",$text);
284 $this->tpl->addBlockFile(
'ADM_CONTENT',
'adm_content',
'tpl.search_root_selector.html',
'Services/Search');
286 include_once
'Services/Search/classes/class.ilSearchRootSelector.php';
291 $exp->
setExpand(
$_GET[
"search_root_expand"] ?
$_GET[
"search_root_expand"] : $tree->readRootId());
292 $exp->setExpandTarget($this->ctrl->getLinkTarget($this,
'showSelectRoot'));
297 $this->tpl->setVariable(
"EXPLORER",$exp->getOutput());
314 include_once
'Services/Search/classes/class.ilSearchResult.php';
323 if(count($result_obj->getResults()))
326 $this->
addPager($result_obj,
'max_page');
328 include_once
'Services/Search/classes/class.ilSearchResultPresentationGUI.php';
330 $this->tpl->setVariable(
"RESULTS",$search_result_presentation->showResults());
338 $this->search_mode =
'in_results';
339 $this->search_cache->setResultPageNumber(1);
351 if(!isset(
$_GET[
'page_number']) and $this->search_mode !=
'in_results' )
354 $this->search_cache->delete();
378 $result_meta =& $this->
__searchMeta($query_parser,
'keyword');
379 $result->mergeEntries($result_meta);
381 $result_meta =& $this->
__searchMeta($query_parser,
'contribute');
382 $result->mergeEntries($result_meta);
384 $result_meta =& $this->
__searchMeta($query_parser,
'title');
385 $result->mergeEntries($result_meta);
387 $result_meta =& $this->
__searchMeta($query_parser,
'description');
388 $result->mergeEntries($result_meta);
396 if($this->search_mode ==
'in_results')
398 include_once
'Services/Search/classes/class.ilSearchResult.php';
401 $old_result_obj->
read();
403 $result->diffEntriesFromResult($old_result_obj);
412 if(!count(
$result->getResults()))
423 $message = sprintf($this->lng->txt(
'search_limit_reached'),$this->settings->getMaxHits());
430 include_once
'Services/Search/classes/class.ilSearchResultPresentationGUI.php';
432 $this->tpl->setVariable(
"RESULTS",$search_result_presentation->showResults());
443 $this->tpl->setCurrentBlock(
"header_image");
445 $this->tpl->parseCurrentBlock();
447 $this->tpl->setVariable(
"TXT_HEADER",$this->lng->txt(
'search'));
449 $this->tpl->addBlockFile(
"TABS",
"tabs",
"tpl.tabs.html");
451 $this->tpl->setCurrentBlock(
"tab");
452 $this->tpl->setVariable(
"TAB_TYPE",
"tabactive");
453 $this->tpl->setVariable(
"TAB_LINK",$this->ctrl->getLinkTarget($this));
454 $this->tpl->setVariable(
"TAB_TEXT",$this->lng->txt(
"search"));
455 $this->tpl->parseCurrentBlock();
457 $this->tpl->setCurrentBlock(
"tab");
458 $this->tpl->setVariable(
"TAB_TYPE",
"tabinactive");
459 $this->tpl->setVariable(
"TAB_LINK",$this->ctrl->getLinkTargetByClass(
'iladvancedsearchgui'));
460 $this->tpl->setVariable(
"TAB_TEXT",$this->lng->txt(
"search_advanced"));
461 $this->tpl->parseCurrentBlock();
463 $this->tpl->setCurrentBlock(
"tab");
464 $this->tpl->setVariable(
"TAB_TYPE",
"tabinactive");
465 $this->tpl->setVariable(
"TAB_LINK",$this->ctrl->getLinkTargetByClass(
'ilsearchresultgui'));
466 $this->tpl->setVariable(
"TAB_TEXT",$this->lng->txt(
"search_search_results"));
467 $this->tpl->parseCurrentBlock();
481 $result->mergeEntries($content_search->performSearch());
483 if($this->settings->enabledLucene())
486 $result->mergeEntries($htlm_search->performSearch());
493 $result->mergeEntries($forum_search->performSearch());
500 $result->mergeEntries($gdf_search->performSearch());
503 $result->mergeEntries($gdf_term_search->performSearch());
509 $result->mergeEntries($exc_search->performSearch());
513 $mcst_search =& ilObjectSearchFactory::_getMediaCastSearchInstance($query_parser);
514 $result->mergeEntries($mcst_search->performSearch());
520 $result->mergeEntries($tst_search->performSearch());
526 $result->mergeEntries($mep_search->performSearch());
530 if($this->settings->enabledLucene())
533 $result->mergeEntries($file_search->performSearch());
540 $result->mergeEntries($wiki_search->performSearch());
560 include_once
'Services/Search/classes/class.ilQueryParser.php';
564 $query_parser->parse();
566 if(!$query_parser->validate())
568 return $query_parser->getMessage();
570 return $query_parser;
579 include_once
'Services/Search/classes/class.ilObjectSearchFactory.php';
586 return $obj_search->performSearch();
597 include_once
'Services/Search/classes/class.ilObjectSearchFactory.php';
607 $meta_search->setMode(
'keyword');
611 $meta_search->setMode(
'contribute');
615 $meta_search->setMode(
'title');
619 $meta_search->setMode(
'description');
622 return $meta_search->performSearch();
636 foreach($this->
getDetails() as $key => $detail_type)
686 return $filter ? $filter : array();
696 $this->tpl->setCurrentBlock(
"search_results");
697 $this->tpl->setVariable(
"BTN_SEARCHRESULTS",$this->lng->txt(
'search_in_result'));
698 $this->tpl->parseCurrentBlock();
700 $this->tpl->setCurrentBlock(
"save_result");
702 $this->tpl->setVariable(
"BTN_SAVE_RESULT",$this->lng->txt(
'save'));
704 $this->tpl->parseCurrentBlock();
713 include_once
'Services/Search/classes/class.ilSearchFolder.php';
721 $options[0] = $this->lng->txt(
"search_select_one_folder_select");
722 $options[$folder_obj->getRootId()] = $this->lng->txt(
"search_save_as_select").
" ".$this->lng->txt(
"search_search_results");
724 foreach($subtree as $node)
726 if($node[
"obj_id"] == $folder_obj->getRootId())
731 $prefix = $this->lng->txt(
"search_save_as_select");
732 for($i = 1; $i < $node[
"depth"];++$i)
734 $prefix .=
" ";
736 $options[$node[
"obj_id"]] = $prefix.$node[
"title"];
750 include_once(
'Services/Search/classes/class.ilUserSearchCache.php');
752 if(
$_GET[
'page_number'])
754 $this->search_cache->setResultPageNumber((
int)
$_GET[
'page_number']);