24 include_once
'./Services/Search/classes/class.ilSearchSettings.php';
25 include_once
'./Services/Search/classes/class.ilSearchBaseGUI.php';
26 include_once
'./Services/Search/classes/Lucene/class.ilLuceneAdvancedSearchFields.php';
27 include_once
'./Services/PersonalDesktop/interfaces/interface.ilDesktopItemHandling.php';
28 include_once
'./Services/Administration/interfaces/interface.ilAdministrationCommandHandling.php';
69 $ilBench->start(
'Lucene',
'0900_executeCommand');
70 $next_class = $this->ctrl->getNextClass($this);
71 $cmd = $this->ctrl->getCmd();
76 case "ilpropertyformgui":
81 $ilCtrl->setReturn($this,
'storeRoot');
82 $ilCtrl->forwardCommand($form);
85 case 'ilobjectcopygui':
86 include_once
'./Services/Object/classes/class.ilObjectCopyGUI.php';
88 $this->ctrl->forwardCommand($cp);
95 $cmd =
"showSavedResults";
100 $ilBench->stop(
'Lucene',
'0900_executeCommand');
118 $GLOBALS[
"tpl"]->setAdminViewButton(
119 $this->ctrl->getLinkTarget($this,
"disableAdministrationPanel"),
120 $this->lng->txt(
"basic_commands"));
122 $GLOBALS[
"tpl"]->addAdminPanelCommand(
"delete",
123 $this->lng->txt(
"delete_selected_items"));
127 $GLOBALS[
"tpl"]->addAdminPanelCommand(
"cut",
128 $this->lng->txt(
"move_selected_items"));
130 $GLOBALS[
"tpl"]->addAdminPanelCommand(
"link",
131 $this->lng->txt(
"link_selected_items"));
135 $GLOBALS[
"tpl"]->addAdminPanelCommand(
"paste",
136 $this->lng->txt(
"paste_clipboard_items"));
137 $GLOBALS[
"tpl"]->addAdminPanelCommand(
"clear",
138 $this->lng->txt(
"clear_clipboard"));
141 elseif($ilUser->getId() != ANONYMOUS_USER_ID)
143 $GLOBALS[
"tpl"]->setAdminViewButton(
144 $this->ctrl->getLinkTarget($this,
"enableAdministrationPanel"),
145 $this->lng->txt(
"all_commands"));
148 $this->ctrl->setParameter($this,
"type",
"");
149 $this->ctrl->setParameter($this,
"item_ref_id",
"");
150 $GLOBALS[
"tpl"]->setPageFormAction($this->ctrl->getFormAction($this));
161 if(count($this->search_cache))
175 return (array) $this->search_cache->getItemFilter();
184 $this->search_cache->setRoot((
int)
$_POST[
'root_id']);
186 $this->search_cache->save();
199 if(!strlen($this->search_cache->getQuery()))
205 include_once
'./Services/Search/classes/Lucene/class.ilLuceneSearcher.php';
206 include_once
'./Services/Search/classes/Lucene/class.ilLuceneQueryParser.php';
213 include_once
'./Services/Search/classes/Lucene/class.ilLuceneSearchResultFilter.php';
215 $filter->loadFromDb();
218 $searcher->highlight($filter->getResultObjIds());
220 include_once
'./Services/Search/classes/class.ilSearchResultPresentation.php';
222 $presentation->setResults($filter->getResultIds());
224 $presentation->setSearcher($searcher);
227 $this->
addPager($filter,
'max_page');
229 $presentation->setPreviousNext($this->prev_link, $this->next_link);
233 if($presentation->render())
235 $this->tpl->setVariable(
'SEARCH_RESULTS',$presentation->getHTML(
true));
237 elseif(strlen($this->search_cache->getQuery()))
239 ilUtil::sendInfo(sprintf($this->lng->txt(
'search_no_match_hint'),$qp->getQuery()));
249 if(!$this->form->checkInput())
251 $this->search_cache->deleteCachedEntries();
253 include_once
'./Services/Object/classes/class.ilSubItemListGUI.php';
260 $this->search_cache->deleteCachedEntries();
263 include_once
'./Services/Object/classes/class.ilSubItemListGUI.php';
282 foreach((array) $this->search_cache->getItemFilter() as $obj => $value)
286 $filter_query .=
'+( ';
290 $filter_query .=
'OR';
292 $filter_query .= (
' '. (string) $filter_settings[$obj][
'filter'].
' ');
294 $filter_query .=
') ';
296 include_once
'./Services/Search/classes/Lucene/class.ilLuceneSearcher.php';
297 include_once
'./Services/Search/classes/Lucene/class.ilLuceneQueryParser.php';
304 include_once
'./Services/Search/classes/Lucene/class.ilLuceneSearchResultFilter.php';
305 include_once
'./Services/Search/classes/Lucene/class.ilLucenePathFilter.php';
308 $filter->setCandidates($searcher->getResult());
311 if($filter->getResultObjIds()) {
312 $searcher->highlight($filter->getResultObjIds());
318 include_once
'./Services/Search/classes/class.ilSearchResultPresentation.php';
320 $presentation->setResults($filter->getResultIds());
321 $presentation->setSearcher($searcher);
324 $ilBench->start(
'Lucene',
'1500_fo');
325 $this->
addPager($filter,
'max_page');
326 $ilBench->stop(
'Lucene',
'1500_fo');
328 $presentation->setPreviousNext($this->prev_link, $this->next_link);
330 if($presentation->render())
332 $this->tpl->setVariable(
'SEARCH_RESULTS',$presentation->getHTML(
true));
336 ilUtil::sendInfo(sprintf($this->lng->txt(
'search_no_match_hint'),$this->search_cache->getQuery()));
339 if($filter->getResultIds())
341 #$this->fillAdminPanel();
353 $this->root_node = $form->getItemByPostVar(
'area')->getValue();
354 $this->search_cache->setRoot($this->root_node);
355 $this->search_cache->save();
356 $this->search_cache->deleteCachedEntries();
358 include_once
'./Services/Object/classes/class.ilSubItemListGUI.php';
374 $this->tabs_gui->addTarget(
'search',$this->ctrl->getLinkTarget($this));
375 if($this->
fields->getActiveFields())
377 $this->tabs_gui->addTarget(
'search_advanced',$this->ctrl->getLinkTargetByClass(
'illuceneAdvancedSearchgui'));
380 $this->tabs_gui->setTabActive(
'search');
394 include_once(
'Services/Search/classes/class.ilUserSearchCache.php');
397 if((
int)
$_GET[
'page_number'])
399 $this->search_cache->setResultPageNumber((
int) $_GET[
'page_number']);
404 if(
$_POST[
'item_filter_enabled'])
409 if(
$_POST[
'filter_type'][$type])
411 $filtered[$type] = 1;
414 $this->search_cache->setItemFilter($filtered);
419 $this->search_cache->setItemFilter(array());
433 $adm_view_cmp = $adm_cmds = $creation_selector = $adm_view =
false;
436 if ((count($this->admin_panel_commands) > 0))
438 foreach($this->admin_panel_commands as
$cmd)
440 $this->tpl->setCurrentBlock(
"lucene_admin_panel_cmd");
441 $this->tpl->setVariable(
"LUCENE_PANEL_CMD", $cmd[
"cmd"]);
442 $this->tpl->setVariable(
"LUCENE_TXT_PANEL_CMD", $cmd[
"txt"]);
443 $this->tpl->parseCurrentBlock();
450 $this->tpl->setCurrentBlock(
"lucene_adm_view_components");
452 $this->tpl->setVariable(
"LUCENE_ADM_ALT_ARROW", $lng->txt(
"actions"));
453 $this->tpl->parseCurrentBlock();
454 $adm_view_cmp =
true;
458 if (is_array($this->admin_view_button))
460 if (is_array($this->admin_view_button))
462 $this->tpl->setCurrentBlock(
"lucene_admin_button");
463 $this->tpl->setVariable(
"LUCENE_ADMIN_MODE_LINK",
464 $this->admin_view_button[
"link"]);
465 $this->tpl->setVariable(
"LUCENE_TXT_ADMIN_MODE",
466 $this->admin_view_button[
"txt"]);
467 $this->tpl->parseCurrentBlock();
469 $this->tpl->setCurrentBlock(
"lucene_admin_view");
470 $this->tpl->parseCurrentBlock();
475 if (is_array($this->creation_selector))
477 $this->tpl->setCurrentBlock(
"lucene_add_commands");
480 $this->tpl->setVariable(
"LUCENE_ADD_COM_WIDTH",
'width="1"');
482 $this->tpl->setVariable(
"LUCENE_SELECT_OBJTYPE_REPOS",
483 $this->creation_selector[
"options"]);
484 $this->tpl->setVariable(
"LUCENE_BTN_NAME_REPOS",
485 $this->creation_selector[
"command"]);
486 $this->tpl->setVariable(
"LUCENE_TXT_ADD_REPOS",
487 $this->creation_selector[
"txt"]);
488 $this->tpl->parseCurrentBlock();
489 $creation_selector =
true;
491 if ($adm_view || $creation_selector)
493 $this->tpl->setCurrentBlock(
"lucene_adm_panel");
496 $this->tpl->setVariable(
"LUCENE_ADM_TBL_WIDTH",
'width:"100%";');
498 $this->tpl->parseCurrentBlock();
507 $this->admin_panel_commands[] =
508 array(
"cmd" => $a_cmd,
"txt" => $a_txt);
516 $this->admin_view_button =
517 array(
"link" => $a_link,
"txt" => $a_txt);
522 $this->page_form_action = $a_action;
533 $this->tpl->addBlockFile(
'ADM_CONTENT',
'adm_content',
'tpl.lucene_search.html',
'Services/Search');
536 include_once(
"./Services/UIComponent/Overlay/classes/class.ilOverlayGUI.php");
538 $this->tpl->addJavascript(
"./Services/Search/js/Search.js");
540 $this->tpl->setVariable(
"FORM_ACTION", $ilCtrl->getFormAction($this,
'performSearch'));
542 $this->tpl->setVariable(
"TXT_SEARCH", $lng->txt(
"search"));
543 $this->tpl->setVariable(
"TXT_OPTIONS", $lng->txt(
"options"));
545 $this->tpl->setVariable(
"TXT_COMBINATION", $lng->txt(
"search_term_combination"));
547 $this->tpl->setVariable(
"TXT_AREA", $lng->txt(
"search_area"));
551 $this->tpl->setCurrentBlock(
"type_sel");
552 $this->tpl->setVariable(
'TXT_TYPE_DEFAULT',$lng->txt(
"search_off"));
554 $this->tpl->setVariable(
"TXT_FILTER_BY_TYPE", $lng->txt(
"search_filter_by_type"));
555 $this->tpl->setVariable(
'FORM',$this->form->getHTML());
556 $this->tpl->parseCurrentBlock();
560 $this->tpl->setVariable(
'SEARCH_AREA_FORM', $this->
getSearchAreaForm()->getHTML());
561 $this->tpl->setVariable(
"TXT_CHANGE", $lng->txt(
"change"));