ILIAS  release_8 Revision v8.24
ilSearchGUI Class Reference

This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Learning e.V. More...

+ Inheritance diagram for ilSearchGUI:
+ Collaboration diagram for ilSearchGUI:

Public Member Functions

 __construct ()
 Constructor @access public. More...
 
 executeCommand ()
 Control @access public. More...
 
 setType (int $a_type)
 Set/get type of search (detail or 'fast' search) @access public. More...
 
 getType ()
 
 setCombination (string $a_combination)
 Set/get combination of search ('and' or 'or') @access public. More...
 
 getCombination ()
 
 setString (string $a_str)
 Set/get search string @access public. More...
 
 getString ()
 
 setDetails (array $a_details)
 Set/get details (object types for details search) @access public. More...
 
 getDetails ()
 
 getRootNode ()
 
 setRootNode (int $a_node_id)
 
 remoteSearch ()
 
 autoComplete ()
 Data resource for autoComplete. More...
 
 showSearch ()
 
 showSavedResults ()
 
 performSearch ()
 Perform search. More...
 
 prepareOutput ()
 
 __parseQueryString ()
 parse query string, using query parser instance More...
 
 __searchObjects (ilQueryParser $query_parser)
 Search in obect title,desctiption. More...
 
 parseCreationFilter (ilObjectSearch $search)
 
 __searchMeta (ilQueryParser $query_parser, string $a_type)
 Search in object meta data (keyword) More...
 
 __getFilter ()
 Get object type for filter (If detail search is enabled) More...
 
- Public Member Functions inherited from ilSearchBaseGUI
 __construct ()
 
 prepareOutput ()
 
 initStandardSearchForm (int $a_mode)
 
 getSearchAreaForm ()
 
 handleCommand (string $a_cmd)
 
 addToDeskObject ()
 Add desktop item @access public. More...
 
 removeFromDeskObject ()
 Remove from desktop @access 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 ()
 
 addToDeskObject ()
 Add desktop item @access public. More...
 
 removeFromDeskObject ()
 Remove from desktop @access public. More...
 
 delete ()
 Show delete confirmation. More...
 
 cancelDelete ()
 Cancel delete. More...
 
 performDelete ()
 
 cut ()
 
 showLinkIntoMultipleObjectsTree ()
 
 showMoveIntoObjectTree ()
 
 showPasteTree ()
 
 performPasteIntoMultipleObjects ()
 
 paste ()
 
 clear ()
 clear clipboard More...
 
 enableAdministrationPanel ()
 
 disableAdministrationPanel ()
 
 cancelMoveLinkObject ()
 
 keepObjectsInClipboardObject ()
 
- Public Member Functions inherited from ILIAS\Object\ImplementsCreationCallback
 callCreationCallback (\ilObject $object, \ilObjectDefinition $obj_definition, int $requested_crtcb)
 

Data Fields

int $root_node
 
string $combination
 
string $string
 
int $type
 
- 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
 

Protected Member Functions

 storeRoot ()
 Store new root node. More...
 
 __performDetailsSearch (ilQueryParser $query_parser, ilSearchResult $result)
 
 parseDateFromCreationFilter ()
 
 parseOperatorFromCreationFilter ()
 
- 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_gui
 
ilHelpGUI $help_gui
 
- 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 = ''
 

Private Attributes

array $details
 

Detailed Description

This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Learning e.V.

ILIAS is licensed with the GPL-3.0, see https://www.gnu.org/licenses/gpl-3.0.en.html You should have received a copy of said license along with the source code, too.

If this is not the case or you just want to try ILIAS, you'll find us at: https://www.ilias.de https://github.com/ILIAS-eLearning Class ilSearchGUI

GUI class for 'simple' search

Author
Stefan Meyer smeye.nosp@m.r.il.nosp@m.ias@g.nosp@m.mx.d.nosp@m.e @ilCtrl_Calls ilSearchGUI: ilPropertyFormGUI @ilCtrl_Calls ilSearchGUI: ilObjectGUI, ilContainerGUI @ilCtrl_Calls ilSearchGUI: ilObjCategoryGUI, ilObjCourseGUI, ilObjFolderGUI, ilObjGroupGUI @ilCtrl_Calls ilSearchGUI: ilObjStudyProgrammeGUI @ilCtrl_Calls ilSearchGUI: ilObjRootFolderGUI, ilObjectCopyGUI

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

Constructor & Destructor Documentation

◆ __construct()

ilSearchGUI::__construct ( )

Constructor @access public.

Reimplemented from ilSearchBaseGUI.

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

51 {
52 global $DIC;
54 $this->tabs_gui = $DIC->tabs();
55 $this->help_gui = $DIC->help();
56 $this->lng->loadLanguageModule("search");
57
58 $post_search = (array) ($this->http->request()->getParsedBody()['search'] ?? []);
59 $post_filter_type = (array) ($this->http->request()->getParsedBody()['filter_type'] ?? []);
60 $post_cmd = (array) ($this->http->request()->getParsedBody()['cmd'] ?? []);
61 $new_search = (bool) ($post_cmd['performSearch'] ?? false);
62
63 // put form values into "old" post variables
65
66 if ($new_search) {
67 // Only call `checkInput` if this is a new POST request, otherwise a `failure` will be shown (red message)
68 $this->form->checkInput();
69 }
70
71 $enabled_types = ilSearchSettings::getInstance()->getEnabledLuceneItemFilterDefinitions();
72 foreach ($enabled_types as $type => $pval) {
73 if (isset($post_filter_type[$type]) && $post_filter_type[$type] == 1) {
74 $post_search["details"][$type] = $post_filter_type[$type];
75 }
76 }
77
78 $post_term = $this->http->wrapper()->post()->retrieve(
79 'term',
80 $this->refinery->byTrying([
81 $this->refinery->kindlyTo()->string(),
82 $this->refinery->always(null)
83 ])
84 );
85 $post_combination = $this->http->wrapper()->post()->retrieve(
86 'combination',
87 $this->refinery->byTrying([
88 $this->refinery->kindlyTo()->string(),
89 $this->refinery->always(null)
90 ])
91 );
92 $post_type = $this->http->wrapper()->post()->retrieve(
93 'type',
94 $this->refinery->byTrying([
95 $this->refinery->kindlyTo()->int(),
96 $this->refinery->always(null)
97 ])
98 );
99 $post_area = $this->http->wrapper()->post()->retrieve(
100 'area',
101 $this->refinery->byTrying([
102 $this->refinery->kindlyTo()->int(),
103 $this->refinery->always(null)
104 ])
105 );
106
107 if ($new_search) {
108 ilSession::set('search_root', $post_area);
109 }
110
111 $post_search["string"] = $post_term;
112 $post_search["combination"] = $post_combination;
113 $post_search["type"] = $post_type;
114
115 $this->root_node = (int) (ilSession::get('search_root') ?? ROOT_FOLDER_ID);
116
117 $session_search = ilSession::get('search') ?? [];
118 $this->setType((int) ($post_search['type'] ?? ($session_search['type'] ?? ilSearchBaseGUI::SEARCH_FAST)));
119
120 $this->setCombination(
122 self::SEARCH_AND :
123 self::SEARCH_OR
124 );
125 $this->setString((string) ($post_search['string'] ?? ($session_search['string'] ?? '')));
126 $this->setDetails(
127 $new_search ?
128 ($post_search['details'] ?? []) :
129 ($session_search['details'] ?? [])
130 );
131
132 if ($new_search) {
133 $this->getSearchCache()->setQuery(ilUtil::stripSlashes($post_term));
134 $this->getSearchCache()->setCreationFilter($this->loadCreationFilter());
135 $this->getSearchCache()->save();
136 }
137 }
initStandardSearchForm(int $a_mode)
setCombination(string $a_combination)
Set/get combination of search ('and' or 'or') @access public.
setType(int $a_type)
Set/get type of search (detail or 'fast' search) @access public.
setString(string $a_str)
Set/get search string @access public.
setDetails(array $a_details)
Set/get details (object types for details search) @access public.
static get(string $a_var)
static set(string $a_var, $a_val)
Set a value.
static stripSlashes(string $a_str, bool $a_strip_html=true, string $a_allow="")
const ROOT_FOLDER_ID
Definition: constants.php:32
global $DIC
Definition: feed.php:28
static http()
Fetches the global http state from ILIAS.
__construct(Container $dic, ilPlugin $plugin)
@inheritDoc
form( $class_path, string $cmd)

References $DIC, $type, ILIAS\GlobalScreen\Provider\__construct(), ILIAS\Repository\form(), ilSession\get(), ilSearchSettings\getInstance(), ilSearchBaseGUI\getSearchCache(), ILIAS\FileDelivery\http(), ilSearchBaseGUI\initStandardSearchForm(), ILIAS\Repository\int(), ILIAS\Repository\lng(), ilSearchBaseGUI\loadCreationFilter(), ilSearchSettings\OPERATOR_AND, ILIAS\Repository\refinery(), ROOT_FOLDER_ID, ilSearchBaseGUI\SEARCH_FAST, ilSearchBaseGUI\SEARCH_FORM_STANDARD, ilSession\set(), setCombination(), setDetails(), setString(), setType(), and ilUtil\stripSlashes().

+ Here is the call graph for this function:

Member Function Documentation

◆ __getFilter()

ilSearchGUI::__getFilter ( )

Get object type for filter (If detail search is enabled)

Returns
string[]

Definition at line 718 of file class.ilSearchGUI.php.

718 : array
719 {
721 return [];
722 }
723
724 $filter = [];
725 foreach ($this->getDetails() as $key => $detail_type) {
726 if (!$detail_type) {
727 continue;
728 }
729
730 switch ($key) {
731 case 'lms':
732 $filter[] = 'lm';
733 $filter[] = 'dbk';
734 $filter[] = 'pg';
735 $filter[] = 'st';
736 $filter[] = 'sahs';
737 $filter[] = 'htlm';
738 break;
739
740 case 'frm':
741 $filter[] = 'frm';
742 break;
743
744 case 'glo':
745 $filter[] = 'glo';
746 break;
747
748 case 'exc':
749 $filter[] = 'exc';
750 break;
751
752 case 'mcst':
753 $filter[] = 'mcst';
754 break;
755
756 case 'tst':
757 $filter[] = 'tst';
758 $filter[] = 'svy';
759 $filter[] = 'qpl';
760 $filter[] = 'spl';
761 break;
762
763 case 'mep':
764 $filter[] = 'mep';
765 $filter[] = 'mob';
766 break;
767
768 case 'fil':
769 $filter[] = 'file';
770 break;
771
772 case 'wiki':
773 $filter[] = 'wpg';
774 break;
775
776 default:
777 $filter[] = $key;
778 }
779 }
780 return $filter;
781 }
string $key
Consumer key/client ID value.
Definition: System.php:193

References ILIAS\LTI\ToolProvider\$key, getDetails(), getType(), and ilSearchBaseGUI\SEARCH_DETAILS.

Referenced by __performDetailsSearch(), __searchMeta(), and __searchObjects().

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

◆ __parseQueryString()

ilSearchGUI::__parseQueryString ( )

parse query string, using query parser instance

Returns
ilQueryParser | string

Definition at line 614 of file class.ilSearchGUI.php.

615 {
616 $query_parser = new ilQueryParser(ilUtil::stripSlashes($this->getString()));
617 $query_parser->setCombination($this->getCombination());
618 $query_parser->parse();
619
620 if (!$query_parser->validate()) {
621 return $query_parser->getMessage();
622 }
623 return $query_parser;
624 }

References getCombination(), getString(), and ilUtil\stripSlashes().

Referenced by performSearch().

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

◆ __performDetailsSearch()

ilSearchGUI::__performDetailsSearch ( ilQueryParser  $query_parser,
ilSearchResult  $result 
)
protected

Definition at line 523 of file class.ilSearchGUI.php.

524 {
525 foreach ($this->getDetails() as $type => $enabled) {
526 if (!$enabled) {
527 continue;
528 }
529
530 switch ($type) {
531 case 'crs':
532 $crs_search = ilObjectSearchFactory::_getObjectSearchInstance($query_parser);
533 $crs_search->setFilter(array('crs'));
534 $result->mergeEntries($crs_search->performSearch());
535 break;
536
537 case 'grp':
538 $grp_search = ilObjectSearchFactory::_getObjectSearchInstance($query_parser);
539 $grp_search->setFilter(array('grp'));
540 $result->mergeEntries($grp_search->performSearch());
541 break;
542
543 case 'lms':
544 $content_search = ilObjectSearchFactory::_getLMContentSearchInstance($query_parser);
545 $content_search->setFilter($this->__getFilter());
546 $result->mergeEntries($content_search->performSearch());
547 break;
548
549 case 'frm':
550 $forum_search = ilObjectSearchFactory::_getForumSearchInstance($query_parser);
551 $forum_search->setFilter($this->__getFilter());
552 $result->mergeEntries($forum_search->performSearch());
553 break;
554
555 case 'glo':
556 // Glossary term definition pages
557 $gdf_search = ilObjectSearchFactory::_getLMContentSearchInstance($query_parser);
558 $gdf_search->setFilter(array('gdf'));
559 $result->mergeEntries($gdf_search->performSearch());
560 // Glossary terms
561 $gdf_term_search = ilObjectSearchFactory::_getGlossaryDefinitionSearchInstance($query_parser);
562 $result->mergeEntries($gdf_term_search->performSearch());
563 break;
564
565 case 'exc':
566 $exc_search = ilObjectSearchFactory::_getExerciseSearchInstance($query_parser);
567 $exc_search->setFilter($this->__getFilter());
568 $result->mergeEntries($exc_search->performSearch());
569 break;
570
571 case 'mcst':
572 $mcst_search = ilObjectSearchFactory::_getMediacastSearchInstance($query_parser);
573 $result->mergeEntries($mcst_search->performSearch());
574 break;
575
576 case 'tst':
577 $tst_search = ilObjectSearchFactory::_getTestSearchInstance($query_parser);
578 $tst_search->setFilter($this->__getFilter());
579 $result->mergeEntries($tst_search->performSearch());
580 break;
581
582 case 'mep':
583 $mep_search = ilObjectSearchFactory::_getMediaPoolSearchInstance($query_parser);
584 $mep_search->setFilter($this->__getFilter());
585 $result->mergeEntries($mep_search->performSearch());
586
587 // Mob keyword search
588 $mob_search = ilObjectSearchFactory::_getMediaPoolSearchInstance($query_parser);
589 $mob_search->setFilter($this->__getFilter());
590 $result->mergeEntries($mob_search->performKeywordSearch());
591
592 break;
593
594 case 'wiki':
595 $wiki_search = ilObjectSearchFactory::_getWikiContentSearchInstance($query_parser);
596 $wiki_search->setFilter($this->__getFilter());
597 $result->mergeEntries($wiki_search->performSearch());
598
599 /*$result_meta =& $this->__searchMeta($query_parser,'title');
600 $result->mergeEntries($result_meta);
601 $result_meta =& $this->__searchMeta($query_parser,'description');
602 $result->mergeEntries($result_meta);*/
603 break;
604
605 }
606 }
607 return $result;
608 }
static _getObjectSearchInstance(ilQueryParser $query_parser)
static _getForumSearchInstance(ilQueryParser $query_parser)
static _getMediacastSearchInstance(ilQueryParser $query_parser)
static _getGlossaryDefinitionSearchInstance(ilQueryParser $query_parser)
static _getMediaPoolSearchInstance(ilQueryParser $query_parser)
static _getExerciseSearchInstance(ilQueryParser $query_parser)
static _getWikiContentSearchInstance(ilQueryParser $query_parser)
static _getLMContentSearchInstance(ilQueryParser $query_parser)
static _getTestSearchInstance(ilQueryParser $query_parser)
__getFilter()
Get object type for filter (If detail search is enabled)
mergeEntries(ilSearchResult $result_obj)
merge entries of this instance and another result object
bool $enabled
Whether the system instance is enabled to accept connection requests.
Definition: System.php:123

References ILIAS\LTI\ToolProvider\$enabled, $type, __getFilter(), ilObjectSearchFactory\_getExerciseSearchInstance(), ilObjectSearchFactory\_getForumSearchInstance(), ilObjectSearchFactory\_getGlossaryDefinitionSearchInstance(), ilObjectSearchFactory\_getLMContentSearchInstance(), ilObjectSearchFactory\_getMediacastSearchInstance(), ilObjectSearchFactory\_getMediaPoolSearchInstance(), ilObjectSearchFactory\_getObjectSearchInstance(), ilObjectSearchFactory\_getTestSearchInstance(), ilObjectSearchFactory\_getWikiContentSearchInstance(), getDetails(), and ilSearchResult\mergeEntries().

Referenced by performSearch().

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

◆ __searchMeta()

ilSearchGUI::__searchMeta ( ilQueryParser  $query_parser,
string  $a_type 
)

Search in object meta data (keyword)

Returns
ilSearchResult result object @access public

Definition at line 689 of file class.ilSearchGUI.php.

690 {
691 $meta_search = ilObjectSearchFactory::_getMetaDataSearchInstance($query_parser);
693 $meta_search->setFilter($this->__getFilter());
694 }
695 switch ($a_type) {
696 case 'keyword':
697 $meta_search->setMode('keyword');
698 break;
699
700 case 'contribute':
701 $meta_search->setMode('contribute');
702 break;
703
704 case 'title':
705 $meta_search->setMode('title');
706 break;
707
708 case 'description':
709 $meta_search->setMode('description');
710 break;
711 }
712 return $meta_search->performSearch();
713 }
static _getMetaDataSearchInstance(ilQueryParser $query_parser)

References __getFilter(), ilObjectSearchFactory\_getMetaDataSearchInstance(), getType(), and ilSearchBaseGUI\SEARCH_DETAILS.

Referenced by performSearch().

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

◆ __searchObjects()

ilSearchGUI::__searchObjects ( ilQueryParser  $query_parser)

Search in obect title,desctiption.

Definition at line 628 of file class.ilSearchGUI.php.

629 {
630 $obj_search = ilObjectSearchFactory::_getObjectSearchInstance($query_parser);
632 $obj_search->setFilter($this->__getFilter());
633 }
634 $this->parseCreationFilter($obj_search);
635 return $obj_search->performSearch();
636 }
parseCreationFilter(ilObjectSearch $search)

References __getFilter(), ilObjectSearchFactory\_getObjectSearchInstance(), getType(), parseCreationFilter(), and ilSearchBaseGUI\SEARCH_DETAILS.

Referenced by performSearch().

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

◆ autoComplete()

ilSearchGUI::autoComplete ( )

Data resource for autoComplete.

Reimplemented from ilSearchBaseGUI.

Definition at line 284 of file class.ilSearchGUI.php.

284 : void
285 {
286 $query = '';
287 if ($this->http->wrapper()->post()->has('term')) {
288 $query = $this->http->wrapper()->post()->retrieve(
289 'term',
290 $this->refinery->kindlyTo()->string()
291 );
292 } elseif ($this->http->wrapper()->query()->has('term')) {
293 $query = $this->http->wrapper()->query()->retrieve(
294 'term',
295 $this->refinery->kindlyTo()->string()
296 );
297 }
298 $search_type = 0;
299 if ($this->http->wrapper()->post()->has('search_type')) {
300 $search_type = $this->http->wrapper()->post()->retrieve(
301 'search_type',
302 $this->refinery->kindlyTo()->int()
303 );
304 } elseif ($this->http->wrapper()->query()->has('search_type')) {
305 $search_type = $this->http->wrapper()->query()->retrieve(
306 'search_type',
307 $this->refinery->kindlyTo()->int()
308 );
309 }
310 if ((int) $search_type === -1) {
311 $a_fields = array('login','firstname','lastname','email');
312 $result_field = 'login';
313
314 // Starting user autocomplete search
315 $auto = new ilUserAutoComplete();
316
317
318 $auto->setMoreLinkAvailable(true);
319 $auto->setSearchFields($a_fields);
320 $auto->setResultField($result_field);
321 $auto->enableFieldSearchableCheck(true);
322 $auto->setUserLimitations(true);
323
324 $res = $auto->getList($query);
325 $res_obj = json_decode($res);
326 if (is_array($res_obj->items)) {
327 echo json_encode($res_obj->items);
328 exit;
329 }
330 } else {
332 echo $list;
333 exit;
334 }
335 }
static getList(string $a_str)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
exit
Definition: login.php:28
$res
Definition: ltiservices.php:69
$query

References $query, $res, exit, ilSearchAutoComplete\getList(), ILIAS\FileDelivery\http(), and ILIAS\Repository\refinery().

+ Here is the call graph for this function:

◆ executeCommand()

ilSearchGUI::executeCommand ( )

Control @access public.

Definition at line 144 of file class.ilSearchGUI.php.

144 : void
145 {
146 $next_class = $this->ctrl->getNextClass($this);
147 $cmd = $this->ctrl->getCmd();
148
149 switch ($next_class) {
150 case "ilpropertyformgui":
151 //$this->initStandardSearchForm(ilSearchBaseGUI::SEARCH_FORM_STANDARD);
152 $form = $this->getSearchAreaForm();
153 $this->prepareOutput();
154 $this->ctrl->setReturn($this, 'storeRoot');
155 $this->ctrl->forwardCommand($form);
156 return;
157
158 case 'ilobjectcopygui':
159 $this->prepareOutput();
160 $this->ctrl->setReturn($this, '');
161 $cp = new ilObjectCopyGUI($this);
162 $this->ctrl->forwardCommand($cp);
163 break;
164
165 default:
166 if (!$cmd) {
167 $cmd = "showSavedResults";
168 }
169 $this->prepareOutput();
170 $this->handleCommand($cmd);
171 break;
172 }
173 }
GUI class for the workflow of copying objects.
handleCommand(string $a_cmd)
ilPropertyFormGUI $form

References ilSearchBaseGUI\$form, ILIAS\Repository\ctrl(), ilSearchBaseGUI\getSearchAreaForm(), ilSearchBaseGUI\handleCommand(), and prepareOutput().

+ Here is the call graph for this function:

◆ getCombination()

ilSearchGUI::getCombination ( )

Definition at line 200 of file class.ilSearchGUI.php.

200 : string
201 {
202 return $this->combination ?: ilSearchBaseGUI::SEARCH_OR;
203 }

References ilSearchBaseGUI\SEARCH_OR.

Referenced by __parseQueryString().

+ Here is the caller graph for this function:

◆ getDetails()

ilSearchGUI::getDetails ( )

Definition at line 228 of file class.ilSearchGUI.php.

228 : array
229 {
230 return $this->details ?? [];
231 }

Referenced by __getFilter(), __performDetailsSearch(), and performSearch().

+ Here is the caller graph for this function:

◆ getRootNode()

ilSearchGUI::getRootNode ( )

Definition at line 234 of file class.ilSearchGUI.php.

234 : int
235 {
236 return $this->root_node ?: ROOT_FOLDER_ID;
237 }

References ROOT_FOLDER_ID.

Referenced by performSearch(), and showSavedResults().

+ Here is the caller graph for this function:

◆ getString()

ilSearchGUI::getString ( )

Definition at line 214 of file class.ilSearchGUI.php.

214 : string
215 {
216 return $this->string;
217 }

References $string.

Referenced by __parseQueryString(), and showSearch().

+ Here is the caller graph for this function:

◆ getType()

ilSearchGUI::getType ( )

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

186 : int
187 {
188 return $this->type ?? ilSearchBaseGUI::SEARCH_FAST;
189 }

References ilSearchBaseGUI\SEARCH_FAST.

Referenced by __getFilter(), __searchMeta(), __searchObjects(), and performSearch().

+ Here is the caller graph for this function:

◆ parseCreationFilter()

ilSearchGUI::parseCreationFilter ( ilObjectSearch  $search)

Definition at line 638 of file class.ilSearchGUI.php.

638 : bool
639 {
640 $date = $this->parseDateFromCreationFilter();
641 $operator = $this->parseOperatorFromCreationFilter();
642
643 if (is_null($date) || is_null($operator)) {
644 return true;
645 }
646
647 $search->setCreationDateFilterDate($date);
648 $search->setCreationDateFilterOperator($operator);
649 return true;
650 }
setCreationDateFilterDate(ilDate $day)
setCreationDateFilterOperator(int $a_operator)

References parseDateFromCreationFilter(), parseOperatorFromCreationFilter(), ilObjectSearch\setCreationDateFilterDate(), and ilObjectSearch\setCreationDateFilterOperator().

Referenced by __searchObjects().

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

◆ parseDateFromCreationFilter()

ilSearchGUI::parseDateFromCreationFilter ( )
protected

Definition at line 652 of file class.ilSearchGUI.php.

652 : ?ilDate
653 {
654 $options = $this->getSearchCache()->getCreationFilter();
655 if (!($options['enabled'] ?? false)) {
656 return null;
657 }
658 return new ilDate($options['date'] ?? 0, IL_CAL_UNIX);
659 }
const IL_CAL_UNIX
Class for single dates.

References ilSearchBaseGUI\getSearchCache(), and IL_CAL_UNIX.

Referenced by parseCreationFilter(), and performSearch().

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

◆ parseOperatorFromCreationFilter()

ilSearchGUI::parseOperatorFromCreationFilter ( )
protected

Definition at line 661 of file class.ilSearchGUI.php.

661 : ?int
662 {
663 $options = $this->getSearchCache()->getCreationFilter();
664 if (!($options['enabled'] ?? false)) {
665 return null;
666 }
667
668 switch ($options['ontype'] ?? 0) {
669 case 1:
671
672 case 2:
674
675 case 3:
677
678 default:
679 return null;
680 }
681 }

References ilObjectSearch\CDATE_OPERATOR_AFTER, ilObjectSearch\CDATE_OPERATOR_BEFORE, ilObjectSearch\CDATE_OPERATOR_ON, and ilSearchBaseGUI\getSearchCache().

Referenced by parseCreationFilter(), and performSearch().

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

◆ performSearch()

ilSearchGUI::performSearch ( )

Perform search.

Definition at line 413 of file class.ilSearchGUI.php.

413 : bool
414 {
415 $page_number = $this->initPageNumberFromQuery();
416 if (!$page_number and $this->search_mode != 'in_results') {
417 ilSession::clear('max_page');
418 $this->search_cache->deleteCachedEntries();
419 }
420
421 $this->search_cache->setResultPageNumber($page_number);
422
423 if ($this->getType() == ilSearchBaseGUI::SEARCH_DETAILS and !$this->getDetails()) {
424 $this->tpl->setOnScreenMessage('info', $this->lng->txt('search_choose_object_type'));
425 $this->showSearch();
426 return false;
427 }
428
429 // Step 1: parse query string
430 if (!is_object($query_parser = $this->__parseQueryString())) {
431 $this->tpl->setOnScreenMessage('info', $query_parser);
432 $this->showSearch();
433
434 return false;
435 }
436 // Step 2: perform object search. Get an ObjectSearch object via factory. Depends on fulltext or like search type.
437 $result = $this->__searchObjects($query_parser);
438
439 // Step 3: perform meta keyword search. Get an MetaDataSearch object.
440 $result_meta = $this->__searchMeta($query_parser, 'keyword');
441 $result->mergeEntries($result_meta);
442
443 $result_meta = $this->__searchMeta($query_parser, 'contribute');
444 $result->mergeEntries($result_meta);
445
446 $result_meta = $this->__searchMeta($query_parser, 'title');
447 $result->mergeEntries($result_meta);
448
449 $result_meta = $this->__searchMeta($query_parser, 'description');
450 $result->mergeEntries($result_meta);
451
452 // Perform details search in object specific tables
454 $result = $this->__performDetailsSearch($query_parser, $result);
455 }
456 // Step 5: Search in results
457 if ($this->search_mode == 'in_results') {
458 $old_result_obj = new ilSearchResult($this->user->getId());
459 $old_result_obj->read();
460
461 $result->diffEntriesFromResult();
462 }
463
464
465 // Step 4: merge and validate results
466 $result->filter(
467 $this->getRootNode(),
471 );
472 $result->save();
473 $this->showSearch();
474
475 if (!count($result->getResults())) {
476 $this->tpl->setOnScreenMessage('info', $this->lng->txt('search_no_match'));
477 }
478
479 if ($result->isLimitReached()) {
480 #$message = sprintf($this->lng->txt('search_limit_reached'),$this->settings->getMaxHits());
481 #ilUtil::sendInfo($message);
482 }
483
484 // Step 6: show results
485 $this->addPager($result, 'max_page');
486
488 $presentation->setResults($result->getResultsForPresentation());
489 $presentation->setSubitemIds($result->getSubitemIds());
490 $presentation->setPreviousNext($this->prev_link, $this->next_link);
491
492 if ($presentation->render()) {
493 $this->tpl->setVariable('RESULTS_TABLE', $presentation->getHTML());
494 }
495 return true;
496 }
addPager($result, string $a_session_key)
__searchObjects(ilQueryParser $query_parser)
Search in obect title,desctiption.
__searchMeta(ilQueryParser $query_parser, string $a_type)
Search in object meta data (keyword)
__parseQueryString()
parse query string, using query parser instance
__performDetailsSearch(ilQueryParser $query_parser, ilSearchResult $result)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
static clear(string $a_var)

References __parseQueryString(), __performDetailsSearch(), __searchMeta(), __searchObjects(), ilSearchBaseGUI\addPager(), ilSession\clear(), getDetails(), ilSearchSettings\getInstance(), getRootNode(), getType(), ilSearchBaseGUI\initPageNumberFromQuery(), ILIAS\Repository\lng(), ilSearchResultPresentation\MODE_STANDARD, ilSearchSettings\OPERATOR_AND, parseDateFromCreationFilter(), parseOperatorFromCreationFilter(), ilSearchBaseGUI\SEARCH_DETAILS, showSearch(), and ILIAS\Repository\user().

Referenced by remoteSearch(), and storeRoot().

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

◆ prepareOutput()

ilSearchGUI::prepareOutput ( )

Reimplemented from ilSearchBaseGUI.

Definition at line 500 of file class.ilSearchGUI.php.

500 : void
501 {
502 parent::prepareOutput();
503
504 $this->help_gui->setScreenIdComponent("src");
505
506 $this->tabs_gui->addTab(
507 "search",
508 $this->lng->txt("search"),
509 $this->ctrl->getLinkTarget($this)
510 );
511
512 if (!$this->settings->getHideAdvancedSearch()) {
513 $this->tabs_gui->addTab(
514 "adv_search",
515 $this->lng->txt("search_advanced"),
516 $this->ctrl->getLinkTargetByClass('iladvancedsearchgui')
517 );
518 }
519
520 $this->tabs_gui->activateTab("search");
521 }

References ILIAS\Repository\lng(), and ILIAS\Repository\settings().

Referenced by executeCommand().

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

◆ remoteSearch()

ilSearchGUI::remoteSearch ( )

Definition at line 245 of file class.ilSearchGUI.php.

245 : void
246 {
247 $root_id = 0;
248 if ($this->http->wrapper()->post()->has('root_id')) {
249 $root_id = $this->http->wrapper()->post()->retrieve(
250 'root_id',
251 $this->refinery->kindlyTo()->int()
252 );
253 }
254 $queryString = '';
255 if ($this->http->wrapper()->post()->has('queryString')) {
256 $queryString = $this->http->wrapper()->post()->retrieve(
257 'queryString',
258 $this->refinery->kindlyTo()->string()
259 );
260 }
261 $this->setString($queryString);
262 $this->setRootNode($root_id);
263 $this->performSearch();
264 }
performSearch()
Perform search.
setRootNode(int $a_node_id)

References ILIAS\FileDelivery\http(), performSearch(), ILIAS\Repository\refinery(), setRootNode(), and setString().

+ Here is the call graph for this function:

◆ setCombination()

ilSearchGUI::setCombination ( string  $a_combination)

Set/get combination of search ('and' or 'or') @access public.

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

194 : void
195 {
196 $session_search = ilSession::get('search') ?? [];
197 $session_search['combination'] = $this->combination = $a_combination;
198 ilSession::set('search', $session_search);
199 }

References ilSession\get(), and ilSession\set().

Referenced by __construct().

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

◆ setDetails()

ilSearchGUI::setDetails ( array  $a_details)

Set/get details (object types for details search) @access public.

Definition at line 222 of file class.ilSearchGUI.php.

222 : void
223 {
224 $session_search = ilSession::get('search') ?? [];
225 $session_search['details'] = $this->details = $a_details;
226 ilSession::set('search', $session_search);
227 }

References ilSession\get(), and ilSession\set().

Referenced by __construct().

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

◆ setRootNode()

ilSearchGUI::setRootNode ( int  $a_node_id)

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

239 : void
240 {
241 ilSession::set('search_root', $this->root_node = $a_node_id);
242 }

References ilSession\set().

Referenced by remoteSearch().

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

◆ setString()

ilSearchGUI::setString ( string  $a_str)

Set/get search string @access public.

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

208 : void
209 {
210 $session_search = ilSession::get('search') ?? [];
211 $session_search['string'] = $this->string = $a_str;
212 ilSession::set('search', $session_search);
213 }

References ilSession\get(), and ilSession\set().

Referenced by __construct(), and remoteSearch().

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

◆ setType()

ilSearchGUI::setType ( int  $a_type)

Set/get type of search (detail or 'fast' search) @access public.

Definition at line 179 of file class.ilSearchGUI.php.

179 : void
180 {
181 $session_search = ilSession::get('search');
182 $session_search['type'] = $this->type = $a_type;
183 ilSession::set('search', $session_search);
184 }

References ilSession\get(), and ilSession\set().

Referenced by __construct().

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

◆ showSavedResults()

ilSearchGUI::showSavedResults ( )

Definition at line 382 of file class.ilSearchGUI.php.

382 : void
383 {
384
385 // Read old result sets
386
387 $result_obj = new ilSearchResult($this->user->getId());
388 $result_obj->read();
389 $result_obj->filterResults($this->getRootNode());
390
391 $this->showSearch();
392
393 // Show them
394 if (count($result_obj->getResults())) {
395 $this->addPager($result_obj, 'max_page');
396
398 $presentation->setResults($result_obj->getResultsForPresentation());
399 $presentation->setSubitemIds($result_obj->getSubitemIds());
400 $presentation->setPreviousNext($this->prev_link, $this->next_link);
401 #$presentation->setSearcher($searcher);
402
403 if ($presentation->render()) {
404 // $this->tpl->setVariable('SEARCH_RESULTS',$presentation->getHTML());
405 $this->tpl->setVariable('RESULTS_TABLE', $presentation->getHTML());
406 }
407 }
408 }

References ilSearchBaseGUI\addPager(), getRootNode(), ilSearchResultPresentation\MODE_STANDARD, showSearch(), and ILIAS\Repository\user().

+ Here is the call graph for this function:

◆ showSearch()

ilSearchGUI::showSearch ( )

Definition at line 337 of file class.ilSearchGUI.php.

337 : void
338 {
339 ilOverlayGUI::initJavascript();
340 $this->tpl->addJavascript("./Services/Search/js/Search.js");
341
342
343 $this->tpl->addBlockFile('ADM_CONTENT', 'adm_content', 'tpl.search.html', 'Services/Search');
344 $this->tpl->setVariable("FORM_ACTION", $this->ctrl->getFormAction($this, 'performSearch'));
345 $this->tpl->setVariable("TERM", ilLegacyFormElementsUtil::prepareFormOutput($this->getString()));
346 $this->tpl->setVariable("SEARCH_LABEL", $this->lng->txt("search"));
348 $btn->setCommand("performSearch");
349 $btn->setCaption("search");
350 $this->tpl->setVariable("SUBMIT_BTN", $btn->render());
351 $this->tpl->setVariable("TXT_OPTIONS", $this->lng->txt("options"));
352 $this->tpl->setVariable("ARR_IMG", ilGlyphGUI::get(ilGlyphGUI::CARET));
353 $this->tpl->setVariable("TXT_COMBINATION", $this->lng->txt("search_term_combination"));
354 $this->tpl->setVariable('TXT_COMBINATION_DEFAULT', ilSearchSettings::getInstance()->getDefaultOperator() == ilSearchSettings::OPERATOR_AND ? $this->lng->txt('search_all_words') : $this->lng->txt('search_any_word'));
355
356 if (ilSearchSettings::getInstance()->isLuceneItemFilterEnabled()) {
357 $this->tpl->setCurrentBlock("type_sel");
358 $this->tpl->setVariable('TXT_TYPE_DEFAULT', $this->lng->txt("search_fast_info"));
359 $this->tpl->setVariable("TXT_TYPE", $this->lng->txt("search_type"));
361 $this->tpl->setVariable("ARR_IMGT", ilGlyphGUI::get(ilGlyphGUI::CARET));
362 $this->tpl->setVariable("FORM", $this->form->getHTML());
363 $this->tpl->parseCurrentBlock();
364 }
365
366 if (ilSearchSettings::getInstance()->isDateFilterEnabled()) {
367 // begin-patch creation_date
368 $this->tpl->setVariable('TXT_FILTER_BY_CDATE', $this->lng->txt('search_filter_cd'));
369 $this->tpl->setVariable('TXT_CD_OFF', $this->lng->txt('search_off'));
370 $this->tpl->setVariable('FORM_CD', $this->getCreationDateForm()->getHTML());
371 $this->tpl->setVariable("ARR_IMG_CD", ilGlyphGUI::get(ilGlyphGUI::CARET));
372 // end-patch creation_date
373 }
374
375
376 $this->tpl->setVariable("TXT_AREA", $this->lng->txt("search_area"));
377
378 // search area form
379 $this->tpl->setVariable('SEARCH_AREA_FORM', $this->getSearchAreaForm()->getHTML());
380 }
static get(string $a_glyph, string $a_text="")
static prepareFormOutput($a_str, bool $a_strip=false)

References ilGlyphGUI\CARET, ILIAS\Repository\ctrl(), ILIAS\Repository\form(), ilGlyphGUI\get(), ilSearchBaseGUI\getCreationDateForm(), ilSearchSettings\getInstance(), ilSubmitButton\getInstance(), ilSearchBaseGUI\getSearchAreaForm(), getString(), ilSearchBaseGUI\initStandardSearchForm(), ILIAS\Repository\lng(), ilSearchSettings\OPERATOR_AND, ilLegacyFormElementsUtil\prepareFormOutput(), and ilSearchBaseGUI\SEARCH_FORM_STANDARD.

Referenced by performSearch(), and showSavedResults().

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

◆ storeRoot()

ilSearchGUI::storeRoot ( )
protected

Store new root node.

Definition at line 269 of file class.ilSearchGUI.php.

269 : void
270 {
271 $form = $this->getSearchAreaForm();
272
273 $this->root_node = $form->getItemByPostVar('area')->getValue();
274 $this->search_cache->setRoot($this->root_node);
275 $this->search_cache->save();
276 $this->search_cache->deleteCachedEntries();
278 $this->performSearch();
279 }
getItemByPostVar(string $a_post_var)
static resetDetails()
As long as static::resetDetails is not possible this method is final.

References ilSearchBaseGUI\$form, ilPropertyFormGUI\getItemByPostVar(), ilSearchBaseGUI\getSearchAreaForm(), performSearch(), and ilSubItemListGUI\resetDetails().

+ Here is the call graph for this function:

Field Documentation

◆ $combination

string ilSearchGUI::$combination

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

◆ $details

array ilSearchGUI::$details
private

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

◆ $help_gui

ilHelpGUI ilSearchGUI::$help_gui
protected

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

◆ $root_node

int ilSearchGUI::$root_node

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

◆ $string

string ilSearchGUI::$string

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

Referenced by getString().

◆ $tabs_gui

ilTabsGUI ilSearchGUI::$tabs_gui
protected

Definition at line 43 of file class.ilSearchGUI.php.

◆ $type

int ilSearchGUI::$type

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

Referenced by __construct(), and __performDetailsSearch().


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