ILIAS  release_5-1 Revision 5.0.0-5477-g43f3e3fab5f
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
 ilSearchBaseGUI ()
 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...
 
 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...
 
 showMoveIntoObjectTree ()
 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...
 
 addLocator ()
 Add Locator. More...
 
 autoComplete ()
 Data resource for autoComplete. More...
 

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
 
 $settings = null
 
 $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 ()
 

Protected Attributes

 $search_cache = null
 
- Protected Attributes inherited from ilSearchBaseGUI
 $ctrl = null
 

Detailed Description

Constructor & Destructor Documentation

◆ __construct()

ilSearchGUI::__construct ( )

Constructor public.

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

References $_POST, $_SESSION, $ilUser, ilSearchBaseGUI\$lng, $type, ilSearchSettings\getInstance(), ilSearchBaseGUI\initStandardSearchForm(), ilSearchBaseGUI\SEARCH_FORM_STANDARD, setCombination(), setDetails(), setString(), and setType().

37  {
38  global $ilUser, $lng;
39 
40  $lng->loadLanguageModule("search");
41 
42  // put form values into "old" post variables
44  $this->form->checkInput();
45 
46  $new_search = isset($_POST['cmd']['performSearch']) ? true : false;
47 
48  $enabled_types = ilSearchSettings::getInstance()->getEnabledLuceneItemFilterDefinitions();
49  foreach($enabled_types as $type => $pval)
50  {
51  if($_POST['filter_type'][$type] == 1)
52  {
53  $_POST["search"]["details"][$type] = $_POST['filter_type'][$type];
54  }
55  }
56 
57  $_POST["search"]["string"] = $_POST["term"];
58  $_POST["search"]["combination"] = $_POST["combination"];
59  $_POST["search"]["type"] = $_POST["type"];
60  $_SESSION['search_root'] = $_POST["area"];
61 
62  $this->root_node = $_SESSION['search_root'] ? $_SESSION['search_root'] : ROOT_FOLDER_ID;
63  $this->setType($_POST['search']['type'] ? $_POST['search']['type'] : $_SESSION['search']['type']);
64  $this->setCombination($_POST['search']['combination'] ? $_POST['search']['combination'] : $_SESSION['search']['combination']);
65  $this->setString($_POST['search']['string'] ? $_POST['search']['string'] : $_SESSION['search']['string']);
66  #$this->setDetails($_POST['search']['details'] ? $_POST['search']['details'] : $_SESSION['search']['details']);
67  $this->setDetails($new_search ? $_POST['search']['details'] : $_SESSION['search']['details']);
68  parent::__construct();
69  }
setType($a_type)
Set/get type of search (detail or 'fast' search) public.
$_POST['username']
Definition: cron.php:12
$_SESSION["AccountId"]
setCombination($a_combination)
Set/get combination of search ('and' or 'or') public.
initStandardSearchForm($a_mode)
Init standard search form.
setDetails($a_details)
Set/get details (object types for details search) public.
setString($a_str)
Set/get search string public.
global $ilUser
Definition: imgupload.php:15
+ 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  {
657  {
658  return false;
659  }
660 
661  foreach($this->getDetails() as $key => $detail_type)
662  {
663  if(!$detail_type)
664  {
665  continue;
666  }
667 
668  switch($key)
669  {
670  case 'lms':
671  $filter[] = 'lm';
672  $filter[] = 'dbk';
673  $filter[] = 'pg';
674  $filter[] = 'st';
675  $filter[] = 'sahs';
676  $filter[] = 'htlm';
677  break;
678 
679  case 'frm':
680  $filter[] = 'frm';
681  break;
682 
683  case 'glo':
684  $filter[] = 'glo';
685  break;
686 
687  case 'exc':
688  $filter[] = 'exc';
689  break;
690 
691  case 'mcst':
692  $filter[] = 'mcst';
693  break;
694 
695  case 'tst':
696  $filter[] = 'tst';
697  $filter[] = 'svy';
698  $filter[] = 'qpl';
699  $filter[] = 'spl';
700  break;
701 
702  case 'mep':
703  $filter[] = 'mep';
704  $filter[] = 'mob';
705  break;
706 
707  case 'fil':
708  $filter[] = 'file';
709  break;
710 
711  case 'wiki':
712  $filter[] = 'wpg';
713  break;
714 
715  default:
716  $filter[] = $key;
717  }
718  }
719  return $filter ? $filter : array();
720  }
+ 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 552 of file class.ilSearchGUI.php.

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

Referenced by performSearch().

553  {
554  include_once 'Services/Search/classes/class.ilQueryParser.php';
555 
556  $query_parser = new ilQueryParser(ilUtil::stripSlashes($this->getString()));
557  $query_parser->setCombination($this->getCombination());
558  $query_parser->parse();
559 
560  if(!$query_parser->validate())
561  {
562  return $query_parser->getMessage();
563  }
564  return $query_parser;
565  }
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 457 of file class.ilSearchGUI.php.

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

Referenced by performSearch().

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

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

Referenced by performSearch().

621  {
622  include_once 'Services/Search/classes/class.ilObjectSearchFactory.php';
623 
624  $meta_search =& ilObjectSearchFactory::_getMetaDataSearchInstance($query_parser);
626  {
627  $meta_search->setFilter($this->__getFilter());
628  }
629  switch($a_type)
630  {
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 571 of file class.ilSearchGUI.php.

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

Referenced by performSearch().

572  {
573  include_once 'Services/Search/classes/class.ilObjectSearchFactory.php';
574 
575  $obj_search =& ilObjectSearchFactory::_getObjectSearchInstance($query_parser);
577  {
578  $obj_search->setFilter($this->__getFilter());
579  }
580 
581  $this->parseCreationFilter($obj_search);
582  return $obj_search->performSearch();
583  }
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 204 of file class.ilSearchGUI.php.

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

205  {
206  if((int) $_REQUEST['search_type'] == -1)
207  {
208  $a_fields = array('login','firstname','lastname','email');
209  $result_field = 'login';
210 
211  // Starting user autocomplete search
212  include_once './Services/User/classes/class.ilUserAutoComplete.php';
213  $auto = new ilUserAutoComplete();
214 
215 
216  $auto->setMoreLinkAvailable(true);
217  $auto->setSearchFields($a_fields);
218  $auto->setResultField($result_field);
219  $auto->enableFieldSearchableCheck(true);
220  $auto->setUserLimitations(true);
222 
223  $res = $auto->getList($_REQUEST['term']);
224 
225  $res_obj = json_decode($res);
226 
227  ilLoggerFactory::getLogger('sea')->debug($res);
228 
229 
230  ilLoggerFactory::getLogger('sea')->dump($res_obj->items, ilLogLevel::DEBUG);
231  if(is_array($res_obj->items))
232  {
233  echo json_encode($res_obj->items);
234  exit;
235  }
236 
237  }
238  else
239  {
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:54
static getList($a_str)
Get completion list.
Auto completion class for user lists.
static getLogger($a_component_id)
Get component logger.
if($_REQUEST['ilias_path']) define('ILIAS_HTTP_PATH' $_REQUEST['ilias_path']
Definition: index.php:7
+ Here is the call graph for this function:

◆ executeCommand()

ilSearchGUI::executeCommand ( )

Control public.

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

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

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

◆ getCombination()

ilSearchGUI::getCombination ( )

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

References ilSearchBaseGUI\SEARCH_OR.

Referenced by __parseQueryString().

136  {
137  return $this->combination ? $this->combination : ilSearchBaseGUI::SEARCH_OR;
138  }
+ Here is the caller graph for this function:

◆ getDetails()

ilSearchGUI::getDetails ( )

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

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

160  {
161  return $this->details ? $this->details : array();
162  }
+ Here is the caller graph for this function:

◆ getRootNode()

ilSearchGUI::getRootNode ( )

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

Referenced by performSearch(), and showSavedResults().

166  {
167  return $this->root_node ? $this->root_node : ROOT_FOLDER_ID;
168  }
+ Here is the caller graph for this function:

◆ getString()

ilSearchGUI::getString ( )

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

References $string.

Referenced by __parseQueryString(), and showSearch().

148  {
149  return $this->string;
150  }
+ Here is the caller graph for this function:

◆ getType()

ilSearchGUI::getType ( )

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

References ilSearchBaseGUI\SEARCH_FAST.

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

124  {
125  return $this->type ? $this->type : ilSearchBaseGUI::SEARCH_FAST;
126  }
+ Here is the caller graph for this function:

◆ initUserSearchCache()

ilSearchGUI::initUserSearchCache ( )
protected

Init user search cache.

private

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

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

Referenced by executeCommand().

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

◆ parseCreationFilter()

ilSearchGUI::parseCreationFilter ( ilObjectSearch  $search)

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

References $options, 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().

586  {
587  $options = $this->getSearchCache()->getCreationFilter();
588 
589  if(!$options['enabled'])
590  {
591  return TRUE;
592  }
593  $limit = new ilDate($options['date'],IL_CAL_UNIX);
594  $search->setCreationDateFilterDate($limit);
595 
596  switch($options['ontype'])
597  {
598  case 1:
600  break;
601 
602  case 2:
604  break;
605 
606  case 3:
608  break;
609  }
610 
611  return TRUE;
612  }
const IL_CAL_UNIX
Class for single dates.
if(!is_array($argv)) $options
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 342 of file class.ilSearchGUI.php.

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

Referenced by remoteSearch(), and storeRoot().

343  {
344  global $ilUser;
345 
346  if(!isset($_GET['page_number']) and $this->search_mode != 'in_results' )
347  {
348  unset($_SESSION['max_page']);
349  $this->search_cache->deleteCachedEntries();
350  }
351 
352  if($this->getType() == ilSearchBaseGUI::SEARCH_DETAILS and !$this->getDetails())
353  {
354  ilUtil::sendInfo($this->lng->txt('search_choose_object_type'));
355  $this->showSearch();
356  return false;
357  }
358 
359  // Step 1: parse query string
360  if(!is_object($query_parser =& $this->__parseQueryString()))
361  {
362  ilUtil::sendInfo($query_parser);
363  $this->showSearch();
364 
365  return false;
366  }
367  // Step 2: perform object search. Get an ObjectSearch object via factory. Depends on fulltext or like search type.
368  $result =& $this->__searchObjects($query_parser);
369 
370  // Step 3: perform meta keyword search. Get an MetaDataSearch object.
371  $result_meta =& $this->__searchMeta($query_parser,'keyword');
372  $result->mergeEntries($result_meta);
373 
374  $result_meta =& $this->__searchMeta($query_parser,'contribute');
375  $result->mergeEntries($result_meta);
376 
377  $result_meta =& $this->__searchMeta($query_parser,'title');
378  $result->mergeEntries($result_meta);
379 
380  $result_meta =& $this->__searchMeta($query_parser,'description');
381  $result->mergeEntries($result_meta);
382 
383  // Perform details search in object specific tables
385  {
386  $result = $this->__performDetailsSearch($query_parser,$result);
387  }
388  // Step 5: Search in results
389  if($this->search_mode == 'in_results')
390  {
391  include_once 'Services/Search/classes/class.ilSearchResult.php';
392 
393  $old_result_obj = new ilSearchResult($ilUser->getId());
394  $old_result_obj->read();
395 
396  $result->diffEntriesFromResult($old_result_obj);
397  }
398 
399 
400  // Step 4: merge and validate results
401  $result->filter($this->getRootNode(),$query_parser->getCombination() == 'and');
402  $result->save();
403  $this->showSearch();
404 
405  if(!count($result->getResults()))
406  {
407  ilUtil::sendInfo($this->lng->txt('search_no_match'));
408  }
409 
410  if($result->isLimitReached())
411  {
412  #$message = sprintf($this->lng->txt('search_limit_reached'),$this->settings->getMaxHits());
413  #ilUtil::sendInfo($message);
414  }
415 
416  // Step 6: show results
417  $this->addPager($result,'max_page');
418 
419  include_once './Services/Search/classes/class.ilSearchResultPresentation.php';
421  $presentation->setResults($result->getResultsForPresentation());
422  $presentation->setSubitemIds($result->getSubitemIds());
423  $presentation->setPreviousNext($this->prev_link, $this->next_link);
424 
425  if($presentation->render())
426  {
427 // $this->tpl->setVariable('SEARCH_RESULTS',$presentation->getHTML());
428  $this->tpl->setVariable('RESULTS_TABLE',$presentation->getHTML(true));
429  }
430 
431  return true;
432  }
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.
& __searchObjects(&$query_parser)
Search in obect title,desctiption.
global $ilUser
Definition: imgupload.php:15
& __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 436 of file class.ilSearchGUI.php.

Referenced by executeCommand().

437  {
438  global $ilTabs, $ilHelp;
439 
440  parent::prepareOutput();
441 
442  $ilHelp->setScreenIdComponent("src");
443 
444  $ilTabs->addTab("search", $this->lng->txt("search"),
445  $this->ctrl->getLinkTarget($this));
446 
447  if (!$this->settings->getHideAdvancedSearch())
448  {
449  $ilTabs->addTab("adv_search", $this->lng->txt("search_advanced"),
450  $this->ctrl->getLinkTargetByClass('iladvancedsearchgui'));
451  }
452 
453  $ilTabs->activateTab("search");
454  }
+ Here is the caller graph for this function:

◆ remoteSearch()

ilSearchGUI::remoteSearch ( )

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

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

176  {
177  $this->setString(ilUtil::stripSlashes($_POST['queryString']));
178  $this->setRootNode((int) $_POST['root_id']);
179  $this->performSearch();
180 
181  }
$_POST['username']
Definition: cron.php:12
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.
+ 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 131 of file class.ilSearchGUI.php.

References $_SESSION.

Referenced by __construct().

132  {
133  $_SESSION['search']['combination'] = $this->combination = $a_combination;
134  }
$_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 155 of file class.ilSearchGUI.php.

References $_SESSION.

Referenced by __construct().

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

◆ setRootNode()

ilSearchGUI::setRootNode (   $a_node_id)

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

References $_SESSION.

Referenced by remoteSearch().

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

◆ setString()

ilSearchGUI::setString (   $a_str)

Set/get search string public.

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

References $_SESSION.

Referenced by __construct(), and remoteSearch().

144  {
145  $_SESSION['search']['string'] = $this->string = $a_str;
146  }
$_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 119 of file class.ilSearchGUI.php.

References $_SESSION.

Referenced by __construct().

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

◆ showSavedResults()

ilSearchGUI::showSavedResults ( )

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

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

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

◆ showSearch()

ilSearchGUI::showSearch ( )

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

References $ilCtrl, 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 $ilLocator, $ilCtrl, $lng;
252 
253  // include js needed
254  include_once("./Services/UIComponent/Overlay/classes/class.ilOverlayGUI.php");
256  $this->tpl->addJavascript("./Services/Search/js/Search.js");
257 
258  include_once("./Services/UIComponent/Glyph/classes/class.ilGlyphGUI.php");
259 
260  $this->tpl->addBlockFile('ADM_CONTENT','adm_content','tpl.search.html','Services/Search');
261  $this->tpl->setVariable("FORM_ACTION", $ilCtrl->getFormAction($this,'performSearch'));
262  $this->tpl->setVariable("TERM", ilUtil::prepareFormOutput($this->getString()));
263  include_once("./Services/UIComponent/Button/classes/class.ilSubmitButton.php");
265  $btn->setCommand("performSearch");
266  $btn->setCaption("search");
267  $this->tpl->setVariable("SUBMIT_BTN",$btn->render());
268  $this->tpl->setVariable("TXT_OPTIONS", $lng->txt("options"));
269  $this->tpl->setVariable("ARR_IMG", ilGlyphGUI::get(ilGlyphGUI::CARET));
270  $this->tpl->setVariable("TXT_COMBINATION", $lng->txt("search_term_combination"));
271  $this->tpl->setVariable('TXT_COMBINATION_DEFAULT', ilSearchSettings::getInstance()->getDefaultOperator() == ilSearchSettings::OPERATOR_AND ? $lng->txt('search_all_words') : $lng->txt('search_any_word'));
272 
273  if (ilSearchSettings::getInstance()->isLuceneItemFilterEnabled())
274  {
275  $this->tpl->setCurrentBlock("type_sel");
276  $this->tpl->setVariable('TXT_TYPE_DEFAULT',$lng->txt("search_fast_info"));
277  $this->tpl->setVariable("TXT_TYPE", $lng->txt("search_type"));
279  $this->tpl->setVariable("ARR_IMGT", ilGlyphGUI::get(ilGlyphGUI::CARET));
280  $this->tpl->setVariable("FORM", $this->form->getHTML());
281  $this->tpl->parseCurrentBlock();
282  }
283 
284  if(ilSearchSettings::getInstance()->isDateFilterEnabled())
285  {
286  // begin-patch creation_date
287  $this->tpl->setVariable('TXT_FILTER_BY_CDATE',$this->lng->txt('search_filter_cd'));
288  $this->tpl->setVariable('TXT_CD_OFF',$this->lng->txt('search_off'));
289  $this->tpl->setVariable('FORM_CD',$this->getCreationDateForm()->getHTML());
290  $this->tpl->setVariable("ARR_IMG_CD", ilGlyphGUI::get(ilGlyphGUI::CARET));
291  // end-patch creation_date
292  }
293 
294 
295  $this->tpl->setVariable("TXT_AREA", $lng->txt("search_area"));
296 
297  // search area form
298  $this->tpl->setVariable('SEARCH_AREA_FORM', $this->getSearchAreaForm()->getHTML());
299 
300  return true;
301  }
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.
global $ilCtrl
Definition: ilias.php:18
initStandardSearchForm($a_mode)
Init standard search form.
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 186 of file class.ilSearchGUI.php.

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

187  {
188  $form = $this->getSearchAreaForm();
189 
190  $this->root_node = $form->getItemByPostVar('area')->getValue();
191  $this->search_cache->setRoot($this->root_node);
192  $this->search_cache->save();
193  $this->search_cache->deleteCachedEntries();
194 
195  include_once './Services/Object/classes/class.ilSubItemListGUI.php';
197 
198  $this->performSearch();
199  }
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().


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