ILIAS  release_8 Revision v8.24
class.ilObjRootFolderGUI.php
Go to the documentation of this file.
1<?php
2
3declare(strict_types=1);
4
19
31{
33 protected ilHelpGUI $help;
34
35 public function __construct(
36 $a_data,
37 int $a_id,
38 bool $a_call_by_reference = true,
39 bool $a_prepare_output = true
40 ) {
42 global $DIC;
43
44 $this->type = "root";
45 $lng = $DIC->language();
46
47 parent::__construct($a_data, $a_id, $a_call_by_reference, $a_prepare_output);
48
49 $lng->loadLanguageModule("cntr");
51
52 $this->root_request = $DIC
53 ->rootFolder()
54 ->internal()
55 ->gui()
56 ->standardRequest();
57 $this->help = $DIC->help();
58 }
59
60 protected function getTabs(): void
61 {
65
67
68 $this->ctrl->setParameter($this, "ref_id", $this->ref_id);
69
70 if ($rbacsystem->checkAccess('read', $this->ref_id)) {
71 $this->tabs_gui->addTab(
72 'view_content',
73 $lng->txt("content"),
74 $this->ctrl->getLinkTarget($this, "")
75 );
76 }
77
78 if ($rbacsystem->checkAccess('write', $this->ref_id)) {
79 $cmd = $this->ctrl->getCmd();
80 $this->tabs_gui->addTarget(
81 "settings",
82 $this->ctrl->getLinkTarget($this, "edit"),
83 "edit",
84 get_class($this),
85 "",
86 $cmd === 'edit'
87 );
88 }
89
90 // parent tabs (all container: edit_permission, clipboard, trash
91 parent::getTabs();
92 }
93
94 public function executeCommand(): void
95 {
96 $next_class = $this->ctrl->getNextClass($this);
97 $cmd = $this->ctrl->getCmd();
98
99 switch ($next_class) {
100 case strtolower(ilRepositoryTrashGUI::class):
101 $ru = new ilRepositoryTrashGUI($this);
102 $this->ctrl->setReturn($this, 'trash');
103 $this->ctrl->forwardCommand($ru);
104 break;
105
106 // container page editing
107 case "ilcontainerpagegui":
108 $this->prepareOutput(false);
109 $ret = $this->forwardToPageObject();
110 if ($ret !== "") {
111 $this->tpl->setContent($ret);
112 }
113 break;
114
115 case 'ilpermissiongui':
116 $this->prepareOutput();
117 $this->tabs_gui->activateTab('perm_settings');
118 $perm_gui = new ilPermissionGUI($this);
119 $ret = $this->ctrl->forwardCommand($perm_gui);
120 break;
121
122 case "ilcolumngui":
123 $this->checkPermission("read");
124 $this->prepareOutput();
125 $this->content_style_gui->addCss(
126 $this->tpl,
127 $this->object->getRefId()
128 );
129 $this->renderObject();
130 break;
131
132 case 'ilobjectcopygui':
133 $this->prepareOutput();
134 $cp = new ilObjectCopyGUI($this);
135 $cp->setType('root');
136 $this->ctrl->forwardCommand($cp);
137 break;
138
139 case "ilobjectcontentstylesettingsgui":
140 $this->checkPermission("write");
141 $this->setTitleAndDescription();
142 $this->showContainerPageTabs();
143 $settings_gui = $this->content_style_gui
144 ->objectSettingsGUIForRefId(
145 null,
146 $this->object->getRefId()
147 );
148 $this->ctrl->forwardCommand($settings_gui);
149 break;
150
151 case "ilcommonactiondispatchergui":
153 $this->ctrl->forwardCommand($gui);
154 break;
155
156 case 'ilobjecttranslationgui':
157 $this->checkPermissionBool("write");
158 $this->prepareOutput();
159 $this->setEditTabs("settings_trans");
160 $transgui = new ilObjectTranslationGUI($this);
161 $this->ctrl->forwardCommand($transgui);
162 break;
163
164 default:
165 if ($cmd === "infoScreen") {
166 $this->checkPermission("visible");
167 } else {
168 try {
169 $this->checkPermission("read");
170 } catch (ilObjectException $exception) {
171 $this->ctrl->redirectToURL("login.php?client_id=" . CLIENT_ID . "&cmd=force_login");
172 }
173 }
174 $this->prepareOutput();
175 $this->content_style_gui->addCss(
176 $this->tpl,
177 $this->object->getRefId()
178 );
179
180 if (!$cmd) {
181 $cmd = "render";
182 }
183
184 $cmd .= "Object";
185 $this->$cmd();
186
187 break;
188 }
189 }
190
191 public function renderObject(): void
192 {
193 global $ilTabs;
194
196 "",
197 "",
198 $this->ctrl->getLinkTargetByClass(["ilcommonactiondispatchergui", "iltagginggui"], "", "", true, false)
199 );
200
201 $ilTabs->activateTab("view_content");
202 parent::renderObject();
203 }
204
208 public function viewObject(): void
209 {
210 $this->checkPermission('read');
211
212 if (strtolower($this->root_request->getBaseClass()) === "iladministrationgui") {
213 parent::viewObject();
214 return;
215 }
216
217 $this->renderObject();
218 }
219
220 protected function setTitleAndDescription(): void
221 {
222 global $lng;
223
224 parent::setTitleAndDescription();
225 $this->tpl->setDescription("");
226 if (!ilContainer::_lookupContainerSetting($this->object->getId(), "hide_header_icon_and_title")) {
227 if ($this->object->getTitle() === "ILIAS") {
228 $this->tpl->setTitle($lng->txt("repository"));
229 } elseif ($this->object->getDescription() !== "") {
230 $this->tpl->setDescription($this->object->getDescription()); // #13479
231 }
232 }
233 }
234
235 protected function setEditTabs(
236 string $active_tab = "settings_misc"
237 ): void {
238 $this->tabs_gui->addSubTab(
239 "settings_misc",
240 $this->lng->txt("settings"),
241 $this->ctrl->getLinkTarget($this, "edit")
242 );
243
244 $this->tabs_gui->addSubTab(
245 "settings_trans",
246 $this->lng->txt("obj_multilinguality"),
247 $this->ctrl->getLinkTargetByClass("ilobjecttranslationgui", "")
248 );
249
250
251 $this->tabs_gui->activateTab("settings");
252 $this->tabs_gui->activateSubTab($active_tab);
253 }
254
255 protected function initEditForm(): ilPropertyFormGUI
256 {
257 $this->setEditTabs();
258 $obj_service = $this->getObjectService();
259
260 $form = new ilPropertyFormGUI();
261 $form->setFormAction($this->ctrl->getFormAction($this));
262 $form->setTitle($this->lng->txt('obj_presentation'));
263
264 // list presentation
265 $form = $this->initListPresentationForm($form);
266
267 $this->initSortingForm(
268 $form,
269 [
273 ]
274 );
275
276
277 $this->showCustomIconsEditing(1, $form, false);
278
279 $form = $obj_service->commonSettings()->legacyForm($form, $this->object)->addTitleIconVisibility();
280
281 $form->addCommandButton("update", $this->lng->txt("save"));
282 $form->addCommandButton("addTranslation", $this->lng->txt("add_translation"));
283
284 return $form;
285 }
286
287 protected function getEditFormValues(): array
288 {
289 // values are set in initEditForm()
290 return [];
291 }
292
293 public function updateObject(): void
294 {
295 global $ilSetting;
296
297 $obj_service = $this->getObjectService();
298
299 if (!$this->checkPermissionBool("write")) {
300 throw new ilPermissionException($this->lng->txt("msg_no_perm_write"));
301 }
302
303 $form = $this->initEditForm();
304 if ($form->checkInput()) {
305 $this->saveSortingSettings($form);
306
307 // list presentation
308 $this->saveListPresentation($form);
309
310 if ($ilSetting->get('custom_icons')) {
311 global $DIC;
313 $customIconFactory = $DIC['object.customicons.factory'];
314 $customIcon = $customIconFactory->getByObjId($this->object->getId(), $this->object->getType());
315
317 $fileData = (array) $form->getInput('cont_icon');
318 $item = $form->getItemByPostVar('cont_icon');
319
320 if ($item->getDeletionFlag()) {
321 $customIcon->remove();
322 }
323
324 if ($fileData['tmp_name']) {
325 $customIcon->saveFromHttpRequest();
326 }
327 }
328
329 // custom icon
330 $obj_service->commonSettings()->legacyForm($form, $this->object)->saveTitleIconVisibility();
331
332 // BEGIN ChangeEvent: Record update
333 global $ilUser;
334 ilChangeEvent::_recordWriteEvent($this->object->getId(), $ilUser->getId(), 'update');
335 ilChangeEvent::_catchupWriteEvents($this->object->getId(), $ilUser->getId());
336 // END ChangeEvent: Record update
337
338 $this->tpl->setOnScreenMessage('success', $this->lng->txt("msg_obj_modified"), true);
339 $this->ctrl->redirect($this, "edit");
340 }
341
342 // display form to correct errors
343 $this->setEditTabs();
344 $form->setValuesByPost();
345 $this->tpl->setContent($form->getHTML());
346 }
347
348 public static function _goto(string $a_target): void
349 {
351 }
352}
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,...
ilRbacSystem $rbacsystem
prepareOutput(bool $show_subobjects=true)
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.
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.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
__construct($data, int $id=0, bool $call_by_reference=true, bool $prepare_output=true)
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)
ilLanguage $lng
static prepareJsLinks(string $redraw_url, string $notes_url, string $tags_url, ilGlobalTemplateInterface $tpl=null)
Insert js/ajax links into template.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
New PermissionGUI (extends from old ilPermission2GUI) RBAC related output.
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
global $DIC
Definition: feed.php:28
$ilUser
Definition: imgupload.php:34
__construct(Container $dic, ilPlugin $plugin)
@inheritDoc
global $ilSetting
Definition: privfeed.php:17