ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
class.ilObjRootFolderGUI.php
Go to the documentation of this file.
1<?php
2
19declare(strict_types=1);
20
23
35{
37 protected ilHelpGUI $help;
38
39 public function __construct(
40 $a_data,
41 int $a_id,
42 bool $a_call_by_reference = true,
43 bool $a_prepare_output = true
44 ) {
46 global $DIC;
47
48 $this->type = "root";
49 $lng = $DIC->language();
50
51 parent::__construct($a_data, $a_id, $a_call_by_reference, $a_prepare_output);
52
53 $lng->loadLanguageModule("cntr");
55
56 $this->root_request = $DIC
57 ->rootFolder()
58 ->internal()
59 ->gui()
60 ->standardRequest();
61 $this->help = $DIC->help();
62 }
63
64 protected function getTabs(): void
65 {
69
71
72 $this->ctrl->setParameter($this, "ref_id", $this->ref_id);
73
74 if ($rbacsystem->checkAccess('read', $this->ref_id)) {
75 $this->tabs_gui->addTab(
76 'view_content',
77 $lng->txt("content"),
78 $this->ctrl->getLinkTarget($this, "")
79 );
80 }
81
82 if ($rbacsystem->checkAccess('write', $this->ref_id)) {
83 $cmd = $this->ctrl->getCmd();
84 $this->tabs_gui->addTarget(
85 "settings",
86 $this->ctrl->getLinkTarget($this, "edit"),
87 "edit",
88 get_class($this),
89 "",
90 $cmd === 'edit'
91 );
92 }
93
94 // parent tabs (all container: edit_permission, clipboard, trash
95 parent::getTabs();
96 }
97
98 public function executeCommand(): void
99 {
100 $next_class = $this->ctrl->getNextClass($this);
101 $cmd = $this->ctrl->getCmd();
102
103 switch ($next_class) {
104 case strtolower(ilRepositoryTrashGUI::class):
105 $ru = new ilRepositoryTrashGUI($this);
106 $this->ctrl->setReturn($this, 'trash');
107 $this->ctrl->forwardCommand($ru);
108 break;
109
110 // container page editing
111 case "ilcontainerpagegui":
112 $this->prepareOutput(false);
113 $ret = $this->forwardToPageObject();
114 if ($ret !== "") {
115 $this->tpl->setContent($ret);
116 }
117 break;
118
119 case 'ilpermissiongui':
120 $this->prepareOutput();
121 $this->tabs_gui->activateTab('perm_settings');
122 $perm_gui = new ilPermissionGUI($this);
123 $ret = $this->ctrl->forwardCommand($perm_gui);
124 break;
125
126 case "ilcolumngui":
127 $this->checkPermission("read");
128 $this->prepareOutput();
129 $this->content_style_gui->addCss(
130 $this->tpl,
131 $this->object->getRefId()
132 );
133 $this->renderObject();
134 break;
135
136 case 'ilobjectcopygui':
137 $this->prepareOutput();
138 $cp = new ilObjectCopyGUI($this);
139 $cp->setType('root');
140 $this->ctrl->forwardCommand($cp);
141 break;
142
143 case "ilobjectcontentstylesettingsgui":
144 $this->checkPermission("write");
145 $this->setTitleAndDescription();
146 $this->showContainerPageTabs();
147 $settings_gui = $this->content_style_gui
148 ->objectSettingsGUIForRefId(
149 null,
150 $this->object->getRefId()
151 );
152 $this->ctrl->forwardCommand($settings_gui);
153 break;
154
155 case "ilcommonactiondispatchergui":
157 $this->ctrl->forwardCommand($gui);
158 break;
159
160 case strtolower(TranslationGUI::class):
161 $this->checkPermissionBool("write");
162 $this->prepareOutput();
163 $this->setEditTabs("settings_trans");
164 $transgui = new TranslationGUI(
165 $this->getObject(),
166 $this->lng,
167 $this->access,
168 $this->user,
169 $this->ctrl,
170 $this->tpl,
171 $this->ui_factory,
172 $this->ui_renderer,
173 $this->http,
174 $this->refinery,
175 $this->toolbar
176 );
177 $this->ctrl->forwardCommand($transgui);
178 break;
179
180 default:
181 if ($cmd === "infoScreen") {
182 $this->checkPermission("visible");
183 } else {
184 try {
185 $this->checkPermission("read");
186 } catch (ilObjectException $exception) {
187 $this->ctrl->redirectToURL("login.php?client_id=" . CLIENT_ID . "&cmd=force_login");
188 }
189 }
190 $this->prepareOutput();
191 $this->content_style_gui->addCss(
192 $this->tpl,
193 $this->object->getRefId()
194 );
195
196 if (!$cmd) {
197 $cmd = "render";
198 }
199
200 $cmd .= "Object";
201 $this->$cmd();
202
203 break;
204 }
205 }
206
207 public function renderObject(): void
208 {
209 global $ilTabs;
210
212 "",
213 "",
214 $this->ctrl->getLinkTargetByClass(["ilcommonactiondispatchergui", "iltagginggui"], "", "", true, false)
215 );
216
217 $ilTabs->activateTab("view_content");
218 parent::renderObject();
219 }
220
224 public function viewObject(): void
225 {
226 $this->checkPermission('read');
227
228 if (strtolower($this->root_request->getBaseClass()) === "iladministrationgui") {
229 parent::viewObject();
230 return;
231 }
232
233 $this->renderObject();
234 }
235
236 protected function setTitleAndDescription(): void
237 {
238 global $lng;
239
240 parent::setTitleAndDescription();
241 $this->tpl->setDescription("");
242 if (!ilContainer::_lookupContainerSetting($this->object->getId(), "hide_header_icon_and_title")) {
243 if ($this->object->getTitle() === "ILIAS") {
244 $this->tpl->setTitle($lng->txt("repository"));
245 } elseif ($this->object->getDescription() !== "") {
246 $this->tpl->setDescription($this->object->getDescription()); // #13479
247 }
248 }
249 }
250
251 protected function setEditTabs(
252 string $active_tab = "settings_misc"
253 ): void {
254 $this->tabs_gui->addSubTab(
255 "settings_misc",
256 $this->lng->txt("settings"),
257 $this->ctrl->getLinkTarget($this, "edit")
258 );
259
260 $this->tabs_gui->addSubTab(
261 "settings_trans",
262 $this->lng->txt("obj_multilinguality"),
263 $this->ctrl->getLinkTargetByClass(TranslationGUI::class, "")
264 );
265
266
267 $this->tabs_gui->activateTab("settings");
268 $this->tabs_gui->activateSubTab($active_tab);
269 }
270
271 protected function initEditForm(): ilPropertyFormGUI
272 {
273 $this->setEditTabs();
274 $obj_service = $this->getObjectService();
275
276 $form = new ilPropertyFormGUI();
277 $form->setFormAction($this->ctrl->getFormAction($this));
278 $form->setTitle($this->lng->txt('obj_presentation'));
279
280 // list presentation
281 $form = $this->initListPresentationForm($form);
282
283 $this->initSortingForm(
284 $form,
285 [
289 ]
290 );
291
292
293 $form = $obj_service->commonSettings()->legacyForm($form, $this->object)->addIcon();
294
295 $form = $obj_service->commonSettings()->legacyForm($form, $this->object)->addTitleIconVisibility();
296
297 $form->addCommandButton("update", $this->lng->txt("save"));
298 $form->addCommandButton("addTranslation", $this->lng->txt("add_translation"));
299
300 return $form;
301 }
302
303 protected function getEditFormValues(): array
304 {
305 // values are set in initEditForm()
306 return [];
307 }
308
309 public function updateObject(): void
310 {
311 global $ilSetting;
312
313 $obj_service = $this->getObjectService();
314
315 if (!$this->checkPermissionBool("write")) {
316 throw new ilPermissionException($this->lng->txt("msg_no_perm_write"));
317 }
318
319 $form = $this->initEditForm();
320 if ($form->checkInput()) {
321 $this->saveSortingSettings($form);
322
323 // list presentation
324 $this->saveListPresentation($form);
325
326 // custom icon
327 $obj_service->commonSettings()->legacyForm($form, $this->object)->saveIcon();
328 $obj_service->commonSettings()->legacyForm($form, $this->object)->saveTitleIconVisibility();
329
330 // BEGIN ChangeEvent: Record update
331 global $ilUser;
332 ilChangeEvent::_recordWriteEvent($this->object->getId(), $ilUser->getId(), 'update');
333 ilChangeEvent::_catchupWriteEvents($this->object->getId(), $ilUser->getId());
334 // END ChangeEvent: Record update
335
336 $this->tpl->setOnScreenMessage('success', $this->lng->txt("msg_obj_modified"), true);
337 $this->ctrl->redirect($this, "edit");
338 }
339
340 // display form to correct errors
341 $this->setEditTabs();
342 $form->setValuesByPost();
343 $this->tpl->setContent($form->getHTML());
344 }
345
346 public static function _goto(string $a_target): void
347 {
349 }
350}
static _catchupWriteEvents(int $obj_id, int $usr_id, ?string $timestamp=null)
Catches up with all write events which occured before the specified timestamp.
static _recordWriteEvent(int $obj_id, int $usr_id, string $action, ?int $parent_obj_id=null)
Records a write event.
static getInstanceFromAjaxCall()
(Re-)Build instance from ajax call
Class ilContainerGUI This is a base GUI class for all container objects in ILIAS: root folder,...
ILIAS Container InternalGUIService $gui
ilRbacSystem $rbacsystem
static _lookupContainerSetting(int $a_id, string $a_keyword, ?string $a_default_value=null)
Help GUI class.
setScreenIdComponent(string $a_comp)
loadLanguageModule(string $a_module)
Load language module.
txt(string $a_topic, string $a_default_lang_fallback_mod="")
gets the text for a given topic if the topic is not in the list, the topic itself with "-" will be re...
Class ilObjRootFolderGUI.
updateObject()
updates object entry in object_data
static _goto(string $a_target)
getTabs()
@abstract overwrite in derived GUI class of your object type
setEditTabs(string $active_tab="settings_misc")
StandardGUIRequest $root_request
GUI class for the workflow of copying objects.
Base exception class for object service.
static _gotoRepositoryRoot(bool $raise_error=false)
Goto repository root.
checkPermission(string $perm, string $cmd="", string $type="", ?int $ref_id=null)
checkPermissionBool(string $perm, string $cmd="", string $type="", ?int $ref_id=null)
prepareOutput(bool $show_sub_objects=true)
ilLanguage $lng
static prepareJsLinks(string $redraw_url, string $notes_url, string $tags_url, ?ilGlobalTemplateInterface $tpl=null)
Insert js/ajax links into template.
This class represents a property form user interface.
checkAccess(string $a_operations, int $a_ref_id, string $a_type="")
checkAccess represents the main method of the RBAC-system in ILIAS3 developers want to use With this ...
Repository GUI Utilities.
const CLIENT_ID
Definition: constants.php:41
static http()
Fetches the global http state from ILIAS.
__construct(Container $dic, ilPlugin $plugin)
@inheritDoc
global $ilSetting
Definition: privfeed.php:31
global $DIC
Definition: shib_login.php:26