ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
class.ilObjSearchSettingsGUI.php
Go to the documentation of this file.
1<?php
2
19declare(strict_types=1);
20
22use ILIAS\FileDelivery\Services as FileDelivery;
23use ILIAS\Search\ObjGUI\Readme\Helper as ServerReadmeHelper;
24
32{
33 protected UIServices $ui;
35 protected ilObjUser $user;
36 protected FileDelivery $file_delivery;
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 $this->file_delivery = $DIC->fileDelivery();
46
47 $this->type = "seas";
48 parent::__construct($a_data, $a_id, $a_call_by_reference, $a_prepare_output);
49 $this->lng->loadLanguageModule('search');
50 }
51
52 public function executeCommand(): void
53 {
54 $next_class = $this->ctrl->getNextClass($this);
55 $cmd = $this->ctrl->getCmd();
56 $this->prepareOutput();
57
58 switch ($next_class) {
59 case strtolower(ilPermissionGUI::class):
60 $this->tabs_gui->activateTab('perm_settings');
61 $perm_gui = new ilPermissionGUI($this);
62 $this->ctrl->forwardCommand($perm_gui);
63 return;
64
65 case strtolower(ilObjSearchSettingsFormGUI::class):
66 $this->tabs_gui->activateTab('settings');
67 $settings_gui = new ilObjSearchSettingsFormGUI(
68 $this->http,
69 $this->ctrl,
70 $this->lng,
71 $this->ui,
73 $this->settings,
74 $this->src_logger
75 ),
76 new ServerReadmeHelper(
77 $this->ctrl,
78 $this->lng,
79 $this->ui->factory()
80 )
81 );
82 $this->ctrl->forwardCommand($settings_gui);
83 return;
84
85 case strtolower(ilObjSearchLuceneSettingsFormGUI::class):
86 $this->tabs_gui->activateTab('lucene_settings_tab');
87 $luc_settings_gui = new ilObjSearchLuceneSettingsFormGUI(
88 $this->http,
89 $this->ctrl,
90 $this->lng,
91 $this->ui,
92 $this->refinery,
93 $this->user,
95 $this->settings,
96 $this->src_logger
97 ),
98 new ServerReadmeHelper(
99 $this->ctrl,
100 $this->lng,
101 $this->ui->factory()
102 )
103 );
104 $this->ctrl->forwardCommand($luc_settings_gui);
105 return;
106
107 case strtolower(ilObjSearchSettingsReadmeGUI::class):
108 $readme_gui = new ilObjSearchSettingsReadmeGUI(
109 $this->ctrl,
110 $this->file_delivery
111 );
112 $this->ctrl->forwardCommand($readme_gui);
113 return;
114 }
115
116 switch ($cmd) {
117 case '':
118 case 'view':
119 case 'settings':
120 $this->redirectToSettings();
121 break;
122
123 case 'luceneSettings':
125 break;
126
127 default:
128 $cmd .= "Object";
129 $this->$cmd();
130 }
131 }
132
133 protected function redirectToSettings(): void
134 {
135 if (!$this->rbac_system->checkAccess('visible,read', $this->object->getRefId())) {
136 $this->error->raiseError($this->lng->txt('permission_denied'), $this->error->MESSAGE);
137 }
138
139 $this->tabs_gui->setTabActive('settings');
140
141 if (!$this->rbac_system->checkAccess('write', $this->object->getRefId())) {
142 $this->ctrl->redirectByClass(
143 [get_class($this),'ilobjsearchsettingsformgui'],
144 'readOnly'
145 );
146 }
147
148 $this->ctrl->redirectByClass(
149 [get_class($this),'ilobjsearchsettingsformgui'],
150 'edit'
151 );
152 }
153
154 protected function redirectToLuceneSettings(): void
155 {
156 if (!$this->rbac_system->checkAccess('visible,read', $this->object->getRefId())) {
157 $this->error->raiseError($this->lng->txt('permission_denied'), $this->error->MESSAGE);
158 }
159
160 $this->tabs_gui->setTabActive('lucene_settings_tab');
161
162 if (!$this->rbac_system->checkAccess('write', $this->object->getRefId())) {
163 $this->ctrl->redirectByClass(
164 [get_class($this),'ilobjsearchlucenesettingsformgui'],
165 'readOnly'
166 );
167 }
168
169 $this->ctrl->redirectByClass(
170 [get_class($this),'ilobjsearchlucenesettingsformgui'],
171 'edit'
172 );
173 }
174
175 public function getAdminTabs(): void
176 {
177 $this->getTabs();
178 }
179
180 protected function getTabs(): void
181 {
182 if ($this->rbac_system->checkAccess("visible,read", $this->object->getRefId())) {
183 $this->tabs_gui->addTab(
184 'settings',
185 $this->lng->txt('settings'),
186 $this->ctrl->getLinkTarget($this, 'settings')
187 );
188 }
189
190 if ($this->rbac_system->checkAccess('read', $this->object->getRefId())) {
191 $this->tabs_gui->addTab(
192 'lucene_settings_tab',
193 $this->lng->txt('lucene_settings_tab'),
194 $this->ctrl->getLinkTarget($this, 'luceneSettings')
195 );
196 }
197
198 if ($this->rbac_system->checkAccess('edit_permission', $this->object->getRefId())) {
199 $this->tabs_gui->addTab(
200 'perm_settings',
201 $this->lng->txt('perm_settings'),
202 $this->ctrl->getLinkTargetByClass(
203 [get_class($this),'ilpermissiongui'],
204 'perm'
205 ),
206 );
207 }
208 }
209}
Provides fluid interface to RBAC services.
Definition: UIServices.php:25
error(string $a_errmsg)
Component logger with individual log levels by component id.
__construct($a_data, $a_id, $a_call_by_reference, $a_prepare_output=true)
getAdminTabs()
administration tabs show only permissions and trash folder
getTabs()
@abstract overwrite in derived GUI class of your object type
User class.
Class ilObjectGUI Basic methods of all Output classes.
prepareOutput(bool $show_sub_objects=true)
static http()
Fetches the global http state from ILIAS.
__construct(Container $dic, ilPlugin $plugin)
@inheritDoc
global $DIC
Definition: shib_login.php:26