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 $this->ctrl->setReturn($this,
'');
87 include_once
'./Services/Object/classes/class.ilObjectCopyGUI.php';
89 $this->ctrl->forwardCommand($cp);
96 $cmd =
"showSavedResults";
101 $ilBench->stop(
'Lucene',
'0900_executeCommand');
110 parent::prepareOutput();
122 if(count($this->search_cache))
136 return (
array) $this->search_cache->getItemFilter();
146 return (
array) $this->search_cache->getMimeFilter();
156 include_once
'./Services/Search/classes/Lucene/class.ilLuceneQueryParser.php';
158 $qp->parseAutoWildcard();
162 $this->search_cache->setRoot((
int)
$_POST[
'root_id']);
164 $this->search_cache->save();
177 if(!strlen($this->search_cache->getQuery()))
183 include_once
'./Services/Search/classes/Lucene/class.ilLuceneSearcher.php';
184 include_once
'./Services/Search/classes/Lucene/class.ilLuceneQueryParser.php';
191 include_once
'./Services/Search/classes/Lucene/class.ilLuceneSearchResultFilter.php';
193 $filter->loadFromDb();
196 $searcher->highlight($filter->getResultObjIds());
198 include_once
'./Services/Search/classes/class.ilSearchResultPresentation.php';
200 $presentation->setResults($filter->getResultIds());
202 $presentation->setSearcher($searcher);
205 $this->
addPager($filter,
'max_page');
207 $presentation->setPreviousNext($this->prev_link, $this->next_link);
211 if($presentation->render())
213 $this->tpl->setVariable(
'SEARCH_RESULTS',$presentation->getHTML(
true));
215 elseif(strlen($this->search_cache->getQuery()))
217 ilUtil::sendInfo(sprintf($this->lng->txt(
'search_no_match_hint'),$qp->getQuery()));
227 if(!$this->form->checkInput())
229 $this->search_cache->deleteCachedEntries();
231 include_once
'./Services/Object/classes/class.ilSubItemListGUI.php';
238 $this->search_cache->deleteCachedEntries();
241 include_once
'./Services/Object/classes/class.ilSubItemListGUI.php';
260 foreach((
array) $this->search_cache->getItemFilter() as $obj => $value)
264 $filter_query .=
'+( ';
268 $filter_query .=
'OR';
270 $filter_query .= (
' '. (
string) $filter_settings[$obj][
'filter'].
' ');
272 $filter_query .=
') ';
279 foreach($this->search_cache->getMimeFilter() as $mime => $value)
283 $mime_query .=
'+( ';
289 $mime_query .= (
' '. (
string) $filter_settings[$mime][
'filter'].
' ');
299 $filter_query = $filter_query .
' '. $mime_query.
' '.$cdate_query;
301 include_once
'./Services/Search/classes/Lucene/class.ilLuceneSearcher.php';
302 include_once
'./Services/Search/classes/Lucene/class.ilLuceneQueryParser.php';
304 $query = $this->search_cache->getQuery();
307 $query =
' +('.$query.
')';
315 include_once
'./Services/Search/classes/Lucene/class.ilLuceneSearchResultFilter.php';
316 include_once
'./Services/Search/classes/Lucene/class.ilLucenePathFilter.php';
319 $filter->setCandidates($searcher->getResult());
322 if($filter->getResultObjIds()) {
323 $searcher->highlight($filter->getResultObjIds());
329 include_once
'./Services/Search/classes/class.ilSearchResultPresentation.php';
331 $presentation->setResults($filter->getResultIds());
332 $presentation->setSearcher($searcher);
335 $ilBench->start(
'Lucene',
'1500_fo');
336 $this->
addPager($filter,
'max_page');
337 $ilBench->stop(
'Lucene',
'1500_fo');
339 $presentation->setPreviousNext($this->prev_link, $this->next_link);
341 if($presentation->render())
343 $this->tpl->setVariable(
'SEARCH_RESULTS',$presentation->getHTML(
true));
347 ilUtil::sendInfo(sprintf($this->lng->txt(
'search_no_match_hint'),$this->search_cache->getQuery()));
358 $this->root_node = $form->getItemByPostVar(
'area')->getValue();
359 $this->search_cache->setRoot($this->root_node);
360 $this->search_cache->save();
361 $this->search_cache->deleteCachedEntries();
363 include_once
'./Services/Object/classes/class.ilSubItemListGUI.php';
376 $ilHelp->setScreenIdComponent(
"src_luc");
378 $this->tabs_gui->addTarget(
'search',$this->ctrl->getLinkTarget($this));
382 $this->tabs_gui->addTarget(
'search_user',$this->ctrl->getLinkTargetByClass(
'illuceneusersearchgui'));
387 $this->tabs_gui->addTarget(
'search_advanced',$this->ctrl->getLinkTargetByClass(
'illuceneAdvancedSearchgui'));
390 $this->tabs_gui->setTabActive(
'search');
404 include_once(
'Services/Search/classes/class.ilUserSearchCache.php');
407 if((
int)
$_GET[
'page_number'])
409 $this->search_cache->setResultPageNumber((
int) $_GET[
'page_number']);
414 if(
$_POST[
'item_filter_enabled'])
419 if(
$_POST[
'filter_type'][$type])
421 $filtered[$type] = 1;
424 $this->search_cache->setItemFilter($filtered);
430 if(
$_POST[
'filter_type'][$type])
435 $this->search_cache->setMimeFilter($mime);
440 if(!
$_POST[
'item_filter_enabled'])
443 $this->search_cache->setItemFilter(
array());
444 $this->search_cache->setMimeFilter(
array());
448 $this->search_cache->setCreationFilter(
array());
462 $adm_view_cmp = $adm_cmds = $creation_selector = $adm_view =
false;
465 if ((count($this->admin_panel_commands) > 0))
467 foreach($this->admin_panel_commands as
$cmd)
469 $this->tpl->setCurrentBlock(
"lucene_admin_panel_cmd");
470 $this->tpl->setVariable(
"LUCENE_PANEL_CMD", $cmd[
"cmd"]);
471 $this->tpl->setVariable(
"LUCENE_TXT_PANEL_CMD", $cmd[
"txt"]);
472 $this->tpl->parseCurrentBlock();
479 $this->tpl->setCurrentBlock(
"lucene_adm_view_components");
481 $this->tpl->setVariable(
"LUCENE_ADM_ALT_ARROW", $lng->txt(
"actions"));
482 $this->tpl->parseCurrentBlock();
483 $adm_view_cmp =
true;
487 if (is_array($this->admin_view_button))
489 if (is_array($this->admin_view_button))
491 $this->tpl->setCurrentBlock(
"lucene_admin_button");
492 $this->tpl->setVariable(
"LUCENE_ADMIN_MODE_LINK",
493 $this->admin_view_button[
"link"]);
494 $this->tpl->setVariable(
"LUCENE_TXT_ADMIN_MODE",
495 $this->admin_view_button[
"txt"]);
496 $this->tpl->parseCurrentBlock();
498 $this->tpl->setCurrentBlock(
"lucene_admin_view");
499 $this->tpl->parseCurrentBlock();
504 if (is_array($this->creation_selector))
506 $this->tpl->setCurrentBlock(
"lucene_add_commands");
509 $this->tpl->setVariable(
"LUCENE_ADD_COM_WIDTH",
'width="1"');
511 $this->tpl->setVariable(
"LUCENE_SELECT_OBJTYPE_REPOS",
512 $this->creation_selector[
"options"]);
513 $this->tpl->setVariable(
"LUCENE_BTN_NAME_REPOS",
514 $this->creation_selector[
"command"]);
515 $this->tpl->setVariable(
"LUCENE_TXT_ADD_REPOS",
516 $this->creation_selector[
"txt"]);
517 $this->tpl->parseCurrentBlock();
518 $creation_selector =
true;
520 if ($adm_view || $creation_selector)
522 $this->tpl->setCurrentBlock(
"lucene_adm_panel");
525 $this->tpl->setVariable(
"LUCENE_ADM_TBL_WIDTH",
'width:"100%";');
527 $this->tpl->parseCurrentBlock();
536 $this->admin_panel_commands[] =
537 array(
"cmd" => $a_cmd,
"txt" => $a_txt);
545 $this->admin_view_button =
546 array(
"link" => $a_link,
"txt" => $a_txt);
551 $this->page_form_action = $a_action;
562 $this->tpl->addBlockFile(
'ADM_CONTENT',
'adm_content',
'tpl.lucene_search.html',
'Services/Search');
565 include_once(
"./Services/UIComponent/Overlay/classes/class.ilOverlayGUI.php");
567 $this->tpl->addJavascript(
"./Services/Search/js/Search.js");
569 include_once(
"./Services/UIComponent/Glyph/classes/class.ilGlyphGUI.php");
571 $this->tpl->setVariable(
"FORM_ACTION", $ilCtrl->getFormAction($this,
'performSearch'));
573 include_once(
"./Services/UIComponent/Button/classes/class.ilSubmitButton.php");
575 $btn->setCommand(
"performSearch");
576 $btn->setCaption(
"search");
577 $this->tpl->setVariable(
"SUBMIT_BTN",$btn->render());
578 $this->tpl->setVariable(
"TXT_OPTIONS", $lng->txt(
"options"));
580 $this->tpl->setVariable(
"TXT_COMBINATION", $lng->txt(
"search_term_combination"));
582 $this->tpl->setVariable(
"TXT_AREA", $lng->txt(
"search_area"));
586 $this->tpl->setCurrentBlock(
"type_sel");
587 $this->tpl->setVariable(
'TXT_TYPE_DEFAULT',$lng->txt(
"search_off"));
589 $this->tpl->setVariable(
"TXT_FILTER_BY_TYPE", $lng->txt(
"search_filter_by_type"));
590 $this->tpl->setVariable(
'FORM',$this->form->getHTML());
591 $this->tpl->parseCurrentBlock();
595 $this->tpl->setVariable(
'SEARCH_AREA_FORM', $this->
getSearchAreaForm()->getHTML());
596 $this->tpl->setVariable(
"TXT_CHANGE", $lng->txt(
"change"));
601 $this->tpl->setVariable(
'TXT_FILTER_BY_CDATE',$this->lng->txt(
'search_filter_cd'));
602 $this->tpl->setVariable(
'TXT_CD_OFF',$this->lng->txt(
'search_off'));
619 $options = $this->search_cache->getCreationFilter();
637 return '+(cdate:[* TO '.$limit->get(
IL_CAL_DATE).
']) ';
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
loadCreationFilter()
Load creation date filter.
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.
parse()
parse query string
static getInstance(ilLuceneQueryParser $qp)
Get singleton instance.
static get($a_glyph, $a_text="")
Get glyph html.
parseCreationFilter()
Parse creation date.
Add rich text string
The name of the decorator.
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.
if(!is_array($argv)) $options
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
Create styles array
The data for the language used.
search()
Search (button pressed)
storeRoot()
Store new root node.
initUserSearchCache()
Init user search cache.
fillAdminPanel()
Put admin panel into template:
Add data(end) time
Method that wraps PHPs time in order to allow simulations with the workflow.
static getInstance()
Get singleton instance.
static initJavascript()
Init javascript.