ILIAS  trunk Revision v11.0_alpha-1749-g1a06bdef097
All Data Structures Namespaces Files Functions Variables Enumerations Enumerator Modules Pages
ilSearchGUI Class Reference

Class ilSearchGUI. More...

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

Public Member Functions

 __construct ()
 Constructor public. More...
 
 executeCommand ()
 Control public. More...
 
 setType (int $a_type)
 Set/get type of search (detail or 'fast' search) public. More...
 
 getType ()
 
 setCombination (string $a_combination)
 Set/get combination of search ('and' or 'or') public. More...
 
 getCombination ()
 
 setString (string $a_str)
 Set/get search string public. More...
 
 getString ()
 
 setDetails (array $a_details)
 Set/get details (object types for details search) public. More...
 
 getDetails ()
 
 getRootNode ()
 
 setRootNode (int $a_node_id)
 
 remoteSearch ()
 
 autoComplete ()
 Data resource for autoComplete. More...
 
 showSearch ()
 
 showSavedResults ()
 
 performSearchFilter ()
 
 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)
 
 handleCommand (string $a_cmd)
 
 addToDeskObject ()
 
 removeFromDeskObject ()
 
 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 ()
 
- 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

 __performDetailsSearch (ilQueryParser $query_parser, ilSearchResult $result)
 
 parseStartDateFromCreationFilter ()
 
 parseEndDateFromCreationFilter ()
 
- Protected Member Functions inherited from ilSearchBaseGUI
 initPageNumberFromQuery ()
 
 addPager ($result, string $a_session_key)
 
 buildSearchAreaPath (int $a_root_node)
 
 getSearchCache ()
 
 loadCreationFilter ()
 
 renderSearch (string $term, int $root_node=0)
 
 renderFilter (int $root_node)
 
 initFilter (int $mode)
 
 getStringArrayTransformation ()
 

Protected Attributes

ilTabsGUI $tabs_gui
 
ilHelpGUI $help_gui
 
UIFactory $ui_factory
 
UIRenderer $ui_renderer
 
- Protected Attributes inherited from ilSearchBaseGUI
ilUserSearchCache $search_cache
 
string $search_mode = ''
 
ilSearchSettings $settings
 
ilPropertyFormGUI $form = null
 
ilSearchFilterGUI $search_filter = null
 
array $search_filter_data = 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

Constructor & Destructor Documentation

◆ __construct()

ilSearchGUI::__construct ( )

Constructor public.

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

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

55  {
56  global $DIC;
58  $this->tabs_gui = $DIC->tabs();
59  $this->help_gui = $DIC->help();
60  $this->lng->loadLanguageModule("search");
61 
62  $this->ui_factory = $DIC->ui()->factory();
63  $this->ui_renderer = $DIC->ui()->renderer();
64 
65  $this->initFilter(self::SEARCH_FORM_STANDARD);
66 
67 
68  $requested_search = (array) ($this->http->request()->getParsedBody()['search'] ?? []);
69 
70  if ($this->http->wrapper()->post()->has('cmd')) {
71  $requested_cmd = (array) $this->http->wrapper()->post()->retrieve('cmd', $this->getStringArrayTransformation());
72  } elseif ($this->http->wrapper()->query()->has('cmd')) {
73  $requested_cmd = (array) $this->http->wrapper()->query()->retrieve(
74  'cmd',
75  $this->refinery->kindlyTo()->string()
76  );
77  $requested_cmd = [$requested_cmd[0] => "Search"];
78  } else {
79  $requested_cmd = [];
80  }
81  $new_search = (bool) ($requested_cmd["performSearch"] ?? false);
82  $new_filter = (bool) ($requested_cmd["performSearchFilter"] ?? false);
83  $new_search_or_filter = $new_search || $new_filter;
84 
85  $requested_filter_type = (array) ($this->search_filter_data["search_type"] ?? []);
86  $requested_filter_type = array_flip($requested_filter_type);
87  $requested_filter_type = array_fill_keys(array_keys($requested_filter_type), "1");
88  $enabled_types = ilSearchSettings::getInstance()->getEnabledLuceneItemFilterDefinitions();
89  foreach ($enabled_types as $type => $pval) {
90  if (isset($requested_filter_type[$type])) {
91  $requested_search["details"][$type] = $requested_filter_type[$type];
92  }
93  }
94 
95  // Search term input field and filter are handled separately, see README (Filtering behaviour)
96  $post_term = $this->http->wrapper()->post()->retrieve(
97  'term',
98  $this->refinery->byTrying([
99  $this->refinery->kindlyTo()->string(),
100  $this->refinery->always(null)
101  ])
102  );
103  $filter_type_active = (is_null($this->search_filter_data["search_type"] ?? null))
104  ? self::SEARCH_FAST
105  : self::SEARCH_DETAILS;
106  $filter_scope = $this->search_filter_data["search_scope"] ?? ROOT_FOLDER_ID;
107 
108  if ($new_filter) {
109  ilSession::set('search_root', $filter_scope);
110  }
111 
112  $requested_search["string"] = $post_term;
113  $requested_search["type"] = $filter_type_active;
114 
115  $this->root_node = (int) (ilSession::get('search_root') ?? ROOT_FOLDER_ID);
116 
117  $session_search = ilSession::get('search') ?? [];
118  $this->setType((int) ($requested_search['type'] ?? ($session_search['type'] ?? self::SEARCH_FAST)));
119 
120  $this->setCombination(
122  self::SEARCH_AND :
123  self::SEARCH_OR
124  );
125  $this->setString((string) ($requested_search['string'] ?? ($session_search['string'] ?? '')));
126  $this->setDetails(
127  $new_search_or_filter ?
128  ($requested_search['details'] ?? []) :
129  ($session_search['details'] ?? [])
130  );
131 
132  if ($new_search_or_filter) {
133  $this->getSearchCache()->setQuery(ilUtil::stripSlashes(
134  $requested_search['string'] ?? ($session_search['string'] ?? '')
135  ));
136  $this->getSearchCache()->setCreationFilter($this->loadCreationFilter());
137  $this->getSearchCache()->save();
138  }
139  }
static get(string $a_var)
setString(string $a_str)
Set/get search string public.
setCombination(string $a_combination)
Set/get combination of search ('and' or 'or') public.
const ROOT_FOLDER_ID
Definition: constants.php:32
static stripSlashes(string $a_str, bool $a_strip_html=true, string $a_allow="")
setType(int $a_type)
Set/get type of search (detail or 'fast' search) public.
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
static http()
Fetches the global http state from ILIAS.
global $DIC
Definition: shib_login.php:22
__construct(Container $dic, ilPlugin $plugin)
static set(string $a_var, $a_val)
Set a value.
setDetails(array $a_details)
Set/get details (object types for details search) public.
+ 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 643 of file class.ilSearchGUI.php.

References getDetails(), and getType().

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

643  : array
644  {
645  if ($this->getType() != self::SEARCH_DETAILS) {
646  return [];
647  }
648 
649  $filter = [];
650  foreach ($this->getDetails() as $key => $detail_type) {
651  if (!$detail_type) {
652  continue;
653  }
654 
655  switch ($key) {
656  case 'lms':
657  $filter[] = 'lm';
658  $filter[] = 'dbk';
659  $filter[] = 'pg';
660  $filter[] = 'st';
661  $filter[] = 'sahs';
662  $filter[] = 'htlm';
663  break;
664 
665  case 'frm':
666  $filter[] = 'frm';
667  break;
668 
669  case 'glo':
670  $filter[] = 'glo';
671  break;
672 
673  case 'exc':
674  $filter[] = 'exc';
675  break;
676 
677  case 'mcst':
678  $filter[] = 'mcst';
679  break;
680 
681  case 'tst':
682  $filter[] = 'tst';
683  $filter[] = 'svy';
684  $filter[] = 'qpl';
685  $filter[] = 'spl';
686  break;
687 
688  case 'mep':
689  $filter[] = 'mep';
690  $filter[] = 'mob';
691  break;
692 
693  case 'fil':
694  $filter[] = 'file';
695  break;
696 
697  case 'wiki':
698  $filter[] = 'wpg';
699  break;
700 
701  default:
702  $filter[] = $key;
703  }
704  }
705  return $filter;
706  }
+ 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 553 of file class.ilSearchGUI.php.

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

Referenced by performSearch().

554  {
555  $query_parser = new ilQueryParser(ilUtil::stripSlashes($this->getString()));
556  $query_parser->setCombination($this->getCombination());
557  $query_parser->parse();
558 
559  if (!$query_parser->validate()) {
560  return $query_parser->getMessage();
561  }
562  return $query_parser;
563  }
static stripSlashes(string $a_str, bool $a_strip_html=true, string $a_allow="")
+ 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 463 of file class.ilSearchGUI.php.

References __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().

464  {
465  foreach ($this->getDetails() as $type => $enabled) {
466  if (!$enabled) {
467  continue;
468  }
469 
470  switch ($type) {
471  case 'crs':
472  $crs_search = ilObjectSearchFactory::_getObjectSearchInstance($query_parser);
473  $crs_search->setFilter(array('crs'));
474  $result->mergeEntries($crs_search->performSearch());
475  break;
476 
477  case 'grp':
478  $grp_search = ilObjectSearchFactory::_getObjectSearchInstance($query_parser);
479  $grp_search->setFilter(array('grp'));
480  $result->mergeEntries($grp_search->performSearch());
481  break;
482 
483  case 'lms':
484  $content_search = ilObjectSearchFactory::_getLMContentSearchInstance($query_parser);
485  $content_search->setFilter($this->__getFilter());
486  $result->mergeEntries($content_search->performSearch());
487  break;
488 
489  case 'frm':
490  $forum_search = ilObjectSearchFactory::_getForumSearchInstance($query_parser);
491  $forum_search->setFilter($this->__getFilter());
492  $result->mergeEntries($forum_search->performSearch());
493  break;
494 
495  case 'glo':
496  // Glossary term definition pages
497  $gdf_search = ilObjectSearchFactory::_getLMContentSearchInstance($query_parser);
498  $gdf_search->setFilter(array('term'));
499  $result->mergeEntries($gdf_search->performSearch());
500  // Glossary terms
501  $gdf_term_search = ilObjectSearchFactory::_getGlossaryDefinitionSearchInstance($query_parser);
502  $result->mergeEntries($gdf_term_search->performSearch());
503  break;
504 
505  case 'exc':
506  $exc_search = ilObjectSearchFactory::_getExerciseSearchInstance($query_parser);
507  $exc_search->setFilter($this->__getFilter());
508  $result->mergeEntries($exc_search->performSearch());
509  break;
510 
511  case 'mcst':
512  $mcst_search = ilObjectSearchFactory::_getMediacastSearchInstance($query_parser);
513  $result->mergeEntries($mcst_search->performSearch());
514  break;
515 
516  case 'tst':
517  $tst_search = ilObjectSearchFactory::_getTestSearchInstance($query_parser);
518  $tst_search->setFilter($this->__getFilter());
519  $result->mergeEntries($tst_search->performSearch());
520  break;
521 
522  case 'mep':
523  $mep_search = ilObjectSearchFactory::_getMediaPoolSearchInstance($query_parser);
524  $mep_search->setFilter($this->__getFilter());
525  $result->mergeEntries($mep_search->performSearch());
526 
527  // Mob keyword search
528  $mob_search = ilObjectSearchFactory::_getMediaPoolSearchInstance($query_parser);
529  $mob_search->setFilter($this->__getFilter());
530  $result->mergeEntries($mob_search->performKeywordSearch());
531 
532  break;
533 
534  case 'wiki':
535  $wiki_search = ilObjectSearchFactory::_getWikiContentSearchInstance($query_parser);
536  $wiki_search->setFilter($this->__getFilter());
537  $result->mergeEntries($wiki_search->performSearch());
538 
539  /*$result_meta =& $this->__searchMeta($query_parser,'title');
540  $result->mergeEntries($result_meta);
541  $result_meta =& $this->__searchMeta($query_parser,'description');
542  $result->mergeEntries($result_meta);*/
543  break;
544  }
545  }
546  return $result;
547  }
static _getLMContentSearchInstance(ilQueryParser $query_parser)
static _getMediaPoolSearchInstance(ilQueryParser $query_parser)
static _getMediacastSearchInstance(ilQueryParser $query_parser)
static _getWikiContentSearchInstance(ilQueryParser $query_parser)
static _getExerciseSearchInstance(ilQueryParser $query_parser)
static _getGlossaryDefinitionSearchInstance(ilQueryParser $query_parser)
static _getForumSearchInstance(ilQueryParser $query_parser)
static _getObjectSearchInstance(ilQueryParser $query_parser)
static _getTestSearchInstance(ilQueryParser $query_parser)
mergeEntries(ilSearchResult $result_obj)
merge entries of this instance and another result object
__getFilter()
Get object type for filter (If detail search is enabled)
+ 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 public

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

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

Referenced by performSearch().

615  {
616  $meta_search = ilObjectSearchFactory::_getMetaDataSearchInstance($query_parser);
617  if ($this->getType() == self::SEARCH_DETAILS) {
618  $meta_search->setFilter($this->__getFilter());
619  }
620  switch ($a_type) {
621  case 'keyword':
622  $meta_search->setMode('keyword');
623  break;
624 
625  case 'contribute':
626  $meta_search->setMode('contribute');
627  break;
628 
629  case 'title':
630  $meta_search->setMode('title');
631  break;
632 
633  case 'description':
634  $meta_search->setMode('description');
635  break;
636  }
637  return $meta_search->performSearch();
638  }
__getFilter()
Get object type for filter (If detail search is enabled)
static _getMetaDataSearchInstance(ilQueryParser $query_parser)
+ 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 567 of file class.ilSearchGUI.php.

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

Referenced by performSearch().

568  {
569  $obj_search = ilObjectSearchFactory::_getObjectSearchInstance($query_parser);
570  if ($this->getType() == self::SEARCH_DETAILS) {
571  $obj_search->setFilter($this->__getFilter());
572  }
573  $this->parseCreationFilter($obj_search);
574  return $obj_search->performSearch();
575  }
static _getObjectSearchInstance(ilQueryParser $query_parser)
parseCreationFilter(ilObjectSearch $search)
__getFilter()
Get object type for filter (If detail search is enabled)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ autoComplete()

ilSearchGUI::autoComplete ( )

Data resource for autoComplete.

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

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

263  : void
264  {
265  $query = '';
266  if ($this->http->wrapper()->post()->has('term')) {
267  $query = $this->http->wrapper()->post()->retrieve(
268  'term',
269  $this->refinery->kindlyTo()->string()
270  );
271  } elseif ($this->http->wrapper()->query()->has('term')) {
272  $query = $this->http->wrapper()->query()->retrieve(
273  'term',
274  $this->refinery->kindlyTo()->string()
275  );
276  }
277  $search_type = 0;
278  if ($this->http->wrapper()->post()->has('search_type')) {
279  $search_type = $this->http->wrapper()->post()->retrieve(
280  'search_type',
281  $this->refinery->kindlyTo()->int()
282  );
283  } elseif ($this->http->wrapper()->query()->has('search_type')) {
284  $search_type = $this->http->wrapper()->query()->retrieve(
285  'search_type',
286  $this->refinery->kindlyTo()->int()
287  );
288  }
289  if ((int) $search_type === -1) {
290  $a_fields = array('login','firstname','lastname','email');
291  $result_field = 'login';
292 
293  // Starting user autocomplete search
294  $auto = new ilUserAutoComplete();
295 
296 
297  $auto->setMoreLinkAvailable(true);
298  $auto->setSearchFields($a_fields);
299  $auto->setResultField($result_field);
300  $auto->enableFieldSearchableCheck(true);
301  $auto->setUserLimitations(true);
302 
303  $res = $auto->getList($query);
304  $res_obj = json_decode($res);
305  if (is_array($res_obj->items)) {
306  echo json_encode($res_obj->items);
307  exit;
308  }
309  } else {
310  $list = ilSearchAutoComplete::getList($query);
311  echo $list;
312  exit;
313  }
314  }
$res
Definition: ltiservices.php:66
static getList(string $a_str)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
static http()
Fetches the global http state from ILIAS.
exit
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
+ Here is the call graph for this function:

◆ executeCommand()

ilSearchGUI::executeCommand ( )

Control public.

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

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

146  : void
147  {
148  $next_class = $this->ctrl->getNextClass($this);
149  $cmd = $this->ctrl->getCmd();
150 
151  switch ($next_class) {
152  case 'ilobjectcopygui':
153  $this->prepareOutput();
154  $this->ctrl->setReturn($this, '');
155  $cp = new ilObjectCopyGUI($this);
156  $this->ctrl->forwardCommand($cp);
157  break;
158 
159  default:
160  if (!$cmd) {
161  $cmd = "showSavedResults";
162  }
163  $this->prepareOutput();
164  $this->handleCommand($cmd);
165  break;
166  }
167  }
GUI class for the workflow of copying objects.
handleCommand(string $a_cmd)
+ Here is the call graph for this function:

◆ getCombination()

ilSearchGUI::getCombination ( )

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

Referenced by __parseQueryString().

194  : string
195  {
196  return $this->combination ?: self::SEARCH_OR;
197  }
+ Here is the caller graph for this function:

◆ getDetails()

ilSearchGUI::getDetails ( )

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

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

222  : array
223  {
224  return $this->details ?? [];
225  }
+ Here is the caller graph for this function:

◆ getRootNode()

ilSearchGUI::getRootNode ( )

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

References ROOT_FOLDER_ID.

Referenced by performSearch(), showSavedResults(), and showSearch().

228  : int
229  {
230  return $this->root_node ?: ROOT_FOLDER_ID;
231  }
const ROOT_FOLDER_ID
Definition: constants.php:32
+ Here is the caller graph for this function:

◆ getString()

ilSearchGUI::getString ( )

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

References $string.

Referenced by __parseQueryString(), and showSearch().

208  : string
209  {
210  return $this->string;
211  }
+ Here is the caller graph for this function:

◆ getType()

ilSearchGUI::getType ( )

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

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

180  : int
181  {
182  return $this->type ?? self::SEARCH_FAST;
183  }
+ Here is the caller graph for this function:

◆ parseCreationFilter()

ilSearchGUI::parseCreationFilter ( ilObjectSearch  $search)

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

References parseEndDateFromCreationFilter(), parseStartDateFromCreationFilter(), ilObjectSearch\setCreationDateFilterEndDate(), and ilObjectSearch\setCreationDateFilterStartDate().

Referenced by __searchObjects().

577  : bool
578  {
579  $date_start = $this->parseStartDateFromCreationFilter();
580  $date_end = $this->parseEndDateFromCreationFilter();
581 
582  if (is_null($date_start) && is_null($date_end)) {
583  return true;
584  }
585 
586  $search->setCreationDateFilterStartDate($date_start);
587  $search->setCreationDateFilterEndDate($date_end);
588  return true;
589  }
setCreationDateFilterStartDate(?ilDate $day)
parseStartDateFromCreationFilter()
setCreationDateFilterEndDate(?ilDate $day)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ parseEndDateFromCreationFilter()

ilSearchGUI::parseEndDateFromCreationFilter ( )
protected

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

References ilSearchBaseGUI\getSearchCache(), IL_CAL_DATE, and null.

Referenced by parseCreationFilter(), and performSearch().

600  : ?ilDate
601  {
602  $options = $this->getSearchCache()->getCreationFilter();
603  if (!($options['date_end'] ?? false)) {
604  return null;
605  }
606  return new ilDate($options['date_end'] ?? "", IL_CAL_DATE);
607  }
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
const IL_CAL_DATE
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ parseStartDateFromCreationFilter()

ilSearchGUI::parseStartDateFromCreationFilter ( )
protected

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

References ilSearchBaseGUI\getSearchCache(), IL_CAL_DATE, and null.

Referenced by parseCreationFilter(), and performSearch().

591  : ?ilDate
592  {
593  $options = $this->getSearchCache()->getCreationFilter();
594  if (!($options['date_start'] ?? false)) {
595  return null;
596  }
597  return new ilDate($options['date_start'] ?? "", IL_CAL_DATE);
598  }
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
const IL_CAL_DATE
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ performSearch()

ilSearchGUI::performSearch ( )

Perform search.

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

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, parseEndDateFromCreationFilter(), parseStartDateFromCreationFilter(), ilSearchResult\read(), ilSearchBaseGUI\SEARCH_DETAILS, showSearch(), and ILIAS\Repository\user().

Referenced by performSearchFilter(), and remoteSearch().

356  : void
357  {
358  $page_number = $this->initPageNumberFromQuery();
359  if (!$page_number and $this->search_mode != 'in_results') {
360  ilSession::clear('max_page');
361  $this->search_cache->deleteCachedEntries();
362  }
363  $this->search_cache->setResultPageNumber($page_number);
364  if ($this->getType() == ilSearchBaseGUI::SEARCH_DETAILS and !$this->getDetails()) {
365  $this->tpl->setOnScreenMessage('info', $this->lng->txt('search_choose_object_type'));
366  $this->showSearch();
367  return;
368  }
369 
370  // Step 1: parse query string
371  if (!is_object($query_parser = $this->__parseQueryString())) {
372  $this->tpl->setOnScreenMessage('info', $query_parser);
373  $this->showSearch();
374 
375  return;
376  }
377  // Step 2: perform object search. Get an ObjectSearch object via factory. Depends on fulltext or like search type.
378  $result = $this->__searchObjects($query_parser);
379 
380  // Step 3: perform meta keyword search. Get an MetaDataSearch object.
381  $result_meta = $this->__searchMeta($query_parser, 'keyword');
382  $result->mergeEntries($result_meta);
383 
384  $result_meta = $this->__searchMeta($query_parser, 'contribute');
385  $result->mergeEntries($result_meta);
386 
387  $result_meta = $this->__searchMeta($query_parser, 'title');
388  $result->mergeEntries($result_meta);
389 
390  $result_meta = $this->__searchMeta($query_parser, 'description');
391  $result->mergeEntries($result_meta);
392 
393  // Perform details search in object specific tables
394  if ($this->getType() == self::SEARCH_DETAILS) {
395  $result = $this->__performDetailsSearch($query_parser, $result);
396  }
397  // Step 5: Search in results
398  if ($this->search_mode == 'in_results') {
399  $old_result_obj = new ilSearchResult($this->user->getId());
400  $old_result_obj->read();
401 
402  $result->diffEntriesFromResult();
403  }
404 
405 
406  // Step 4: merge and validate results
407  $result->filter(
408  $this->getRootNode(),
412  );
413  $result->save();
414  $this->showSearch();
415 
416  if (!count($result->getResults())) {
417  $this->tpl->setOnScreenMessage('info', $this->lng->txt('search_no_match'));
418  }
419 
420  if ($result->isLimitReached()) {
421  #$message = sprintf($this->lng->txt('search_limit_reached'),$this->settings->getMaxHits());
422  #ilUtil::sendInfo($message);
423  }
424 
425  // Step 6: show results
426  $this->addPager($result, 'max_page');
427 
429  $presentation->setResults($result->getResultsForPresentation());
430  $presentation->setSubitemIds($result->getSubitemIds());
431  $presentation->setPreviousNext($this->prev_link, $this->next_link);
432 
433  if ($presentation->render()) {
434  $this->tpl->setVariable('SEARCH_RESULTS', $presentation->getHTML());
435  }
436  }
read(int $a_type=ilUserSearchCache::DEFAULT_SEARCH)
read search results
__searchMeta(ilQueryParser $query_parser, string $a_type)
Search in object meta data (keyword)
__searchObjects(ilQueryParser $query_parser)
Search in obect title,desctiption.
__performDetailsSearch(ilQueryParser $query_parser, ilSearchResult $result)
parseStartDateFromCreationFilter()
__parseQueryString()
parse query string, using query parser instance
Presentation of search results using object list gui.
addPager($result, string $a_session_key)
static clear(string $a_var)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ performSearchFilter()

ilSearchGUI::performSearchFilter ( )

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

References performSearch().

348  : void
349  {
350  $this->performSearch();
351  }
performSearch()
Perform search.
+ Here is the call graph for this function:

◆ prepareOutput()

ilSearchGUI::prepareOutput ( )

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

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

Referenced by executeCommand().

440  : void
441  {
442  parent::prepareOutput();
443 
444  $this->help_gui->setScreenIdComponent("src");
445 
446  $this->tabs_gui->addTab(
447  "search",
448  $this->lng->txt("search"),
449  $this->ctrl->getLinkTarget($this)
450  );
451 
452  if (!$this->settings->getHideAdvancedSearch()) {
453  $this->tabs_gui->addTab(
454  "adv_search",
455  $this->lng->txt("search_advanced"),
456  $this->ctrl->getLinkTargetByClass('iladvancedsearchgui')
457  );
458  }
459 
460  $this->tabs_gui->activateTab("search");
461  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ remoteSearch()

ilSearchGUI::remoteSearch ( )

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

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

239  : void
240  {
241  $root_id = 0;
242  if ($this->http->wrapper()->post()->has('root_id')) {
243  $root_id = $this->http->wrapper()->post()->retrieve(
244  'root_id',
245  $this->refinery->kindlyTo()->int()
246  );
247  }
248  $queryString = '';
249  if ($this->http->wrapper()->post()->has('queryString')) {
250  $queryString = $this->http->wrapper()->post()->retrieve(
251  'queryString',
252  $this->refinery->kindlyTo()->string()
253  );
254  }
255  $this->setString($queryString);
256  $this->setRootNode($root_id);
257  $this->performSearch();
258  }
setString(string $a_str)
Set/get search string public.
performSearch()
Perform search.
setRootNode(int $a_node_id)
static http()
Fetches the global http state from ILIAS.
+ Here is the call graph for this function:

◆ setCombination()

ilSearchGUI::setCombination ( string  $a_combination)

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

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

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

Referenced by __construct().

188  : void
189  {
190  $session_search = ilSession::get('search') ?? [];
191  $session_search['combination'] = $this->combination = $a_combination;
192  ilSession::set('search', $session_search);
193  }
static get(string $a_var)
static set(string $a_var, $a_val)
Set a value.
+ 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) public.

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

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

Referenced by __construct().

216  : void
217  {
218  $session_search = ilSession::get('search') ?? [];
219  $session_search['details'] = $this->details = $a_details;
220  ilSession::set('search', $session_search);
221  }
static get(string $a_var)
static set(string $a_var, $a_val)
Set a value.
+ 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 233 of file class.ilSearchGUI.php.

References ilSession\set().

Referenced by remoteSearch().

233  : void
234  {
235  ilSession::set('search_root', $this->root_node = $a_node_id);
236  }
static set(string $a_var, $a_val)
Set a value.
+ 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 public.

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

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

Referenced by __construct(), and remoteSearch().

202  : void
203  {
204  $session_search = ilSession::get('search') ?? [];
205  $session_search['string'] = $this->string = $a_str;
206  ilSession::set('search', $session_search);
207  }
static get(string $a_var)
static set(string $a_var, $a_val)
Set a value.
+ 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) public.

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

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

Referenced by __construct().

173  : void
174  {
175  $session_search = ilSession::get('search');
176  $session_search['type'] = $this->type = $a_type;
177  ilSession::set('search', $session_search);
178  }
static get(string $a_var)
static set(string $a_var, $a_val)
Set a value.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ showSavedResults()

ilSearchGUI::showSavedResults ( )

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

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

322  : void
323  {
324  // Read old result sets
325 
326  $result_obj = new ilSearchResult($this->user->getId());
327  $result_obj->read();
328  $result_obj->filterResults($this->getRootNode());
329 
330  $this->showSearch();
331 
332  // Show them
333  if (count($result_obj->getResults())) {
334  $this->addPager($result_obj, 'max_page');
335 
337  $presentation->setResults($result_obj->getResultsForPresentation());
338  $presentation->setSubitemIds($result_obj->getSubitemIds());
339  $presentation->setPreviousNext($this->prev_link, $this->next_link);
340  #$presentation->setSearcher($searcher);
341 
342  if ($presentation->render()) {
343  $this->tpl->setVariable('SEARCH_RESULTS', $presentation->getHTML());
344  }
345  }
346  }
read(int $a_type=ilUserSearchCache::DEFAULT_SEARCH)
read search results
Presentation of search results using object list gui.
addPager($result, string $a_session_key)
+ Here is the call graph for this function:

◆ showSearch()

ilSearchGUI::showSearch ( )

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

References getRootNode(), getString(), and ilSearchBaseGUI\renderSearch().

Referenced by performSearch(), and showSavedResults().

316  : void
317  {
318  $this->tpl->addBlockFile('ADM_CONTENT', 'adm_content', 'tpl.search.html', 'components/ILIAS/Search');
319  $this->renderSearch($this->getString(), $this->getRootNode());
320  }
renderSearch(string $term, int $root_node=0)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Field Documentation

◆ $combination

string ilSearchGUI::$combination

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

◆ $details

array ilSearchGUI::$details
private

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

◆ $help_gui

ilHelpGUI ilSearchGUI::$help_gui
protected

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

◆ $root_node

int ilSearchGUI::$root_node

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

◆ $string

string ilSearchGUI::$string

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

Referenced by getString().

◆ $tabs_gui

ilTabsGUI ilSearchGUI::$tabs_gui
protected

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

◆ $type

int ilSearchGUI::$type

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

Referenced by __construct().

◆ $ui_factory

UIFactory ilSearchGUI::$ui_factory
protected

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

◆ $ui_renderer

UIRenderer ilSearchGUI::$ui_renderer
protected

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


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