ILIAS  release_5-2 Revision v5.2.25-18-g3f80b828510
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...
 
 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
 
 $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
 

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.
$_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.
$ilUser
Definition: imgupload.php:18
setString($a_str)
Set/get search string public.
$_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 653 of file class.ilSearchGUI.php.

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

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

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

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

Referenced by performSearch().

552  {
553  include_once 'Services/Search/classes/class.ilQueryParser.php';
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  {
561  return $query_parser->getMessage();
562  }
563  return $query_parser;
564  }
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 456 of file class.ilSearchGUI.php.

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

Referenced by performSearch().

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

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

Referenced by performSearch().

620  {
621  include_once 'Services/Search/classes/class.ilObjectSearchFactory.php';
622 
623  $meta_search =& ilObjectSearchFactory::_getMetaDataSearchInstance($query_parser);
625  {
626  $meta_search->setFilter($this->__getFilter());
627  }
628  switch($a_type)
629  {
630  case 'keyword':
631  $meta_search->setMode('keyword');
632  break;
633 
634  case 'contribute':
635  $meta_search->setMode('contribute');
636  break;
637 
638  case 'title':
639  $meta_search->setMode('title');
640  break;
641 
642  case 'description':
643  $meta_search->setMode('description');
644  break;
645  }
646  return $meta_search->performSearch();
647  }
$a_type
Definition: workflow.php:93
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 570 of file class.ilSearchGUI.php.

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

Referenced by performSearch().

571  {
572  include_once 'Services/Search/classes/class.ilObjectSearchFactory.php';
573 
574  $obj_search =& ilObjectSearchFactory::_getObjectSearchInstance($query_parser);
576  {
577  $obj_search->setFilter($this->__getFilter());
578  }
579 
580  $this->parseCreationFilter($obj_search);
581  return $obj_search->performSearch();
582  }
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 $res, array, ilLogLevel\DEBUG, exit, ilSearchAutoComplete\getList(), and ilLoggerFactory\getLogger().

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);
221 
222  $res = $auto->getList($_REQUEST['term']);
223 
224  $res_obj = json_decode($res);
225 
226  ilLoggerFactory::getLogger('sea')->debug($res);
227 
228 
229  ilLoggerFactory::getLogger('sea')->dump($res_obj->items, ilLogLevel::DEBUG);
230  if(is_array($res_obj->items))
231  {
232  echo json_encode($res_obj->items);
233  exit;
234  }
235 
236  }
237  else
238  {
239  $q = $_REQUEST["term"];
240  include_once("./Services/Search/classes/class.ilSearchAutoComplete.php");
241  $list = ilSearchAutoComplete::getList($q);
242  ilLoggerFactory::getLogger('sea')->dump(json_decode($list));
243  echo $list;
244  exit;
245  }
246  }
static getList($a_str)
Get completion list.
Auto completion class for user lists.
Create styles array
The data for the language used.
static getLogger($a_component_id)
Get component logger.
+ 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.

References array.

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

160  {
161  return $this->details ? $this->details : array();
162  }
Create styles array
The data for the language used.
+ 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 727 of file class.ilSearchGUI.php.

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

Referenced by executeCommand().

728  {
729  global $ilUser;
730 
731  include_once('Services/Search/classes/class.ilUserSearchCache.php');
732  $this->search_cache = ilUserSearchCache::_getInstance($ilUser->getId());
733  $this->search_cache->switchSearchType(ilUserSearchCache::DEFAULT_SEARCH);
734 
735  if($_GET['page_number'])
736  {
737  $this->search_cache->setResultPageNumber((int) $_GET['page_number']);
738  }
739  if(isset($_POST['cmd']['performSearch']))
740  {
741  $this->search_cache->setQuery(ilUtil::stripSlashes($_POST['term']));
742  $this->search_cache->setCreationFilter($this->loadCreationFilter());
743  $this->search_cache->save();
744  }
745  }
loadCreationFilter()
Load creation date filter.
$_GET["client_id"]
static _getInstance($a_usr_id)
Get singleton instance.
$ilUser
Definition: imgupload.php:18
static stripSlashes($a_str, $a_strip_html=true, $a_allow="")
strip slashes if magic qoutes is enabled
$_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 584 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().

585  {
586  $options = $this->getSearchCache()->getCreationFilter();
587 
588  if(!$options['enabled'])
589  {
590  return TRUE;
591  }
592  $limit = new ilDate($options['date'],IL_CAL_UNIX);
593  $search->setCreationDateFilterDate($limit);
594 
595  switch($options['ontype'])
596  {
597  case 1:
599  break;
600 
601  case 2:
603  break;
604 
605  case 3:
607  break;
608  }
609 
610  return TRUE;
611  }
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 341 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().

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

References settings().

Referenced by executeCommand().

436  {
437  global $ilTabs, $ilHelp;
438 
439  parent::prepareOutput();
440 
441  $ilHelp->setScreenIdComponent("src");
442 
443  $ilTabs->addTab("search", $this->lng->txt("search"),
444  $this->ctrl->getLinkTarget($this));
445 
446  if (!$this->settings->getHideAdvancedSearch())
447  {
448  $ilTabs->addTab("adv_search", $this->lng->txt("search_advanced"),
449  $this->ctrl->getLinkTargetByClass('iladvancedsearchgui'));
450  }
451 
452  $ilTabs->activateTab("search");
453  }
settings()
Definition: settings.php:2
+ Here is the call graph for this function:
+ 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  }
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 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, and $a_type.

Referenced by __construct().

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

◆ showSavedResults()

ilSearchGUI::showSavedResults ( )

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

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

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

◆ showSearch()

ilSearchGUI::showSearch ( )

Definition at line 248 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().

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