ILIAS  trunk Revision v12.0_alpha-377-g3641b37b9db
ilLuceneUserSearchGUI Class Reference
+ Collaboration diagram for ilLuceneUserSearchGUI:

Public Member Functions

 __construct ()
 Constructor. More...
 
 executeCommand ()
 Execute Command. More...
 

Protected Member Functions

 prepareOutput ()
 
 getTabs ()
 
 remoteSearch ()
 Search from main menu. More...
 
 showSavedResults ()
 
 search ()
 Search (button pressed) More...
 
 performSearch ()
 Perform search. More...
 
 initUserSearchCache ()
 
 showSearchForm ()
 

Protected Attributes

ilUserSearchCache $search_cache
 
ilCtrl $ctrl
 
ilLanguage $lng
 
ilGlobalTemplateInterface $tpl
 
ilObjUser $user
 
GlobalHttpState $http
 
Refinery $refinery
 
ilTabsGUI $tabs
 
ilHelpGUI $help
 

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 31 of file class.ilLuceneUserSearchGUI.php.

Constructor & Destructor Documentation

◆ __construct()

ilLuceneUserSearchGUI::__construct ( )

Constructor.

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

48 {
49 global $DIC;
50
51 $this->tabs = $DIC->tabs();
52 $this->help = $DIC->help();
53 $this->ctrl = $DIC->ctrl();
54 $this->lng = $DIC->language();
55 $this->lng->loadLanguageModule('search');
56 $this->tpl = $DIC->ui()->mainTemplate();
57 $this->user = $DIC->user();
58 $this->http = $DIC->http();
59 $this->refinery = $DIC->refinery();
60 $this->initUserSearchCache();
61 }
static http()
Fetches the global http state from ILIAS.
global $DIC
Definition: shib_login.php:26

References $DIC, ILIAS\Repository\ctrl(), ILIAS\Repository\help(), ILIAS\FileDelivery\http(), initUserSearchCache(), ILIAS\Repository\lng(), ILIAS\Repository\refinery(), ILIAS\Repository\tabs(), and ILIAS\Repository\user().

+ Here is the call graph for this function:

Member Function Documentation

◆ executeCommand()

ilLuceneUserSearchGUI::executeCommand ( )

Execute Command.

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

66 : void
67 {
68 $next_class = $this->ctrl->getNextClass($this);
69 $cmd = $this->ctrl->getCmd();
70
71 $this->prepareOutput();
72 switch ($next_class) {
73 case strtolower(PublicProfileGUI::class):
74
75 $user_id = 0;
76 if ($this->http->wrapper()->query()->has('user_id')) {
77 $user_id = $this->http->wrapper()->query()->retrieve(
78 'user_id',
79 $this->refinery->kindlyTo()->int()
80 );
81 }
82 $profile = new PublicProfileGUI($user_id);
83 $profile->setBackUrl($this->ctrl->getLinkTarget($this, 'showSavedResults'));
84 $ret = $this->ctrl->forwardCommand($profile);
85 $this->tpl->setContent($ret);
86 break;
87
88
89 default:
90 if (!$cmd) {
91 $cmd = "showSavedResults";
92 }
93 $this->$cmd();
94 break;
95 }
96 }
GUI class for public user profile presentation.

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

+ Here is the call graph for this function:

◆ getTabs()

ilLuceneUserSearchGUI::getTabs ( )
protected

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

111 : void
112 {
113 $this->help->setScreenIdComponent('src_luc');
114
115 $this->tabs->addTarget('search', $this->ctrl->getLinkTargetByClass(ilSearchGUI::class));
116
117 if (ilSearchSettings::getInstance()->isLuceneUserSearchEnabled()) {
118 $this->tabs->addTarget('search_user', $this->ctrl->getLinkTargetByClass(ilLuceneUserSearchGUI::class));
119 }
120
121 $this->tabs->setTabActive('search_user');
122 }

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

Referenced by prepareOutput().

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

◆ initUserSearchCache()

ilLuceneUserSearchGUI::initUserSearchCache ( )
protected

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

194 : void
195 {
196 $this->search_cache = ilUserSearchCache::_getInstance($this->user->getId());
197 $this->search_cache->switchSearchType(ilUserSearchCache::LUCENE_USER_SEARCH);
198
199 if ($this->http->wrapper()->post()->has('term')) {
200 $query = $this->http->wrapper()->post()->retrieve(
201 'term',
202 $this->refinery->kindlyTo()->string()
203 );
204 $this->search_cache->setQuery($query);
205 $this->search_cache->setItemFilter([]);
206 $this->search_cache->setMimeFilter([]);
207 $this->search_cache->save();
208 }
209 }
static _getInstance(int $a_usr_id)

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

Referenced by __construct().

+ 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 172 of file class.ilLuceneUserSearchGUI.php.

172 : void
173 {
174 $qp = new ilLuceneQueryParser($this->search_cache->getQuery());
175 $qp->parse();
176 $searcher = ilLuceneSearcher::getInstance($qp);
177 $searcher->setType(ilLuceneSearcher::TYPE_USER);
178 $searcher->search();
179
180 $this->showSearchForm();
181
182 $user_table = new ilRepositoryUserResultTableGUI(
183 $this,
184 'performSearch',
185 false,
187 );
188 $user_table->setLuceneResult($searcher->getResult());
189 $user_table->parseUserIds($searcher->getResult()->getCandidates());
190
191 $this->tpl->setVariable('SEARCH_RESULTS', $user_table->getHTML());
192 }
static getInstance(ilLuceneQueryParser $qp)
Get singleton instance.

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

Referenced by search(), and showSavedResults().

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

◆ prepareOutput()

ilLuceneUserSearchGUI::prepareOutput ( )
protected

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

98 : void
99 {
100 $this->tpl->loadStandardTemplate();
101
102 $this->tpl->setTitleIcon(
103 ilObject::_getIcon(0, "big", "src"),
104 ""
105 );
106 $this->tpl->setTitle($this->lng->txt("search"));
107
108 $this->getTabs();
109 }
static _getIcon(int $obj_id=0, string $size="big", string $type="", bool $offline=false)
Get icon for repository item.

References ilObject\_getIcon(), getTabs(), and ILIAS\Repository\lng().

Referenced by executeCommand().

+ 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 128 of file class.ilLuceneUserSearchGUI.php.

128 : void
129 {
130 $root_id = 0;
131 if ($this->http->wrapper()->post()->has('root_id')) {
132 $root_id = $this->http->wrapper()->post()->retrieve(
133 'root_id',
134 $this->refinery->kindlyTo()->int()
135 );
136 }
137 $queryString = '';
138 if ($this->http->wrapper()->post()->has('queryString')) {
139 $queryString = $this->http->wrapper()->post()->retrieve(
140 'queryString',
141 $this->refinery->kindlyTo()->string()
142 );
143 }
144 $this->search_cache->setRoot($root_id);
145 $this->search_cache->setQuery($queryString);
146 $this->search_cache->save();
147 $this->search();
148 }
search()
Search (button pressed)

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

+ Here is the call graph for this function:

◆ search()

ilLuceneUserSearchGUI::search ( )
protected

Search (button pressed)

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

163 : void
164 {
165 $this->search_cache->deleteCachedEntries();
166 $this->performSearch();
167 }

References performSearch().

Referenced by remoteSearch().

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

◆ showSavedResults()

ilLuceneUserSearchGUI::showSavedResults ( )
protected

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

150 : void
151 {
152 if (strlen($this->search_cache->getQuery())) {
153 $this->performSearch();
154 return;
155 }
156
157 $this->showSearchForm();
158 }

References performSearch(), and showSearchForm().

+ Here is the call graph for this function:

◆ showSearchForm()

ilLuceneUserSearchGUI::showSearchForm ( )
protected

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

212 {
213 $this->tpl->addBlockFile('ADM_CONTENT', 'adm_content', 'tpl.lucene_usr_search.html', 'components/ILIAS/Search');
214 $this->tpl->addJavascript("assets/js/Search.js");
215
216 $this->tpl->setVariable("FORM_ACTION", $this->ctrl->getFormAction($this, "performSearch"));
217 $this->tpl->setVariable("TERM", ilLegacyFormElementsUtil::prepareFormOutput($this->search_cache->getQuery()));
218 $this->tpl->setVariable("SEARCH_LABEL", $this->lng->txt("search"));
220 $btn->setCommand("performSearch");
221 $btn->setCaption("search");
222 $this->tpl->setVariable("SUBMIT_BTN", $btn->render());
223 }
static prepareFormOutput($a_str, bool $a_strip=false)

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

Referenced by performSearch(), and showSavedResults().

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

Field Documentation

◆ $ctrl

ilCtrl ilLuceneUserSearchGUI::$ctrl
protected

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

◆ $help

ilHelpGUI ilLuceneUserSearchGUI::$help
protected

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

◆ $http

GlobalHttpState ilLuceneUserSearchGUI::$http
protected

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

◆ $lng

ilLanguage ilLuceneUserSearchGUI::$lng
protected

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

◆ $refinery

Refinery ilLuceneUserSearchGUI::$refinery
protected

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

◆ $search_cache

ilUserSearchCache ilLuceneUserSearchGUI::$search_cache
protected

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

◆ $tabs

ilTabsGUI ilLuceneUserSearchGUI::$tabs
protected

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

◆ $tpl

ilGlobalTemplateInterface ilLuceneUserSearchGUI::$tpl
protected

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

◆ $user

ilObjUser ilLuceneUserSearchGUI::$user
protected

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


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