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();
68 $ilBench->start(
'Lucene',
'0900_executeCommand');
69 $next_class = $this->ctrl->getNextClass($this);
70 $cmd = $this->ctrl->getCmd();
73 switch ($next_class) {
74 case "ilpropertyformgui":
79 $ilCtrl->setReturn($this,
'storeRoot');
80 $ilCtrl->forwardCommand(
$form);
83 case 'ilobjectcopygui':
84 $this->ctrl->setReturn($this,
'');
85 include_once
'./Services/Object/classes/class.ilObjectCopyGUI.php';
87 $this->ctrl->forwardCommand($cp);
93 $cmd =
"showSavedResults";
98 $ilBench->stop(
'Lucene',
'0900_executeCommand');
107 parent::prepareOutput();
119 if (count($this->search_cache)) {
132 return (
array) $this->search_cache->getItemFilter();
142 return (
array) $this->search_cache->getMimeFilter();
152 include_once
'./Services/Search/classes/Lucene/class.ilLuceneQueryParser.php';
154 $qp->parseAutoWildcard();
158 $this->search_cache->setRoot((
int)
$_POST[
'root_id']);
160 $this->search_cache->save();
173 if (!strlen($this->search_cache->getQuery())) {
178 include_once
'./Services/Search/classes/Lucene/class.ilLuceneSearcher.php';
179 include_once
'./Services/Search/classes/Lucene/class.ilLuceneQueryParser.php';
186 include_once
'./Services/Search/classes/Lucene/class.ilLuceneSearchResultFilter.php';
188 $filter->loadFromDb();
191 $searcher->highlight($filter->getResultObjIds());
193 include_once
'./Services/Search/classes/class.ilSearchResultPresentation.php';
195 $presentation->setResults($filter->getResultIds());
197 $presentation->setSearcher($searcher);
200 $this->
addPager($filter,
'max_page');
202 $presentation->setPreviousNext($this->prev_link, $this->next_link);
206 if ($presentation->render()) {
207 $this->tpl->setVariable(
'SEARCH_RESULTS', $presentation->getHTML(
true));
208 } elseif (strlen($this->search_cache->getQuery())) {
209 ilUtil::sendInfo(sprintf($this->lng->txt(
'search_no_match_hint'), $qp->getQuery()));
219 if (!$this->form->checkInput()) {
220 $this->search_cache->deleteCachedEntries();
222 include_once
'./Services/Object/classes/class.ilSubItemListGUI.php';
229 $this->search_cache->deleteCachedEntries();
232 include_once
'./Services/Object/classes/class.ilSubItemListGUI.php';
250 foreach ((
array) $this->search_cache->getItemFilter() as $obj => $value) {
251 if (!$filter_query) {
252 $filter_query .=
'+( ';
254 $filter_query .=
'OR';
256 $filter_query .= (
' ' . (
string) $filter_settings[$obj][
'filter'] .
' ');
258 $filter_query .=
') ';
264 foreach ($this->search_cache->getMimeFilter() as $mime => $value) {
266 $mime_query .=
'+( ';
270 $mime_query .= (
' ' . (
string) $filter_settings[$mime][
'filter'] .
' ');
280 $filter_query = $filter_query .
' ' . $mime_query .
' ' . $cdate_query;
282 include_once
'./Services/Search/classes/Lucene/class.ilLuceneSearcher.php';
283 include_once
'./Services/Search/classes/Lucene/class.ilLuceneQueryParser.php';
285 $query = $this->search_cache->getQuery();
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()) {
322 $this->tpl->setVariable(
'SEARCH_RESULTS', $presentation->getHTML(
true));
324 ilUtil::sendInfo(sprintf($this->lng->txt(
'search_no_match_hint'), $this->search_cache->getQuery()));
335 $this->root_node =
$form->getItemByPostVar(
'area')->getValue();
336 $this->search_cache->setRoot($this->root_node);
337 $this->search_cache->save();
338 $this->search_cache->deleteCachedEntries();
340 include_once
'./Services/Object/classes/class.ilSubItemListGUI.php';
353 $ilHelp->setScreenIdComponent(
"src_luc");
355 $this->tabs_gui->addTarget(
'search', $this->ctrl->getLinkTarget($this));
358 $this->tabs_gui->addTarget(
'search_user', $this->ctrl->getLinkTargetByClass(
'illuceneusersearchgui'));
362 $this->tabs_gui->addTarget(
'search_advanced', $this->ctrl->getLinkTargetByClass(
'illuceneAdvancedSearchgui'));
365 $this->tabs_gui->setTabActive(
'search');
378 include_once(
'Services/Search/classes/class.ilUserSearchCache.php');
381 if ((
int)
$_GET[
'page_number']) {
382 $this->search_cache->setResultPageNumber((
int) $_GET[
'page_number']);
384 if (isset(
$_POST[
'term'])) {
386 if (
$_POST[
'item_filter_enabled']) {
390 $filtered[
$type] = 1;
393 $this->search_cache->setItemFilter($filtered);
402 $this->search_cache->setMimeFilter($mime);
405 if (!
$_POST[
'item_filter_enabled']) {
407 $this->search_cache->setItemFilter(
array());
408 $this->search_cache->setMimeFilter(
array());
410 if (!
$_POST[
'screation']) {
411 $this->search_cache->setCreationFilter(
array());
425 $adm_view_cmp = $adm_cmds = $creation_selector = $adm_view =
false;
428 if ((count($this->admin_panel_commands) > 0)) {
429 foreach ($this->admin_panel_commands as $cmd) {
430 $this->tpl->setCurrentBlock(
"lucene_admin_panel_cmd");
431 $this->tpl->setVariable(
"LUCENE_PANEL_CMD", $cmd[
"cmd"]);
432 $this->tpl->setVariable(
"LUCENE_TXT_PANEL_CMD", $cmd[
"txt"]);
433 $this->tpl->parseCurrentBlock();
439 $this->tpl->setCurrentBlock(
"lucene_adm_view_components");
441 $this->tpl->setVariable(
"LUCENE_ADM_ALT_ARROW", $lng->txt(
"actions"));
442 $this->tpl->parseCurrentBlock();
443 $adm_view_cmp =
true;
447 if (is_array($this->admin_view_button)) {
448 if (is_array($this->admin_view_button)) {
449 $this->tpl->setCurrentBlock(
"lucene_admin_button");
450 $this->tpl->setVariable(
451 "LUCENE_ADMIN_MODE_LINK",
452 $this->admin_view_button[
"link"]
454 $this->tpl->setVariable(
455 "LUCENE_TXT_ADMIN_MODE",
456 $this->admin_view_button[
"txt"]
458 $this->tpl->parseCurrentBlock();
460 $this->tpl->setCurrentBlock(
"lucene_admin_view");
461 $this->tpl->parseCurrentBlock();
466 if (is_array($this->creation_selector)) {
467 $this->tpl->setCurrentBlock(
"lucene_add_commands");
469 $this->tpl->setVariable(
"LUCENE_ADD_COM_WIDTH",
'width="1"');
471 $this->tpl->setVariable(
472 "LUCENE_SELECT_OBJTYPE_REPOS",
473 $this->creation_selector[
"options"]
475 $this->tpl->setVariable(
476 "LUCENE_BTN_NAME_REPOS",
477 $this->creation_selector[
"command"]
479 $this->tpl->setVariable(
480 "LUCENE_TXT_ADD_REPOS",
481 $this->creation_selector[
"txt"]
483 $this->tpl->parseCurrentBlock();
484 $creation_selector =
true;
486 if ($adm_view || $creation_selector) {
487 $this->tpl->setCurrentBlock(
"lucene_adm_panel");
489 $this->tpl->setVariable(
"LUCENE_ADM_TBL_WIDTH",
'width:"100%";');
491 $this->tpl->parseCurrentBlock();
500 $this->admin_panel_commands[] =
501 array(
"cmd" => $a_cmd,
"txt" => $a_txt);
509 $this->admin_view_button =
510 array(
"link" => $a_link,
"txt" => $a_txt);
515 $this->page_form_action = $a_action;
526 $this->tpl->addBlockFile(
'ADM_CONTENT',
'adm_content',
'tpl.lucene_search.html',
'Services/Search');
529 include_once(
"./Services/UIComponent/Overlay/classes/class.ilOverlayGUI.php");
531 $this->tpl->addJavascript(
"./Services/Search/js/Search.js");
533 include_once(
"./Services/UIComponent/Glyph/classes/class.ilGlyphGUI.php");
535 $this->tpl->setVariable(
"FORM_ACTION", $ilCtrl->getFormAction($this,
'performSearch'));
537 include_once(
"./Services/UIComponent/Button/classes/class.ilSubmitButton.php");
539 $btn->setCommand(
"performSearch");
540 $btn->setCaption(
"search");
541 $this->tpl->setVariable(
"SUBMIT_BTN", $btn->render());
542 $this->tpl->setVariable(
"TXT_OPTIONS", $lng->txt(
"options"));
544 $this->tpl->setVariable(
"TXT_COMBINATION", $lng->txt(
"search_term_combination"));
546 $this->tpl->setVariable(
"TXT_AREA", $lng->txt(
"search_area"));
549 $this->tpl->setCurrentBlock(
"type_sel");
550 $this->tpl->setVariable(
'TXT_TYPE_DEFAULT', $lng->txt(
"search_off"));
552 $this->tpl->setVariable(
"TXT_FILTER_BY_TYPE", $lng->txt(
"search_filter_by_type"));
553 $this->tpl->setVariable(
'FORM', $this->form->getHTML());
554 $this->tpl->parseCurrentBlock();
558 $this->tpl->setVariable(
'SEARCH_AREA_FORM', $this->
getSearchAreaForm()->getHTML());
559 $this->tpl->setVariable(
"TXT_CHANGE", $lng->txt(
"change"));
563 $this->tpl->setVariable(
'TXT_FILTER_BY_CDATE', $this->lng->txt(
'search_filter_cd'));
564 $this->tpl->setVariable(
'TXT_CD_OFF', $this->lng->txt(
'search_off'));
581 $options = $this->search_cache->getCreationFilter();
597 return '+(cdate:[* TO ' . $limit->get(
IL_CAL_DATE) .
']) ';
601 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
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.
if(!isset($_REQUEST['ReturnTo'])) if(!isset($_REQUEST['AuthId'])) $options
static initJavascript()
Init javascript.