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';
58 parent::__construct();
73 $ilBench->start(
'Lucene',
'0900_executeCommand');
74 $next_class = $this->ctrl->getNextClass($this);
75 $cmd = $this->ctrl->getCmd();
78 switch ($next_class) {
79 case "ilpropertyformgui":
84 $ilCtrl->setReturn($this,
'storeRoot');
88 case 'ilobjectcopygui':
89 $this->ctrl->setReturn($this,
'');
90 include_once
'./Services/Object/classes/class.ilObjectCopyGUI.php';
92 $this->ctrl->forwardCommand($cp);
98 $cmd =
"showSavedResults";
103 $ilBench->stop(
'Lucene',
'0900_executeCommand');
112 parent::prepareOutput();
124 if (count($this->search_cache)) {
137 return (array) $this->search_cache->getItemFilter();
147 return (array) $this->search_cache->getMimeFilter();
157 include_once
'./Services/Search/classes/Lucene/class.ilLuceneQueryParser.php';
159 $qp->parseAutoWildcard();
163 $this->search_cache->setRoot((
int)
$_POST[
'root_id']);
165 $this->search_cache->save();
181 if (!strlen($this->search_cache->getQuery())) {
186 include_once
'./Services/Search/classes/Lucene/class.ilLuceneSearcher.php';
187 include_once
'./Services/Search/classes/Lucene/class.ilLuceneQueryParser.php';
194 include_once
'./Services/Search/classes/Lucene/class.ilLuceneSearchResultFilter.php';
196 $filter->loadFromDb();
199 $searcher->highlight($filter->getResultObjIds());
201 include_once
'./Services/Search/classes/class.ilSearchResultPresentation.php';
203 $presentation->setResults($filter->getResultIds());
205 $presentation->setSearcher($searcher);
208 $this->
addPager($filter,
'max_page');
210 $presentation->setPreviousNext($this->prev_link, $this->next_link);
214 if ($presentation->render()) {
215 $this->tpl->setVariable(
'SEARCH_RESULTS', $presentation->getHTML(
true));
216 } elseif (strlen($this->search_cache->getQuery())) {
217 ilUtil::sendInfo(sprintf($this->lng->txt(
'search_no_match_hint'), $qp->getQuery()));
227 if (!$this->form->checkInput()) {
228 $this->search_cache->deleteCachedEntries();
230 include_once
'./Services/Object/classes/class.ilSubItemListGUI.php';
237 $this->search_cache->deleteCachedEntries();
240 include_once
'./Services/Object/classes/class.ilSubItemListGUI.php';
261 foreach ((array) $this->search_cache->getItemFilter() as $obj => $value) {
262 if (!$filter_query) {
263 $filter_query .=
'+( ';
265 $filter_query .=
'OR';
267 $filter_query .= (
' ' . (string) $filter_settings[$obj][
'filter'] .
' ');
269 $filter_query .=
') ';
275 foreach ($this->search_cache->getMimeFilter() as $mime => $value) {
277 $mime_query .=
'+( ';
281 $mime_query .= (
' ' . (string) $filter_settings[$mime][
'filter'] .
' ');
291 $filter_query = $filter_query .
' ' . $mime_query .
' ' . $cdate_query;
293 include_once
'./Services/Search/classes/Lucene/class.ilLuceneSearcher.php';
294 include_once
'./Services/Search/classes/Lucene/class.ilLuceneQueryParser.php';
296 $query = $this->search_cache->getQuery();
306 include_once
'./Services/Search/classes/Lucene/class.ilLuceneSearchResultFilter.php';
307 include_once
'./Services/Search/classes/Lucene/class.ilLucenePathFilter.php';
310 $filter->setCandidates($searcher->getResult());
313 if ($filter->getResultObjIds()) {
314 $searcher->highlight($filter->getResultObjIds());
320 include_once
'./Services/Search/classes/class.ilSearchResultPresentation.php';
322 $presentation->setResults($filter->getResultIds());
323 $presentation->setSearcher($searcher);
326 $ilBench->start(
'Lucene',
'1500_fo');
327 $this->
addPager($filter,
'max_page');
328 $ilBench->stop(
'Lucene',
'1500_fo');
330 $presentation->setPreviousNext($this->prev_link, $this->next_link);
332 if ($presentation->render()) {
333 $this->tpl->setVariable(
'SEARCH_RESULTS', $presentation->getHTML(
true));
335 ilUtil::sendInfo(sprintf($this->lng->txt(
'search_no_match_hint'), $this->search_cache->getQuery()));
346 $this->root_node =
$form->getItemByPostVar(
'area')->getValue();
347 $this->search_cache->setRoot($this->root_node);
348 $this->search_cache->save();
349 $this->search_cache->deleteCachedEntries();
351 include_once
'./Services/Object/classes/class.ilSubItemListGUI.php';
364 $ilHelp = $DIC[
'ilHelp'];
366 $ilHelp->setScreenIdComponent(
"src_luc");
368 $this->tabs_gui->addTarget(
'search', $this->ctrl->getLinkTarget($this));
371 $this->tabs_gui->addTarget(
'search_user', $this->ctrl->getLinkTargetByClass(
'illuceneusersearchgui'));
375 $this->tabs_gui->addTarget(
'search_advanced', $this->ctrl->getLinkTargetByClass(
'illuceneAdvancedSearchgui'));
378 $this->tabs_gui->setTabActive(
'search');
393 include_once(
'Services/Search/classes/class.ilUserSearchCache.php');
396 if ((
int)
$_GET[
'page_number']) {
397 $this->search_cache->setResultPageNumber((
int) $_GET[
'page_number']);
399 if (isset(
$_POST[
'term'])) {
401 if (
$_POST[
'item_filter_enabled']) {
405 $filtered[
$type] = 1;
408 $this->search_cache->setItemFilter($filtered);
417 $this->search_cache->setMimeFilter($mime);
420 if (!
$_POST[
'item_filter_enabled']) {
422 $this->search_cache->setItemFilter(array());
423 $this->search_cache->setMimeFilter(array());
425 if (!
$_POST[
'screation']) {
426 $this->search_cache->setCreationFilter(array());
442 $adm_view_cmp = $adm_cmds = $creation_selector = $adm_view =
false;
445 if ((count((array) $this->admin_panel_commands) > 0)) {
446 foreach ($this->admin_panel_commands as $cmd) {
447 $this->tpl->setCurrentBlock(
"lucene_admin_panel_cmd");
448 $this->tpl->setVariable(
"LUCENE_PANEL_CMD", $cmd[
"cmd"]);
449 $this->tpl->setVariable(
"LUCENE_TXT_PANEL_CMD", $cmd[
"txt"]);
450 $this->tpl->parseCurrentBlock();
456 $this->tpl->setCurrentBlock(
"lucene_adm_view_components");
458 $this->tpl->setVariable(
"LUCENE_ADM_ALT_ARROW",
$lng->txt(
"actions"));
459 $this->tpl->parseCurrentBlock();
460 $adm_view_cmp =
true;
464 if (is_array($this->admin_view_button)) {
465 if (is_array($this->admin_view_button)) {
466 $this->tpl->setCurrentBlock(
"lucene_admin_button");
467 $this->tpl->setVariable(
468 "LUCENE_ADMIN_MODE_LINK",
469 $this->admin_view_button[
"link"]
471 $this->tpl->setVariable(
472 "LUCENE_TXT_ADMIN_MODE",
473 $this->admin_view_button[
"txt"]
475 $this->tpl->parseCurrentBlock();
477 $this->tpl->setCurrentBlock(
"lucene_admin_view");
478 $this->tpl->parseCurrentBlock();
483 if (is_array($this->creation_selector)) {
484 $this->tpl->setCurrentBlock(
"lucene_add_commands");
486 $this->tpl->setVariable(
"LUCENE_ADD_COM_WIDTH",
'width="1"');
488 $this->tpl->setVariable(
489 "LUCENE_SELECT_OBJTYPE_REPOS",
490 $this->creation_selector[
"options"]
492 $this->tpl->setVariable(
493 "LUCENE_BTN_NAME_REPOS",
494 $this->creation_selector[
"command"]
496 $this->tpl->setVariable(
497 "LUCENE_TXT_ADD_REPOS",
498 $this->creation_selector[
"txt"]
500 $this->tpl->parseCurrentBlock();
501 $creation_selector =
true;
503 if ($adm_view || $creation_selector) {
504 $this->tpl->setCurrentBlock(
"lucene_adm_panel");
506 $this->tpl->setVariable(
"LUCENE_ADM_TBL_WIDTH",
'width:"100%";');
508 $this->tpl->parseCurrentBlock();
517 $this->admin_panel_commands[] =
518 array(
"cmd" => $a_cmd,
"txt" => $a_txt);
526 $this->admin_view_button =
527 array(
"link" => $a_link,
"txt" => $a_txt);
532 $this->page_form_action = $a_action;
546 $this->tpl->addBlockFile(
'ADM_CONTENT',
'adm_content',
'tpl.lucene_search.html',
'Services/Search');
549 include_once(
"./Services/UIComponent/Overlay/classes/class.ilOverlayGUI.php");
551 $this->tpl->addJavascript(
"./Services/Search/js/Search.js");
553 include_once(
"./Services/UIComponent/Glyph/classes/class.ilGlyphGUI.php");
555 $this->tpl->setVariable(
"FORM_ACTION",
$ilCtrl->getFormAction($this,
'performSearch'));
557 $this->tpl->setVariable(
"SEARCH_LABEL",
$lng->txt(
"search"));
558 include_once(
"./Services/UIComponent/Button/classes/class.ilSubmitButton.php");
560 $btn->setCommand(
"performSearch");
561 $btn->setCaption(
"search");
562 $this->tpl->setVariable(
"SUBMIT_BTN", $btn->render());
563 $this->tpl->setVariable(
"TXT_OPTIONS",
$lng->txt(
"options"));
565 $this->tpl->setVariable(
"TXT_COMBINATION",
$lng->txt(
"search_term_combination"));
567 $this->tpl->setVariable(
"TXT_AREA",
$lng->txt(
"search_area"));
570 $this->tpl->setCurrentBlock(
"type_sel");
571 $this->tpl->setVariable(
'TXT_TYPE_DEFAULT',
$lng->txt(
"search_off"));
573 $this->tpl->setVariable(
"TXT_FILTER_BY_TYPE",
$lng->txt(
"search_filter_by_type"));
574 $this->tpl->setVariable(
'FORM', $this->form->getHTML());
575 $this->tpl->parseCurrentBlock();
579 $this->tpl->setVariable(
'SEARCH_AREA_FORM', $this->
getSearchAreaForm()->getHTML());
580 $this->tpl->setVariable(
"TXT_CHANGE",
$lng->txt(
"change"));
584 $this->tpl->setVariable(
'TXT_FILTER_BY_CDATE', $this->lng->txt(
'search_filter_cd'));
585 $this->tpl->setVariable(
'TXT_CD_OFF', $this->lng->txt(
'search_off'));
602 $options = $this->search_cache->getCreationFilter();
618 return '+(cdate:[* TO ' . $limit->get(
IL_CAL_DATE) .
']) ';
622 return '+(cdate:' . $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.
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(isset($_POST['submit'])) $form
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.
fillAdminPanel()
Put admin panel into template:
static getInstance()
Get singleton instance.
static initJavascript()
Init javascript.