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