3 declare(strict_types=1);
55 $this->tabs_gui = $DIC->tabs();
56 $this->
help = $DIC[
'ilHelp'];
68 $next_class = $this->
ctrl->getNextClass($this);
69 $cmd = $this->
ctrl->getCmd();
72 switch ($next_class) {
73 case 'ilobjectcopygui':
74 $this->
ctrl->setReturn($this);
76 $this->
ctrl->forwardCommand($cp);
82 $cmd =
"showSavedResults";
102 $filter->loadFromDb();
105 if ($filter->getResultObjIds()) {
106 $searcher->highlight($filter->getResultObjIds());
109 $this->tpl->addBlockFile(
'ADM_CONTENT',
'adm_content',
'tpl.lucene_adv_search.html',
'Services/Search');
111 $presentation->setResults($filter->getResultIds());
112 $presentation->setSearcher($searcher);
116 $this->
addPager($filter,
'max_page');
117 $presentation->setPreviousNext($this->prev_link, $this->next_link);
119 if ($presentation->render()) {
120 $this->tpl->setVariable(
'SEARCH_RESULTS', $presentation->getHTML());
121 } elseif (strlen(trim($qp->getQuery()))) {
122 $this->tpl->setOnScreenMessage(
'info', $this->
lng->txt(
'search_no_match'));
127 $this->tpl->setVariable(
'SEARCH_TABLE', $this->
form->getHTML());
129 if ($filter->getResultIds()) {
140 $this->
form->setFormAction($this->
ctrl->getFormAction($this,
'search'));
141 $this->
form->setTitle($this->
lng->txt(
'search_advanced'));
142 $this->
form->addCommandButton(
'search', $this->
lng->txt(
'search'));
143 $this->
form->addCommandButton(
'reset', $this->
lng->txt(
'reset'));
145 foreach ($this->
fields->getActiveSections() as $definition) {
146 if ($definition[
'name'] !=
'default') {
148 $section->setTitle($definition[
'name']);
149 $this->
form->addItem($section);
152 foreach ($definition[
'fields'] as $field_name) {
153 if (is_object($element = $this->
fields->getFormElement($this->search_cache->getQuery(), $field_name,
$this->form))) {
154 $this->
form->addItem($element);
166 if ($this->
http->wrapper()->post()->has(
'root_id')) {
167 $root_id = $this->
http->wrapper()->post()->retrieve(
173 if ($this->
http->wrapper()->post()->has(
'queryString')) {
174 $queryString = $this->
http->wrapper()->post()->retrieve(
176 $this->
refinery->kindlyTo()->string()
179 $this->search_cache->setRoot($root_id);
180 $this->search_cache->setQuery([
'lom_content' => $queryString]);
181 $this->search_cache->save();
187 if (!is_array($this->search_cache->getQuery())) {
189 $this->tpl->setOnScreenMessage(
'info', $this->
lng->txt(
'msg_no_search_string'));
194 $this->search_cache->deleteCachedEntries();
207 $this->search_cache->setQuery(array());
208 $this->search_cache->save();
220 if (!strlen(trim($qp->getQuery()))) {
221 $this->tpl->setOnScreenMessage(
'info', $this->
lng->txt(
'msg_no_search_string'));
232 $filter->setCandidates($searcher->getResult());
235 if ($filter->getResultObjIds()) {
236 $searcher->highlight($filter->getResultObjIds());
240 $this->tpl->addBlockFile(
'ADM_CONTENT',
'adm_content',
'tpl.lucene_adv_search.html',
'Services/Search');
242 $presentation->setResults($filter->getResultIds());
243 $presentation->setSearcher($searcher);
246 $this->
addPager($filter,
'max_page');
247 $presentation->setPreviousNext($this->prev_link, $this->next_link);
249 if ($presentation->render()) {
250 $this->tpl->setVariable(
'SEARCH_RESULTS', $presentation->getHTML());
252 $this->tpl->setOnScreenMessage(
'info', $this->
lng->txt(
'search_no_match'));
257 $this->tpl->setVariable(
'SEARCH_TABLE', $this->
form->getHTML());
259 if ($filter->getResultIds()) {
269 parent::prepareOutput();
278 $this->
help->setScreenIdComponent(
"src_luc");
280 $this->tabs_gui->addTarget(
'search', $this->
ctrl->getLinkTargetByClass(
'illucenesearchgui'));
283 $this->tabs_gui->addTarget(
'search_user', $this->
ctrl->getLinkTargetByClass(
'illuceneusersearchgui'));
288 $this->
fields->getActiveFields()) {
289 $this->tabs_gui->addTarget(
'search_advanced', $this->
ctrl->getLinkTarget($this));
292 $this->tabs_gui->setTabActive(
'search_advanced');
307 $this->search_cache->setResultPageNumber($page_number);
309 if ($this->
http->wrapper()->post()->has(
'query')) {
310 $this->search_cache->setQuery($this->
http->request()->getParsedBody()[
'query'] ?? []);
319 $adm_view_cmp = $adm_cmds = $creation_selector = $adm_view =
false;
322 if (isset($this->admin_panel_commands) && (count((array) $this->admin_panel_commands) > 0)) {
323 foreach ($this->admin_panel_commands as $cmd) {
324 $this->tpl->setCurrentBlock(
"lucene_admin_panel_cmd");
325 $this->tpl->setVariable(
"LUCENE_PANEL_CMD", $cmd[
"cmd"]);
326 $this->tpl->setVariable(
"LUCENE_TXT_PANEL_CMD", $cmd[
"txt"]);
327 $this->tpl->parseCurrentBlock();
333 $this->tpl->setCurrentBlock(
"lucene_adm_view_components");
335 $this->tpl->setVariable(
"LUCENE_ADM_ALT_ARROW", $this->
lng->txt(
"actions"));
336 $this->tpl->parseCurrentBlock();
337 $adm_view_cmp =
true;
341 if (isset($this->admin_view_button) && is_array($this->admin_view_button)) {
342 if (is_array($this->admin_view_button)) {
343 $this->tpl->setCurrentBlock(
"lucene_admin_button");
344 $this->tpl->setVariable(
345 "LUCENE_ADMIN_MODE_LINK",
346 $this->admin_view_button[
"link"]
348 $this->tpl->setVariable(
349 "LUCENE_TXT_ADMIN_MODE",
350 $this->admin_view_button[
"txt"]
352 $this->tpl->parseCurrentBlock();
354 $this->tpl->setCurrentBlock(
"lucene_admin_view");
355 $this->tpl->parseCurrentBlock();
360 if (isset($this->creation_selector) && is_array($this->creation_selector)) {
361 $this->tpl->setCurrentBlock(
"lucene_add_commands");
363 $this->tpl->setVariable(
"LUCENE_ADD_COM_WIDTH",
'width="1"');
365 $this->tpl->setVariable(
366 "LUCENE_SELECT_OBJTYPE_REPOS",
367 $this->creation_selector[
"options"]
369 $this->tpl->setVariable(
370 "LUCENE_BTN_NAME_REPOS",
371 $this->creation_selector[
"command"]
373 $this->tpl->setVariable(
374 "LUCENE_TXT_ADD_REPOS",
375 $this->creation_selector[
"txt"]
377 $this->tpl->parseCurrentBlock();
378 $creation_selector =
true;
380 if ($adm_view || $creation_selector) {
381 $this->tpl->setCurrentBlock(
"lucene_adm_panel");
383 $this->tpl->setVariable(
"LUCENE_ADM_TBL_WIDTH",
'width:"100%";');
385 $this->tpl->parseCurrentBlock();
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
GUI class for the workflow of copying objects.
static _getInstance(int $a_usr_id)
static getImagePath(string $img, string $module_path="", string $mode="output", bool $offline=false)
get image path (for images located in a template directory)
static getInstance(ilLuceneQueryParser $qp)
Get singleton instance.
reset()
Reset search form.
remoteSearch()
Search from main menu.
handleCommand(string $a_cmd)
executeCommand()
Execute Command.
static resetDetails()
As long as static::resetDetails is not possible this method is final.
prepareOutput()
Add admin panel command.
__construct()
Constructor.
static http()
Fetches the global http state from ILIAS.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
static getInstance(int $a_user_id)
initFormSearch()
Show search form.
initUserSearchCache()
Init user search cache.
form( $class_path, string $cmd)
showSavedResults()
Show saved results.
addPager($result, string $a_session_key)
__construct(Container $dic, ilPlugin $plugin)
array $admin_panel_commands
performSearch()
Perform search.
initPageNumberFromQuery()
static clear(string $a_var)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
ilLuceneAdvancedSearchFields $fields