ILIAS  release_10 Revision v10.1-43-ga1241a92c2f
class.ilSearchControllerGUI.php
Go to the documentation of this file.
1 <?php
2 
19 declare(strict_types=1);
20 
23 
36 {
37  public const TYPE_USER_SEARCH = -1;
38  protected ilObjUser $user;
39 
40  protected ilCtrl $ctrl;
41  protected ILIAS $ilias;
42  protected ilLanguage $lng;
44  protected ilRbacSystem $system;
46  protected Factory $refinery;
47 
48 
53  public function __construct()
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  }
66 
67  public function executeCommand(): void
68  {
69  // Check hacks
70  if (!$this->system->checkAccess('search', ilSearchSettings::_getSearchSettingRefId())) {
71  $this->ilias->raiseError($this->lng->txt("permission_denied"), $this->ilias->error_obj->MESSAGE);
72  }
73  $forward_class = $this->ctrl->getNextClass($this);
74  switch ($forward_class) {
75  case 'illucenesearchgui':
76  $this->ctrl->forwardCommand(new ilLuceneSearchGUI());
77  break;
78 
79  case 'illuceneadvancedsearchgui':
80  $this->ctrl->forwardCommand(new ilLuceneAdvancedSearchGUI());
81  break;
82 
83  case 'illuceneusersearchgui':
84  if ($this->user->getId() === ANONYMOUS_USER_ID) {
85  $this->ilias->raiseError($this->lng->txt("permission_denied"), $this->ilias->error_obj->MESSAGE);
86  }
87  $this->ctrl->forwardCommand(new ilLuceneUserSearchGUI());
88  break;
89 
90  case 'iladvancedsearchgui':
91  $this->ctrl->forwardCommand(new ilAdvancedSearchGUI());
92  break;
93 
94  case 'ilsearchgui':
95  default:
96  $search_gui = new ilSearchGUI();
97  $this->ctrl->forwardCommand($search_gui);
98  break;
99  }
100  $this->tpl->printToStdout();
101  }
102 }
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
ilGlobalTemplateInterface $tpl
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
Interface Observer Contains several chained tasks and infos about them.
__construct()
Constructor public.
Interface ilCtrlBaseClassInterface describes ilCtrl base classes.
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:25
Class ilObjForumAdministration.
GUI for Lucene user search