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';
56 parent::__construct();
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');
109 parent::prepareOutput();
121 if(count($this->search_cache))
135 return (array) $this->search_cache->getItemFilter();
145 return (array) $this->search_cache->getMimeFilter();
154 $this->search_cache->setRoot((
int)
$_POST[
'root_id']);
156 $this->search_cache->save();
169 if(!strlen($this->search_cache->getQuery()))
175 include_once
'./Services/Search/classes/Lucene/class.ilLuceneSearcher.php';
176 include_once
'./Services/Search/classes/Lucene/class.ilLuceneQueryParser.php';
183 include_once
'./Services/Search/classes/Lucene/class.ilLuceneSearchResultFilter.php';
185 $filter->loadFromDb();
188 $searcher->highlight($filter->getResultObjIds());
190 include_once
'./Services/Search/classes/class.ilSearchResultPresentation.php';
192 $presentation->setResults($filter->getResultIds());
194 $presentation->setSearcher($searcher);
197 $this->
addPager($filter,
'max_page');
199 $presentation->setPreviousNext($this->prev_link, $this->next_link);
203 if($presentation->render())
205 $this->tpl->setVariable(
'SEARCH_RESULTS',$presentation->getHTML(
true));
207 elseif(strlen($this->search_cache->getQuery()))
209 ilUtil::sendInfo(sprintf($this->lng->txt(
'search_no_match_hint'),$qp->getQuery()));
219 if(!$this->form->checkInput())
221 $this->search_cache->deleteCachedEntries();
223 include_once
'./Services/Object/classes/class.ilSubItemListGUI.php';
230 $this->search_cache->deleteCachedEntries();
233 include_once
'./Services/Object/classes/class.ilSubItemListGUI.php';
252 foreach((array) $this->search_cache->getItemFilter() as $obj => $value)
256 $filter_query .=
'+( ';
260 $filter_query .=
'OR';
262 $filter_query .= (
' '. (string) $filter_settings[$obj][
'filter'].
' ');
264 $filter_query .=
') ';
271 foreach($this->search_cache->getMimeFilter() as $mime => $value)
275 $mime_query .=
'+( ';
281 $mime_query .= (
' '. (string) $filter_settings[$mime][
'filter'].
' ');
285 $filter_query = $filter_query .
' '. $mime_query;
287 include_once
'./Services/Search/classes/Lucene/class.ilLuceneSearcher.php';
288 include_once
'./Services/Search/classes/Lucene/class.ilLuceneQueryParser.php';
295 include_once
'./Services/Search/classes/Lucene/class.ilLuceneSearchResultFilter.php';
296 include_once
'./Services/Search/classes/Lucene/class.ilLucenePathFilter.php';
299 $filter->setCandidates($searcher->getResult());
302 if($filter->getResultObjIds()) {
303 $searcher->highlight($filter->getResultObjIds());
309 include_once
'./Services/Search/classes/class.ilSearchResultPresentation.php';
311 $presentation->setResults($filter->getResultIds());
312 $presentation->setSearcher($searcher);
315 $ilBench->start(
'Lucene',
'1500_fo');
316 $this->
addPager($filter,
'max_page');
317 $ilBench->stop(
'Lucene',
'1500_fo');
319 $presentation->setPreviousNext($this->prev_link, $this->next_link);
321 if($presentation->render())
323 $this->tpl->setVariable(
'SEARCH_RESULTS',$presentation->getHTML(
true));
327 ilUtil::sendInfo(sprintf($this->lng->txt(
'search_no_match_hint'),$this->search_cache->getQuery()));
338 $this->root_node = $form->getItemByPostVar(
'area')->getValue();
339 $this->search_cache->setRoot($this->root_node);
340 $this->search_cache->save();
341 $this->search_cache->deleteCachedEntries();
343 include_once
'./Services/Object/classes/class.ilSubItemListGUI.php';
359 $this->tabs_gui->addTarget(
'search',$this->ctrl->getLinkTarget($this));
363 $this->tabs_gui->addTarget(
'search_user',$this->ctrl->getLinkTargetByClass(
'illuceneusersearchgui'));
366 if($this->
fields->getActiveFields())
368 $this->tabs_gui->addTarget(
'search_advanced',$this->ctrl->getLinkTargetByClass(
'illuceneAdvancedSearchgui'));
371 $this->tabs_gui->setTabActive(
'search');
385 include_once(
'Services/Search/classes/class.ilUserSearchCache.php');
388 if((
int)
$_GET[
'page_number'])
390 $this->search_cache->setResultPageNumber((
int) $_GET[
'page_number']);
395 if(
$_POST[
'item_filter_enabled'])
400 if(
$_POST[
'filter_type'][$type])
402 $filtered[$type] = 1;
405 $this->search_cache->setItemFilter($filtered);
411 if(
$_POST[
'filter_type'][$type])
416 $this->search_cache->setMimeFilter($mime);
421 $this->search_cache->setItemFilter(array());
422 $this->search_cache->setMimeFilter(array());
436 $adm_view_cmp = $adm_cmds = $creation_selector = $adm_view =
false;
439 if ((count($this->admin_panel_commands) > 0))
441 foreach($this->admin_panel_commands as
$cmd)
443 $this->tpl->setCurrentBlock(
"lucene_admin_panel_cmd");
444 $this->tpl->setVariable(
"LUCENE_PANEL_CMD", $cmd[
"cmd"]);
445 $this->tpl->setVariable(
"LUCENE_TXT_PANEL_CMD", $cmd[
"txt"]);
446 $this->tpl->parseCurrentBlock();
453 $this->tpl->setCurrentBlock(
"lucene_adm_view_components");
455 $this->tpl->setVariable(
"LUCENE_ADM_ALT_ARROW", $lng->txt(
"actions"));
456 $this->tpl->parseCurrentBlock();
457 $adm_view_cmp =
true;
461 if (is_array($this->admin_view_button))
463 if (is_array($this->admin_view_button))
465 $this->tpl->setCurrentBlock(
"lucene_admin_button");
466 $this->tpl->setVariable(
"LUCENE_ADMIN_MODE_LINK",
467 $this->admin_view_button[
"link"]);
468 $this->tpl->setVariable(
"LUCENE_TXT_ADMIN_MODE",
469 $this->admin_view_button[
"txt"]);
470 $this->tpl->parseCurrentBlock();
472 $this->tpl->setCurrentBlock(
"lucene_admin_view");
473 $this->tpl->parseCurrentBlock();
478 if (is_array($this->creation_selector))
480 $this->tpl->setCurrentBlock(
"lucene_add_commands");
483 $this->tpl->setVariable(
"LUCENE_ADD_COM_WIDTH",
'width="1"');
485 $this->tpl->setVariable(
"LUCENE_SELECT_OBJTYPE_REPOS",
486 $this->creation_selector[
"options"]);
487 $this->tpl->setVariable(
"LUCENE_BTN_NAME_REPOS",
488 $this->creation_selector[
"command"]);
489 $this->tpl->setVariable(
"LUCENE_TXT_ADD_REPOS",
490 $this->creation_selector[
"txt"]);
491 $this->tpl->parseCurrentBlock();
492 $creation_selector =
true;
494 if ($adm_view || $creation_selector)
496 $this->tpl->setCurrentBlock(
"lucene_adm_panel");
499 $this->tpl->setVariable(
"LUCENE_ADM_TBL_WIDTH",
'width:"100%";');
501 $this->tpl->parseCurrentBlock();
510 $this->admin_panel_commands[] =
511 array(
"cmd" => $a_cmd,
"txt" => $a_txt);
519 $this->admin_view_button =
520 array(
"link" => $a_link,
"txt" => $a_txt);
525 $this->page_form_action = $a_action;
536 $this->tpl->addBlockFile(
'ADM_CONTENT',
'adm_content',
'tpl.lucene_search.html',
'Services/Search');
539 include_once(
"./Services/UIComponent/Overlay/classes/class.ilOverlayGUI.php");
541 $this->tpl->addJavascript(
"./Services/Search/js/Search.js");
543 $this->tpl->setVariable(
"FORM_ACTION", $ilCtrl->getFormAction($this,
'performSearch'));
545 $this->tpl->setVariable(
"TXT_SEARCH", $lng->txt(
"search"));
546 $this->tpl->setVariable(
"TXT_OPTIONS", $lng->txt(
"options"));
548 $this->tpl->setVariable(
"TXT_COMBINATION", $lng->txt(
"search_term_combination"));
550 $this->tpl->setVariable(
"TXT_AREA", $lng->txt(
"search_area"));
554 $this->tpl->setCurrentBlock(
"type_sel");
555 $this->tpl->setVariable(
'TXT_TYPE_DEFAULT',$lng->txt(
"search_off"));
557 $this->tpl->setVariable(
"TXT_FILTER_BY_TYPE", $lng->txt(
"search_filter_by_type"));
558 $this->tpl->setVariable(
'FORM',$this->form->getHTML());
559 $this->tpl->parseCurrentBlock();
563 $this->tpl->setVariable(
'SEARCH_AREA_FORM', $this->
getSearchAreaForm()->getHTML());
564 $this->tpl->setVariable(
"TXT_CHANGE", $lng->txt(
"change"));
showSearchForm()
Show search form.
getType()
Get type of search (details | fast)
static prepareFormOutput($a_str, $a_strip=false)
prepares string output for html forms public
getSearchAreaForm()
Init standard search form.
remoteSearch()
Search from main menu.
getDetails()
Needed for base class search form.
GUI class for the workflow of copying objects.
static img($a_src, $a_alt="", $a_width="", $a_height="", $a_border=0, $a_id="")
Build img tag.
parse()
parse query string
static getInstance(ilLuceneQueryParser $qp)
Get singleton instance.
getMimeDetails()
Needed for base class search form.
executeCommand()
Execute Command.
__construct()
Constructor.
prepareOutput()
Add admin panel command.
static resetDetails()
reset details As long as static::resetDetails is not possible this method is final ...
setPageFormAction($a_action)
static sendInfo($a_info="", $a_keep=false)
Send Info Message to Screen.
GUI for simple Lucene search
setAdminViewButton($a_link, $a_txt)
Show admin view button.
showSavedResults()
Show saved results.
static _getInstance($a_usr_id)
Get singleton instance.
static getInstance($a_user_id)
addPager($result, $a_session_key)
Add Pager.
Presentation of search results using object list gui.
static getImagePath($img, $module_path="", $mode="output", $offline=false)
get image path (for images located in a template directory)
initStandardSearchForm($a_mode)
Init standard search form.
addAdminPanelCommand($a_cmd, $a_txt)
Add a command to the admin panel.
performSearch()
Perform search.
handleCommand($a_cmd)
Handle command.
static stripSlashes($a_str, $a_strip_html=true, $a_allow="")
strip slashes if magic qoutes is enabled
search()
Search (button pressed)
storeRoot()
Store new root node.
initUserSearchCache()
Init user search cache.
while($lm_rec=$ilDB->fetchAssoc($lm_set)) $data
fillAdminPanel()
Put admin panel into template:
static getInstance()
Get singleton instance.
static initJavascript()
Init javascript.