ILIAS  trunk Revision v13.0_alpha-62-g3b72d83f2e5
ilLuceneUserSearchGUI Class Reference
+ Collaboration diagram for ilLuceneUserSearchGUI:

Public Member Functions

 __construct ()
 
 executeCommand ()
 

Protected Member Functions

 search ()
 
 remoteSearch ()
 Search from main menu. More...
 
 showSavedResults ()
 
 switchResultPage ()
 
 performSearch (string $term, int $current_page)
 
 fetchCache ()
 
 renderResults (FilteredResult $result, PaginationInfos $pagination_infos, string $term)
 
 renderSearchInput (string $term)
 
 buildPaginationInfos (int $page, int $max_page)
 

Protected Attributes

ilCtrl $ctrl
 
ilLanguage $lng
 
ilGlobalTemplateInterface $tpl
 
ilTabsGUI $tabs
 
UIRenderer $ui_renderer
 
ilObjUser $user
 
GlobalHttpState $http
 
Refinery $refinery
 
ilSearchSettings $settings
 
ResultPresenter $result_presenter
 
Actions $actions
 
SearchStateHandler $state_handler
 
ResultFilter $result_filter
 
Criterion $user_public_criterion
 

Detailed Description

Author
Stefan Meyer meyer.nosp@m.@lei.nosp@m.fos.c.nosp@m.om

@ilCtrl_Calls ilLuceneUserSearchGUI: ILIAS\User\Profile\PublicProfileGUI @ilCtrl_IsCalledBy ilLuceneUserSearchGUI: ilSearchControllerGUI

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

Constructor & Destructor Documentation

◆ __construct()

ilLuceneUserSearchGUI::__construct ( )

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

60 {
61 global $DIC;
62
63 $service = new Service($DIC);
64
65 $this->ctrl = $DIC->ctrl();
66 $this->lng = $DIC->language();
67 $this->lng->loadLanguageModule('search');
68 $this->tpl = $DIC->ui()->mainTemplate();
69 $this->tabs = $DIC->tabs();
70 $this->ui_renderer = $DIC->ui()->renderer();
71 $this->user = $DIC->user();
72 $this->http = $DIC->http();
73 $this->refinery = $DIC->refinery();
75 $this->result_presenter = $service->presentation()->result();
76 $this->actions = $service->gui()->userSearchActions();
77 $this->state_handler = $service->gui()->searchStateHandler();
78 $this->result_filter = $service->result()->resultFilter();
79 $this->user_public_criterion = $service->result()->userIsPublicCriterion();
80 }
$service
Definition: ltiresult.php:44
static http()
Fetches the global http state from ILIAS.
global $DIC
Definition: shib_login.php:26

References $DIC, $service, ILIAS\Repository\ctrl(), ilSearchSettings\getInstance(), ILIAS\FileDelivery\http(), ILIAS\Repository\lng(), ILIAS\Repository\refinery(), ILIAS\Repository\settings(), ILIAS\Repository\tabs(), and ILIAS\Repository\user().

+ Here is the call graph for this function:

Member Function Documentation

◆ buildPaginationInfos()

ilLuceneUserSearchGUI::buildPaginationInfos ( int  $page,
int  $max_page 
)
protected

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

281 return $this->result_presenter->getPaginationInfos(
282 $page,
283 $max_page,
284 $this->settings->getMaxHits(),
285 $this->actions->switchResultPage(),
287 );
288 }

Referenced by remoteSearch(), search(), showSavedResults(), and switchResultPage().

+ Here is the caller graph for this function:

◆ executeCommand()

ilLuceneUserSearchGUI::executeCommand ( )

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

82 : void
83 {
84 $next_class = $this->ctrl->getNextClass($this);
85 $cmd = $this->ctrl->getCmd();
86
87 switch ($next_class) {
88 case strtolower(PublicProfileGUI::class):
89 $this->tabs->clearTargets();
90 $this->tabs->setBackTarget(
91 $this->lng->txt('back'),
92 (string) $this->actions->showSavedResults()
93 );
94 $user_id = 0;
95 if ($this->http->wrapper()->query()->has('user_id')) {
96 $user_id = $this->http->wrapper()->query()->retrieve(
97 'user_id',
98 $this->refinery->kindlyTo()->int()
99 );
100 }
101 $profile = new PublicProfileGUI($user_id);
102 $ret = $this->ctrl->forwardCommand($profile);
103 $this->tpl->setContent($ret);
104 break;
105
106
107 default:
108 if (!$this->actions->isValidCommand($cmd)) {
109 $cmd = 'showSavedResults';
110 }
111 $this->$cmd();
112 break;
113 }
114 }
GUI class for public user profile presentation.

References $user_id, ILIAS\Repository\ctrl(), ILIAS\FileDelivery\http(), ILIAS\Repository\lng(), ILIAS\Repository\refinery(), and ILIAS\Repository\tabs().

+ Here is the call graph for this function:

◆ fetchCache()

ilLuceneUserSearchGUI::fetchCache ( )
protected

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

227 {
228 $cache = ilUserSearchCache::_getInstance($this->user->getId());
229 $cache->switchSearchType(ilUserSearchCache::LUCENE_USER_SEARCH);
230 return $cache;
231 }
Class for storing search result.
static _getInstance(int $a_usr_id)

References ilUserSearchCache\_getInstance(), ilUserSearchCache\LUCENE_USER_SEARCH, and ILIAS\Repository\user().

Referenced by remoteSearch(), search(), showSavedResults(), and switchResultPage().

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

◆ performSearch()

ilLuceneUserSearchGUI::performSearch ( string  $term,
int  $current_page 
)
protected

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

212 $qp = new ilLuceneQueryParser($term);
213 $qp->parse();
214 $searcher = ilLuceneSearcher::getInstance($qp);
215 $searcher->setType(ilLuceneSearcher::TYPE_USER);
216 $searcher->search();
217
218 return $this->result_filter->filter(
219 $this->user_public_criterion,
220 ($current_page - 1) * $this->settings->getMaxHits(),
221 $this->settings->getMaxHits(),
222 ...$searcher->getResult()->getCandidates()
223 );
224 }
static getInstance(ilLuceneQueryParser $qp)
Get singleton instance.

Referenced by remoteSearch(), search(), showSavedResults(), and switchResultPage().

+ Here is the caller graph for this function:

◆ remoteSearch()

ilLuceneUserSearchGUI::remoteSearch ( )
protected

Search from main menu.

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

143 : void
144 {
145 $cache = $this->fetchCache();
146
147 $term = $this->state_handler->fetchRequestedRemoteSearchTerm();
148 $page = 1;
149 $max_page = 1;
150
151 $result = $this->performSearch($term, $page);
152 if ($page >= $max_page && !$result->isResultComplete()) {
153 $max_page = $page + 1;
154 }
155
156 $this->state_handler->updateMaxPage($max_page);
157 $cache->deleteCachedEntries();
158 $cache->setQuery($term);
159 $cache->save();
160
161 $this->renderSearchInput($term);
162 $pagination_infos = $this->buildPaginationInfos($page, $max_page);
163 $this->renderResults($result, $pagination_infos, $term);
164 }
renderResults(FilteredResult $result, PaginationInfos $pagination_infos, string $term)
performSearch(string $term, int $current_page)
buildPaginationInfos(int $page, int $max_page)

References $page, buildPaginationInfos(), fetchCache(), performSearch(), renderResults(), and renderSearchInput().

+ Here is the call graph for this function:

◆ renderResults()

ilLuceneUserSearchGUI::renderResults ( FilteredResult  $result,
PaginationInfos  $pagination_infos,
string  $term 
)
protected

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

237 : void {
238 if ($result->valid() || $pagination_infos->currentPage() > 1) {
239 $result_panel = $this->result_presenter->getLuceneUserSearchResultAsPanel(
240 $pagination_infos,
241 ...$result
242 );
243 $this->tpl->setVariable(
244 'SEARCH_RESULTS',
245 $this->ui_renderer->render($result_panel)
246 );
247 } elseif ($term !== '') {
248 $this->tpl->setOnScreenMessage(
249 GlobalTemplate::MESSAGE_TYPE_INFO,
250 sprintf(
251 $this->lng->txt('search_no_match_hint'),
252 $term
253 )
254 );
255 } else {
256 $this->tpl->setOnScreenMessage(
257 GlobalTemplate::MESSAGE_TYPE_INFO,
258 $this->lng->txt('search_no_match')
259 );
260 }
261 }

Referenced by remoteSearch(), search(), showSavedResults(), and switchResultPage().

+ Here is the caller graph for this function:

◆ renderSearchInput()

ilLuceneUserSearchGUI::renderSearchInput ( string  $term)
protected

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

264 {
265 $this->tpl->addBlockFile('ADM_CONTENT', 'adm_content', 'tpl.lucene_usr_search.html', 'components/ILIAS/Search');
266 $this->tpl->addJavascript("assets/js/Search.js");
267
268 $this->tpl->setVariable("FORM_ACTION", $this->ctrl->getFormAction($this, "search"));
269 $this->tpl->setVariable("TERM", ilLegacyFormElementsUtil::prepareFormOutput($term));
270 $this->tpl->setVariable("SEARCH_LABEL", $this->lng->txt("search"));
272 $btn->setCommand("search");
273 $btn->setCaption("search");
274 $this->tpl->setVariable("SUBMIT_BTN", $btn->render());
275 }
static prepareFormOutput($a_str, bool $a_strip=false)

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

Referenced by remoteSearch(), search(), showSavedResults(), and switchResultPage().

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

◆ search()

ilLuceneUserSearchGUI::search ( )
protected

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

116 : void
117 {
118 $cache = $this->fetchCache();
119
120 $term = $this->state_handler->fetchRequestedSearchTerm();
121 $page = 1;
122 $max_page = 1;
123
124
125 $result = $this->performSearch($term, $page);
126 if ($page >= $max_page && !$result->isResultComplete()) {
127 $max_page = $page + 1;
128 }
129
130 $this->state_handler->updateMaxPage($max_page);
131 $cache->deleteCachedEntries();
132 $cache->setQuery($term);
133 $cache->save();
134
135 $this->renderSearchInput($term);
136 $pagination_infos = $this->buildPaginationInfos($page, $max_page);
137 $this->renderResults($result, $pagination_infos, $term);
138 }

References $page, buildPaginationInfos(), fetchCache(), performSearch(), renderResults(), and renderSearchInput().

+ Here is the call graph for this function:

◆ showSavedResults()

ilLuceneUserSearchGUI::showSavedResults ( )
protected

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

166 : void
167 {
168 $cache = $this->fetchCache();
169
170 $term = $cache->getQuery();
171 $page = $cache->getResultPageNumber();
172 $max_page = $this->state_handler->fetchMaxPage();
173
174 $result = $this->performSearch($term, $page);
175 if ($page >= $max_page && !$result->isResultComplete()) {
176 $max_page = $page + 1;
177 }
178
179 $this->state_handler->updateMaxPage($max_page);
180
181 $this->renderSearchInput($term);
182 $pagination_infos = $this->buildPaginationInfos($page, $max_page);
183 $this->renderResults($result, $pagination_infos, $term);
184 }

References $page, buildPaginationInfos(), fetchCache(), performSearch(), renderResults(), and renderSearchInput().

+ Here is the call graph for this function:

◆ switchResultPage()

ilLuceneUserSearchGUI::switchResultPage ( )
protected

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

186 : void
187 {
188 $cache = $this->fetchCache();
189
190 $term = $cache->getQuery();
191 $page = $this->state_handler->fetchRequestedPage();
192 $max_page = max($this->state_handler->fetchMaxPage(), $page);
193
194 $result = $this->performSearch($term, $page);
195 if ($page >= $max_page && !$result->isResultComplete()) {
196 $max_page = $page + 1;
197 }
198
199 $this->state_handler->updateMaxPage($max_page);
200 $cache->setResultPageNumber($page);
201 $cache->save();
202
203 $this->renderSearchInput($term);
204 $pagination_infos = $this->buildPaginationInfos($page, $max_page);
205 $this->renderResults($result, $pagination_infos, $term);
206 }

References $page, buildPaginationInfos(), fetchCache(), performSearch(), renderResults(), and renderSearchInput().

+ Here is the call graph for this function:

Field Documentation

◆ $actions

Actions ilLuceneUserSearchGUI::$actions
protected

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

◆ $ctrl

ilCtrl ilLuceneUserSearchGUI::$ctrl
protected

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

◆ $http

GlobalHttpState ilLuceneUserSearchGUI::$http
protected

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

◆ $lng

ilLanguage ilLuceneUserSearchGUI::$lng
protected

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

◆ $refinery

Refinery ilLuceneUserSearchGUI::$refinery
protected

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

◆ $result_filter

ResultFilter ilLuceneUserSearchGUI::$result_filter
protected

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

◆ $result_presenter

ResultPresenter ilLuceneUserSearchGUI::$result_presenter
protected

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

◆ $settings

ilSearchSettings ilLuceneUserSearchGUI::$settings
protected

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

◆ $state_handler

SearchStateHandler ilLuceneUserSearchGUI::$state_handler
protected

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

◆ $tabs

ilTabsGUI ilLuceneUserSearchGUI::$tabs
protected

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

◆ $tpl

ilGlobalTemplateInterface ilLuceneUserSearchGUI::$tpl
protected

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

◆ $ui_renderer

UIRenderer ilLuceneUserSearchGUI::$ui_renderer
protected

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

◆ $user

ilObjUser ilLuceneUserSearchGUI::$user
protected

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

◆ $user_public_criterion

Criterion ilLuceneUserSearchGUI::$user_public_criterion
protected

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


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