ILIAS  trunk Revision v11.0_alpha-2638-g80c1d007f79
class.ilObjSearchSettingsGUI.php
Go to the documentation of this file.
1 <?php
2 
19 declare(strict_types=1);
20 
24 
31 {
32  protected UIServices $ui;
33  protected ilLogger $src_logger;
34  protected ilObjUser $user;
35 
36  protected bool $read_only = true;
37 
38  public function __construct($a_data, $a_id, $a_call_by_reference, $a_prepare_output = true)
39  {
40  global $DIC;
41 
42  $this->ui = $DIC->ui();
43  $this->src_logger = $DIC->logger()->src();
44  $this->user = $DIC->user();
45 
46  $this->type = "seas";
47  parent::__construct($a_data, $a_id, $a_call_by_reference, $a_prepare_output);
48  $this->lng->loadLanguageModule('search');
49  }
50 
51  public function executeCommand(): void
52  {
53  $next_class = $this->ctrl->getNextClass($this);
54  $cmd = $this->ctrl->getCmd();
55  $this->prepareOutput();
56 
57  switch ($next_class) {
58  case 'ilpermissiongui':
59  $this->tabs_gui->activateTab('perm_settings');
60  $perm_gui = new ilPermissionGUI($this);
61  $ret = $this->ctrl->forwardCommand($perm_gui);
62  return;
63 
64  case 'ilobjsearchsettingsformgui':
65  $this->tabs_gui->activateTab('settings');
66  $settings_gui = new ilObjSearchSettingsFormGUI(
67  $this->http,
68  $this->ctrl,
69  $this->lng,
70  $this->ui,
72  $this->settings,
73  $this->src_logger
74  )
75  );
76  $ret = $this->ctrl->forwardCommand($settings_gui);
77  return;
78 
79  case 'ilobjsearchlucenesettingsformgui':
80  $this->tabs_gui->activateTab('lucene_settings_tab');
81  $luc_settings_gui = new ilObjSearchLuceneSettingsFormGUI(
82  $this->http,
83  $this->ctrl,
84  $this->lng,
85  $this->ui,
86  $this->refinery,
87  $this->user,
89  $this->settings,
90  $this->src_logger
91  )
92  );
93  $ret = $this->ctrl->forwardCommand($luc_settings_gui);
94  return;
95  }
96 
97  switch ($cmd) {
98  case '':
99  case 'view':
100  case 'settings':
101  $this->redirectToSettings();
102  break;
103 
104  case 'luceneSettings':
105  $this->redirectToLuceneSettings();
106  break;
107 
108  default:
109  $cmd .= "Object";
110  $this->$cmd();
111  }
112  }
113 
114  protected function redirectToSettings(): void
115  {
116  if (!$this->rbac_system->checkAccess('visible,read', $this->object->getRefId())) {
117  $this->error->raiseError($this->lng->txt('permission_denied'), $this->error->MESSAGE);
118  }
119 
120  $this->tabs_gui->setTabActive('settings');
121 
122  if (!$this->rbac_system->checkAccess('write', $this->object->getRefId())) {
123  $this->ctrl->redirectByClass(
124  [get_class($this),'ilobjsearchsettingsformgui'],
125  'readOnly'
126  );
127  }
128 
129  $this->ctrl->redirectByClass(
130  [get_class($this),'ilobjsearchsettingsformgui'],
131  'edit'
132  );
133  }
134 
135  protected function redirectToLuceneSettings(): void
136  {
137  if (!$this->rbac_system->checkAccess('visible,read', $this->object->getRefId())) {
138  $this->error->raiseError($this->lng->txt('permission_denied'), $this->error->MESSAGE);
139  }
140 
141  $this->tabs_gui->setTabActive('lucene_settings_tab');
142 
143  if (!$this->rbac_system->checkAccess('write', $this->object->getRefId())) {
144  $this->ctrl->redirectByClass(
145  [get_class($this),'ilobjsearchlucenesettingsformgui'],
146  'readOnly'
147  );
148  }
149 
150  $this->ctrl->redirectByClass(
151  [get_class($this),'ilobjsearchlucenesettingsformgui'],
152  'edit'
153  );
154  }
155 
156  public function getAdminTabs(): void
157  {
158  $this->getTabs();
159  }
160 
161  protected function getTabs(): void
162  {
163  if ($this->rbac_system->checkAccess("visible,read", $this->object->getRefId())) {
164  $this->tabs_gui->addTab(
165  'settings',
166  $this->lng->txt('settings'),
167  $this->ctrl->getLinkTarget($this, 'settings')
168  );
169  }
170 
171  if ($this->rbac_system->checkAccess('read', $this->object->getRefId())) {
172  $this->tabs_gui->addTab(
173  'lucene_settings_tab',
174  $this->lng->txt('lucene_settings_tab'),
175  $this->ctrl->getLinkTarget($this, 'luceneSettings')
176  );
177  }
178 
179  if ($this->rbac_system->checkAccess('edit_permission', $this->object->getRefId())) {
180  $this->tabs_gui->addTab(
181  'perm_settings',
182  $this->lng->txt('perm_settings'),
183  $this->ctrl->getLinkTargetByClass(
184  [get_class($this),'ilpermissiongui'],
185  'perm'
186  ),
187  );
188  }
189  }
190 }
prepareOutput(bool $show_sub_objects=true)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
Provides fluid interface to RBAC services.
Definition: UIServices.php:24
static http()
Fetches the global http state from ILIAS.
Class ilObjectGUI Basic methods of all Output classes.
global $DIC
Definition: shib_login.php:26
__construct($a_data, $a_id, $a_call_by_reference, $a_prepare_output=true)
__construct(Container $dic, ilPlugin $plugin)