ILIAS  release_8 Revision v8.23
ilSearchControllerGUI Class Reference
+ Inheritance diagram for ilSearchControllerGUI:
+ Collaboration diagram for ilSearchControllerGUI:

Public Member Functions

 __construct ()
 Constructor public. More...
 
 getLastClass ()
 
 setLastClass (string $a_class)
 
 setCmdClass (string $a_cmd_class)
 
 executeCommand ()
 

Data Fields

const TYPE_USER_SEARCH = -1
 

Protected Attributes

ilObjUser $user
 
ilCtrl $ctrl
 
ILIAS $ilias
 
ilLanguage $lng
 
ilGlobalTemplateInterface $tpl
 
ilRbacSystem $system
 
GlobalHttpState $http
 
Factory $refinery
 

Detailed Description

Definition at line 35 of file class.ilSearchControllerGUI.php.

Constructor & Destructor Documentation

◆ __construct()

ilSearchControllerGUI::__construct ( )

Constructor public.

Definition at line 53 of file class.ilSearchControllerGUI.php.

References $DIC, ILIAS\Repository\ctrl(), ILIAS\FileDelivery\http(), ILIAS\Repository\lng(), ILIAS\Repository\refinery(), and ILIAS\Repository\user().

54  {
55  global $DIC;
56 
57  $this->ctrl = $DIC->ctrl();
58  $this->ilias = $DIC['ilias'];
59  $this->lng = $DIC->language();
60  $this->tpl = $DIC->ui()->mainTemplate();
61  $this->system = $DIC->rbac()->system();
62  $this->http = $DIC->http();
63  $this->refinery = $DIC->refinery();
64  $this->user = $DIC->user();
65  }
global $DIC
Definition: feed.php:28
static http()
Fetches the global http state from ILIAS.
header include for all ilias files.
+ Here is the call graph for this function:

Member Function Documentation

◆ executeCommand()

ilSearchControllerGUI::executeCommand ( )

Definition at line 101 of file class.ilSearchControllerGUI.php.

References ilSearchSettings\_getSearchSettingRefId(), ANONYMOUS_USER_ID, ILIAS\Repository\ctrl(), getLastClass(), ILIAS\Repository\lng(), setCmdClass(), setLastClass(), and ILIAS\Repository\user().

101  : void
102  {
103  // Check hacks
104  if (!$this->system->checkAccess('search', ilSearchSettings::_getSearchSettingRefId())) {
105  $this->ilias->raiseError($this->lng->txt("permission_denied"), $this->ilias->error_obj->MESSAGE);
106  }
107  $forward_class = $this->ctrl->getNextClass($this) ? $this->ctrl->getNextClass($this) : $this->getLastClass();
108  switch ($forward_class) {
109  case 'illucenesearchgui':
110  $this->setLastClass('illucenesearchgui');
111  $this->setCmdClass(ilLuceneSearchGUI::class);
112  $this->ctrl->forwardCommand(new ilLuceneSearchGUI());
113  break;
114 
115  case 'illuceneadvancedsearchgui':
116  $this->setLastClass('illuceneadvancedsearchgui');
117  $this->setCmdClass(ilLuceneAdvancedSearchGUI::class);
118  $this->ctrl->forwardCommand(new ilLuceneAdvancedSearchGUI());
119  break;
120 
121  case 'illuceneusersearchgui':
122  if ($this->user->getId() === ANONYMOUS_USER_ID) {
123  $this->ilias->raiseError($this->lng->txt("permission_denied"), $this->ilias->error_obj->MESSAGE);
124  }
125  $this->setLastClass('illuceneusersearchgui');
126  $this->setCmdClass(ilLuceneUserSearchGUI::class);
127  $this->ctrl->forwardCommand(new ilLuceneUserSearchGUI());
128  break;
129 
130  case 'iladvancedsearchgui':
131  // Remember last class
132  $this->setLastClass('iladvancedsearchgui');
133  $this->setCmdClass(ilAdvancedSearchGUI::class);
134  $this->ctrl->forwardCommand(new ilAdvancedSearchGUI());
135  break;
136 
137  case 'ilsearchgui':
138  // Remember last class
139  $this->setLastClass('ilsearchgui');
140  // no break
141  default:
142  $search_gui = new ilSearchGUI();
143  $this->setCmdClass(ilSearchGUI::class);
144  $this->ctrl->forwardCommand($search_gui);
145  break;
146  }
147  $this->tpl->printToStdout();
148  }
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
const ANONYMOUS_USER_ID
Definition: constants.php:27
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
static _getSearchSettingRefId()
Read the ref_id of Search Settings object.
header include for all ilias files.
GUI for Lucene user search
+ Here is the call graph for this function:

◆ getLastClass()

ilSearchControllerGUI::getLastClass ( )

Definition at line 67 of file class.ilSearchControllerGUI.php.

References ilSession\get(), ilSearchSettings\getInstance(), ILIAS\FileDelivery\http(), ILIAS\Repository\refinery(), and setLastClass().

Referenced by executeCommand().

67  : string
68  {
69  if (ilSearchSettings::getInstance()->enabledLucene()) {
70  $default = 'illucenesearchgui';
71  } else {
72  $default = 'ilsearchgui';
73  }
74 
75  $root_id = 0;
76  if ($this->http->wrapper()->post()->has('root_id')) {
77  $root_id = $this->http->wrapper()->post()->retrieve(
78  'root_id',
79  $this->refinery->kindlyTo()->int()
80  );
81  }
82  if ($root_id == self::TYPE_USER_SEARCH) {
83  $default = 'illuceneusersearchgui';
84  }
85 
86  $this->setLastClass($default);
87  return ilSession::get('search_last_class') ?? $default;
88  }
static get(string $a_var)
static http()
Fetches the global http state from ILIAS.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ setCmdClass()

ilSearchControllerGUI::setCmdClass ( string  $a_cmd_class)

Definition at line 94 of file class.ilSearchControllerGUI.php.

References ILIAS\Repository\ctrl().

Referenced by executeCommand().

94  : void
95  {
96  if ($this->ctrl->getNextClass($this) === '') {
97  $this->ctrl->setCmdClass($a_cmd_class);
98  }
99  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ setLastClass()

ilSearchControllerGUI::setLastClass ( string  $a_class)

Definition at line 89 of file class.ilSearchControllerGUI.php.

References ilSession\set().

Referenced by executeCommand(), and getLastClass().

89  : void
90  {
91  ilSession::set('search_last_class', $a_class);
92  }
static set(string $a_var, $a_val)
Set a value.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Field Documentation

◆ $ctrl

ilCtrl ilSearchControllerGUI::$ctrl
protected

Definition at line 40 of file class.ilSearchControllerGUI.php.

◆ $http

GlobalHttpState ilSearchControllerGUI::$http
protected

Definition at line 45 of file class.ilSearchControllerGUI.php.

◆ $ilias

ILIAS ilSearchControllerGUI::$ilias
protected

Definition at line 41 of file class.ilSearchControllerGUI.php.

◆ $lng

ilLanguage ilSearchControllerGUI::$lng
protected

Definition at line 42 of file class.ilSearchControllerGUI.php.

◆ $refinery

Factory ilSearchControllerGUI::$refinery
protected

Definition at line 46 of file class.ilSearchControllerGUI.php.

◆ $system

ilRbacSystem ilSearchControllerGUI::$system
protected

Definition at line 44 of file class.ilSearchControllerGUI.php.

◆ $tpl

ilGlobalTemplateInterface ilSearchControllerGUI::$tpl
protected

Definition at line 43 of file class.ilSearchControllerGUI.php.

◆ $user

ilObjUser ilSearchControllerGUI::$user
protected

Definition at line 38 of file class.ilSearchControllerGUI.php.

◆ TYPE_USER_SEARCH

const ilSearchControllerGUI::TYPE_USER_SEARCH = -1

Definition at line 37 of file class.ilSearchControllerGUI.php.

Referenced by ilMainMenuSearchGUI\getHTML().


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