ILIAS  release_4-4 Revision
All Data Structures Namespaces Files Functions Variables Modules Pages
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...
 
__searchMeta (&$query_parser, $a_type)
 Search in object meta data (keyword) More...
 
 __getFilter ()
 Get object type for filter (If detail search is enabled) More...
 
- Public Member Functions inherited from ilSearchBaseGUI
 ilSearchBaseGUI ()
 Constructor public. More...
 
 prepareOutput ()
 
 initStandardSearchForm ($a_mode)
 Init standard search form. More...
 
 getSearchAreaForm ()
 Init standard search form. More...
 
 handleCommand ($a_cmd)
 Handle command. More...
 
 addToDeskObject ()
 Interface methods. More...
 
 removeFromDeskObject ()
 Remove from dektop. More...
 
 delete ()
 Show deletion screen. More...
 
 cancelDelete ()
 Cancel delete. More...
 
 performDelete ()
 Delete objects. More...
 
 cut ()
 Interface ilAdministrationCommandHandler. More...
 
 link ()
 Interface ilAdministrationCommandHandler. More...
 
 paste ()
 Paste. More...
 
 showLinkIntoMultipleObjectsTree ()
 Target selection link. More...
 
 showMoveIntoObjectTree ()
 Target selection cut. More...
 
 performPasteIntoMultipleObjects ()
 Perform paste into multiple objects. More...
 
 clear ()
 clear clipboard More...
 
 enableAdministrationPanel ()
 Enable administration panel. More...
 
 disableAdministrationPanel ()
 Disable administration panel. More...
 
 addLocator ()
 Add Locator. More...
 
 autoComplete ()
 Data resource for autoComplete. More...
 

Data Fields

 $root_node
 
 $combination
 
 $string
 
 $type
 
- Data Fields inherited from ilSearchBaseGUI
const SEARCH_FAST = 1
 
const SEARCH_DETAILS = 2
 
const SEARCH_AND = 'and'
 
const SEARCH_OR = 'or'
 
const SEARCH_FORM_LUCENE = 1
 
const SEARCH_FORM_STANDARD = 2
 
const SEARCH_FORM_USER = 3
 
 $settings = null
 
 $ilias = null
 
 $lng = null
 
 $tpl = null
 

Protected Member Functions

 storeRoot ()
 Store new root node. More...
 
 initUserSearchCache ()
 Init user search cache. More...
 
- Protected Member Functions inherited from ilSearchBaseGUI
 addPager ($result, $a_session_key)
 Add Pager. More...
 
 buildSearchAreaPath ($a_root_node)
 Build path for search area. More...
 

Protected Attributes

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

Detailed Description

Constructor & Destructor Documentation

◆ __construct()

ilSearchGUI::__construct ( )

Constructor public.

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

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

37  {
38  global $ilUser, $lng;
39 
40  $lng->loadLanguageModule("search");
41 
42  // put form values into "old" post variables
44  $this->form->checkInput();
45 
46  $new_search = isset($_POST['cmd']['performSearch']) ? true : false;
47 
48  $enabled_types = ilSearchSettings::getInstance()->getEnabledLuceneItemFilterDefinitions();
49  foreach($enabled_types as $type => $pval)
50  {
51  if($_POST['filter_type'][$type] == 1)
52  {
53  $_POST["search"]["details"][$type] = $_POST['filter_type'][$type];
54  }
55  }
56 
57  $_POST["search"]["string"] = $_POST["term"];
58  $_POST["search"]["combination"] = $_POST["combination"];
59  $_POST["search"]["type"] = $_POST["type"];
60  $_SESSION['search_root'] = $_POST["area"];
61 
62  $this->root_node = $_SESSION['search_root'] ? $_SESSION['search_root'] : ROOT_FOLDER_ID;
63  $this->setType($_POST['search']['type'] ? $_POST['search']['type'] : $_SESSION['search']['type']);
64  $this->setCombination($_POST['search']['combination'] ? $_POST['search']['combination'] : $_SESSION['search']['combination']);
65  $this->setString($_POST['search']['string'] ? $_POST['search']['string'] : $_SESSION['search']['string']);
66  #$this->setDetails($_POST['search']['details'] ? $_POST['search']['details'] : $_SESSION['search']['details']);
67  $this->setDetails($new_search ? $_POST['search']['details'] : $_SESSION['search']['details']);
68  parent::__construct();
69  }
< a tabindex="-1" style="border-style: none;" href="#" title="Refresh Image" onclick="document.getElementById('siimage').src = './securimage_show.php?sid=' + Math.random(); this.blur(); return false">< img src="./images/refresh.png" alt="Reload Image" height="32" width="32" onclick="this.blur()" align="bottom" border="0"/></a >< br/>< strong > Enter Code *if($_SERVER['REQUEST_METHOD']=='POST' &&@ $_POST['do']=='contact') $_SESSION['ctform']['success']
setType($a_type)
Set/get type of search (detail or &#39;fast&#39; search) public.
$_POST['username']
Definition: cron.php:12
setCombination($a_combination)
Set/get combination of search (&#39;and&#39; or &#39;or&#39;) public.
initStandardSearchForm($a_mode)
Init standard search form.
setDetails($a_details)
Set/get details (object types for details search) public.
setString($a_str)
Set/get search string public.
global $ilUser
Definition: imgupload.php:15
+ Here is the call graph for this function:

Member Function Documentation

◆ __getFilter()

ilSearchGUI::__getFilter ( )

Get object type for filter (If detail search is enabled)

Returns
array object types public

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

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

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

572  {
574  {
575  return false;
576  }
577 
578  foreach($this->getDetails() as $key => $detail_type)
579  {
580  if(!$detail_type)
581  {
582  continue;
583  }
584 
585  switch($key)
586  {
587  case 'lms':
588  $filter[] = 'lm';
589  $filter[] = 'dbk';
590  $filter[] = 'pg';
591  $filter[] = 'st';
592  $filter[] = 'sahs';
593  $filter[] = 'htlm';
594  break;
595 
596  case 'frm':
597  $filter[] = 'frm';
598  break;
599 
600  case 'glo':
601  $filter[] = 'glo';
602  break;
603 
604  case 'exc':
605  $filter[] = 'exc';
606  break;
607 
608  case 'mcst':
609  $filter[] = 'mcst';
610  break;
611 
612  case 'tst':
613  $filter[] = 'tst';
614  $filter[] = 'svy';
615  $filter[] = 'qpl';
616  $filter[] = 'spl';
617  break;
618 
619  case 'mep':
620  $filter[] = 'mep';
621  $filter[] = 'mob';
622  break;
623 
624  case 'fil':
625  $filter[] = 'file';
626  break;
627 
628  case 'wiki':
629  $filter[] = 'wpg';
630  break;
631 
632  default:
633  $filter[] = $key;
634  }
635  }
636  return $filter ? $filter : array();
637  }
+ 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 500 of file class.ilSearchGUI.php.

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

Referenced by performSearch().

501  {
502  include_once 'Services/Search/classes/class.ilQueryParser.php';
503 
504  $query_parser = new ilQueryParser(ilUtil::stripSlashes($this->getString()));
505  $query_parser->setCombination($this->getCombination());
506  $query_parser->parse();
507 
508  if(!$query_parser->validate())
509  {
510  return $query_parser->getMessage();
511  }
512  return $query_parser;
513  }
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 405 of file class.ilSearchGUI.php.

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

Referenced by performSearch().

406  {
407  foreach($this->getDetails() as $type => $enabled)
408  {
409  if(!$enabled)
410  {
411  continue;
412  }
413 
414  switch($type)
415  {
416  case 'crs':
417  $crs_search = ilObjectSearchFactory::_getObjectSearchInstance($query_parser);
418  $crs_search->setFilter(array('crs'));
419  $result->mergeEntries($crs_search->performSearch());
420  break;
421 
422  case 'grp':
423  $grp_search = ilObjectSearchFactory::_getObjectSearchInstance($query_parser);
424  $grp_search->setFilter(array('grp'));
425  $result->mergeEntries($grp_search->performSearch());
426  break;
427 
428  case 'lms':
429  $content_search =& ilObjectSearchFactory::_getLMContentSearchInstance($query_parser);
430  $content_search->setFilter($this->__getFilter());
431  $result->mergeEntries($content_search->performSearch());
432  break;
433 
434  case 'frm':
435  $forum_search =& ilObjectSearchFactory::_getForumSearchInstance($query_parser);
436  $forum_search->setFilter($this->__getFilter());
437  $result->mergeEntries($forum_search->performSearch());
438  break;
439 
440  case 'glo':
441  // Glossary term definition pages
442  $gdf_search =& ilObjectSearchFactory::_getLMContentSearchInstance($query_parser);
443  $gdf_search->setFilter(array('gdf'));
444  $result->mergeEntries($gdf_search->performSearch());
445  // Glossary terms
446  $gdf_term_search =& ilObjectSearchFactory::_getGlossaryDefinitionSearchInstance($query_parser);
447  $result->mergeEntries($gdf_term_search->performSearch());
448  break;
449 
450  case 'exc':
451  $exc_search =& ilObjectSearchFactory::_getExerciseSearchInstance($query_parser);
452  $exc_search->setFilter($this->__getFilter());
453  $result->mergeEntries($exc_search->performSearch());
454  break;
455 
456  case 'mcst':
457  $mcst_search =& ilObjectSearchFactory::_getMediaCastSearchInstance($query_parser);
458  $result->mergeEntries($mcst_search->performSearch());
459  break;
460 
461  case 'tst':
462  $tst_search =& ilObjectSearchFactory::_getTestSearchInstance($query_parser);
463  $tst_search->setFilter($this->__getFilter());
464  $result->mergeEntries($tst_search->performSearch());
465  break;
466 
467  case 'mep':
468  $mep_search =& ilObjectSearchFactory::_getMediaPoolSearchInstance($query_parser);
469  $mep_search->setFilter($this->__getFilter());
470  $result->mergeEntries($mep_search->performSearch());
471 
472  // Mob keyword search
473  $mob_search = ilObjectSearchFactory::_getMediaPoolSearchInstance($query_parser);
474  $mob_search->setFilter($this->__getFilter());
475  $result->mergeEntries($mob_search->performKeywordSearch());
476 
477  break;
478 
479  case 'wiki':
480  $wiki_search =& ilObjectSearchFactory::_getWikiContentSearchInstance($query_parser);
481  $wiki_search->setFilter($this->__getFilter());
482  $result->mergeEntries($wiki_search->performSearch());
483 
484  /*$result_meta =& $this->__searchMeta($query_parser,'title');
485  $result->mergeEntries($result_meta);
486  $result_meta =& $this->__searchMeta($query_parser,'description');
487  $result->mergeEntries($result_meta);*/
488  break;
489 
490  }
491  }
492  return $result;
493  }
static _getWikiContentSearchInstance($query_parser)
get reference of ilFulltextWikiContentSearch
$result
static _getMediaPoolSearchInstance($query_parser)
get reference of ilFulltextMediapoolSearch
static _getForumSearchInstance($query_parser)
get reference of ilFulltextForumSearch
static _getExerciseSearchInstance($query_parser)
get reference of ilFulltextExerciseSearch
static _getGlossaryDefinitionSearchInstance($query_parser)
get reference of ilFulltextGlossaryDefinitionSearch
static _getLMContentSearchInstance($query_parser)
get reference of ilFulltextLMContentSearch
__getFilter()
Get object type for filter (If detail search is enabled)
static _getObjectSearchInstance($query_parser)
get reference of ilFulltext/LikeObjectSearch.
static _getTestSearchInstance($query_parser)
get reference of ilFulltextTestSearch
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ __searchMeta()

& ilSearchGUI::__searchMeta ( $query_parser,
  $a_type 
)

Search in object meta data (keyword)

Returns
object result object public

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

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

Referenced by performSearch().

538  {
539  include_once 'Services/Search/classes/class.ilObjectSearchFactory.php';
540 
541  $meta_search =& ilObjectSearchFactory::_getMetaDataSearchInstance($query_parser);
543  {
544  $meta_search->setFilter($this->__getFilter());
545  }
546  switch($a_type)
547  {
548  case 'keyword':
549  $meta_search->setMode('keyword');
550  break;
551 
552  case 'contribute':
553  $meta_search->setMode('contribute');
554  break;
555 
556  case 'title':
557  $meta_search->setMode('title');
558  break;
559 
560  case 'description':
561  $meta_search->setMode('description');
562  break;
563  }
564  return $meta_search->performSearch();
565  }
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 519 of file class.ilSearchGUI.php.

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

Referenced by performSearch().

520  {
521  include_once 'Services/Search/classes/class.ilObjectSearchFactory.php';
522 
523  $obj_search =& ilObjectSearchFactory::_getObjectSearchInstance($query_parser);
525  {
526  $obj_search->setFilter($this->__getFilter());
527  }
528  return $obj_search->performSearch();
529  }
__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 203 of file class.ilSearchGUI.php.

References $_REQUEST, exit, and ilSearchAutoComplete\getList().

204  {
205  $q = $_REQUEST["term"];
206  include_once("./Services/Search/classes/class.ilSearchAutoComplete.php");
207  $list = ilSearchAutoComplete::getList($q);
208  echo $list;
209  exit;
210 
211  }
exit
Definition: login.php:54
static getList($a_str)
Get completion list.
if($_REQUEST['ilias_path']) define('ILIAS_HTTP_PATH' $_REQUEST['ilias_path']
Definition: index.php:7
+ Here is the call graph for this function:

◆ executeCommand()

ilSearchGUI::executeCommand ( )

Control public.

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

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

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

◆ getCombination()

ilSearchGUI::getCombination ( )

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

References ilSearchBaseGUI\SEARCH_OR.

Referenced by __parseQueryString().

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

◆ getDetails()

ilSearchGUI::getDetails ( )

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

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

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

◆ getRootNode()

ilSearchGUI::getRootNode ( )

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

Referenced by performSearch(), and showSavedResults().

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

◆ getString()

ilSearchGUI::getString ( )

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

References $string.

Referenced by __parseQueryString(), and showSearch().

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

◆ getType()

ilSearchGUI::getType ( )

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

References ilSearchBaseGUI\SEARCH_FAST.

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

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

◆ initUserSearchCache()

ilSearchGUI::initUserSearchCache ( )
protected

Init user search cache.

private

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

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

Referenced by executeCommand().

646  {
647  global $ilUser;
648 
649  include_once('Services/Search/classes/class.ilUserSearchCache.php');
650  $this->search_cache = ilUserSearchCache::_getInstance($ilUser->getId());
651  $this->search_cache->switchSearchType(ilUserSearchCache::DEFAULT_SEARCH);
652  if($_GET['page_number'])
653  {
654  $this->search_cache->setResultPageNumber((int) $_GET['page_number']);
655  }
656  if(isset($_POST['cmd']['performSearch']))
657  {
658  $this->search_cache->setQuery(ilUtil::stripSlashes($_POST['term']));
659  $this->search_cache->save();
660  }
661  }
$_POST['username']
Definition: cron.php:12
$_GET["client_id"]
static _getInstance($a_usr_id)
Get singleton instance.
static stripSlashes($a_str, $a_strip_html=true, $a_allow="")
strip slashes if magic qoutes is enabled
global $ilUser
Definition: imgupload.php:15
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ performSearch()

ilSearchGUI::performSearch ( )

Perform search.

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

291  {
292  global $ilUser;
293 
294  if(!isset($_GET['page_number']) and $this->search_mode != 'in_results' )
295  {
296  unset($_SESSION['max_page']);
297  $this->search_cache->deleteCachedEntries();
298  }
299 
300  if($this->getType() == ilSearchBaseGUI::SEARCH_DETAILS and !$this->getDetails())
301  {
302  ilUtil::sendInfo($this->lng->txt('search_choose_object_type'));
303  $this->showSearch();
304  return false;
305  }
306 
307  // Step 1: parse query string
308  if(!is_object($query_parser =& $this->__parseQueryString()))
309  {
310  ilUtil::sendInfo($query_parser);
311  $this->showSearch();
312 
313  return false;
314  }
315  // Step 2: perform object search. Get an ObjectSearch object via factory. Depends on fulltext or like search type.
316  $result =& $this->__searchObjects($query_parser);
317 
318  // Step 3: perform meta keyword search. Get an MetaDataSearch object.
319  $result_meta =& $this->__searchMeta($query_parser,'keyword');
320  $result->mergeEntries($result_meta);
321 
322  $result_meta =& $this->__searchMeta($query_parser,'contribute');
323  $result->mergeEntries($result_meta);
324 
325  $result_meta =& $this->__searchMeta($query_parser,'title');
326  $result->mergeEntries($result_meta);
327 
328  $result_meta =& $this->__searchMeta($query_parser,'description');
329  $result->mergeEntries($result_meta);
330 
331  // Perform details search in object specific tables
333  {
334  $result = $this->__performDetailsSearch($query_parser,$result);
335  }
336  // Step 5: Search in results
337  if($this->search_mode == 'in_results')
338  {
339  include_once 'Services/Search/classes/class.ilSearchResult.php';
340 
341  $old_result_obj = new ilSearchResult($ilUser->getId());
342  $old_result_obj->read();
343 
344  $result->diffEntriesFromResult($old_result_obj);
345  }
346 
347 
348  // Step 4: merge and validate results
349  $result->filter($this->getRootNode(),$query_parser->getCombination() == 'and');
350  $result->save();
351  $this->showSearch();
352 
353  if(!count($result->getResults()))
354  {
355  ilUtil::sendInfo($this->lng->txt('search_no_match'));
356  }
357 
358  if($result->isLimitReached())
359  {
360  #$message = sprintf($this->lng->txt('search_limit_reached'),$this->settings->getMaxHits());
361  #ilUtil::sendInfo($message);
362  }
363 
364  // Step 6: show results
365  $this->addPager($result,'max_page');
366 
367  include_once './Services/Search/classes/class.ilSearchResultPresentation.php';
369  $presentation->setResults($result->getResultsForPresentation());
370  $presentation->setSubitemIds($result->getSubitemIds());
371  $presentation->setPreviousNext($this->prev_link, $this->next_link);
372 
373  if($presentation->render())
374  {
375 // $this->tpl->setVariable('SEARCH_RESULTS',$presentation->getHTML());
376  $this->tpl->setVariable('RESULTS_TABLE',$presentation->getHTML(true));
377  }
378 
379  return true;
380  }
< a tabindex="-1" style="border-style: none;" href="#" title="Refresh Image" onclick="document.getElementById('siimage').src = './securimage_show.php?sid=' + Math.random(); this.blur(); return false">< img src="./images/refresh.png" alt="Reload Image" height="32" width="32" onclick="this.blur()" align="bottom" border="0"/></a >< br/>< strong > Enter Code *if($_SERVER['REQUEST_METHOD']=='POST' &&@ $_POST['do']=='contact') $_SESSION['ctform']['success']
read($a_type=DEFAULT_SEARCH)
read search results
& __performDetailsSearch(&$query_parser, &$result)
$result
$_GET["client_id"]
static sendInfo($a_info="", $a_keep=false)
Send Info Message to Screen.
& __parseQueryString()
parse query string, using query parser instance
addPager($result, $a_session_key)
Add Pager.
Presentation of search results using object list gui.
& __searchObjects(&$query_parser)
Search in obect title,desctiption.
global $ilUser
Definition: imgupload.php:15
& __searchMeta(&$query_parser, $a_type)
Search in object meta data (keyword)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ prepareOutput()

ilSearchGUI::prepareOutput ( )

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

Referenced by executeCommand().

385  {
386  global $ilTabs, $ilHelp;
387 
388  parent::prepareOutput();
389 
390  $ilHelp->setScreenIdComponent("src");
391 
392  $ilTabs->addTab("search", $this->lng->txt("search"),
393  $this->ctrl->getLinkTarget($this));
394 
395  if (!$this->settings->getHideAdvancedSearch())
396  {
397  $ilTabs->addTab("adv_search", $this->lng->txt("search_advanced"),
398  $this->ctrl->getLinkTargetByClass('iladvancedsearchgui'));
399  }
400 
401  $ilTabs->activateTab("search");
402  }
+ Here is the caller graph for this function:

◆ remoteSearch()

ilSearchGUI::remoteSearch ( )

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

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

175  {
176  $this->setString(ilUtil::stripSlashes($_POST['queryString']));
177  $this->setRootNode((int) $_POST['root_id']);
178  $this->performSearch();
179 
180  }
$_POST['username']
Definition: cron.php:12
performSearch()
Perform search.
setRootNode($a_node_id)
static stripSlashes($a_str, $a_strip_html=true, $a_allow="")
strip slashes if magic qoutes is enabled
setString($a_str)
Set/get search string public.
+ Here is the call graph for this function:

◆ setCombination()

ilSearchGUI::setCombination (   $a_combination)

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

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

References $_SESSION.

Referenced by __construct().

131  {
132  $_SESSION['search']['combination'] = $this->combination = $a_combination;
133  }
< a tabindex="-1" style="border-style: none;" href="#" title="Refresh Image" onclick="document.getElementById('siimage').src = './securimage_show.php?sid=' + Math.random(); this.blur(); return false">< img src="./images/refresh.png" alt="Reload Image" height="32" width="32" onclick="this.blur()" align="bottom" border="0"/></a >< br/>< strong > Enter Code *if($_SERVER['REQUEST_METHOD']=='POST' &&@ $_POST['do']=='contact') $_SESSION['ctform']['success']
+ 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 154 of file class.ilSearchGUI.php.

References $_SESSION.

Referenced by __construct().

155  {
156  $_SESSION['search']['details'] = $this->details = $a_details;
157  }
< a tabindex="-1" style="border-style: none;" href="#" title="Refresh Image" onclick="document.getElementById('siimage').src = './securimage_show.php?sid=' + Math.random(); this.blur(); return false">< img src="./images/refresh.png" alt="Reload Image" height="32" width="32" onclick="this.blur()" align="bottom" border="0"/></a >< br/>< strong > Enter Code *if($_SERVER['REQUEST_METHOD']=='POST' &&@ $_POST['do']=='contact') $_SESSION['ctform']['success']
+ Here is the caller graph for this function:

◆ setRootNode()

ilSearchGUI::setRootNode (   $a_node_id)

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

References $_SESSION.

Referenced by remoteSearch().

169  {
170  $_SESSION['search_root'] = $this->root_node = $a_node_id;
171  }
< a tabindex="-1" style="border-style: none;" href="#" title="Refresh Image" onclick="document.getElementById('siimage').src = './securimage_show.php?sid=' + Math.random(); this.blur(); return false">< img src="./images/refresh.png" alt="Reload Image" height="32" width="32" onclick="this.blur()" align="bottom" border="0"/></a >< br/>< strong > Enter Code *if($_SERVER['REQUEST_METHOD']=='POST' &&@ $_POST['do']=='contact') $_SESSION['ctform']['success']
+ Here is the caller graph for this function:

◆ setString()

ilSearchGUI::setString (   $a_str)

Set/get search string public.

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

References $_SESSION.

Referenced by __construct(), and remoteSearch().

143  {
144  $_SESSION['search']['string'] = $this->string = $a_str;
145  }
< a tabindex="-1" style="border-style: none;" href="#" title="Refresh Image" onclick="document.getElementById('siimage').src = './securimage_show.php?sid=' + Math.random(); this.blur(); return false">< img src="./images/refresh.png" alt="Reload Image" height="32" width="32" onclick="this.blur()" align="bottom" border="0"/></a >< br/>< strong > Enter Code *if($_SERVER['REQUEST_METHOD']=='POST' &&@ $_POST['do']=='contact') $_SESSION['ctform']['success']
+ 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 118 of file class.ilSearchGUI.php.

References $_SESSION.

Referenced by __construct().

119  {
120  $_SESSION['search']['type'] = $this->type = $a_type;
121  }
< a tabindex="-1" style="border-style: none;" href="#" title="Refresh Image" onclick="document.getElementById('siimage').src = './securimage_show.php?sid=' + Math.random(); this.blur(); return false">< img src="./images/refresh.png" alt="Reload Image" height="32" width="32" onclick="this.blur()" align="bottom" border="0"/></a >< br/>< strong > Enter Code *if($_SERVER['REQUEST_METHOD']=='POST' &&@ $_POST['do']=='contact') $_SESSION['ctform']['success']
+ Here is the caller graph for this function:

◆ showSavedResults()

ilSearchGUI::showSavedResults ( )

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

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

252  {
253  global $ilUser;
254 
255  // Read old result sets
256  include_once 'Services/Search/classes/class.ilSearchResult.php';
257 
258  $result_obj = new ilSearchResult($ilUser->getId());
259  $result_obj->read();
260  $result_obj->filterResults($this->getRootNode());
261 
262  $this->showSearch();
263 
264  // Show them
265  if(count($result_obj->getResults()))
266  {
267  $this->addPager($result_obj,'max_page');
268 
269  include_once './Services/Search/classes/class.ilSearchResultPresentation.php';
271  $presentation->setResults($result_obj->getResultsForPresentation());
272  $presentation->setSubitemIds($result_obj->getSubitemIds());
273  $presentation->setPreviousNext($this->prev_link, $this->next_link);
274  #$presentation->setSearcher($searcher);
275 
276  if($presentation->render())
277  {
278 // $this->tpl->setVariable('SEARCH_RESULTS',$presentation->getHTML());
279  $this->tpl->setVariable('RESULTS_TABLE',$presentation->getHTML(true));
280  }
281  }
282 
283  return true;
284  }
read($a_type=DEFAULT_SEARCH)
read search results
addPager($result, $a_session_key)
Add Pager.
Presentation of search results using object list gui.
global $ilUser
Definition: imgupload.php:15
+ Here is the call graph for this function:

◆ showSearch()

ilSearchGUI::showSearch ( )

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

References $ilCtrl, ilSearchBaseGUI\$lng, ilUtil\getImagePath(), ilSearchSettings\getInstance(), ilSearchBaseGUI\getSearchAreaForm(), getString(), ilUtil\img(), ilOverlayGUI\initJavascript(), ilSearchBaseGUI\initStandardSearchForm(), ilSearchSettings\OPERATOR_AND, ilUtil\prepareFormOutput(), and ilSearchBaseGUI\SEARCH_FORM_STANDARD.

Referenced by performSearch(), and showSavedResults().

214  {
215  global $ilLocator, $ilCtrl, $lng;
216 
217  // include js needed
218  include_once("./Services/UIComponent/Overlay/classes/class.ilOverlayGUI.php");
220  $this->tpl->addJavascript("./Services/Search/js/Search.js");
221 
222  $this->tpl->addBlockFile('ADM_CONTENT','adm_content','tpl.search.html','Services/Search');
223  $this->tpl->setVariable("FORM_ACTION", $ilCtrl->getFormAction($this,'performSearch'));
224  $this->tpl->setVariable("TERM", ilUtil::prepareFormOutput($this->getString()));
225  $this->tpl->setVariable("TXT_SEARCH", $lng->txt("search"));
226  $this->tpl->setVariable("TXT_OPTIONS", $lng->txt("options"));
227  $this->tpl->setVariable("ARR_IMG", ilUtil::img(ilUtil::getImagePath("mm_down_arrow_dark.png")));
228  $this->tpl->setVariable("TXT_COMBINATION", $lng->txt("search_term_combination"));
229  $this->tpl->setVariable('TXT_COMBINATION_DEFAULT', ilSearchSettings::getInstance()->getDefaultOperator() == ilSearchSettings::OPERATOR_AND ? $lng->txt('search_all_words') : $lng->txt('search_any_word'));
230 
231  if (ilSearchSettings::getInstance()->isLuceneItemFilterEnabled())
232  {
233  $this->tpl->setCurrentBlock("type_sel");
234  $this->tpl->setVariable('TXT_TYPE_DEFAULT',$lng->txt("search_fast_info"));
235  $this->tpl->setVariable("TXT_TYPE", $lng->txt("search_type"));
237  $this->tpl->setVariable("ARR_IMGT", ilUtil::img(ilUtil::getImagePath("mm_down_arrow_dark.png")));
238  $this->tpl->setVariable("FORM", $this->form->getHTML());
239  $this->tpl->parseCurrentBlock();
240  }
241 
242  $this->tpl->setVariable("TXT_AREA", $lng->txt("search_area"));
243 
244 
245  // search area form
246  $this->tpl->setVariable('SEARCH_AREA_FORM', $this->getSearchAreaForm()->getHTML());
247 
248  return true;
249  }
static prepareFormOutput($a_str, $a_strip=false)
prepares string output for html forms public
getSearchAreaForm()
Init standard search form.
static img($a_src, $a_alt="", $a_width="", $a_height="", $a_border=0, $a_id="")
Build img tag.
global $ilCtrl
Definition: ilias.php:18
static getImagePath($img, $module_path="", $mode="output", $offline=false)
get image path (for images located in a template directory)
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 185 of file class.ilSearchGUI.php.

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

186  {
187  $form = $this->getSearchAreaForm();
188 
189  $this->root_node = $form->getItemByPostVar('area')->getValue();
190  $this->search_cache->setRoot($this->root_node);
191  $this->search_cache->save();
192  $this->search_cache->deleteCachedEntries();
193 
194  include_once './Services/Object/classes/class.ilSubItemListGUI.php';
196 
197  $this->performSearch();
198  }
getSearchAreaForm()
Init standard search form.
performSearch()
Perform search.
static resetDetails()
reset details As long as static::resetDetails is not possible this method is final ...
+ Here is the call graph for this function:

Field Documentation

◆ $combination

ilSearchGUI::$combination

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

◆ $root_node

ilSearchGUI::$root_node

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

◆ $search_cache

ilSearchGUI::$search_cache = null
protected

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

◆ $string

ilSearchGUI::$string

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

Referenced by getString().

◆ $type

ilSearchGUI::$type

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

Referenced by __construct().


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