ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
ilSearchGUI Class Reference

Class ilSearchGUI. More...

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

Public Member Functions

 __construct ()
 Constructor @access public. More...
 
 executeCommand ()
 Control @access public. More...
 
 setType ($a_type)
 Set/get type of search (detail or 'fast' search) @access public. More...
 
 getType ()
 
 setCombination ($a_combination)
 Set/get combination of search ('and' or 'or') @access public. More...
 
 getCombination ()
 
 setString ($a_str)
 Set/get search string @access public. More...
 
 getString ()
 
 setDetails ($a_details)
 Set/get details (object types for details search) @access 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 @access 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...
 
 showPasteTree ()
 Target selection cut. More...
 
 performPasteIntoMultipleObjects ()
 Perform paste into multiple objects. More...
 
 clear ()
 clear clipboard More...
 
 enableAdministrationPanel ()
 Enable administration panel. More...
 
 disableAdministrationPanel ()
 Disable administration panel. More...
 
 keepObjectsInClipboardObject ()
 cancel action but keep objects in clipboard
Returns
void
More...
 
 addLocator ()
 Add Locator. More...
 
 autoComplete ()
 Data resource for autoComplete. More...
 
 addToDeskObject ()
 Add desktop item @access public. More...
 
 removeFromDeskObject ()
 Remove from desktop @access public. More...
 
 delete ()
 Show delete confirmation. More...
 
 cancelDelete ()
 Cancel delete. More...
 
 performDelete ()
 Perform Delete. More...
 
 cut ()
 Cut object. More...
 
 showLinkIntoMultipleObjectsTree ()
 Target selection link. More...
 
 showPasteTree ()
 Target selection cut. More...
 
 performPasteIntoMultipleObjects ()
 Perform paste into multiple objects. More...
 
 paste ()
 Paste. More...
 
 clear ()
 clear clipboard More...
 
 enableAdministrationPanel ()
 Enable administration panel. More...
 
 disableAdministrationPanel ()
 Disable administration panel. More...
 
 cancelMoveLinkObject ()
 Cancel move/link. More...
 
 keepObjectsInClipboardObject ()
 cancel action but keep objects in clipboard 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

Class ilSearchGUI.

GUI class for 'simple' search

Author
Stefan Meyer smeye.nosp@m.r.il.nosp@m.ias@g.nosp@m.mx.d.nosp@m.e
Version
$Id$ @ilCtrl_Calls ilSearchGUI: ilPropertyFormGUI @ilCtrl_Calls ilSearchGUI: ilObjectGUI, ilContainerGUI @ilCtrl_Calls ilSearchGUI: ilObjCategoryGUI, ilObjCourseGUI, ilObjFolderGUI, ilObjGroupGUI @ilCtrl_Calls ilSearchGUI: ilObjRootFolderGUIGUI, ilObjectCopyGUI

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

Constructor & Destructor Documentation

◆ __construct()

ilSearchGUI::__construct ( )

Constructor @access public.

Reimplemented from ilSearchBaseGUI.

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

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

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

+ 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 @access public

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

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

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

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

+ 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 @access public

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

550 {
551 include_once 'Services/Search/classes/class.ilQueryParser.php';
552
553 $query_parser = new ilQueryParser(ilUtil::stripSlashes($this->getString()));
554 $query_parser->setCombination($this->getCombination());
555 $query_parser->parse();
556
557 if (!$query_parser->validate()) {
558 return $query_parser->getMessage();
559 }
560 return $query_parser;
561 }
static stripSlashes($a_str, $a_strip_html=true, $a_allow="")
strip slashes if magic qoutes is enabled

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

Referenced by performSearch().

+ 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.

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

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

Referenced by performSearch().

+ 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 @access public

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

614 {
615 include_once 'Services/Search/classes/class.ilObjectSearchFactory.php';
616
617 $meta_search = &ilObjectSearchFactory::_getMetaDataSearchInstance($query_parser);
619 $meta_search->setFilter($this->__getFilter());
620 }
621 switch ($a_type) {
622 case 'keyword':
623 $meta_search->setMode('keyword');
624 break;
625
626 case 'contribute':
627 $meta_search->setMode('contribute');
628 break;
629
630 case 'title':
631 $meta_search->setMode('title');
632 break;
633
634 case 'description':
635 $meta_search->setMode('description');
636 break;
637 }
638 return $meta_search->performSearch();
639 }
static _getMetaDataSearchInstance($query_parser)
get reference of ilFulltext/LikeMetaDataSearch.
$a_type
Definition: workflow.php:92

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

Referenced by performSearch().

+ 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 @access public

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

568 {
569 include_once 'Services/Search/classes/class.ilObjectSearchFactory.php';
570
571 $obj_search = &ilObjectSearchFactory::_getObjectSearchInstance($query_parser);
573 $obj_search->setFilter($this->__getFilter());
574 }
575
576 $this->parseCreationFilter($obj_search);
577 return $obj_search->performSearch();
578 }
parseCreationFilter(ilObjectSearch $search)

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

Referenced by performSearch().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ autoComplete()

ilSearchGUI::autoComplete ( )

Data resource for autoComplete.

Reimplemented from ilSearchBaseGUI.

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

206 {
207 if ((int) $_REQUEST['search_type'] == -1) {
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 echo json_encode($res_obj->items);
232 exit;
233 }
234 } else {
235 $q = $_REQUEST["term"];
236 include_once("./Services/Search/classes/class.ilSearchAutoComplete.php");
238 ilLoggerFactory::getLogger('sea')->dump(json_decode($list));
239 echo $list;
240 exit;
241 }
242 }
exit
Definition: backend.php:16
static getLogger($a_component_id)
Get component logger.
static getList($a_str)
Get completion list.
Auto completion class for user lists.
if(isset($_REQUEST['delete'])) $list
Definition: registry.php:41
foreach($_POST as $key=> $value) $res

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

+ Here is the call graph for this function:

◆ executeCommand()

ilSearchGUI::executeCommand ( )

Control @access public.

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

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

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

+ Here is the call graph for this function:

◆ getCombination()

ilSearchGUI::getCombination ( )

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

138 {
139 return $this->combination ? $this->combination : ilSearchBaseGUI::SEARCH_OR;
140 }

References ilSearchBaseGUI\SEARCH_OR.

Referenced by __parseQueryString().

+ Here is the caller graph for this function:

◆ getDetails()

ilSearchGUI::getDetails ( )

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

162 {
163 return $this->details ? $this->details : array();
164 }

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

+ Here is the caller graph for this function:

◆ getRootNode()

ilSearchGUI::getRootNode ( )

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

168 {
169 return $this->root_node ? $this->root_node : ROOT_FOLDER_ID;
170 }

Referenced by performSearch(), and showSavedResults().

+ Here is the caller graph for this function:

◆ getString()

ilSearchGUI::getString ( )

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

150 {
151 return $this->string;
152 }

References $string.

Referenced by __parseQueryString(), and showSearch().

+ Here is the caller graph for this function:

◆ getType()

ilSearchGUI::getType ( )

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

126 {
127 return $this->type ? $this->type : ilSearchBaseGUI::SEARCH_FAST;
128 }

References ilSearchBaseGUI\SEARCH_FAST.

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

+ Here is the caller graph for this function:

◆ initUserSearchCache()

ilSearchGUI::initUserSearchCache ( )
protected

Init user search cache.

@access private

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

716 {
717 global $DIC;
718
719 $ilUser = $DIC['ilUser'];
720
721 include_once('Services/Search/classes/class.ilUserSearchCache.php');
722 $this->search_cache = ilUserSearchCache::_getInstance($ilUser->getId());
723 $this->search_cache->switchSearchType(ilUserSearchCache::DEFAULT_SEARCH);
724
725 if ($_GET['page_number']) {
726 $this->search_cache->setResultPageNumber((int) $_GET['page_number']);
727 }
728 if (isset($_POST['cmd']['performSearch'])) {
729 $this->search_cache->setQuery(ilUtil::stripSlashes($_POST['term']));
730 $this->search_cache->setCreationFilter($this->loadCreationFilter());
731 $this->search_cache->save();
732 }
733 }
$_GET["client_id"]
loadCreationFilter()
Load creation date filter.
static _getInstance($a_usr_id)
Get singleton instance.

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

Referenced by executeCommand().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ parseCreationFilter()

ilSearchGUI::parseCreationFilter ( ilObjectSearch  $search)

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

581 {
582 $options = $this->getSearchCache()->getCreationFilter();
583
584 if (!$options['enabled']) {
585 return true;
586 }
587 $limit = new ilDate($options['date'], IL_CAL_UNIX);
588 $search->setCreationDateFilterDate($limit);
589
590 switch ($options['ontype']) {
591 case 1:
593 break;
594
595 case 2:
597 break;
598
599 case 3:
601 break;
602 }
603
604 return true;
605 }
const IL_CAL_UNIX
Class for single dates.
setCreationDateFilterDate(ilDate $day)
Set creation date filter.
setCreationDateFilterOperator($a_operator)
getSearchCache()
Get user search cache.

References PHPMailer\PHPMailer\$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().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ performSearch()

ilSearchGUI::performSearch ( )

Perform search.

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

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

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

Referenced by remoteSearch(), and storeRoot().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ prepareOutput()

ilSearchGUI::prepareOutput ( )

Reimplemented from ilSearchBaseGUI.

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

429 {
430 global $DIC;
431
432 $ilTabs = $DIC['ilTabs'];
433 $ilHelp = $DIC['ilHelp'];
434
435 parent::prepareOutput();
436
437 $ilHelp->setScreenIdComponent("src");
438
439 $ilTabs->addTab(
440 "search",
441 $this->lng->txt("search"),
442 $this->ctrl->getLinkTarget($this)
443 );
444
445 if (!$this->settings->getHideAdvancedSearch()) {
446 $ilTabs->addTab(
447 "adv_search",
448 $this->lng->txt("search_advanced"),
449 $this->ctrl->getLinkTargetByClass('iladvancedsearchgui')
450 );
451 }
452
453 $ilTabs->activateTab("search");
454 }
settings()
Definition: settings.php:2

References $DIC, and settings().

Referenced by executeCommand().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ remoteSearch()

ilSearchGUI::remoteSearch ( )

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

178 {
179 $this->setString(ilUtil::stripSlashes($_POST['queryString']));
180 $this->setRootNode((int) $_POST['root_id']);
181 $this->performSearch();
182 }
performSearch()
Perform search.
setRootNode($a_node_id)

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

+ Here is the call graph for this function:

◆ setCombination()

ilSearchGUI::setCombination (   $a_combination)

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

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

134 {
135 $_SESSION['search']['combination'] = $this->combination = $a_combination;
136 }

References $_SESSION.

Referenced by __construct().

+ Here is the caller graph for this function:

◆ setDetails()

ilSearchGUI::setDetails (   $a_details)

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

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

158 {
159 $_SESSION['search']['details'] = $this->details = $a_details;
160 }

References $_SESSION.

Referenced by __construct().

+ Here is the caller graph for this function:

◆ setRootNode()

ilSearchGUI::setRootNode (   $a_node_id)

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

172 {
173 $_SESSION['search_root'] = $this->root_node = $a_node_id;
174 }

References $_SESSION.

Referenced by remoteSearch().

+ Here is the caller graph for this function:

◆ setString()

ilSearchGUI::setString (   $a_str)

Set/get search string @access public.

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

146 {
147 $_SESSION['search']['string'] = $this->string = $a_str;
148 }

References $_SESSION.

Referenced by __construct(), and remoteSearch().

+ Here is the caller graph for this function:

◆ setType()

ilSearchGUI::setType (   $a_type)

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

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

122 {
123 $_SESSION['search']['type'] = $this->type = $a_type;
124 }

References $_SESSION, and $a_type.

Referenced by __construct().

+ Here is the caller graph for this function:

◆ showSavedResults()

ilSearchGUI::showSavedResults ( )

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

302 {
303 global $DIC;
304
305 $ilUser = $DIC['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 $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 // $this->tpl->setVariable('SEARCH_RESULTS',$presentation->getHTML());
329 $this->tpl->setVariable('RESULTS_TABLE', $presentation->getHTML(true));
330 }
331 }
332
333 return true;
334 }

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

+ Here is the call graph for this function:

◆ showSearch()

ilSearchGUI::showSearch ( )

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

245 {
246 global $DIC;
247
248 $ilLocator = $DIC['ilLocator'];
249 $ilCtrl = $DIC['ilCtrl'];
250 $lng = $DIC['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 $this->tpl->setVariable("SEARCH_LABEL", $lng->txt("search"));
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 $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 // begin-patch creation_date
285 $this->tpl->setVariable('TXT_FILTER_BY_CDATE', $this->lng->txt('search_filter_cd'));
286 $this->tpl->setVariable('TXT_CD_OFF', $this->lng->txt('search_off'));
287 $this->tpl->setVariable('FORM_CD', $this->getCreationDateForm()->getHTML());
288 $this->tpl->setVariable("ARR_IMG_CD", ilGlyphGUI::get(ilGlyphGUI::CARET));
289 // end-patch creation_date
290 }
291
292
293 $this->tpl->setVariable("TXT_AREA", $lng->txt("search_area"));
294
295 // search area form
296 $this->tpl->setVariable('SEARCH_AREA_FORM', $this->getSearchAreaForm()->getHTML());
297
298 return true;
299 }
static get($a_glyph, $a_text="")
Get glyph html.
static initJavascript()
Init javascript.
static getInstance()
Factory.
static prepareFormOutput($a_str, $a_strip=false)
prepares string output for html forms @access public

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

Referenced by performSearch(), and showSavedResults().

+ 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 187 of file class.ilSearchGUI.php.

188 {
189 $form = $this->getSearchAreaForm();
190
191 $this->root_node = $form->getItemByPostVar('area')->getValue();
192 $this->search_cache->setRoot($this->root_node);
193 $this->search_cache->save();
194 $this->search_cache->deleteCachedEntries();
195
196 include_once './Services/Object/classes/class.ilSubItemListGUI.php';
198
199 $this->performSearch();
200 }
static resetDetails()
reset details As long as static::resetDetails is not possible this method is final

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

+ 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: