ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
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...
 
 keepObjectsInClipboardObject ()
 cancel action but keep objects in clipboard
Returns
void
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  if ($_POST['filter_type'][$type] == 1) {
51  $_POST["search"]["details"][$type] = $_POST['filter_type'][$type];
52  }
53  }
54 
55  $_POST["search"]["string"] = $_POST["term"];
56  $_POST["search"]["combination"] = $_POST["combination"];
57  $_POST["search"]["type"] = $_POST["type"];
58  $_SESSION['search_root'] = $_POST["area"];
59 
60  $this->root_node = $_SESSION['search_root'] ? $_SESSION['search_root'] : ROOT_FOLDER_ID;
61  $this->setType($_POST['search']['type'] ? $_POST['search']['type'] : $_SESSION['search']['type']);
62  $this->setCombination($_POST['search']['combination'] ? $_POST['search']['combination'] : $_SESSION['search']['combination']);
63  $this->setString($_POST['search']['string'] ? $_POST['search']['string'] : $_SESSION['search']['string']);
64  #$this->setDetails($_POST['search']['details'] ? $_POST['search']['details'] : $_SESSION['search']['details']);
65  $this->setDetails($new_search ? $_POST['search']['details'] : $_SESSION['search']['details']);
66  parent::__construct();
67  }
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 627 of file class.ilSearchGUI.php.

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

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

628  {
629  if ($this->getType() != ilSearchBaseGUI::SEARCH_DETAILS) {
630  return false;
631  }
632 
633  foreach ($this->getDetails() as $key => $detail_type) {
634  if (!$detail_type) {
635  continue;
636  }
637 
638  switch ($key) {
639  case 'lms':
640  $filter[] = 'lm';
641  $filter[] = 'dbk';
642  $filter[] = 'pg';
643  $filter[] = 'st';
644  $filter[] = 'sahs';
645  $filter[] = 'htlm';
646  break;
647 
648  case 'frm':
649  $filter[] = 'frm';
650  break;
651 
652  case 'glo':
653  $filter[] = 'glo';
654  break;
655 
656  case 'exc':
657  $filter[] = 'exc';
658  break;
659 
660  case 'mcst':
661  $filter[] = 'mcst';
662  break;
663 
664  case 'tst':
665  $filter[] = 'tst';
666  $filter[] = 'svy';
667  $filter[] = 'qpl';
668  $filter[] = 'spl';
669  break;
670 
671  case 'mep':
672  $filter[] = 'mep';
673  $filter[] = 'mob';
674  break;
675 
676  case 'fil':
677  $filter[] = 'file';
678  break;
679 
680  case 'wiki':
681  $filter[] = 'wpg';
682  break;
683 
684  default:
685  $filter[] = $key;
686  }
687  }
688  return $filter ? $filter : array();
689  }
Create styles array
The data for the language used.
$key
Definition: croninfo.php:18
+ 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 531 of file class.ilSearchGUI.php.

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

Referenced by performSearch().

532  {
533  include_once 'Services/Search/classes/class.ilQueryParser.php';
534 
535  $query_parser = new ilQueryParser(ilUtil::stripSlashes($this->getString()));
536  $query_parser->setCombination($this->getCombination());
537  $query_parser->parse();
538 
539  if (!$query_parser->validate()) {
540  return $query_parser->getMessage();
541  }
542  return $query_parser;
543  }
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 439 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(), array, and getDetails().

Referenced by performSearch().

440  {
441  foreach ($this->getDetails() as $type => $enabled) {
442  if (!$enabled) {
443  continue;
444  }
445 
446  switch ($type) {
447  case 'crs':
448  $crs_search = ilObjectSearchFactory::_getObjectSearchInstance($query_parser);
449  $crs_search->setFilter(array('crs'));
450  $result->mergeEntries($crs_search->performSearch());
451  break;
452 
453  case 'grp':
454  $grp_search = ilObjectSearchFactory::_getObjectSearchInstance($query_parser);
455  $grp_search->setFilter(array('grp'));
456  $result->mergeEntries($grp_search->performSearch());
457  break;
458 
459  case 'lms':
460  $content_search =&ilObjectSearchFactory::_getLMContentSearchInstance($query_parser);
461  $content_search->setFilter($this->__getFilter());
462  $result->mergeEntries($content_search->performSearch());
463  break;
464 
465  case 'frm':
466  $forum_search =&ilObjectSearchFactory::_getForumSearchInstance($query_parser);
467  $forum_search->setFilter($this->__getFilter());
468  $result->mergeEntries($forum_search->performSearch());
469  break;
470 
471  case 'glo':
472  // Glossary term definition pages
473  $gdf_search =&ilObjectSearchFactory::_getLMContentSearchInstance($query_parser);
474  $gdf_search->setFilter(array('gdf'));
475  $result->mergeEntries($gdf_search->performSearch());
476  // Glossary terms
477  $gdf_term_search =&ilObjectSearchFactory::_getGlossaryDefinitionSearchInstance($query_parser);
478  $result->mergeEntries($gdf_term_search->performSearch());
479  break;
480 
481  case 'exc':
482  $exc_search =&ilObjectSearchFactory::_getExerciseSearchInstance($query_parser);
483  $exc_search->setFilter($this->__getFilter());
484  $result->mergeEntries($exc_search->performSearch());
485  break;
486 
487  case 'mcst':
488  $mcst_search =&ilObjectSearchFactory::_getMediaCastSearchInstance($query_parser);
489  $result->mergeEntries($mcst_search->performSearch());
490  break;
491 
492  case 'tst':
493  $tst_search =&ilObjectSearchFactory::_getTestSearchInstance($query_parser);
494  $tst_search->setFilter($this->__getFilter());
495  $result->mergeEntries($tst_search->performSearch());
496  break;
497 
498  case 'mep':
499  $mep_search =&ilObjectSearchFactory::_getMediaPoolSearchInstance($query_parser);
500  $mep_search->setFilter($this->__getFilter());
501  $result->mergeEntries($mep_search->performSearch());
502 
503  // Mob keyword search
504  $mob_search = ilObjectSearchFactory::_getMediaPoolSearchInstance($query_parser);
505  $mob_search->setFilter($this->__getFilter());
506  $result->mergeEntries($mob_search->performKeywordSearch());
507 
508  break;
509 
510  case 'wiki':
511  $wiki_search =&ilObjectSearchFactory::_getWikiContentSearchInstance($query_parser);
512  $wiki_search->setFilter($this->__getFilter());
513  $result->mergeEntries($wiki_search->performSearch());
514 
515  /*$result_meta =& $this->__searchMeta($query_parser,'title');
516  $result->mergeEntries($result_meta);
517  $result_meta =& $this->__searchMeta($query_parser,'description');
518  $result->mergeEntries($result_meta);*/
519  break;
520 
521  }
522  }
523  return $result;
524  }
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 595 of file class.ilSearchGUI.php.

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

Referenced by performSearch().

596  {
597  include_once 'Services/Search/classes/class.ilObjectSearchFactory.php';
598 
599  $meta_search =&ilObjectSearchFactory::_getMetaDataSearchInstance($query_parser);
600  if ($this->getType() == ilSearchBaseGUI::SEARCH_DETAILS) {
601  $meta_search->setFilter($this->__getFilter());
602  }
603  switch ($a_type) {
604  case 'keyword':
605  $meta_search->setMode('keyword');
606  break;
607 
608  case 'contribute':
609  $meta_search->setMode('contribute');
610  break;
611 
612  case 'title':
613  $meta_search->setMode('title');
614  break;
615 
616  case 'description':
617  $meta_search->setMode('description');
618  break;
619  }
620  return $meta_search->performSearch();
621  }
$a_type
Definition: workflow.php:92
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 549 of file class.ilSearchGUI.php.

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

Referenced by performSearch().

550  {
551  include_once 'Services/Search/classes/class.ilObjectSearchFactory.php';
552 
553  $obj_search =&ilObjectSearchFactory::_getObjectSearchInstance($query_parser);
554  if ($this->getType() == ilSearchBaseGUI::SEARCH_DETAILS) {
555  $obj_search->setFilter($this->__getFilter());
556  }
557 
558  $this->parseCreationFilter($obj_search);
559  return $obj_search->performSearch();
560  }
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 199 of file class.ilSearchGUI.php.

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

200  {
201  if ((int) $_REQUEST['search_type'] == -1) {
202  $a_fields = array('login','firstname','lastname','email');
203  $result_field = 'login';
204 
205  // Starting user autocomplete search
206  include_once './Services/User/classes/class.ilUserAutoComplete.php';
207  $auto = new ilUserAutoComplete();
208 
209 
210  $auto->setMoreLinkAvailable(true);
211  $auto->setSearchFields($a_fields);
212  $auto->setResultField($result_field);
213  $auto->enableFieldSearchableCheck(true);
214  $auto->setUserLimitations(true);
215 
216  $res = $auto->getList($_REQUEST['term']);
217 
218  $res_obj = json_decode($res);
219 
220  ilLoggerFactory::getLogger('sea')->debug($res);
221 
222 
223  ilLoggerFactory::getLogger('sea')->dump($res_obj->items, ilLogLevel::DEBUG);
224  if (is_array($res_obj->items)) {
225  echo json_encode($res_obj->items);
226  exit;
227  }
228  } else {
229  $q = $_REQUEST["term"];
230  include_once("./Services/Search/classes/class.ilSearchAutoComplete.php");
232  ilLoggerFactory::getLogger('sea')->dump(json_decode($list));
233  echo $list;
234  exit;
235  }
236  }
if(isset($_REQUEST['delete'])) $list
Definition: registry.php:41
static getList($a_str)
Get completion list.
Auto completion class for user lists.
foreach($_POST as $key=> $value) $res
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 74 of file class.ilSearchGUI.php.

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

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

◆ getCombination()

ilSearchGUI::getCombination ( )

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

References ilSearchBaseGUI\SEARCH_OR.

Referenced by __parseQueryString().

132  {
133  return $this->combination ? $this->combination : ilSearchBaseGUI::SEARCH_OR;
134  }
+ Here is the caller graph for this function:

◆ getDetails()

ilSearchGUI::getDetails ( )

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

References array.

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

156  {
157  return $this->details ? $this->details : array();
158  }
Create styles array
The data for the language used.
+ Here is the caller graph for this function:

◆ getRootNode()

ilSearchGUI::getRootNode ( )

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

Referenced by performSearch(), and showSavedResults().

162  {
163  return $this->root_node ? $this->root_node : ROOT_FOLDER_ID;
164  }
+ Here is the caller graph for this function:

◆ getString()

ilSearchGUI::getString ( )

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

References $string.

Referenced by __parseQueryString(), and showSearch().

144  {
145  return $this->string;
146  }
+ Here is the caller graph for this function:

◆ getType()

ilSearchGUI::getType ( )

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

References ilSearchBaseGUI\SEARCH_FAST.

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

120  {
121  return $this->type ? $this->type : ilSearchBaseGUI::SEARCH_FAST;
122  }
+ Here is the caller graph for this function:

◆ initUserSearchCache()

ilSearchGUI::initUserSearchCache ( )
protected

Init user search cache.

private

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

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

Referenced by executeCommand().

698  {
699  global $ilUser;
700 
701  include_once('Services/Search/classes/class.ilUserSearchCache.php');
702  $this->search_cache = ilUserSearchCache::_getInstance($ilUser->getId());
703  $this->search_cache->switchSearchType(ilUserSearchCache::DEFAULT_SEARCH);
704 
705  if ($_GET['page_number']) {
706  $this->search_cache->setResultPageNumber((int) $_GET['page_number']);
707  }
708  if (isset($_POST['cmd']['performSearch'])) {
709  $this->search_cache->setQuery(ilUtil::stripSlashes($_POST['term']));
710  $this->search_cache->setCreationFilter($this->loadCreationFilter());
711  $this->search_cache->save();
712  }
713  }
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 562 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().

563  {
564  $options = $this->getSearchCache()->getCreationFilter();
565 
566  if (!$options['enabled']) {
567  return true;
568  }
569  $limit = new ilDate($options['date'], IL_CAL_UNIX);
570  $search->setCreationDateFilterDate($limit);
571 
572  switch ($options['ontype']) {
573  case 1:
575  break;
576 
577  case 2:
579  break;
580 
581  case 3:
583  break;
584  }
585 
586  return true;
587  }
const IL_CAL_UNIX
Class for single dates.
setCreationDateFilterDate(ilDate $day)
Set creation date filter.
setCreationDateFilterOperator($a_operator)
if(!isset($_REQUEST['ReturnTo'])) if(!isset($_REQUEST['AuthId'])) $options
Definition: as_login.php:20
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 327 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().

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

References settings().

Referenced by executeCommand().

414  {
415  global $ilTabs, $ilHelp;
416 
417  parent::prepareOutput();
418 
419  $ilHelp->setScreenIdComponent("src");
420 
421  $ilTabs->addTab(
422  "search",
423  $this->lng->txt("search"),
424  $this->ctrl->getLinkTarget($this)
425  );
426 
427  if (!$this->settings->getHideAdvancedSearch()) {
428  $ilTabs->addTab(
429  "adv_search",
430  $this->lng->txt("search_advanced"),
431  $this->ctrl->getLinkTargetByClass('iladvancedsearchgui')
432  );
433  }
434 
435  $ilTabs->activateTab("search");
436  }
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 171 of file class.ilSearchGUI.php.

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

172  {
173  $this->setString(ilUtil::stripSlashes($_POST['queryString']));
174  $this->setRootNode((int) $_POST['root_id']);
175  $this->performSearch();
176  }
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 127 of file class.ilSearchGUI.php.

References $_SESSION.

Referenced by __construct().

128  {
129  $_SESSION['search']['combination'] = $this->combination = $a_combination;
130  }
$_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 151 of file class.ilSearchGUI.php.

References $_SESSION.

Referenced by __construct().

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

◆ setRootNode()

ilSearchGUI::setRootNode (   $a_node_id)

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

References $_SESSION.

Referenced by remoteSearch().

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

◆ setString()

ilSearchGUI::setString (   $a_str)

Set/get search string public.

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

References $_SESSION.

Referenced by __construct(), and remoteSearch().

140  {
141  $_SESSION['search']['string'] = $this->string = $a_str;
142  }
$_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 115 of file class.ilSearchGUI.php.

References $_SESSION, and $a_type.

Referenced by __construct().

116  {
117  $_SESSION['search']['type'] = $this->type = $a_type;
118  }
$_SESSION["AccountId"]
$a_type
Definition: workflow.php:92
+ Here is the caller graph for this function:

◆ showSavedResults()

ilSearchGUI::showSavedResults ( )

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

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

291  {
292  global $ilUser;
293 
294  // Read old result sets
295  include_once 'Services/Search/classes/class.ilSearchResult.php';
296 
297  $result_obj = new ilSearchResult($ilUser->getId());
298  $result_obj->read();
299  $result_obj->filterResults($this->getRootNode());
300 
301  $this->showSearch();
302 
303  // Show them
304  if (count($result_obj->getResults())) {
305  $this->addPager($result_obj, 'max_page');
306 
307  include_once './Services/Search/classes/class.ilSearchResultPresentation.php';
309  $presentation->setResults($result_obj->getResultsForPresentation());
310  $presentation->setSubitemIds($result_obj->getSubitemIds());
311  $presentation->setPreviousNext($this->prev_link, $this->next_link);
312  #$presentation->setSearcher($searcher);
313 
314  if ($presentation->render()) {
315  // $this->tpl->setVariable('SEARCH_RESULTS',$presentation->getHTML());
316  $this->tpl->setVariable('RESULTS_TABLE', $presentation->getHTML(true));
317  }
318  }
319 
320  return true;
321  }
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 238 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().

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

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

182  {
183  $form = $this->getSearchAreaForm();
184 
185  $this->root_node = $form->getItemByPostVar('area')->getValue();
186  $this->search_cache->setRoot($this->root_node);
187  $this->search_cache->save();
188  $this->search_cache->deleteCachedEntries();
189 
190  include_once './Services/Object/classes/class.ilSubItemListGUI.php';
192 
193  $this->performSearch();
194  }
getSearchAreaForm()
Init standard search form.
performSearch()
Perform search.
static resetDetails()
reset details As long as static::resetDetails is not possible this method is final ...
if(isset($_POST['submit'])) $form
+ 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: