ILIAS  trunk Revision v11.0_alpha-2638-g80c1d007f79
class.ilSearchControllerGUI.php
Go to the documentation of this file.
1 <?php
2 
19 declare(strict_types=1);
20 
23 
31 {
32  public const int TYPE_USER_SEARCH = -1;
33  protected ilObjUser $user;
34 
35  protected ilCtrl $ctrl;
36  protected ILIAS $ilias;
37  protected ilLanguage $lng;
39  protected ilRbacSystem $system;
41  protected Factory $refinery;
42 
43  public function __construct()
44  {
45  global $DIC;
46 
47  $this->ctrl = $DIC->ctrl();
48  $this->ilias = $DIC['ilias'];
49  $this->lng = $DIC->language();
50  $this->tpl = $DIC->ui()->mainTemplate();
51  $this->system = $DIC->rbac()->system();
52  $this->http = $DIC->http();
53  $this->refinery = $DIC->refinery();
54  $this->user = $DIC->user();
55  }
56 
57  public function executeCommand(): void
58  {
59  // Check hacks
60  if (!$this->system->checkAccess('search', ilSearchSettings::_getSearchSettingRefId())) {
61  $this->ilias->raiseError($this->lng->txt("permission_denied"), $this->ilias->error_obj->MESSAGE);
62  }
63  $forward_class = $this->ctrl->getNextClass($this);
64  switch ($forward_class) {
65  case 'illucenesearchgui':
66  $this->ctrl->forwardCommand(new ilLuceneSearchGUI());
67  break;
68 
69  case 'illuceneusersearchgui':
70  if ($this->user->getId() === ANONYMOUS_USER_ID) {
71  $this->ilias->raiseError($this->lng->txt("permission_denied"), $this->ilias->error_obj->MESSAGE);
72  }
73  $this->ctrl->forwardCommand(new ilLuceneUserSearchGUI());
74  break;
75 
76  case 'ilsearchgui':
77  default:
78  $search_gui = new ilSearchGUI();
79  $this->ctrl->forwardCommand($search_gui);
80  break;
81  }
82  $this->tpl->printToStdout();
83  }
84 }
const ANONYMOUS_USER_ID
Definition: constants.php:27
ilGlobalTemplateInterface $tpl
GUI class for &#39;simple&#39; search.
Interface Observer Contains several chained tasks and infos about them.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
static http()
Fetches the global http state from ILIAS.
static _getSearchSettingRefId()
Read the ref_id of Search Settings object.
global $DIC
Definition: shib_login.php:26
Class ilObjForumAdministration.