ILIAS  release_5-1 Revision 5.0.0-5477-g43f3e3fab5f
ilLuceneAdvancedSearchGUI Class Reference

Meta Data search GUI. More...

+ Inheritance diagram for ilLuceneAdvancedSearchGUI:
+ Collaboration diagram for ilLuceneAdvancedSearchGUI:

Public Member Functions

 __construct ()
 Constructor. More...
 
 executeCommand ()
 Execute Command. More...
 
 showSavedResults ()
 Show saved results. More...
 
 prepareOutput ()
 Add admin panel command. More...
 
- Public Member Functions inherited from ilSearchBaseGUI
 ilSearchBaseGUI ()
 Constructor @access public. More...
 
 prepareOutput ()
 
 initStandardSearchForm ($a_mode)
 Init standard search form. More...
 
 getSearchAreaForm ()
 Init standard search form. More...
 
 handleCommand ($a_cmd)
 Handle command. More...
 
 addToDeskObject ()
 Interface methods. More...
 
 removeFromDeskObject ()
 Remove from dektop
More...
 
 delete ()
 Show deletion screen. More...
 
 cancelDelete ()
 Cancel delete. More...
 
 cancelMoveLinkObject ()
 Cancel move/link. More...
 
 performDelete ()
 Delete objects. More...
 
 cut ()
 Interface ilAdministrationCommandHandler. More...
 
 link ()
 Interface ilAdministrationCommandHandler. More...
 
 paste ()
 Paste. More...
 
 showLinkIntoMultipleObjectsTree ()
 Target selection link. More...
 
 showMoveIntoObjectTree ()
 Target selection cut. More...
 
 performPasteIntoMultipleObjects ()
 Perform paste into multiple objects. More...
 
 clear ()
 clear clipboard More...
 
 enableAdministrationPanel ()
 Enable administration panel. More...
 
 disableAdministrationPanel ()
 Disable administration panel. More...
 
 addLocator ()
 Add Locator. More...
 
 autoComplete ()
 Data resource for autoComplete. More...
 
 addToDeskObject ()
 Add desktop item @access public. More...
 
 removeFromDeskObject ()
 Remove from desktop @access public. More...
 
 delete ()
 Show delete confirmation. More...
 
 cancelDelete ()
 Cancel delete. More...
 
 performDelete ()
 Perform Delete. More...
 
 cut ()
 Cut object. More...
 
 showLinkIntoMultipleObjectsTree ()
 Target selection link. More...
 
 showMoveIntoObjectTree ()
 Target selection cut. More...
 
 performPasteIntoMultipleObjects ()
 Perform paste into multiple objects. More...
 
 paste ()
 Paste. More...
 
 clear ()
 clear clipboard More...
 
 enableAdministrationPanel ()
 Enable administration panel. More...
 
 disableAdministrationPanel ()
 Disable administration panel. More...
 
 cancelMoveLinkObject ()
 Cancel move/link. More...
 

Protected Member Functions

 initFormSearch ()
 Show search form
More...
 
 remoteSearch ()
 Search from main menu. More...
 
 search ()
 
 reset ()
 Reset search form. More...
 
 performSearch ()
 Perform search. More...
 
 getTabs ()
 get tabs More...
 
 initUserSearchCache ()
 Init user search cache. More...
 
 fillAdminPanel ()
 
 addAdminPanelCommand ($a_cmd, $a_txt)
 Add a command to the admin panel. More...
 
 setAdminViewButton ($a_link, $a_txt)
 Show admin view button. More...
 
 setPageFormAction ($a_action)
 
- Protected Member Functions inherited from ilSearchBaseGUI
 addPager ($result, $a_session_key)
 Add Pager. More...
 
 buildSearchAreaPath ($a_root_node)
 Build path for search area. More...
 
 getCreationDateForm ()
 
 getSearchCache ()
 Get user search cache. More...
 
 loadCreationFilter ()
 

Protected Attributes

 $ilTabs
 
 $fields = null
 
- Protected Attributes inherited from ilSearchBaseGUI
 $ctrl = null
 

Additional Inherited Members

- Data Fields inherited from ilSearchBaseGUI
const SEARCH_FAST = 1
 
const SEARCH_DETAILS = 2
 
const SEARCH_AND = 'and'
 
const SEARCH_OR = 'or'
 
const SEARCH_FORM_LUCENE = 1
 
const SEARCH_FORM_STANDARD = 2
 
const SEARCH_FORM_USER = 3
 
 $settings = null
 
 $ilias = null
 
 $lng = null
 
 $tpl = null
 

Detailed Description

Constructor & Destructor Documentation

◆ __construct()

ilLuceneAdvancedSearchGUI::__construct ( )

Constructor.

Definition at line 51 of file class.ilLuceneAdvancedSearchGUI.php.

52 {
53 global $ilTabs;
54
55 $this->tabs_gui = $ilTabs;
56 parent::__construct();
57
59 $this->initUserSearchCache();
60 }
static getInstance()
Get singleton instance.
initUserSearchCache()
Init user search cache.
$errors fields
Definition: imgupload.php:48

References $ilTabs, fields, ilLuceneAdvancedSearchFields\getInstance(), and initUserSearchCache().

+ Here is the call graph for this function:

Member Function Documentation

◆ addAdminPanelCommand()

ilLuceneAdvancedSearchGUI::addAdminPanelCommand (   $a_cmd,
  $a_txt 
)
protected

Add a command to the admin panel.

Definition at line 426 of file class.ilLuceneAdvancedSearchGUI.php.

427 {
428 $this->admin_panel_commands[] =
429 array("cmd" => $a_cmd, "txt" => $a_txt);
430 }

◆ executeCommand()

ilLuceneAdvancedSearchGUI::executeCommand ( )

Execute Command.

Definition at line 65 of file class.ilLuceneAdvancedSearchGUI.php.

66 {
67 $next_class = $this->ctrl->getNextClass($this);
68 $cmd = $this->ctrl->getCmd();
69
70 $this->prepareOutput();
71 switch($next_class)
72 {
73 case 'ilobjectcopygui':
74 $this->ctrl->setReturn($this);
75 include_once './Services/Object/classes/class.ilObjectCopyGUI.php';
76 $cp = new ilObjectCopyGUI($this,'');
77 $this->ctrl->forwardCommand($cp);
78 break;
79
80
81 default:
82 if(!$cmd)
83 {
84 $cmd = "showSavedResults";
85 }
86 $this->handleCommand($cmd);
87 break;
88 }
89 return true;
90 }
GUI class for the workflow of copying objects.
handleCommand($a_cmd)
Handle command.
$cmd
Definition: sahs_server.php:35

References $cmd, ilSearchBaseGUI\handleCommand(), and prepareOutput().

+ Here is the call graph for this function:

◆ fillAdminPanel()

ilLuceneAdvancedSearchGUI::fillAdminPanel ( )
protected

Definition at line 350 of file class.ilLuceneAdvancedSearchGUI.php.

351 {
352 global $lng;
353
354 $adm_view_cmp = $adm_cmds = $creation_selector = $adm_view = false;
355
356 // admin panel commands
357 if ((count($this->admin_panel_commands) > 0))
358 {
359 foreach($this->admin_panel_commands as $cmd)
360 {
361 $this->tpl->setCurrentBlock("lucene_admin_panel_cmd");
362 $this->tpl->setVariable("LUCENE_PANEL_CMD", $cmd["cmd"]);
363 $this->tpl->setVariable("LUCENE_TXT_PANEL_CMD", $cmd["txt"]);
364 $this->tpl->parseCurrentBlock();
365 }
366
367 $adm_cmds = true;
368 }
369 if ($adm_cmds)
370 {
371 $this->tpl->setCurrentBlock("lucene_adm_view_components");
372 $this->tpl->setVariable("LUCENE_ADM_IMG_ARROW", ilUtil::getImagePath("arrow_upright.svg"));
373 $this->tpl->setVariable("LUCENE_ADM_ALT_ARROW", $lng->txt("actions"));
374 $this->tpl->parseCurrentBlock();
375 $adm_view_cmp = true;
376 }
377
378 // admin view button
379 if (is_array($this->admin_view_button))
380 {
381 if (is_array($this->admin_view_button))
382 {
383 $this->tpl->setCurrentBlock("lucene_admin_button");
384 $this->tpl->setVariable("LUCENE_ADMIN_MODE_LINK",
385 $this->admin_view_button["link"]);
386 $this->tpl->setVariable("LUCENE_TXT_ADMIN_MODE",
387 $this->admin_view_button["txt"]);
388 $this->tpl->parseCurrentBlock();
389 }
390 $this->tpl->setCurrentBlock("lucene_admin_view");
391 $this->tpl->parseCurrentBlock();
392 $adm_view = true;
393 }
394
395 // creation selector
396 if (is_array($this->creation_selector))
397 {
398 $this->tpl->setCurrentBlock("lucene_add_commands");
399 if ($adm_cmds)
400 {
401 $this->tpl->setVariable("LUCENE_ADD_COM_WIDTH", 'width="1"');
402 }
403 $this->tpl->setVariable("LUCENE_SELECT_OBJTYPE_REPOS",
404 $this->creation_selector["options"]);
405 $this->tpl->setVariable("LUCENE_BTN_NAME_REPOS",
406 $this->creation_selector["command"]);
407 $this->tpl->setVariable("LUCENE_TXT_ADD_REPOS",
408 $this->creation_selector["txt"]);
409 $this->tpl->parseCurrentBlock();
410 $creation_selector = true;
411 }
412 if ($adm_view || $creation_selector)
413 {
414 $this->tpl->setCurrentBlock("lucene_adm_panel");
415 if ($adm_view_cmp)
416 {
417 $this->tpl->setVariable("LUCENE_ADM_TBL_WIDTH", 'width:"100%";');
418 }
419 $this->tpl->parseCurrentBlock();
420 }
421 }
static getImagePath($img, $module_path="", $mode="output", $offline=false)
get image path (for images located in a template directory)

References $cmd, ilSearchBaseGUI\$lng, and ilUtil\getImagePath().

Referenced by performSearch(), and showSavedResults().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getTabs()

ilLuceneAdvancedSearchGUI::getTabs ( )
protected

get tabs

Definition at line 305 of file class.ilLuceneAdvancedSearchGUI.php.

306 {
307 global $ilHelp;
308
309 $ilHelp->setScreenIdComponent("src_luc");
310
311 $this->tabs_gui->addTarget('search',$this->ctrl->getLinkTargetByClass('illucenesearchgui'));
312
313 if(ilSearchSettings::getInstance()->isLuceneUserSearchEnabled())
314 {
315 $this->tabs_gui->addTarget('search_user',$this->ctrl->getLinkTargetByClass('illuceneusersearchgui'));
316 }
317
318 if(
319 !ilSearchSettings::getInstance()->getHideAdvancedSearch() and
320 $this->fields->getActiveFields())
321 {
322 $this->tabs_gui->addTarget('search_advanced',$this->ctrl->getLinkTarget($this));
323 }
324
325 $this->tabs_gui->setTabActive('search_advanced');
326 }

References fields, and ilSearchSettings\getInstance().

Referenced by prepareOutput().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ initFormSearch()

ilLuceneAdvancedSearchGUI::initFormSearch ( )
protected

Show search form

Definition at line 151 of file class.ilLuceneAdvancedSearchGUI.php.

152 {
153 global $tree;
154
155 include_once './Services/Form/classes/class.ilPropertyFormGUI.php';
156
157 $this->form = new ilPropertyFormGUI();
158 $this->form->setFormAction($this->ctrl->getFormAction($this,'search'));
159 $this->form->setTitle($this->lng->txt('search_advanced'));
160 $this->form->addCommandButton('search',$this->lng->txt('search'));
161 $this->form->addCommandButton('reset',$this->lng->txt('reset'));
162
163 foreach($this->fields->getActiveSections() as $definition)
164 {
165 if($definition['name'] != 'default')
166 {
168 $section->setTitle($definition['name']);
169 $this->form->addItem($section);
170 }
171
172 foreach($definition['fields'] as $field_name)
173 {
174 if(is_object($element = $this->fields->getFormElement($this->search_cache->getQuery(),$field_name,$this->form)))
175 {
176 $this->form->addItem($element);
177 }
178 }
179 }
180 return true;
181 }
$section
Definition: Utf8Test.php:84
This class represents a section header in a property form.
This class represents a property form user interface.

References $section, and fields.

Referenced by performSearch(), and showSavedResults().

+ Here is the caller graph for this function:

◆ initUserSearchCache()

ilLuceneAdvancedSearchGUI::initUserSearchCache ( )
protected

Init user search cache.

@access private

Definition at line 334 of file class.ilLuceneAdvancedSearchGUI.php.

335 {
336 global $ilUser;
337
338 include_once('Services/Search/classes/class.ilUserSearchCache.php');
339 $this->search_cache = ilUserSearchCache::_getInstance($ilUser->getId());
340 $this->search_cache->switchSearchType(ilUserSearchCache::LUCENE_ADVANCED);
341 if((int) $_GET['page_number'])
342 {
343 $this->search_cache->setResultPageNumber((int) $_GET['page_number']);
344 }
345 if(isset($_POST['query']))
346 {
347 $this->search_cache->setQuery($_POST['query']);
348 }
349 }
$_GET["client_id"]
static _getInstance($a_usr_id)
Get singleton instance.
$_POST['username']
Definition: cron.php:12
global $ilUser
Definition: imgupload.php:15

References $_GET, $_POST, $ilUser, ilUserSearchCache\_getInstance(), and ilUserSearchCache\LUCENE_ADVANCED.

Referenced by __construct().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ performSearch()

ilLuceneAdvancedSearchGUI::performSearch ( )
protected

Perform search.

Definition at line 226 of file class.ilLuceneAdvancedSearchGUI.php.

227 {
228 global $ilUser,$ilBench;
229
230 unset($_SESSION['vis_references']);
231
232 include_once './Services/Search/classes/Lucene/class.ilLuceneSearcher.php';
233 include_once './Services/Search/classes/Lucene/class.ilLuceneAdvancedQueryParser.php';
234 $qp = new ilLuceneAdvancedQueryParser($this->search_cache->getQuery());
235 $qp->parse();
236 if(!strlen(trim($qp->getQuery())))
237 {
238 ilUtil::sendInfo($this->lng->txt('msg_no_search_string'));
239 $this->showSavedResults();
240 return false;
241 }
242
243 $searcher = ilLuceneSearcher::getInstance($qp);
244 $searcher->search();
245
246 // Filter results
247 $ilBench->start('Lucene','ResultFilter');
248 include_once './Services/Search/classes/Lucene/class.ilLuceneSearchResultFilter.php';
249 include_once './Services/Search/classes/Lucene/class.ilLucenePathFilter.php';
251 $filter->addFilter(new ilLucenePathFilter($this->search_cache->getRoot()));
252 $filter->setCandidates($searcher->getResult());
253 $filter->filter();
254 $ilBench->stop('Lucene','ResultFilter');
255
256 if($filter->getResultObjIds()) {
257 $searcher->highlight($filter->getResultObjIds());
258 }
259
260 // Show results
261 $this->tpl->addBlockFile('ADM_CONTENT','adm_content','tpl.lucene_adv_search.html','Services/Search');
262 include_once './Services/Search/classes/class.ilSearchResultPresentation.php';
263 $presentation = new ilSearchResultPresentation($this);
264 $presentation->setResults($filter->getResultIds());
265 $presentation->setSearcher($searcher);
266
267 // TODO: other handling required
268 $ilBench->start('Lucene','1500_fo');
269 $this->addPager($filter,'max_page');
270 $ilBench->stop('Lucene','1500_fo');
271 $presentation->setPreviousNext($this->prev_link, $this->next_link);
272
273 if($presentation->render())
274 {
275 $this->tpl->setVariable('SEARCH_RESULTS',$presentation->getHTML(true));
276 }
277 else
278 {
279 ilUtil::sendInfo($this->lng->txt('search_no_match'));
280 }
281
282 // and finally add search form
283 $this->initFormSearch();
284 $this->tpl->setVariable('SEARCH_TABLE',$this->form->getHTML());
285
286 if($filter->getResultIds())
287 {
288 $this->fillAdminPanel();
289 }
290 }
$_SESSION["AccountId"]
static getInstance(ilLuceneQueryParser $qp)
Get singleton instance.
addPager($result, $a_session_key)
Add Pager.
Presentation of search results using object list gui.
static sendInfo($a_info="", $a_keep=false)
Send Info Message to Screen.
global $ilBench
Definition: ilias.php:18

References $_SESSION, $ilBench, $ilUser, ilSearchBaseGUI\addPager(), fillAdminPanel(), ilLuceneSearchResultFilter\getInstance(), ilLuceneSearcher\getInstance(), initFormSearch(), ilUtil\sendInfo(), and showSavedResults().

Referenced by search().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ prepareOutput()

ilLuceneAdvancedSearchGUI::prepareOutput ( )

Add admin panel command.

Reimplemented from ilSearchBaseGUI.

Definition at line 295 of file class.ilLuceneAdvancedSearchGUI.php.

296 {
297 parent::prepareOutput();
298 $this->getTabs();
299 return true;
300 }

References getTabs().

Referenced by executeCommand().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ remoteSearch()

ilLuceneAdvancedSearchGUI::remoteSearch ( )
protected

Search from main menu.

Definition at line 186 of file class.ilLuceneAdvancedSearchGUI.php.

187 {
188 $this->search_cache->setRoot((int) $_POST['root_id']);
189 $this->search_cache->setQuery(array('lom_content' => ilUtil::stripSlashes($_POST['queryString'])));
190 $this->search_cache->save();
191 $this->search();
192 }
static stripSlashes($a_str, $a_strip_html=true, $a_allow="")
strip slashes if magic qoutes is enabled

References $_POST, search(), and ilUtil\stripSlashes().

+ Here is the call graph for this function:

◆ reset()

ilLuceneAdvancedSearchGUI::reset ( )
protected

Reset search form.

Definition at line 216 of file class.ilLuceneAdvancedSearchGUI.php.

217 {
218 $this->search_cache->setQuery(array());
219 $this->search_cache->save();
220 $this->showSavedResults();
221 }

References showSavedResults().

+ Here is the call graph for this function:

◆ search()

ilLuceneAdvancedSearchGUI::search ( )
protected

Definition at line 194 of file class.ilLuceneAdvancedSearchGUI.php.

195 {
196 if(!is_array($this->search_cache->getQuery()))
197 {
198 // TOD: handle empty advances search
199 ilUtil::sendInfo($this->lng->txt('msg_no_search_string'));
200 $this->showSavedResults();
201 return false;
202 }
203 unset($_SESSION['max_page']);
204 $this->search_cache->deleteCachedEntries();
205
206 // Reset details
207 include_once './Services/Object/classes/class.ilSubItemListGUI.php';
209
210 $this->performSearch();
211 }
static resetDetails()
reset details As long as static::resetDetails is not possible this method is final

References $_SESSION, performSearch(), ilSubItemListGUI\resetDetails(), ilUtil\sendInfo(), and showSavedResults().

Referenced by remoteSearch().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ setAdminViewButton()

ilLuceneAdvancedSearchGUI::setAdminViewButton (   $a_link,
  $a_txt 
)
protected

Show admin view button.

Definition at line 435 of file class.ilLuceneAdvancedSearchGUI.php.

436 {
437 $this->admin_view_button =
438 array("link" => $a_link, "txt" => $a_txt);
439 }

◆ setPageFormAction()

ilLuceneAdvancedSearchGUI::setPageFormAction (   $a_action)
protected

Definition at line 441 of file class.ilLuceneAdvancedSearchGUI.php.

442 {
443 $this->page_form_action = $a_action;
444 }

◆ showSavedResults()

ilLuceneAdvancedSearchGUI::showSavedResults ( )

Show saved results.

Returns

Definition at line 97 of file class.ilLuceneAdvancedSearchGUI.php.

98 {
99 global $ilUser,$ilBench;
100
101 include_once './Services/Search/classes/Lucene/class.ilLuceneSearcher.php';
102 include_once './Services/Search/classes/Lucene/class.ilLuceneAdvancedQueryParser.php';
103 $qp = new ilLuceneAdvancedQueryParser($this->search_cache->getQuery());
104 $qp->parse();
105 $searcher = ilLuceneSearcher::getInstance($qp);
106 $searcher->search();
107
108 // Load saved results
109 include_once './Services/Search/classes/Lucene/class.ilLuceneSearchResultFilter.php';
111 $filter->loadFromDb();
112
113 // Highlight
114 if($filter->getResultObjIds()) {
115 $searcher->highlight($filter->getResultObjIds());
116 }
117
118 $this->tpl->addBlockFile('ADM_CONTENT','adm_content','tpl.lucene_adv_search.html','Services/Search');
119 include_once './Services/Search/classes/class.ilSearchResultPresentation.php';
120 $presentation = new ilSearchResultPresentation($this);
121 $presentation->setResults($filter->getResultIds());
122 $presentation->setSearcher($searcher);
123
124
125 // TODO: other handling required
126 $this->addPager($filter,'max_page');
127 $presentation->setPreviousNext($this->prev_link, $this->next_link);
128
129 if($presentation->render())
130 {
131 $this->tpl->setVariable('SEARCH_RESULTS',$presentation->getHTML(true));
132 }
133 elseif(strlen(trim($qp->getQuery())))
134 {
135 ilUtil::sendInfo($this->lng->txt('search_no_match'));
136 }
137
138 // and finally add search form
139 $this->initFormSearch();
140 $this->tpl->setVariable('SEARCH_TABLE',$this->form->getHTML());
141
142 if($filter->getResultIds())
143 {
144 $this->fillAdminPanel();
145 }
146 }

References $ilBench, $ilUser, ilSearchBaseGUI\addPager(), fillAdminPanel(), ilLuceneSearchResultFilter\getInstance(), ilLuceneSearcher\getInstance(), initFormSearch(), and ilUtil\sendInfo().

Referenced by performSearch(), reset(), and search().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Field Documentation

◆ $fields

ilLuceneAdvancedSearchGUI::$fields = null
protected

Definition at line 46 of file class.ilLuceneAdvancedSearchGUI.php.

◆ $ilTabs

ilLuceneAdvancedSearchGUI::$ilTabs
protected

Definition at line 44 of file class.ilLuceneAdvancedSearchGUI.php.

Referenced by __construct().


The documentation for this class was generated from the following file: