19 declare(strict_types=1);
86 $this->
logger = $DIC->logger()->src();
87 $this->
ilias = $DIC[
'ilias'];
88 $this->
locator = $DIC[
'ilLocator'];
89 $this->
ctrl = $DIC->ctrl();
90 $this->
lng = $DIC->language();
91 $this->tpl = $DIC->ui()->mainTemplate();
92 $this->tree = $DIC->repositoryTree();
94 $this->
lng->loadLanguageModule(
'search');
97 $this->
user = $DIC->user();
98 $this->clipboard = $DIC
104 $this->
http = $DIC->http();
110 if ($this->
http->wrapper()->query()->has(
'page_number')) {
111 return $this->
http->wrapper()->query()->retrieve(
122 $this->tpl->loadStandardTemplate();
124 $this->tpl->setTitleIcon(
128 $this->tpl->setTitle($this->
lng->txt(
"search"));
137 $this->
form->setOpenTag(
false);
138 $this->
form->setCloseTag(
false);
142 if ($a_mode == self::SEARCH_FORM_STANDARD) {
147 (
string) self::SEARCH_FAST :
148 (
string) self::SEARCH_DETAILS
150 $op1 =
new ilRadioOption($this->
lng->txt(
"search_fast_info"), (string) self::SEARCH_FAST);
151 $radg->addOption($op1);
152 $op2 =
new ilRadioOption($this->
lng->txt(
"search_details_info"), (string) self::SEARCH_DETAILS);
160 $cbgr->setUseValuesAsKeys(
true);
161 $details = $this->getDetails();
165 if (isset($details[$type])) {
168 $cbgr->addOption($cb);
171 if ($a_mode == self::SEARCH_FORM_LUCENE) {
173 $mimes = $this->getMimeDetails();
176 if (isset($mimes[$type])) {
179 $cbgr->addOption($op3);
184 $cbgr->
setValue(array_merge((array) $details, (array) $mimes));
185 $op2->addSubItem($cbgr);
187 if ($a_mode != self::SEARCH_FORM_STANDARD && $det) {
188 $op2->setChecked(
true);
191 if ($a_mode == self::SEARCH_FORM_STANDARD) {
192 $radg->addOption($op2);
193 $this->
form->addItem($radg);
195 $this->
form->addItem($op2);
199 $this->
form->setFormAction($this->
ctrl->getFormAction($this,
'performSearch'));
205 if (method_exists($this, $a_cmd)) {
215 if ($this->
http->wrapper()->query()->has(
'item_ref_id')) {
216 $this->favourites->add(
217 $this->
user->getId(),
218 $this->
http->wrapper()->query()->retrieve(
224 $this->showSavedResults();
229 if ($this->
http->wrapper()->query()->has(
'item_ref_id')) {
230 $this->favourites->remove(
231 $this->
user->getId(),
232 $this->
http->wrapper()->query()->retrieve(
238 $this->showSavedResults();
241 public function delete():
void 249 $this->showSavedResults();
254 $this->showSavedResults();
259 $this->showSavedResults();
265 $admin->performDelete();
268 public function cut(): void
290 $admin->showLinkIntoMultipleObjectsTree();
296 $admin->showPasteTree();
303 $admin->showMoveIntoObjectTree();
309 $admin->performPasteIntoMultipleObjects();
314 $this->clipboard->clear();
315 $this->
ctrl->redirect($this);
331 $this->
ctrl->redirect($this);
337 $this->
locator->addItem($this->
lng->txt(
'search'), $this->
ctrl->getLinkTarget($this));
338 $this->tpl->setLocator();
344 protected function addPager($result,
string $a_session_key): bool
346 $max_page = max(
ilSession::get($a_session_key), $this->search_cache->getResultPageNumber());
349 if ($max_page == 1 and
350 (count($result->getResults()) < $result->getMaxHits())) {
354 if ($this->search_cache->getResultPageNumber() > 1) {
355 $this->
ctrl->setParameter($this,
'page_number', $this->search_cache->getResultPageNumber() - 1);
356 $this->prev_link = $this->
ctrl->getLinkTarget($this,
'performSearch');
358 for ($i = 1;$i <= $max_page;$i++) {
359 if ($i == $this->search_cache->getResultPageNumber()) {
363 $this->
ctrl->setParameter($this,
'page_number', $i);
364 $link =
'<a href="' . $this->
ctrl->getLinkTarget($this,
'performSearch') .
'" /a>' . $i .
'</a> ';
366 if (count($result->getResults()) >= $result->getMaxHits()) {
367 $this->
ctrl->setParameter($this,
'page_number', $this->search_cache->getResultPageNumber() + 1);
368 $this->next_link = $this->
ctrl->getLinkTarget($this,
'performSearch');
370 $this->
ctrl->clearParameters($this);
376 $path_arr = $this->tree->getPathFull($a_root_node,
ROOT_FOLDER_ID);
379 foreach ($path_arr as
$data) {
382 $path .= $data[
'title'];
384 $path .= $this->
lng->txt(
'repository');
393 if ($this->
http->wrapper()->post()->has(
'term')) {
394 $query = $this->
http->wrapper()->post()->retrieve(
396 $this->
refinery->kindlyTo()->string()
414 if (!$this->
settings->isDateFilterEnabled()) {
419 if (isset($this->search_filter_data[
"search_date"])) {
420 $options[
"date_start"] = $this->search_filter_data[
"search_date"][0];
421 $options[
"date_end"] = $this->search_filter_data[
"search_date"][1];
429 $this->tpl->addJavascript(
"assets/js/Search.js");
431 $this->tpl->setVariable(
"FORM_ACTION", $this->
ctrl->getFormAction($this,
"performSearch"));
433 $this->tpl->setVariable(
"SEARCH_LABEL", $this->
lng->txt(
"search"));
435 $btn->setCommand(
"performSearch");
436 $btn->setCaption(
"search");
437 $this->tpl->setVariable(
"SUBMIT_BTN", $btn->render());
446 $filter_html = $this->search_filter->getHTML();
447 preg_match(
'/id="([^"]+)"/', $filter_html, $matches);
448 $filter_id = $matches[1];
449 $this->tpl->setVariable(
"SEARCH_FILTER", $filter_html);
451 $this->tpl->addOnLoadCode(
"il.Search.syncFilterScope('" . $filter_id .
"', '" . $root_node .
"');");
457 $this->search_filter_data = $this->search_filter->getData();
462 return $this->
refinery->custom()->transformation(
463 static function (array $arr): array {
466 static function ($v):
string {
467 return \ilUtil::stripSlashes((
string) $v);
static get(string $a_var)
This class represents an option in a radio group.
This class represents an option in a checkbox group.
static _getIcon(int $obj_id=0, string $size="big", string $type="", bool $offline=false)
Get icon for repository item.
showLinkIntoMultipleObjectsTree()
static getList(string $a_str)
Interface Observer Contains several chained tasks and infos about them.
Handles Administration commands (cut, delete paste)
static _getInstance(int $a_usr_id)
ClipboardManager $clipboard
handleCommand(string $a_cmd)
keepObjectsInClipboardObject()
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
disableAdministrationPanel()
static http()
Fetches the global http state from ILIAS.
setValue(string $a_value)
renderFilter(int $root_node)
cancelDelete()
Cancel delete.
Class ilObjForumAdministration.
performPasteIntoMultipleObjects()
Manages items in repository clipboard.
array $search_filter_data
renderSearch(string $term, int $root_node=0)
form( $class_path, string $cmd, string $submit_caption="")
ilUserSearchCache $search_cache
getStringArrayTransformation()
addPager($result, string $a_session_key)
initStandardSearchForm(int $a_mode)
Class for storing search result.
buildSearchAreaPath(int $a_root_node)
enableAdministrationPanel()
Interface for GUI classes (PDGUI, LuceneSearchGUI...) that have to handle administration commands (cu...
ilSearchFilterGUI $search_filter
initPageNumberFromQuery()
const SEARCH_FORM_STANDARD
ilFavouritesManager $favourites
static set(string $a_var, $a_val)
Set a value.
ilSearchSettings $settings
ViewManager $container_view_manager
ilGlobalTemplateInterface $tpl