ILIAS  release_7 Revision v7.30-3-g800a261c036
All Data Structures Namespaces Files Functions Variables 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 ($a_type)
 Set/get type of search (detail or 'fast' search) public. More...
 
 getType ()
 
 setCombination ($a_combination)
 Set/get combination of search ('and' or 'or') public. More...
 
 getCombination ()
 
 setString ($a_str)
 Set/get search string public. More...
 
 getString ()
 
 setDetails ($a_details)
 Set/get details (object types for details search) public. More...
 
 getDetails ()
 
 getRootNode ()
 
 setRootNode ($a_node_id)
 
 remoteSearch ()
 
 autoComplete ()
 Data resource for autoComplete. More...
 
 showSearch ()
 
 showSavedResults ()
 
 performSearch ()
 Perform search. More...
 
 prepareOutput ()
 
__performDetailsSearch (&$query_parser, &$result)
 
__parseQueryString ()
 parse query string, using query parser instance More...
 
__searchObjects (&$query_parser)
 Search in obect title,desctiption. More...
 
 parseCreationFilter (ilObjectSearch $search)
 
__searchMeta (&$query_parser, $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 ()
 Constructor public. More...
 
 prepareOutput ()
 
 initStandardSearchForm ($a_mode)
 Init standard search form. More...
 
 getSearchAreaForm ()
 Init standard search form. More...
 
 handleCommand ($a_cmd)
 Handle command. More...
 
 addToDeskObject ()
 Interface methods. More...
 
 removeFromDeskObject ()
 Remove from dektop. More...
 
 delete ()
 Show deletion screen. More...
 
 cancelDelete ()
 Cancel delete. More...
 
 cancelObject ()
 
 cancelMoveLinkObject ()
 Cancel move/link. More...
 
 performDelete ()
 Delete objects. More...
 
 cut ()
 Interface ilAdministrationCommandHandler. More...
 
 link ()
 Interface ilAdministrationCommandHandler. More...
 
 paste ()
 Paste. More...
 
 showLinkIntoMultipleObjectsTree ()
 Target selection link. More...
 
 showPasteTree ()
 Target selection cut. More...
 
 performPasteIntoMultipleObjects ()
 Perform paste into multiple objects. More...
 
 clear ()
 clear clipboard More...
 
 enableAdministrationPanel ()
 Enable administration panel. More...
 
 disableAdministrationPanel ()
 Disable administration panel. More...
 
 keepObjectsInClipboardObject ()
 cancel action but keep objects in clipboard
Returns
void
More...
 
 addLocator ()
 Add Locator. More...
 
 autoComplete ()
 Data resource for autoComplete. More...
 
- Public Member Functions inherited from ILIAS\Object\ImplementsCreationCallback
 callCreationCallback (\ilObject $object, \ilObjectDefinition $obj_definition, int $requested_crtcb)
 

Data Fields

 $root_node
 
 $combination
 
 $string
 
 $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
 
 $ilias = null
 
 $lng = null
 
 $tpl = null
 

Protected Member Functions

 storeRoot ()
 Store new root node. More...
 
 initUserSearchCache ()
 Init user search cache. More...
 
- Protected Member Functions inherited from ilSearchBaseGUI
 addPager ($result, $a_session_key)
 Add Pager. More...
 
 buildSearchAreaPath ($a_root_node)
 Build path for search area. More...
 
 getCreationDateForm ()
 
 getSearchCache ()
 Get user search cache. More...
 
 loadCreationFilter ()
 Load creation date filter. More...
 

Protected Attributes

 $search_cache = null
 
- Protected Attributes inherited from ilSearchBaseGUI
 $settings = null
 
 $ctrl = null
 
 $favourites
 
 $user
 

Detailed Description

Constructor & Destructor Documentation

◆ __construct()

ilSearchGUI::__construct ( )

Constructor public.

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

References $_POST, $_SESSION, $DIC, $ilUser, ilSearchBaseGUI\$lng, $type, ILIAS\GlobalScreen\Provider\__construct(), ilSearchSettings\getInstance(), ilSearchBaseGUI\initStandardSearchForm(), ilSearchSettings\OPERATOR_AND, ROOT_FOLDER_ID, ilSearchBaseGUI\SEARCH_FORM_STANDARD, setCombination(), setDetails(), setString(), and setType().

37  {
38  global $DIC;
39 
40  $ilUser = $DIC['ilUser'];
41  $lng = $DIC['lng'];
42 
43  $lng->loadLanguageModule("search");
44 
45  // put form values into "old" post variables
47  $this->form->checkInput();
48 
49  $new_search = isset($_POST['cmd']['performSearch']) ? true : false;
50 
51  $enabled_types = ilSearchSettings::getInstance()->getEnabledLuceneItemFilterDefinitions();
52  foreach ($enabled_types as $type => $pval) {
53  if ($_POST['filter_type'][$type] == 1) {
54  $_POST["search"]["details"][$type] = $_POST['filter_type'][$type];
55  }
56  }
57 
58  $_POST["search"]["string"] = $_POST["term"];
59  $_POST["search"]["combination"] = $_POST["combination"];
60  $_POST["search"]["type"] = $_POST["type"];
61  $_SESSION['search_root'] = $_POST["area"];
62 
63  $this->root_node = $_SESSION['search_root'] ? $_SESSION['search_root'] : ROOT_FOLDER_ID;
64  $this->setType($_POST['search']['type'] ? $_POST['search']['type'] : $_SESSION['search']['type']);
65 
66  $this->setCombination(
68  self::SEARCH_AND :
69  self::SEARCH_OR
70  );
71  $this->setString($_POST['search']['string'] ? $_POST['search']['string'] : $_SESSION['search']['string']);
72  #$this->setDetails($_POST['search']['details'] ? $_POST['search']['details'] : $_SESSION['search']['details']);
73  $this->setDetails($new_search ? $_POST['search']['details'] : $_SESSION['search']['details']);
75  }
setType($a_type)
Set/get type of search (detail or 'fast' search) public.
$_SESSION["AccountId"]
const ROOT_FOLDER_ID
Definition: constants.php:30
setCombination($a_combination)
Set/get combination of search ('and' or 'or') public.
initStandardSearchForm($a_mode)
Init standard search form.
global $DIC
Definition: goto.php:24
setDetails($a_details)
Set/get details (object types for details search) public.
setString($a_str)
Set/get search string public.
__construct(Container $dic, ilPlugin $plugin)
$ilUser
Definition: imgupload.php:18
$_POST["username"]
+ 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
array object types public

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

References getDetails(), getType(), and ilSearchBaseGUI\SEARCH_DETAILS.

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

655  {
656  if ($this->getType() != ilSearchBaseGUI::SEARCH_DETAILS) {
657  return false;
658  }
659 
660  foreach ($this->getDetails() as $key => $detail_type) {
661  if (!$detail_type) {
662  continue;
663  }
664 
665  switch ($key) {
666  case 'lms':
667  $filter[] = 'lm';
668  $filter[] = 'dbk';
669  $filter[] = 'pg';
670  $filter[] = 'st';
671  $filter[] = 'sahs';
672  $filter[] = 'htlm';
673  break;
674 
675  case 'frm':
676  $filter[] = 'frm';
677  break;
678 
679  case 'glo':
680  $filter[] = 'glo';
681  break;
682 
683  case 'exc':
684  $filter[] = 'exc';
685  break;
686 
687  case 'mcst':
688  $filter[] = 'mcst';
689  break;
690 
691  case 'tst':
692  $filter[] = 'tst';
693  $filter[] = 'svy';
694  $filter[] = 'qpl';
695  $filter[] = 'spl';
696  break;
697 
698  case 'mep':
699  $filter[] = 'mep';
700  $filter[] = 'mob';
701  break;
702 
703  case 'fil':
704  $filter[] = 'file';
705  break;
706 
707  case 'wiki':
708  $filter[] = 'wpg';
709  break;
710 
711  default:
712  $filter[] = $key;
713  }
714  }
715  return $filter ? $filter : array();
716  }
+ 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
object of query parser or error message if an error occured public

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

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

Referenced by performSearch().

559  {
560  include_once 'Services/Search/classes/class.ilQueryParser.php';
561 
562  $query_parser = new ilQueryParser(ilUtil::stripSlashes($this->getString()));
563  $query_parser->setCombination($this->getCombination());
564  $query_parser->parse();
565 
566  if (!$query_parser->validate()) {
567  return $query_parser->getMessage();
568  }
569  return $query_parser;
570  }
static stripSlashes($a_str, $a_strip_html=true, $a_allow="")
strip slashes if magic qoutes is enabled
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ __performDetailsSearch()

& ilSearchGUI::__performDetailsSearch ( $query_parser,
$result 
)

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

References $result, $type, __getFilter(), ilObjectSearchFactory\_getExerciseSearchInstance(), ilObjectSearchFactory\_getForumSearchInstance(), ilObjectSearchFactory\_getGlossaryDefinitionSearchInstance(), ilObjectSearchFactory\_getLMContentSearchInstance(), ilObjectSearchFactory\_getMediaPoolSearchInstance(), ilObjectSearchFactory\_getObjectSearchInstance(), ilObjectSearchFactory\_getTestSearchInstance(), ilObjectSearchFactory\_getWikiContentSearchInstance(), and getDetails().

Referenced by performSearch().

467  {
468  foreach ($this->getDetails() as $type => $enabled) {
469  if (!$enabled) {
470  continue;
471  }
472 
473  switch ($type) {
474  case 'crs':
475  $crs_search = ilObjectSearchFactory::_getObjectSearchInstance($query_parser);
476  $crs_search->setFilter(array('crs'));
477  $result->mergeEntries($crs_search->performSearch());
478  break;
479 
480  case 'grp':
481  $grp_search = ilObjectSearchFactory::_getObjectSearchInstance($query_parser);
482  $grp_search->setFilter(array('grp'));
483  $result->mergeEntries($grp_search->performSearch());
484  break;
485 
486  case 'lms':
487  $content_search = &ilObjectSearchFactory::_getLMContentSearchInstance($query_parser);
488  $content_search->setFilter($this->__getFilter());
489  $result->mergeEntries($content_search->performSearch());
490  break;
491 
492  case 'frm':
493  $forum_search = &ilObjectSearchFactory::_getForumSearchInstance($query_parser);
494  $forum_search->setFilter($this->__getFilter());
495  $result->mergeEntries($forum_search->performSearch());
496  break;
497 
498  case 'glo':
499  // Glossary term definition pages
500  $gdf_search = &ilObjectSearchFactory::_getLMContentSearchInstance($query_parser);
501  $gdf_search->setFilter(array('gdf'));
502  $result->mergeEntries($gdf_search->performSearch());
503  // Glossary terms
504  $gdf_term_search = &ilObjectSearchFactory::_getGlossaryDefinitionSearchInstance($query_parser);
505  $result->mergeEntries($gdf_term_search->performSearch());
506  break;
507 
508  case 'exc':
509  $exc_search = &ilObjectSearchFactory::_getExerciseSearchInstance($query_parser);
510  $exc_search->setFilter($this->__getFilter());
511  $result->mergeEntries($exc_search->performSearch());
512  break;
513 
514  case 'mcst':
515  $mcst_search = &ilObjectSearchFactory::_getMediaCastSearchInstance($query_parser);
516  $result->mergeEntries($mcst_search->performSearch());
517  break;
518 
519  case 'tst':
520  $tst_search = &ilObjectSearchFactory::_getTestSearchInstance($query_parser);
521  $tst_search->setFilter($this->__getFilter());
522  $result->mergeEntries($tst_search->performSearch());
523  break;
524 
525  case 'mep':
526  $mep_search = &ilObjectSearchFactory::_getMediaPoolSearchInstance($query_parser);
527  $mep_search->setFilter($this->__getFilter());
528  $result->mergeEntries($mep_search->performSearch());
529 
530  // Mob keyword search
531  $mob_search = ilObjectSearchFactory::_getMediaPoolSearchInstance($query_parser);
532  $mob_search->setFilter($this->__getFilter());
533  $result->mergeEntries($mob_search->performKeywordSearch());
534 
535  break;
536 
537  case 'wiki':
538  $wiki_search = &ilObjectSearchFactory::_getWikiContentSearchInstance($query_parser);
539  $wiki_search->setFilter($this->__getFilter());
540  $result->mergeEntries($wiki_search->performSearch());
541 
542  /*$result_meta =& $this->__searchMeta($query_parser,'title');
543  $result->mergeEntries($result_meta);
544  $result_meta =& $this->__searchMeta($query_parser,'description');
545  $result->mergeEntries($result_meta);*/
546  break;
547 
548  }
549  }
550  return $result;
551  }
static _getWikiContentSearchInstance($query_parser)
get reference of ilFulltextWikiContentSearch
$result
static _getMediaPoolSearchInstance($query_parser)
get reference of ilFulltextMediapoolSearch
static _getForumSearchInstance($query_parser)
get reference of ilFulltextForumSearch
static _getExerciseSearchInstance($query_parser)
get reference of ilFulltextExerciseSearch
static _getGlossaryDefinitionSearchInstance($query_parser)
get reference of ilFulltextGlossaryDefinitionSearch
static _getLMContentSearchInstance($query_parser)
get reference of ilFulltextLMContentSearch
__getFilter()
Get object type for filter (If detail search is enabled)
static _getObjectSearchInstance($query_parser)
get reference of ilFulltext/LikeObjectSearch.
static _getTestSearchInstance($query_parser)
get reference of ilFulltextTestSearch
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ __searchMeta()

& ilSearchGUI::__searchMeta ( $query_parser,
  $a_type 
)

Search in object meta data (keyword)

Returns
object result object public

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

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

Referenced by performSearch().

623  {
624  include_once 'Services/Search/classes/class.ilObjectSearchFactory.php';
625 
626  $meta_search = &ilObjectSearchFactory::_getMetaDataSearchInstance($query_parser);
627  if ($this->getType() == ilSearchBaseGUI::SEARCH_DETAILS) {
628  $meta_search->setFilter($this->__getFilter());
629  }
630  switch ($a_type) {
631  case 'keyword':
632  $meta_search->setMode('keyword');
633  break;
634 
635  case 'contribute':
636  $meta_search->setMode('contribute');
637  break;
638 
639  case 'title':
640  $meta_search->setMode('title');
641  break;
642 
643  case 'description':
644  $meta_search->setMode('description');
645  break;
646  }
647  return $meta_search->performSearch();
648  }
static _getMetaDataSearchInstance($query_parser)
get reference of ilFulltext/LikeMetaDataSearch.
__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:

◆ __searchObjects()

& ilSearchGUI::__searchObjects ( $query_parser)

Search in obect title,desctiption.

Returns
object result object public

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

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

Referenced by performSearch().

577  {
578  include_once 'Services/Search/classes/class.ilObjectSearchFactory.php';
579 
580  $obj_search = &ilObjectSearchFactory::_getObjectSearchInstance($query_parser);
581  if ($this->getType() == ilSearchBaseGUI::SEARCH_DETAILS) {
582  $obj_search->setFilter($this->__getFilter());
583  }
584 
585  $this->parseCreationFilter($obj_search);
586  return $obj_search->performSearch();
587  }
parseCreationFilter(ilObjectSearch $search)
__getFilter()
Get object type for filter (If detail search is enabled)
static _getObjectSearchInstance($query_parser)
get reference of ilFulltext/LikeObjectSearch.
+ 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 210 of file class.ilSearchGUI.php.

References $res, ilLogLevel\DEBUG, exit, ilSearchAutoComplete\getList(), and ilLoggerFactory\getLogger().

211  {
212  if ((int) $_REQUEST['search_type'] == -1) {
213  $a_fields = array('login','firstname','lastname','email');
214  $result_field = 'login';
215 
216  // Starting user autocomplete search
217  include_once './Services/User/classes/class.ilUserAutoComplete.php';
218  $auto = new ilUserAutoComplete();
219 
220 
221  $auto->setMoreLinkAvailable(true);
222  $auto->setSearchFields($a_fields);
223  $auto->setResultField($result_field);
224  $auto->enableFieldSearchableCheck(true);
225  $auto->setUserLimitations(true);
226 
227  $res = $auto->getList($_REQUEST['term']);
228 
229  $res_obj = json_decode($res);
230 
231  ilLoggerFactory::getLogger('sea')->debug($res);
232 
233 
234  ilLoggerFactory::getLogger('sea')->dump($res_obj->items, ilLogLevel::DEBUG);
235  if (is_array($res_obj->items)) {
236  echo json_encode($res_obj->items);
237  exit;
238  }
239  } else {
240  $q = $_REQUEST["term"];
241  include_once("./Services/Search/classes/class.ilSearchAutoComplete.php");
242  $list = ilSearchAutoComplete::getList($q);
243  ilLoggerFactory::getLogger('sea')->dump(json_decode($list));
244  echo $list;
245  exit;
246  }
247  }
exit
Definition: login.php:29
static getList($a_str)
Get completion list.
Auto completion class for user lists.
foreach($_POST as $key=> $value) $res
static getLogger($a_component_id)
Get component logger.
+ Here is the call graph for this function:

◆ executeCommand()

ilSearchGUI::executeCommand ( )

Control public.

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

References $DIC, ilSearchBaseGUI\getSearchAreaForm(), ilSearchBaseGUI\handleCommand(), initUserSearchCache(), and prepareOutput().

83  {
84  global $DIC;
85 
86  $rbacsystem = $DIC['rbacsystem'];
87  $ilCtrl = $DIC['ilCtrl'];
88 
89 
90 
91  $next_class = $this->ctrl->getNextClass($this);
92  $cmd = $this->ctrl->getCmd();
93 
94  switch ($next_class) {
95  case "ilpropertyformgui":
96  //$this->initStandardSearchForm(ilSearchBaseGUI::SEARCH_FORM_STANDARD);
97  $form = $this->getSearchAreaForm();
98  $this->prepareOutput();
99  $ilCtrl->setReturn($this, 'storeRoot');
100  return $ilCtrl->forwardCommand($form);
101 
102  case 'ilobjectcopygui':
103  $this->prepareOutput();
104  $this->ctrl->setReturn($this, '');
105  include_once './Services/Object/classes/class.ilObjectCopyGUI.php';
106  $cp = new ilObjectCopyGUI($this);
107  $this->ctrl->forwardCommand($cp);
108  break;
109 
110  default:
111  $this->initUserSearchCache();
112  if (!$cmd) {
113  $cmd = "showSavedResults";
114  }
115  $this->prepareOutput();
116  $this->handleCommand($cmd);
117  break;
118  }
119  return true;
120  }
getSearchAreaForm()
Init standard search form.
GUI class for the workflow of copying objects.
global $DIC
Definition: goto.php:24
handleCommand($a_cmd)
Handle command.
initUserSearchCache()
Init user search cache.
+ Here is the call graph for this function:

◆ getCombination()

ilSearchGUI::getCombination ( )

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

References ilSearchBaseGUI\SEARCH_OR.

Referenced by __parseQueryString().

143  {
144  return $this->combination ? $this->combination : ilSearchBaseGUI::SEARCH_OR;
145  }
+ Here is the caller graph for this function:

◆ getDetails()

ilSearchGUI::getDetails ( )

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

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

167  {
168  return $this->details ? $this->details : array();
169  }
+ Here is the caller graph for this function:

◆ getRootNode()

ilSearchGUI::getRootNode ( )

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

References ROOT_FOLDER_ID.

Referenced by performSearch(), and showSavedResults().

173  {
174  return $this->root_node ? $this->root_node : ROOT_FOLDER_ID;
175  }
const ROOT_FOLDER_ID
Definition: constants.php:30
+ Here is the caller graph for this function:

◆ getString()

ilSearchGUI::getString ( )

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

References $string.

Referenced by __parseQueryString(), and showSearch().

155  {
156  return $this->string;
157  }
+ Here is the caller graph for this function:

◆ getType()

ilSearchGUI::getType ( )

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

References ilSearchBaseGUI\SEARCH_FAST.

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

131  {
132  return $this->type ? $this->type : ilSearchBaseGUI::SEARCH_FAST;
133  }
+ Here is the caller graph for this function:

◆ initUserSearchCache()

ilSearchGUI::initUserSearchCache ( )
protected

Init user search cache.

private

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

References $_GET, $_POST, $DIC, $ilUser, ilUserSearchCache\_getInstance(), ilUserSearchCache\DEFAULT_SEARCH, ilSearchBaseGUI\loadCreationFilter(), and ilUtil\stripSlashes().

Referenced by executeCommand().

725  {
726  global $DIC;
727 
728  $ilUser = $DIC['ilUser'];
729 
730  include_once('Services/Search/classes/class.ilUserSearchCache.php');
731  $this->search_cache = ilUserSearchCache::_getInstance($ilUser->getId());
732  $this->search_cache->switchSearchType(ilUserSearchCache::DEFAULT_SEARCH);
733 
734  if ($_GET['page_number']) {
735  $this->search_cache->setResultPageNumber((int) $_GET['page_number']);
736  }
737  if (isset($_POST['cmd']['performSearch'])) {
738  $this->search_cache->setQuery(ilUtil::stripSlashes($_POST['term']));
739  $this->search_cache->setCreationFilter($this->loadCreationFilter());
740  $this->search_cache->save();
741  }
742  }
loadCreationFilter()
Load creation date filter.
$_GET["client_id"]
static _getInstance($a_usr_id)
Get singleton instance.
global $DIC
Definition: goto.php:24
static stripSlashes($a_str, $a_strip_html=true, $a_allow="")
strip slashes if magic qoutes is enabled
$ilUser
Definition: imgupload.php:18
$_POST["username"]
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ parseCreationFilter()

ilSearchGUI::parseCreationFilter ( ilObjectSearch  $search)

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

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

Referenced by __searchObjects().

590  {
591  $options = $this->getSearchCache()->getCreationFilter();
592 
593  if (!$options['enabled']) {
594  return true;
595  }
596  $limit = new ilDate($options['date'], IL_CAL_UNIX);
597  $search->setCreationDateFilterDate($limit);
598 
599  switch ($options['ontype']) {
600  case 1:
602  break;
603 
604  case 2:
606  break;
607 
608  case 3:
610  break;
611  }
612 
613  return true;
614  }
const IL_CAL_UNIX
Class for single dates.
setCreationDateFilterDate(ilDate $day)
Set creation date filter.
setCreationDateFilterOperator($a_operator)
getSearchCache()
Get user search cache.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ performSearch()

ilSearchGUI::performSearch ( )

Perform search.

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

References $_GET, $_SESSION, $DIC, $ilUser, $result, __parseQueryString(), __performDetailsSearch(), __searchMeta(), __searchObjects(), ilSearchBaseGUI\addPager(), getDetails(), ilSearchSettings\getInstance(), getRootNode(), getType(), ilSearchResultPresentation\MODE_STANDARD, ilSearchSettings\OPERATOR_AND, ilSearchResult\read(), ilSearchBaseGUI\SEARCH_DETAILS, ilUtil\sendInfo(), and showSearch().

Referenced by remoteSearch(), and storeRoot().

347  {
348  global $DIC;
349 
350  $ilUser = $DIC['ilUser'];
351 
352  if (!isset($_GET['page_number']) and $this->search_mode != 'in_results') {
353  unset($_SESSION['max_page']);
354  $this->search_cache->deleteCachedEntries();
355  }
356 
357  if ($this->getType() == ilSearchBaseGUI::SEARCH_DETAILS and !$this->getDetails()) {
358  ilUtil::sendInfo($this->lng->txt('search_choose_object_type'));
359  $this->showSearch();
360  return false;
361  }
362 
363  // Step 1: parse query string
364  if (!is_object($query_parser = &$this->__parseQueryString())) {
365  ilUtil::sendInfo($query_parser);
366  $this->showSearch();
367 
368  return false;
369  }
370  // Step 2: perform object search. Get an ObjectSearch object via factory. Depends on fulltext or like search type.
371  $result = &$this->__searchObjects($query_parser);
372 
373  // Step 3: perform meta keyword search. Get an MetaDataSearch object.
374  $result_meta = &$this->__searchMeta($query_parser, 'keyword');
375  $result->mergeEntries($result_meta);
376 
377  $result_meta = &$this->__searchMeta($query_parser, 'contribute');
378  $result->mergeEntries($result_meta);
379 
380  $result_meta = &$this->__searchMeta($query_parser, 'title');
381  $result->mergeEntries($result_meta);
382 
383  $result_meta = &$this->__searchMeta($query_parser, 'description');
384  $result->mergeEntries($result_meta);
385 
386  // Perform details search in object specific tables
387  if ($this->getType() == ilSearchBaseGUI::SEARCH_DETAILS) {
388  $result = $this->__performDetailsSearch($query_parser, $result);
389  }
390  // Step 5: Search in results
391  if ($this->search_mode == 'in_results') {
392  include_once 'Services/Search/classes/class.ilSearchResult.php';
393 
394  $old_result_obj = new ilSearchResult($ilUser->getId());
395  $old_result_obj->read();
396 
397  $result->diffEntriesFromResult($old_result_obj);
398  }
399 
400 
401  // Step 4: merge and validate results
402  $result->filter(
403  $this->getRootNode(),
405  );
406  $result->save();
407  $this->showSearch();
408 
409  if (!count($result->getResults())) {
410  ilUtil::sendInfo($this->lng->txt('search_no_match'));
411  }
412 
413  if ($result->isLimitReached()) {
414  #$message = sprintf($this->lng->txt('search_limit_reached'),$this->settings->getMaxHits());
415  #ilUtil::sendInfo($message);
416  }
417 
418  // Step 6: show results
419  $this->addPager($result, 'max_page');
420 
421  include_once './Services/Search/classes/class.ilSearchResultPresentation.php';
423  $presentation->setResults($result->getResultsForPresentation());
424  $presentation->setSubitemIds($result->getSubitemIds());
425  $presentation->setPreviousNext($this->prev_link, $this->next_link);
426 
427  if ($presentation->render()) {
428  // $this->tpl->setVariable('SEARCH_RESULTS',$presentation->getHTML());
429  $this->tpl->setVariable('RESULTS_TABLE', $presentation->getHTML(true));
430  }
431 
432  return true;
433  }
read($a_type=DEFAULT_SEARCH)
read search results
& __performDetailsSearch(&$query_parser, &$result)
$_SESSION["AccountId"]
$result
$_GET["client_id"]
static sendInfo($a_info="", $a_keep=false)
Send Info Message to Screen.
& __parseQueryString()
parse query string, using query parser instance
addPager($result, $a_session_key)
Add Pager.
Presentation of search results using object list gui.
global $DIC
Definition: goto.php:24
& __searchObjects(&$query_parser)
Search in obect title,desctiption.
$ilUser
Definition: imgupload.php:18
& __searchMeta(&$query_parser, $a_type)
Search in object meta data (keyword)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ prepareOutput()

ilSearchGUI::prepareOutput ( )

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

References $DIC, and settings().

Referenced by executeCommand().

438  {
439  global $DIC;
440 
441  $ilTabs = $DIC['ilTabs'];
442  $ilHelp = $DIC['ilHelp'];
443 
444  parent::prepareOutput();
445 
446  $ilHelp->setScreenIdComponent("src");
447 
448  $ilTabs->addTab(
449  "search",
450  $this->lng->txt("search"),
451  $this->ctrl->getLinkTarget($this)
452  );
453 
454  if (!$this->settings->getHideAdvancedSearch()) {
455  $ilTabs->addTab(
456  "adv_search",
457  $this->lng->txt("search_advanced"),
458  $this->ctrl->getLinkTargetByClass('iladvancedsearchgui')
459  );
460  }
461 
462  $ilTabs->activateTab("search");
463  }
settings()
Definition: settings.php:2
global $DIC
Definition: goto.php:24
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ remoteSearch()

ilSearchGUI::remoteSearch ( )

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

References $_POST, performSearch(), setRootNode(), setString(), and ilUtil\stripSlashes().

183  {
184  $this->setString(ilUtil::stripSlashes($_POST['queryString']));
185  $this->setRootNode((int) $_POST['root_id']);
186  $this->performSearch();
187  }
performSearch()
Perform search.
setRootNode($a_node_id)
static stripSlashes($a_str, $a_strip_html=true, $a_allow="")
strip slashes if magic qoutes is enabled
setString($a_str)
Set/get search string public.
$_POST["username"]
+ Here is the call graph for this function:

◆ setCombination()

ilSearchGUI::setCombination (   $a_combination)

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

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

References $_SESSION.

Referenced by __construct().

139  {
140  $_SESSION['search']['combination'] = $this->combination = $a_combination;
141  }
$_SESSION["AccountId"]
+ Here is the caller graph for this function:

◆ setDetails()

ilSearchGUI::setDetails (   $a_details)

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

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

References $_SESSION.

Referenced by __construct().

163  {
164  $_SESSION['search']['details'] = $this->details = $a_details;
165  }
$_SESSION["AccountId"]
+ Here is the caller graph for this function:

◆ setRootNode()

ilSearchGUI::setRootNode (   $a_node_id)

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

References $_SESSION.

Referenced by remoteSearch().

177  {
178  $_SESSION['search_root'] = $this->root_node = $a_node_id;
179  }
$_SESSION["AccountId"]
+ Here is the caller graph for this function:

◆ setString()

ilSearchGUI::setString (   $a_str)

Set/get search string public.

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

References $_SESSION.

Referenced by __construct(), and remoteSearch().

151  {
152  $_SESSION['search']['string'] = $this->string = $a_str;
153  }
$_SESSION["AccountId"]
+ Here is the caller graph for this function:

◆ setType()

ilSearchGUI::setType (   $a_type)

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

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

References $_SESSION.

Referenced by __construct().

127  {
128  $_SESSION['search']['type'] = $this->type = $a_type;
129  }
$_SESSION["AccountId"]
+ Here is the caller graph for this function:

◆ showSavedResults()

ilSearchGUI::showSavedResults ( )

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

References $DIC, $ilUser, ilSearchBaseGUI\addPager(), getRootNode(), ilSearchResultPresentation\MODE_STANDARD, ilSearchResult\read(), and showSearch().

308  {
309  global $DIC;
310 
311  $ilUser = $DIC['ilUser'];
312 
313  // Read old result sets
314  include_once 'Services/Search/classes/class.ilSearchResult.php';
315 
316  $result_obj = new ilSearchResult($ilUser->getId());
317  $result_obj->read();
318  $result_obj->filterResults($this->getRootNode());
319 
320  $this->showSearch();
321 
322  // Show them
323  if (count($result_obj->getResults())) {
324  $this->addPager($result_obj, 'max_page');
325 
326  include_once './Services/Search/classes/class.ilSearchResultPresentation.php';
328  $presentation->setResults($result_obj->getResultsForPresentation());
329  $presentation->setSubitemIds($result_obj->getSubitemIds());
330  $presentation->setPreviousNext($this->prev_link, $this->next_link);
331  #$presentation->setSearcher($searcher);
332 
333  if ($presentation->render()) {
334  // $this->tpl->setVariable('SEARCH_RESULTS',$presentation->getHTML());
335  $this->tpl->setVariable('RESULTS_TABLE', $presentation->getHTML(true));
336  }
337  }
338 
339  return true;
340  }
read($a_type=DEFAULT_SEARCH)
read search results
addPager($result, $a_session_key)
Add Pager.
Presentation of search results using object list gui.
global $DIC
Definition: goto.php:24
$ilUser
Definition: imgupload.php:18
+ Here is the call graph for this function:

◆ showSearch()

ilSearchGUI::showSearch ( )

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

References $DIC, ilSearchBaseGUI\$lng, ilGlyphGUI\CARET, ilGlyphGUI\get(), ilSearchBaseGUI\getCreationDateForm(), ilSubmitButton\getInstance(), ilSearchSettings\getInstance(), ilSearchBaseGUI\getSearchAreaForm(), getString(), ilOverlayGUI\initJavascript(), ilSearchBaseGUI\initStandardSearchForm(), ilSearchSettings\OPERATOR_AND, ilUtil\prepareFormOutput(), and ilSearchBaseGUI\SEARCH_FORM_STANDARD.

Referenced by performSearch(), and showSavedResults().

250  {
251  global $DIC;
252 
253  $ilLocator = $DIC['ilLocator'];
254  $ilCtrl = $DIC['ilCtrl'];
255  $lng = $DIC['lng'];
256 
257  // include js needed
258  include_once("./Services/UIComponent/Overlay/classes/class.ilOverlayGUI.php");
260  $this->tpl->addJavascript("./Services/Search/js/Search.js");
261 
262  include_once("./Services/UIComponent/Glyph/classes/class.ilGlyphGUI.php");
263 
264  $this->tpl->addBlockFile('ADM_CONTENT', 'adm_content', 'tpl.search.html', 'Services/Search');
265  $this->tpl->setVariable("FORM_ACTION", $ilCtrl->getFormAction($this, 'performSearch'));
266  $this->tpl->setVariable("TERM", ilUtil::prepareFormOutput($this->getString()));
267  $this->tpl->setVariable("SEARCH_LABEL", $lng->txt("search"));
268  include_once("./Services/UIComponent/Button/classes/class.ilSubmitButton.php");
270  $btn->setCommand("performSearch");
271  $btn->setCaption("search");
272  $this->tpl->setVariable("SUBMIT_BTN", $btn->render());
273  $this->tpl->setVariable("TXT_OPTIONS", $lng->txt("options"));
274  $this->tpl->setVariable("ARR_IMG", ilGlyphGUI::get(ilGlyphGUI::CARET));
275  $this->tpl->setVariable("TXT_COMBINATION", $lng->txt("search_term_combination"));
276  $this->tpl->setVariable('TXT_COMBINATION_DEFAULT', ilSearchSettings::getInstance()->getDefaultOperator() == ilSearchSettings::OPERATOR_AND ? $lng->txt('search_all_words') : $lng->txt('search_any_word'));
277 
278  if (ilSearchSettings::getInstance()->isLuceneItemFilterEnabled()) {
279  $this->tpl->setCurrentBlock("type_sel");
280  $this->tpl->setVariable('TXT_TYPE_DEFAULT', $lng->txt("search_fast_info"));
281  $this->tpl->setVariable("TXT_TYPE", $lng->txt("search_type"));
283  $this->tpl->setVariable("ARR_IMGT", ilGlyphGUI::get(ilGlyphGUI::CARET));
284  $this->tpl->setVariable("FORM", $this->form->getHTML());
285  $this->tpl->parseCurrentBlock();
286  }
287 
288  if (ilSearchSettings::getInstance()->isDateFilterEnabled()) {
289  // begin-patch creation_date
290  $this->tpl->setVariable('TXT_FILTER_BY_CDATE', $this->lng->txt('search_filter_cd'));
291  $this->tpl->setVariable('TXT_CD_OFF', $this->lng->txt('search_off'));
292  $this->tpl->setVariable('TXT_CD_ON', $this->lng->txt('search_on'));
293  $this->tpl->setVariable('FORM_CD', $this->getCreationDateForm()->getHTML());
294  $this->tpl->setVariable("ARR_IMG_CD", ilGlyphGUI::get(ilGlyphGUI::CARET));
295  // end-patch creation_date
296  }
297 
298 
299  $this->tpl->setVariable("TXT_AREA", $lng->txt("search_area"));
300 
301  // search area form
302  $this->tpl->setVariable('SEARCH_AREA_FORM', $this->getSearchAreaForm()->getHTML());
303 
304  return true;
305  }
static prepareFormOutput($a_str, $a_strip=false)
prepares string output for html forms public
getSearchAreaForm()
Init standard search form.
static get($a_glyph, $a_text="")
Get glyph html.
initStandardSearchForm($a_mode)
Init standard search form.
global $DIC
Definition: goto.php:24
static initJavascript()
Init javascript.
+ 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 192 of file class.ilSearchGUI.php.

References ilSearchBaseGUI\getSearchAreaForm(), performSearch(), and ilSubItemListGUI\resetDetails().

193  {
194  $form = $this->getSearchAreaForm();
195 
196  $this->root_node = $form->getItemByPostVar('area')->getValue();
197  $this->search_cache->setRoot($this->root_node);
198  $this->search_cache->save();
199  $this->search_cache->deleteCachedEntries();
200 
201  include_once './Services/Object/classes/class.ilSubItemListGUI.php';
203 
204  $this->performSearch();
205  }
getSearchAreaForm()
Init standard search form.
performSearch()
Perform search.
static resetDetails()
reset details As long as static::resetDetails is not possible this method is final ...
+ Here is the call graph for this function:

Field Documentation

◆ $combination

ilSearchGUI::$combination

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

◆ $root_node

ilSearchGUI::$root_node

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

◆ $search_cache

ilSearchGUI::$search_cache = null
protected

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

◆ $string

ilSearchGUI::$string

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

Referenced by getString().

◆ $type

ilSearchGUI::$type

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

Referenced by __construct(), and __performDetailsSearch().


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