ILIAS  release_5-0 Revision 5.0.0-1144-gc4397b1f870
All Data Structures Namespaces Files Functions Variables Modules Pages
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 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...
 

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...
 

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.

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

52  {
53  global $ilTabs;
54 
55  $this->tabs_gui = $ilTabs;
56  parent::__construct();
57 
59  $this->initUserSearchCache();
60  }
$errors fields
Definition: imgupload.php:48
initUserSearchCache()
Init user search cache.
static getInstance()
Get singleton instance.
+ 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 425 of file class.ilLuceneAdvancedSearchGUI.php.

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

◆ executeCommand()

ilLuceneAdvancedSearchGUI::executeCommand ( )

Execute Command.

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

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

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  include_once './Services/Object/classes/class.ilObjectCopyGUI.php';
75  $cp = new ilObjectCopyGUI($this);
76  $this->ctrl->forwardCommand($cp);
77  break;
78 
79 
80  default:
81  if(!$cmd)
82  {
83  $cmd = "showSavedResults";
84  }
85  $this->handleCommand($cmd);
86  break;
87  }
88  return true;
89  }
GUI class for the workflow of copying objects.
$cmd
Definition: sahs_server.php:35
prepareOutput()
Add admin panel command.
handleCommand($a_cmd)
Handle command.
+ Here is the call graph for this function:

◆ fillAdminPanel()

ilLuceneAdvancedSearchGUI::fillAdminPanel ( )
protected

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

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

Referenced by performSearch(), and showSavedResults().

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

References fields, and ilSearchSettings\getInstance().

Referenced by prepareOutput().

305  {
306  global $ilHelp;
307 
308  $ilHelp->setScreenIdComponent("src_luc");
309 
310  $this->tabs_gui->addTarget('search',$this->ctrl->getLinkTargetByClass('illucenesearchgui'));
311 
312  if(ilSearchSettings::getInstance()->isLuceneUserSearchEnabled())
313  {
314  $this->tabs_gui->addTarget('search_user',$this->ctrl->getLinkTargetByClass('illuceneusersearchgui'));
315  }
316 
317  if(
318  !ilSearchSettings::getInstance()->getHideAdvancedSearch() and
319  $this->fields->getActiveFields())
320  {
321  $this->tabs_gui->addTarget('search_advanced',$this->ctrl->getLinkTarget($this));
322  }
323 
324  $this->tabs_gui->setTabActive('search_advanced');
325  }
$errors fields
Definition: imgupload.php:48
+ 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 150 of file class.ilLuceneAdvancedSearchGUI.php.

References $section, and fields.

Referenced by performSearch(), and showSavedResults().

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

◆ initUserSearchCache()

ilLuceneAdvancedSearchGUI::initUserSearchCache ( )
protected

Init user search cache.

private

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

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

Referenced by __construct().

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

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

Referenced by search().

226  {
227  global $ilUser,$ilBench;
228 
229  unset($_SESSION['vis_references']);
230 
231  include_once './Services/Search/classes/Lucene/class.ilLuceneSearcher.php';
232  include_once './Services/Search/classes/Lucene/class.ilLuceneAdvancedQueryParser.php';
233  $qp = new ilLuceneAdvancedQueryParser($this->search_cache->getQuery());
234  $qp->parse();
235  if(!strlen(trim($qp->getQuery())))
236  {
237  ilUtil::sendInfo($this->lng->txt('msg_no_search_string'));
238  $this->showSavedResults();
239  return false;
240  }
241 
242  $searcher = ilLuceneSearcher::getInstance($qp);
243  $searcher->search();
244 
245  // Filter results
246  $ilBench->start('Lucene','ResultFilter');
247  include_once './Services/Search/classes/Lucene/class.ilLuceneSearchResultFilter.php';
248  include_once './Services/Search/classes/Lucene/class.ilLucenePathFilter.php';
249  $filter = ilLuceneSearchResultFilter::getInstance($ilUser->getId());
250  $filter->addFilter(new ilLucenePathFilter($this->search_cache->getRoot()));
251  $filter->setCandidates($searcher->getResult());
252  $filter->filter();
253  $ilBench->stop('Lucene','ResultFilter');
254 
255  if($filter->getResultObjIds()) {
256  $searcher->highlight($filter->getResultObjIds());
257  }
258 
259  // Show results
260  $this->tpl->addBlockFile('ADM_CONTENT','adm_content','tpl.lucene_adv_search.html','Services/Search');
261  include_once './Services/Search/classes/class.ilSearchResultPresentation.php';
262  $presentation = new ilSearchResultPresentation($this);
263  $presentation->setResults($filter->getResultIds());
264  $presentation->setSearcher($searcher);
265 
266  // TODO: other handling required
267  $ilBench->start('Lucene','1500_fo');
268  $this->addPager($filter,'max_page');
269  $ilBench->stop('Lucene','1500_fo');
270  $presentation->setPreviousNext($this->prev_link, $this->next_link);
271 
272  if($presentation->render())
273  {
274  $this->tpl->setVariable('SEARCH_RESULTS',$presentation->getHTML(true));
275  }
276  else
277  {
278  ilUtil::sendInfo($this->lng->txt('search_no_match'));
279  }
280 
281  // and finally add search form
282  $this->initFormSearch();
283  $this->tpl->setVariable('SEARCH_TABLE',$this->form->getHTML());
284 
285  if($filter->getResultIds())
286  {
287  $this->fillAdminPanel();
288  }
289  }
< a tabindex="-1" style="border-style: none;" href="#" title="Refresh Image" onclick="document.getElementById('siimage').src = './securimage_show.php?sid=' + Math.random(); this.blur(); return false">< img src="./images/refresh.png" alt="Reload Image" height="32" width="32" onclick="this.blur()" align="bottom" border="0"/></a >< br/>< strong > Enter Code *if($_SERVER['REQUEST_METHOD']=='POST' &&@ $_POST['do']=='contact') $_SESSION['ctform']['success']
static getInstance(ilLuceneQueryParser $qp)
Get singleton instance.
static sendInfo($a_info="", $a_keep=false)
Send Info Message to Screen.
addPager($result, $a_session_key)
Add Pager.
Presentation of search results using object list gui.
global $ilUser
Definition: imgupload.php:15
global $ilBench
Definition: ilias.php:18
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ prepareOutput()

ilLuceneAdvancedSearchGUI::prepareOutput ( )

Add admin panel command.

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

References getTabs().

Referenced by executeCommand().

295  {
296  parent::prepareOutput();
297  $this->getTabs();
298  return true;
299  }
+ 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 185 of file class.ilLuceneAdvancedSearchGUI.php.

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

186  {
187  $this->search_cache->setRoot((int) $_POST['root_id']);
188  $this->search_cache->setQuery(array('lom_content' => ilUtil::stripSlashes($_POST['queryString'])));
189  $this->search_cache->save();
190  $this->search();
191  }
$_POST['username']
Definition: cron.php:12
static stripSlashes($a_str, $a_strip_html=true, $a_allow="")
strip slashes if magic qoutes is enabled
+ Here is the call graph for this function:

◆ reset()

ilLuceneAdvancedSearchGUI::reset ( )
protected

Reset search form.

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

References showSavedResults().

216  {
217  $this->search_cache->setQuery(array());
218  $this->search_cache->save();
219  $this->showSavedResults();
220  }
+ Here is the call graph for this function:

◆ search()

ilLuceneAdvancedSearchGUI::search ( )
protected

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

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

Referenced by remoteSearch().

194  {
195  if(!is_array($this->search_cache->getQuery()))
196  {
197  // TOD: handle empty advances search
198  ilUtil::sendInfo($this->lng->txt('msg_no_search_string'));
199  $this->showSavedResults();
200  return false;
201  }
202  unset($_SESSION['max_page']);
203  $this->search_cache->deleteCachedEntries();
204 
205  // Reset details
206  include_once './Services/Object/classes/class.ilSubItemListGUI.php';
208 
209  $this->performSearch();
210  }
< a tabindex="-1" style="border-style: none;" href="#" title="Refresh Image" onclick="document.getElementById('siimage').src = './securimage_show.php?sid=' + Math.random(); this.blur(); return false">< img src="./images/refresh.png" alt="Reload Image" height="32" width="32" onclick="this.blur()" align="bottom" border="0"/></a >< br/>< strong > Enter Code *if($_SERVER['REQUEST_METHOD']=='POST' &&@ $_POST['do']=='contact') $_SESSION['ctform']['success']
static resetDetails()
reset details As long as static::resetDetails is not possible this method is final ...
static sendInfo($a_info="", $a_keep=false)
Send Info Message to Screen.
+ 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 434 of file class.ilLuceneAdvancedSearchGUI.php.

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

◆ setPageFormAction()

ilLuceneAdvancedSearchGUI::setPageFormAction (   $a_action)
protected

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

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

◆ showSavedResults()

ilLuceneAdvancedSearchGUI::showSavedResults ( )

Show saved results.

Returns

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

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

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

97  {
98  global $ilUser,$ilBench;
99 
100  include_once './Services/Search/classes/Lucene/class.ilLuceneSearcher.php';
101  include_once './Services/Search/classes/Lucene/class.ilLuceneAdvancedQueryParser.php';
102  $qp = new ilLuceneAdvancedQueryParser($this->search_cache->getQuery());
103  $qp->parse();
104  $searcher = ilLuceneSearcher::getInstance($qp);
105  $searcher->search();
106 
107  // Load saved results
108  include_once './Services/Search/classes/Lucene/class.ilLuceneSearchResultFilter.php';
109  $filter = ilLuceneSearchResultFilter::getInstance($ilUser->getId());
110  $filter->loadFromDb();
111 
112  // Highlight
113  if($filter->getResultObjIds()) {
114  $searcher->highlight($filter->getResultObjIds());
115  }
116 
117  $this->tpl->addBlockFile('ADM_CONTENT','adm_content','tpl.lucene_adv_search.html','Services/Search');
118  include_once './Services/Search/classes/class.ilSearchResultPresentation.php';
119  $presentation = new ilSearchResultPresentation($this);
120  $presentation->setResults($filter->getResultIds());
121  $presentation->setSearcher($searcher);
122 
123 
124  // TODO: other handling required
125  $this->addPager($filter,'max_page');
126  $presentation->setPreviousNext($this->prev_link, $this->next_link);
127 
128  if($presentation->render())
129  {
130  $this->tpl->setVariable('SEARCH_RESULTS',$presentation->getHTML(true));
131  }
132  elseif(strlen(trim($qp->getQuery())))
133  {
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  {
143  $this->fillAdminPanel();
144  }
145  }
static getInstance(ilLuceneQueryParser $qp)
Get singleton instance.
static sendInfo($a_info="", $a_keep=false)
Send Info Message to Screen.
addPager($result, $a_session_key)
Add Pager.
Presentation of search results using object list gui.
global $ilUser
Definition: imgupload.php:15
global $ilBench
Definition: ilias.php:18
+ 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: