ILIAS  release_6 Revision v6.24-5-g0c8bfefb3b8
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
 
 $favourites
 
 $user
 

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']);
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.
__construct(Container $dic, ilPlugin $plugin)
@inheritDoc
$ilUser
Definition: imgupload.php:18
$DIC
Definition: xapitoken.php:46

References $_POST, $_SESSION, $DIC, $ilUser, ilSearchBaseGUI\$lng, $type, ILIAS\GlobalScreen\Provider\__construct(), 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 646 of file class.ilSearchGUI.php.

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

References 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 550 of file class.ilSearchGUI.php.

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

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

615 {
616 include_once 'Services/Search/classes/class.ilObjectSearchFactory.php';
617
618 $meta_search = &ilObjectSearchFactory::_getMetaDataSearchInstance($query_parser);
620 $meta_search->setFilter($this->__getFilter());
621 }
622 switch ($a_type) {
623 case 'keyword':
624 $meta_search->setMode('keyword');
625 break;
626
627 case 'contribute':
628 $meta_search->setMode('contribute');
629 break;
630
631 case 'title':
632 $meta_search->setMode('title');
633 break;
634
635 case 'description':
636 $meta_search->setMode('description');
637 break;
638 }
639 return $meta_search->performSearch();
640 }
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 568 of file class.ilSearchGUI.php.

569 {
570 include_once 'Services/Search/classes/class.ilObjectSearchFactory.php';
571
572 $obj_search = &ilObjectSearchFactory::_getObjectSearchInstance($query_parser);
574 $obj_search->setFilter($this->__getFilter());
575 }
576
577 $this->parseCreationFilter($obj_search);
578 return $obj_search->performSearch();
579 }
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 }
static getLogger($a_component_id)
Get component logger.
static getList($a_str)
Get completion list.
Auto completion class for user lists.
exit
Definition: login.php:29
foreach($_POST as $key=> $value) $res

References $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

References $DIC, $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 716 of file class.ilSearchGUI.php.

717 {
718 global $DIC;
719
720 $ilUser = $DIC['ilUser'];
721
722 include_once('Services/Search/classes/class.ilUserSearchCache.php');
723 $this->search_cache = ilUserSearchCache::_getInstance($ilUser->getId());
724 $this->search_cache->switchSearchType(ilUserSearchCache::DEFAULT_SEARCH);
725
726 if ($_GET['page_number']) {
727 $this->search_cache->setResultPageNumber((int) $_GET['page_number']);
728 }
729 if (isset($_POST['cmd']['performSearch'])) {
730 $this->search_cache->setQuery(ilUtil::stripSlashes($_POST['term']));
731 $this->search_cache->setCreationFilter($this->loadCreationFilter());
732 $this->search_cache->save();
733 }
734 }
$_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 581 of file class.ilSearchGUI.php.

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

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

Referenced by __searchObjects().

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

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

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

303 {
304 global $DIC;
305
306 $ilUser = $DIC['ilUser'];
307
308 // Read old result sets
309 include_once 'Services/Search/classes/class.ilSearchResult.php';
310
311 $result_obj = new ilSearchResult($ilUser->getId());
312 $result_obj->read();
313 $result_obj->filterResults($this->getRootNode());
314
315 $this->showSearch();
316
317 // Show them
318 if (count($result_obj->getResults())) {
319 $this->addPager($result_obj, 'max_page');
320
321 include_once './Services/Search/classes/class.ilSearchResultPresentation.php';
323 $presentation->setResults($result_obj->getResultsForPresentation());
324 $presentation->setSubitemIds($result_obj->getSubitemIds());
325 $presentation->setPreviousNext($this->prev_link, $this->next_link);
326 #$presentation->setSearcher($searcher);
327
328 if ($presentation->render()) {
329 // $this->tpl->setVariable('SEARCH_RESULTS',$presentation->getHTML());
330 $this->tpl->setVariable('RESULTS_TABLE', $presentation->getHTML(true));
331 }
332 }
333
334 return true;
335 }

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('TXT_CD_ON', $this->lng->txt('search_on'));
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 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 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: