ILIAS  release_7 Revision v7.30-3-g800a261c036
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
 __construct ()
 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...
 
 cancelObject ()
 
 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...
 
 showPasteTree ()
 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...
 
 keepObjectsInClipboardObject ()
 cancel action but keep objects in clipboard
Returns
void
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...
 
 showPasteTree ()
 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...
 
 keepObjectsInClipboardObject ()
 cancel action but keep objects in clipboard More...
 
- Public Member Functions inherited from ILIAS\Object\ImplementsCreationCallback
 callCreationCallback (\ilObject $object, \ilObjectDefinition $obj_definition, int $requested_crtcb)
 

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 ()
 Load creation date filter. More...
 

Protected Attributes

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

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
 
 $ilias = null
 
 $lng = null
 
 $tpl = null
 

Detailed Description

Constructor & Destructor Documentation

◆ __construct()

ilLuceneAdvancedSearchGUI::__construct ( )

Constructor.

Reimplemented from ilSearchBaseGUI.

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

51 {
52 global $DIC;
53
54 $ilTabs = $DIC['ilTabs'];
55
56 $this->tabs_gui = $ilTabs;
58
60 $this->initUserSearchCache();
61 }
static getInstance()
Get singleton instance.
initUserSearchCache()
Init user search cache.
global $DIC
Definition: goto.php:24
$errors fields
Definition: imgupload.php:51
__construct(Container $dic, ilPlugin $plugin)
@inheritDoc

References $DIC, $ilTabs, ILIAS\GlobalScreen\Provider\__construct(), 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 422 of file class.ilLuceneAdvancedSearchGUI.php.

423 {
424 $this->admin_panel_commands[] =
425 array("cmd" => $a_cmd, "txt" => $a_txt);
426 }

◆ executeCommand()

ilLuceneAdvancedSearchGUI::executeCommand ( )

Execute Command.

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

67 {
68 $next_class = $this->ctrl->getNextClass($this);
69 $cmd = $this->ctrl->getCmd();
70
71 $this->prepareOutput();
72 switch ($next_class) {
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 $cmd = "showSavedResults";
84 }
85 $this->handleCommand($cmd);
86 break;
87 }
88 return true;
89 }
GUI class for the workflow of copying objects.
handleCommand($a_cmd)
Handle command.

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

+ Here is the call graph for this function:

◆ fillAdminPanel()

ilLuceneAdvancedSearchGUI::fillAdminPanel ( )
protected

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

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

References $DIC, 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 298 of file class.ilLuceneAdvancedSearchGUI.php.

299 {
300 global $DIC;
301
302 $ilHelp = $DIC['ilHelp'];
303
304 $ilHelp->setScreenIdComponent("src_luc");
305
306 $this->tabs_gui->addTarget('search', $this->ctrl->getLinkTargetByClass('illucenesearchgui'));
307
308 if (ilSearchSettings::getInstance()->isLuceneUserSearchEnabled()) {
309 $this->tabs_gui->addTarget('search_user', $this->ctrl->getLinkTargetByClass('illuceneusersearchgui'));
310 }
311
312 if (
313 !ilSearchSettings::getInstance()->getHideAdvancedSearch() and
314 $this->fields->getActiveFields()) {
315 $this->tabs_gui->addTarget('search_advanced', $this->ctrl->getLinkTarget($this));
316 }
317
318 $this->tabs_gui->setTabActive('search_advanced');
319 }

References $DIC, 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 149 of file class.ilLuceneAdvancedSearchGUI.php.

150 {
151 global $DIC;
152
153 $tree = $DIC['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 if ($definition['name'] != 'default') {
166 $section->setTitle($definition['name']);
167 $this->form->addItem($section);
168 }
169
170 foreach ($definition['fields'] as $field_name) {
171 if (is_object($element = $this->fields->getFormElement($this->search_cache->getQuery(), $field_name, $this->form))) {
172 $this->form->addItem($element);
173 }
174 }
175 }
176 return true;
177 }
$section
Definition: Utf8Test.php:83
This class represents a section header in a property form.
This class represents a property form user interface.

References $DIC, $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 327 of file class.ilLuceneAdvancedSearchGUI.php.

328 {
329 global $DIC;
330
331 $ilUser = $DIC['ilUser'];
332
333 include_once('Services/Search/classes/class.ilUserSearchCache.php');
334 $this->search_cache = ilUserSearchCache::_getInstance($ilUser->getId());
335 $this->search_cache->switchSearchType(ilUserSearchCache::LUCENE_ADVANCED);
336 if ((int) $_GET['page_number']) {
337 $this->search_cache->setResultPageNumber((int) $_GET['page_number']);
338 }
339 if (isset($_POST['query'])) {
340 $this->search_cache->setQuery($_POST['query']);
341 }
342 }
$_GET["client_id"]
$_POST["username"]
static _getInstance($a_usr_id)
Get singleton instance.
$ilUser
Definition: imgupload.php:18

References $_GET, $_POST, $DIC, $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 221 of file class.ilLuceneAdvancedSearchGUI.php.

222 {
223 global $DIC;
224
225 $ilUser = $DIC['ilUser'];
226 $ilBench = $DIC['ilBench'];
227
228 unset($_SESSION['vis_references']);
229
230 include_once './Services/Search/classes/Lucene/class.ilLuceneSearcher.php';
231 include_once './Services/Search/classes/Lucene/class.ilLuceneAdvancedQueryParser.php';
232 $qp = new ilLuceneAdvancedQueryParser($this->search_cache->getQuery());
233 $qp->parse();
234 if (!strlen(trim($qp->getQuery()))) {
235 ilUtil::sendInfo($this->lng->txt('msg_no_search_string'));
236 $this->showSavedResults();
237 return false;
238 }
239
240 $searcher = ilLuceneSearcher::getInstance($qp);
241 $searcher->search();
242
243 // Filter results
244 $ilBench->start('Lucene', 'ResultFilter');
245 include_once './Services/Search/classes/Lucene/class.ilLuceneSearchResultFilter.php';
246 include_once './Services/Search/classes/Lucene/class.ilLucenePathFilter.php';
248 $filter->addFilter(new ilLucenePathFilter($this->search_cache->getRoot()));
249 $filter->setCandidates($searcher->getResult());
250 $filter->filter();
251 $ilBench->stop('Lucene', 'ResultFilter');
252
253 if ($filter->getResultObjIds()) {
254 $searcher->highlight($filter->getResultObjIds());
255 }
256
257 // Show results
258 $this->tpl->addBlockFile('ADM_CONTENT', 'adm_content', 'tpl.lucene_adv_search.html', 'Services/Search');
259 include_once './Services/Search/classes/class.ilSearchResultPresentation.php';
260 $presentation = new ilSearchResultPresentation($this);
261 $presentation->setResults($filter->getResultIds());
262 $presentation->setSearcher($searcher);
263
264 // TODO: other handling required
265 $ilBench->start('Lucene', '1500_fo');
266 $this->addPager($filter, 'max_page');
267 $ilBench->stop('Lucene', '1500_fo');
268 $presentation->setPreviousNext($this->prev_link, $this->next_link);
269
270 if ($presentation->render()) {
271 $this->tpl->setVariable('SEARCH_RESULTS', $presentation->getHTML(true));
272 } else {
273 ilUtil::sendInfo($this->lng->txt('search_no_match'));
274 }
275
276 // and finally add search form
277 $this->initFormSearch();
278 $this->tpl->setVariable('SEARCH_TABLE', $this->form->getHTML());
279
280 if ($filter->getResultIds()) {
281 $this->fillAdminPanel();
282 }
283 }
$_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:21

References $_SESSION, $DIC, $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 288 of file class.ilLuceneAdvancedSearchGUI.php.

289 {
290 parent::prepareOutput();
291 $this->getTabs();
292 return true;
293 }

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 182 of file class.ilLuceneAdvancedSearchGUI.php.

183 {
184 $this->search_cache->setRoot((int) $_POST['root_id']);
185 $this->search_cache->setQuery(array('lom_content' => ilUtil::stripSlashes($_POST['queryString'])));
186 $this->search_cache->save();
187 $this->search();
188 }
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 211 of file class.ilLuceneAdvancedSearchGUI.php.

212 {
213 $this->search_cache->setQuery(array());
214 $this->search_cache->save();
215 $this->showSavedResults();
216 }

References showSavedResults().

+ Here is the call graph for this function:

◆ search()

ilLuceneAdvancedSearchGUI::search ( )
protected

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

191 {
192 if (!is_array($this->search_cache->getQuery())) {
193 // TOD: handle empty advances search
194 ilUtil::sendInfo($this->lng->txt('msg_no_search_string'));
195 $this->showSavedResults();
196 return false;
197 }
198 unset($_SESSION['max_page']);
199 $this->search_cache->deleteCachedEntries();
200
201 // Reset details
202 include_once './Services/Object/classes/class.ilSubItemListGUI.php';
204
205 $this->performSearch();
206 }
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 431 of file class.ilLuceneAdvancedSearchGUI.php.

432 {
433 $this->admin_view_button =
434 array("link" => $a_link, "txt" => $a_txt);
435 }

◆ setPageFormAction()

ilLuceneAdvancedSearchGUI::setPageFormAction (   $a_action)
protected

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

438 {
439 $this->page_form_action = $a_action;
440 }

◆ showSavedResults()

ilLuceneAdvancedSearchGUI::showSavedResults ( )

Show saved results.

Returns

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

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

References $DIC, $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 45 of file class.ilLuceneAdvancedSearchGUI.php.

◆ $ilTabs

ilLuceneAdvancedSearchGUI::$ilTabs
protected

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

Referenced by __construct().


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