4 include_once
'Services/Search/classes/class.ilSearchBaseGUI.php';
6 define(
'SEARCH_FAST',1);
7 define(
'SEARCH_DETAILS',2);
8 define(
'SEARCH_AND',
'and');
9 define(
'SEARCH_OR',
'or');
44 $lng->loadLanguageModule(
"search");
46 $this->obj_types = array (
47 "lms" => $lng->txt(
"learning_resources"),
48 "glo" => $lng->txt(
"objs_glo"),
49 "wiki" => $lng->txt(
"objs_wiki"),
50 "mcst" => $lng->txt(
"objs_mcst"),
51 "fil" => $lng->txt(
"objs_file"),
52 "frm" => $lng->txt(
"objs_frm"),
53 "exc" => $lng->txt(
"objs_exc"),
54 "tst" => $lng->txt(
"search_tst_svy"),
55 "mep" => $lng->txt(
"objs_mep")
60 $this->form->checkInput();
61 reset($this->obj_types);
63 $new_search = isset(
$_POST[
'cmd'][
'performSearch']) ?
true :
false;
65 foreach($this->obj_types as $k =>
$t)
74 $this->root_node =
$_SESSION[
'search_root'] ?
$_SESSION[
'search_root'] : ROOT_FOLDER_ID;
77 $this->
setString(
$_POST[
'search'][
'string'] ?
$_POST[
'search'][
'string'] : $_SESSION[
'search'][
'string']);
78 #$this->setDetails($_POST['search']['details'] ? $_POST['search']['details'] : $_SESSION['search']['details']);
79 $this->
setDetails($new_search ?
$_POST[
'search'][
'details'] : $_SESSION[
'search'][
'details']);
91 $_SESSION[
'search'][
'type'] = $this->type = $a_type;
103 $_SESSION[
'search'][
'combination'] = $this->combination = $a_combination;
107 return $this->combination ? $this->combination :
SEARCH_OR;
115 $_SESSION[
'search'][
'string'] = $this->
string = $a_str;
127 $_SESSION[
'search'][
'details'] = $this->details = $a_details;
131 return $this->details ? $this->details : array();
137 return $this->root_node ? $this->root_node : ROOT_FOLDER_ID;
141 $_SESSION[
'search_root'] = $this->root_node = $a_node_id;
153 $next_class = $this->ctrl->getNextClass($this);
154 $cmd = $this->ctrl->getCmd();
158 case "ilpropertyformgui":
161 $ilCtrl->setReturn($this,
"");
162 return $ilCtrl->forwardCommand($this->form);
165 case 'ilobjectcopygui':
167 include_once
'./Services/Object/classes/class.ilObjectCopyGUI.php';
169 $this->ctrl->forwardCommand($cp);
176 $cmd =
"showSavedResults";
198 $q = $_REQUEST[
"query"];
199 include_once(
"./Services/Search/classes/class.ilSearchAutoComplete.php");
211 $this->tpl->addBlockFile(
'ADM_CONTENT',
'adm_content',
'tpl.search.html',
'Services/Search');
214 $this->tpl->setVariable(
"FORM", $this->form->getHTML());
223 $this->tpl->addBlockFile(
'ADM_CONTENT',
'adm_content',
'tpl.search_root_selector.html',
'Services/Search');
225 include_once
'Services/Search/classes/class.ilSearchRootSelector.php';
230 $exp->
setExpand(
$_GET[
"search_root_expand"] ?
$_GET[
"search_root_expand"] : $tree->readRootId());
231 $exp->setExpandTarget($this->ctrl->getLinkTarget($this,
'showSelectRoot'));
236 $this->tpl->setVariable(
"EXPLORER",$exp->getOutput());
254 include_once(
"Services/Form/classes/class.ilPropertyFormGUI.php");
258 $ti =
new ilTextInputGUI($lng->txt(
"search_search_term"),
"term");
262 $dsSchema = array(
"resultsList" =>
'response.results',
263 "fields" => array(
'term'));
264 $ti->setDataSource($ilCtrl->getLinkTarget($this,
"autoComplete"));
265 $ti->setDataSourceSchema($dsSchema);
266 $ti->setDataSourceResultFormat($dsFormatCallback);
267 $ti->setDataSourceDelimiter($dsDelimiter);
268 $this->form->addItem($ti);
274 $op1 =
new ilRadioOption($lng->txt(
"search_any_word"),
"or");
275 $radg->addOption($op1);
276 $op2 =
new ilRadioOption($lng->txt(
"search_all_words"),
"and");
277 $radg->addOption($op2);
278 $this->form->addItem($radg);
281 include_once(
"./Services/Form/classes/class.ilRepositorySelectorInputGUI.php");
284 $this->form->addItem($ti);
285 $ti->readFromSession();
291 $radg->addOption($op1);
296 reset($this->obj_types);
297 foreach ($this->obj_types as $k =>
$t)
300 $cb->setChecked($details[$k]);
301 $op2->addSubItem($cb);
304 $radg->addOption($op2);
305 $this->form->addItem($radg);
309 $this->form->addCommandButton(
"performSearch", $lng->txt(
"search"));
311 $this->form->setTitle($lng->txt(
"search"));
312 $this->form->setFormAction($ilCtrl->getFormAction($this,
'performSearch'));
321 include_once
'Services/Search/classes/class.ilSearchResult.php';
330 if(count($result_obj->getResults()))
332 $this->
addPager($result_obj,
'max_page');
334 include_once
'./Services/Search/classes/class.ilSearchResultPresentation.php';
336 $presentation->setResults($result_obj->getResultsForPresentation());
337 $presentation->setSubitemIds($result_obj->getSubitemIds());
338 $presentation->setPreviousNext($this->prev_link, $this->next_link);
339 #$presentation->setSearcher($searcher);
341 if($presentation->render())
344 $this->tpl->setVariable(
'RESULTS_TABLE',$presentation->getHTML(
true));
353 $this->search_mode =
'in_results';
354 $this->search_cache->setResultPageNumber(1);
369 if(!isset(
$_GET[
'page_number']) and $this->search_mode !=
'in_results' )
372 $this->search_cache->delete();
395 $result_meta =& $this->
__searchMeta($query_parser,
'keyword');
396 $result->mergeEntries($result_meta);
398 $result_meta =& $this->
__searchMeta($query_parser,
'contribute');
399 $result->mergeEntries($result_meta);
401 $result_meta =& $this->
__searchMeta($query_parser,
'title');
402 $result->mergeEntries($result_meta);
404 $result_meta =& $this->
__searchMeta($query_parser,
'description');
405 $result->mergeEntries($result_meta);
413 if($this->search_mode ==
'in_results')
415 include_once
'Services/Search/classes/class.ilSearchResult.php';
418 $old_result_obj->
read();
420 $result->diffEntriesFromResult($old_result_obj);
429 if(!count(
$result->getResults()))
436 #$message = sprintf($this->lng->txt('search_limit_reached'),$this->settings->getMaxHits());
437 #ilUtil::sendInfo($message);
443 include_once
'./Services/Search/classes/class.ilSearchResultPresentation.php';
445 $presentation->setResults(
$result->getResultsForPresentation());
446 $presentation->setSubitemIds(
$result->getSubitemIds());
447 $presentation->setPreviousNext($this->prev_link, $this->next_link);
449 if($presentation->render())
452 $this->tpl->setVariable(
'RESULTS_TABLE',$presentation->getHTML(
true));
468 $ilTabs->addTab(
"search", $this->lng->txt(
"search"),
469 $this->ctrl->getLinkTarget($this));
477 if (!$this->settings->getHideAdvancedSearch())
484 $ilTabs->addTab(
"adv_search", $this->lng->txt(
"search_advanced"),
485 $this->ctrl->getLinkTargetByClass(
'iladvancedsearchgui'));
488 $ilTabs->activateTab(
"search");
506 $result->mergeEntries($content_search->performSearch());
512 $result->mergeEntries($forum_search->performSearch());
518 $gdf_search->setFilter(array(
'gdf'));
519 $result->mergeEntries($gdf_search->performSearch());
522 $result->mergeEntries($gdf_term_search->performSearch());
528 $result->mergeEntries($exc_search->performSearch());
532 $mcst_search =& ilObjectSearchFactory::_getMediaCastSearchInstance($query_parser);
533 $result->mergeEntries($mcst_search->performSearch());
539 $result->mergeEntries($tst_search->performSearch());
545 $result->mergeEntries($mep_search->performSearch());
550 $result->mergeEntries($mob_search->performKeywordSearch());
557 $result->mergeEntries($wiki_search->performSearch());
577 include_once
'Services/Search/classes/class.ilQueryParser.php';
581 $query_parser->parse();
583 if(!$query_parser->validate())
585 return $query_parser->getMessage();
587 return $query_parser;
596 include_once
'Services/Search/classes/class.ilObjectSearchFactory.php';
603 return $obj_search->performSearch();
614 include_once
'Services/Search/classes/class.ilObjectSearchFactory.php';
624 $meta_search->setMode(
'keyword');
628 $meta_search->setMode(
'contribute');
632 $meta_search->setMode(
'title');
636 $meta_search->setMode(
'description');
639 return $meta_search->performSearch();
721 include_once(
'Services/Search/classes/class.ilUserSearchCache.php');
723 if(
$_GET[
'page_number'])
725 $this->search_cache->setResultPageNumber((
int)
$_GET[
'page_number']);