ILIAS  release_8 Revision v8.23
ilLuceneUserSearchGUI Class Reference

GUI for Lucene user search More...

+ Inheritance diagram for ilLuceneUserSearchGUI:
+ Collaboration diagram for ilLuceneUserSearchGUI:

Public Member Functions

 __construct ()
 Constructor. More...
 
 executeCommand ()
 Execute Command. More...
 
 prepareOutput ()
 
- Public Member Functions inherited from ilSearchBaseGUI
 __construct ()
 
 prepareOutput ()
 
 initStandardSearchForm (int $a_mode)
 
 getSearchAreaForm ()
 
 handleCommand (string $a_cmd)
 
 addToDeskObject ()
 Add desktop item public. More...
 
 removeFromDeskObject ()
 Remove from desktop public. More...
 
 delete ()
 Show delete confirmation. More...
 
 cancelDelete ()
 Cancel delete. More...
 
 cancelObject ()
 
 cancelMoveLinkObject ()
 
 performDelete ()
 
 cut ()
 
 link ()
 
 paste ()
 
 showLinkIntoMultipleObjectsTree ()
 
 showPasteTree ()
 
 showMoveIntoObjectTree ()
 
 performPasteIntoMultipleObjects ()
 
 clear ()
 clear clipboard More...
 
 enableAdministrationPanel ()
 
 disableAdministrationPanel ()
 
 keepObjectsInClipboardObject ()
 
 addLocator ()
 
 autoComplete ()
 
- Public Member Functions inherited from ILIAS\Object\ImplementsCreationCallback
 callCreationCallback (\ilObject $object, \ilObjectDefinition $obj_definition, int $requested_crtcb)
 

Protected Member Functions

 getType ()
 Get type of search (details | fast) More...
 
 getDetails ()
 Needed for base class search form. More...
 
 remoteSearch ()
 Search from main menu. More...
 
 showSavedResults ()
 Show saved results. More...
 
 search ()
 Search (button pressed) More...
 
 performSearch ()
 Perform search. More...
 
 getTabs ()
 get tabs More...
 
 initUserSearchCache ()
 Init user search cache. More...
 
 showSearchForm ()
 Show search form. More...
 
- Protected Member Functions inherited from ilSearchBaseGUI
 initPageNumberFromQuery ()
 
 addPager ($result, string $a_session_key)
 
 buildSearchAreaPath (int $a_root_node)
 
 getCreationDateForm ()
 
 getSearchCache ()
 
 loadCreationFilter ()
 

Protected Attributes

ilTabsGUI $tabs
 
ilHelpGUI $help
 
- Protected Attributes inherited from ilSearchBaseGUI
ilUserSearchCache $search_cache
 
string $search_mode = ''
 
ilSearchSettings $settings
 
ilPropertyFormGUI $form = null
 
ClipboardManager $clipboard
 
ViewManager $container_view_manager
 
ilFavouritesManager $favourites
 
ilCtrl $ctrl
 
ILIAS $ilias
 
ilLanguage $lng
 
ilGlobalTemplateInterface $tpl
 
ilLocatorGUI $locator
 
ilObjUser $user
 
ilTree $tree
 
GlobalHttpState $http
 
Factory $refinery
 
ilLogger $logger
 
string $prev_link = ''
 
string $next_link = ''
 

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
 

Detailed Description

Constructor & Destructor Documentation

◆ __construct()

ilLuceneUserSearchGUI::__construct ( )

Constructor.

Definition at line 26 of file class.ilLuceneUserSearchGUI.php.

References $DIC, ILIAS\GlobalScreen\Provider\__construct(), ILIAS\Repository\help(), initUserSearchCache(), and ILIAS\Repository\tabs().

27  {
28  global $DIC;
29 
30  $this->tabs = $DIC->tabs();
31  $this->help = $DIC->help();
33  $this->initUserSearchCache();
34  }
initUserSearchCache()
Init user search cache.
global $DIC
Definition: feed.php:28
__construct(Container $dic, ilPlugin $plugin)
+ Here is the call graph for this function:

Member Function Documentation

◆ executeCommand()

ilLuceneUserSearchGUI::executeCommand ( )

Execute Command.

Definition at line 39 of file class.ilLuceneUserSearchGUI.php.

References ILIAS\Repository\ctrl(), ilSearchBaseGUI\handleCommand(), ILIAS\FileDelivery\http(), ilSearchBaseGUI\initStandardSearchForm(), prepareOutput(), ILIAS\Repository\refinery(), and ilSearchBaseGUI\SEARCH_FORM_USER.

39  : void
40  {
41  $next_class = $this->ctrl->getNextClass($this);
42  $cmd = $this->ctrl->getCmd();
43 
44  $this->prepareOutput();
45  switch ($next_class) {
46  case "ilpublicuserprofilegui":
47 
48  $user_id = 0;
49  if ($this->http->wrapper()->query()->has('user_id')) {
50  $user_id = $this->http->wrapper()->query()->retrieve(
51  'user_id',
52  $this->refinery->kindlyTo()->int()
53  );
54  }
55  $profile = new ilPublicUserProfileGUI($user_id);
56  $profile->setBackUrl($this->ctrl->getLinkTarget($this, 'showSavedResults'));
57  $ret = $this->ctrl->forwardCommand($profile);
58  $this->tpl->setContent($ret);
59  break;
60 
61 
62  default:
64  if (!$cmd) {
65  $cmd = "showSavedResults";
66  }
67  $this->handleCommand($cmd);
68  break;
69  }
70  }
handleCommand(string $a_cmd)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
static http()
Fetches the global http state from ILIAS.
initStandardSearchForm(int $a_mode)
+ Here is the call graph for this function:

◆ getDetails()

ilLuceneUserSearchGUI::getDetails ( )
protected

Needed for base class search form.

Todo:
rename

Definition at line 94 of file class.ilLuceneUserSearchGUI.php.

94  : array
95  {
96  return $this->search_cache->getItemFilter();
97  }

◆ getTabs()

ilLuceneUserSearchGUI::getTabs ( )
protected

get tabs

Definition at line 188 of file class.ilLuceneUserSearchGUI.php.

References ILIAS\Repository\ctrl(), ilSearchSettings\getInstance(), ilLuceneAdvancedSearchFields\getInstance(), ILIAS\Repository\help(), and ILIAS\Repository\tabs().

Referenced by prepareOutput().

188  : void
189  {
190  $this->help->setScreenIdComponent("src_luc");
191 
192  $this->tabs->addTarget('search', $this->ctrl->getLinkTargetByClass('illucenesearchgui'));
193 
194  if (ilSearchSettings::getInstance()->isLuceneUserSearchEnabled()) {
195  $this->tabs->addTarget('search_user', $this->ctrl->getLinkTargetByClass('illuceneusersearchgui'));
196  }
197 
199 
200  if (
201  !ilSearchSettings::getInstance()->getHideAdvancedSearch() and
202  $fields->getActiveFields()) {
203  $this->tabs->addTarget('search_advanced', $this->ctrl->getLinkTargetByClass('illuceneadvancedsearchgui'));
204  }
205 
206  $this->tabs->setTabActive('search_user');
207  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getType()

ilLuceneUserSearchGUI::getType ( )
protected

Get type of search (details | fast)

Todo:
rename Needed for base class search form

Definition at line 85 of file class.ilLuceneUserSearchGUI.php.

85  : int
86  {
87  return self::SEARCH_DETAILS;
88  }

◆ initUserSearchCache()

ilLuceneUserSearchGUI::initUserSearchCache ( )
protected

Init user search cache.

Definition at line 212 of file class.ilLuceneUserSearchGUI.php.

References $query, ilUserSearchCache\_getInstance(), ILIAS\FileDelivery\http(), ilSearchBaseGUI\initPageNumberFromQuery(), ilUserSearchCache\LUCENE_USER_SEARCH, ILIAS\Repository\refinery(), and ILIAS\Repository\user().

Referenced by __construct().

212  : void
213  {
214  $this->search_cache = ilUserSearchCache::_getInstance($this->user->getId());
215  $this->search_cache->switchSearchType(ilUserSearchCache::LUCENE_USER_SEARCH);
216  $page_number = $this->initPageNumberFromQuery();
217  if ($page_number) {
218  $this->search_cache->setResultPageNumber($page_number);
219  }
220 
221  if ($this->http->wrapper()->post()->has('term')) {
222  $query = $this->http->wrapper()->post()->retrieve(
223  'term',
224  $this->refinery->kindlyTo()->string()
225  );
226  $this->search_cache->setQuery($query);
227  $this->search_cache->setItemFilter(array());
228  $this->search_cache->setMimeFilter(array());
229  $this->search_cache->save();
230  }
231  }
static _getInstance(int $a_usr_id)
static http()
Fetches the global http state from ILIAS.
$query
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ performSearch()

ilLuceneUserSearchGUI::performSearch ( )
protected

Perform search.

Definition at line 163 of file class.ilLuceneUserSearchGUI.php.

References ilLuceneSearcher\getInstance(), ilLuceneQueryParser\parse(), showSearchForm(), ilRepositoryUserResultTableGUI\TYPE_GLOBAL_SEARCH, and ilLuceneSearcher\TYPE_USER.

Referenced by search(), and showSavedResults().

163  : void
164  {
165  $qp = new ilLuceneQueryParser($this->search_cache->getQuery());
166  $qp->parse();
167  $searcher = ilLuceneSearcher::getInstance($qp);
168  $searcher->setType(ilLuceneSearcher::TYPE_USER);
169  $searcher->search();
170 
171  $this->showSearchForm();
172 
173  $user_table = new ilRepositoryUserResultTableGUI(
174  $this,
175  'performSearch',
176  false,
178  );
179  $user_table->setLuceneResult($searcher->getResult());
180  $user_table->parseUserIds($searcher->getResult()->getCandidates());
181 
182  $this->tpl->setVariable('SEARCH_RESULTS', $user_table->getHTML());
183  }
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
parse()
parse query string
static getInstance(ilLuceneQueryParser $qp)
Get singleton instance.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ prepareOutput()

ilLuceneUserSearchGUI::prepareOutput ( )

Definition at line 72 of file class.ilLuceneUserSearchGUI.php.

References getTabs().

Referenced by executeCommand().

72  : void
73  {
74  parent::prepareOutput();
75  $this->getTabs();
76  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ remoteSearch()

ilLuceneUserSearchGUI::remoteSearch ( )
protected

Search from main menu.

Definition at line 103 of file class.ilLuceneUserSearchGUI.php.

References ILIAS\FileDelivery\http(), ILIAS\Repository\refinery(), and search().

103  : void
104  {
105  $root_id = 0;
106  if ($this->http->wrapper()->post()->has('root_id')) {
107  $root_id = $this->http->wrapper()->post()->retrieve(
108  'root_id',
109  $this->refinery->kindlyTo()->int()
110  );
111  }
112  $queryString = '';
113  if ($this->http->wrapper()->post()->has('queryString')) {
114  $queryString = $this->http->wrapper()->post()->retrieve(
115  'queryString',
116  $this->refinery->kindlyTo()->string()
117  );
118  }
119  $this->search_cache->setRoot($root_id);
120  $this->search_cache->setQuery($queryString);
121  $this->search_cache->save();
122  $this->search();
123  }
search()
Search (button pressed)
static http()
Fetches the global http state from ILIAS.
+ Here is the call graph for this function:

◆ search()

ilLuceneUserSearchGUI::search ( )
protected

Search (button pressed)

Returns
void

Definition at line 143 of file class.ilLuceneUserSearchGUI.php.

References ilSession\clear(), ILIAS\Repository\form(), performSearch(), ilSubItemListGUI\resetDetails(), and showSearchForm().

Referenced by remoteSearch().

143  : void
144  {
145  if (!$this->form->checkInput()) {
146  $this->search_cache->deleteCachedEntries();
147  // Reset details
149  $this->showSearchForm();
150  return;
151  }
152  ilSession::clear('max_page');
153  $this->search_cache->deleteCachedEntries();
154 
155  // Reset details
157  $this->performSearch();
158  }
static resetDetails()
As long as static::resetDetails is not possible this method is final.
form( $class_path, string $cmd)
static clear(string $a_var)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ showSavedResults()

ilLuceneUserSearchGUI::showSavedResults ( )
protected

Show saved results.

Returns
void

Definition at line 129 of file class.ilLuceneUserSearchGUI.php.

References performSearch(), and showSearchForm().

129  : void
130  {
131  if (strlen($this->search_cache->getQuery())) {
132  $this->performSearch();
133  return;
134  }
135 
136  $this->showSearchForm();
137  }
+ Here is the call graph for this function:

◆ showSearchForm()

ilLuceneUserSearchGUI::showSearchForm ( )
protected

Show search form.

Returns
boolean

Definition at line 239 of file class.ilLuceneUserSearchGUI.php.

References ILIAS\Repository\ctrl(), ilSubmitButton\getInstance(), ILIAS\Repository\lng(), and ilLegacyFormElementsUtil\prepareFormOutput().

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

240  {
241  $this->tpl->addBlockFile('ADM_CONTENT', 'adm_content', 'tpl.lucene_usr_search.html', 'Services/Search');
242 
243  ilOverlayGUI::initJavascript();
244  $this->tpl->addJavascript("./Services/Search/js/Search.js");
245 
246  $this->tpl->setVariable('FORM_ACTION', $this->ctrl->getFormAction($this, 'performSearch'));
247  $this->tpl->setVariable("TERM", ilLegacyFormElementsUtil::prepareFormOutput($this->search_cache->getQuery()));
248  $this->tpl->setVariable("SEARCH_LABEL", $this->lng->txt("search"));
250  $btn->setCommand("performSearch");
251  $btn->setCaption("search");
252  $this->tpl->setVariable("SUBMIT_BTN", $btn->render());
253 
254  return true;
255  }
static prepareFormOutput($a_str, bool $a_strip=false)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Field Documentation

◆ $help

ilHelpGUI ilLuceneUserSearchGUI::$help
protected

Definition at line 21 of file class.ilLuceneUserSearchGUI.php.

◆ $tabs

ilTabsGUI ilLuceneUserSearchGUI::$tabs
protected

Definition at line 20 of file class.ilLuceneUserSearchGUI.php.


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