ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
class.ilObjWikiSettingsGUI.php
Go to the documentation of this file.
1<?php
2
29{
31 protected ilTabsGUI $tabs;
32
33 public function __construct(
34 int $a_id = 0,
35 int $a_id_type = self::REPOSITORY_NODE_ID,
36 int $a_parent_node_id = 0
37 ) {
38 parent::__construct($a_id, $a_id_type, $a_parent_node_id);
39 global $DIC;
40
41 $this->error = $DIC["ilErr"];
42 $this->access = $DIC->access();
43 $this->lng = $DIC->language();
44 $this->ctrl = $DIC->ctrl();
45 $this->tabs = $DIC->tabs();
46 $this->toolbar = $DIC->toolbar();
47 $this->tpl = $DIC["tpl"];
48 }
49
50 public function getType(): string
51 {
52 return "wiks";
53 }
54
55 public function executeCommand(): void
56 {
59
60 $lng->loadLanguageModule("wiki");
61
62 $next_class = $this->ctrl->getNextClass($this);
63 $cmd = $this->ctrl->getCmd();
64
65 $this->prepareOutput();
66
67 if (!$this->rbac_system->checkAccess("visible,read", $this->object->getRefId())) {
68 $ilErr->raiseError($this->lng->txt('no_permission'), $ilErr->WARNING);
69 }
70
71 switch ($next_class) {
72 case 'ilpermissiongui':
73 $this->tabs_gui->setTabActive('perm_settings');
74 $perm_gui = new ilPermissionGUI($this);
75 $this->ctrl->forwardCommand($perm_gui);
76 break;
77
78 default:
79 if (!$cmd || $cmd === 'view') {
80 $cmd = "editSettings";
81 }
82 $this->$cmd();
83 break;
84 }
85 }
86
87 protected function editSettings(?ilPropertyFormGUI $form = null): void
88 {
89 $ilTabs = $this->tabs;
91
92 $ilTabs->activateTab("settings");
93
94 if ($this->rbac_system->checkAccess("visible,read", $this->object->getRefId())) {
95 if (!$form) {
96 $form = $this->initForm();
97 $this->populateWithCurrentSettings($form);
98 }
99 $tpl->setContent($form->getHTML());
100 }
101 }
102
103 protected function populateWithCurrentSettings(ilPropertyFormGUI $form): void
104 {
105 $form->setValuesByArray([]);
106 }
107
108 public function initForm(): ilPropertyFormGUI
109 {
111 $ilCtrl = $this->ctrl;
112
113 $form = new ilPropertyFormGUI();
114
115
116 if ($this->checkPermissionBool("write")) {
117 $form->addCommandButton("saveSettings", $lng->txt("save"));
118 }
119
120 $form->setTitle($lng->txt("settings"));
121 $form->setFormAction($ilCtrl->getFormAction($this));
122
123 return $form;
124 }
125
126 protected function saveSettings(): void
127 {
129 $ilCtrl = $this->ctrl;
130
131 if (!$this->checkPermissionBool("write")) {
132 $this->editSettings();
133 return;
134 }
135
136 $form = $this->initForm();
137 if (!$form->checkInput()) {
138 $form->setValuesByPost();
139 $this->editSettings($form);
140 return;
141 }
142
143 $this->tpl->setOnScreenMessage('success', $lng->txt('msg_obj_modified'), true);
144 $ilCtrl->redirect($this, 'editSettings');
145 }
146
147 public function getAdminTabs(): void
148 {
149 if ($this->checkPermissionBool("visible,read")) {
150 $this->tabs_gui->addTab(
151 "settings",
152 $this->lng->txt("settings"),
153 $this->ctrl->getLinkTarget($this, "editSettings")
154 );
155 }
156
157 if ($this->checkPermissionBool("edit_permission")) {
158 $this->tabs_gui->addTab(
159 "perm_settings",
160 $this->lng->txt("perm_settings"),
161 $this->ctrl->getLinkTargetByClass(array(get_class($this),'ilpermissiongui'), "perm")
162 );
163 }
164 }
165
166 public function addToExternalSettingsForm(int $a_form_id): ?array
167 {
168 return null;
169 }
170}
error(string $a_errmsg)
Error Handling & global info handling.
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...
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
editSettings(?ilPropertyFormGUI $form=null)
getAdminTabs()
administration tabs show only permissions and trash folder
__construct(int $a_id=0, int $a_id_type=self::REPOSITORY_NODE_ID, int $a_parent_node_id=0)
populateWithCurrentSettings(ilPropertyFormGUI $form)
getType()
Functions that must be overwritten.
New implementation of ilObjectGUI.
ilGlobalTemplateInterface $tpl
checkPermissionBool(string $perm, string $cmd="", string $type="", ?int $node_id=null)
prepareOutput(bool $show_sub_objects=true)
This class represents a property form user interface.
setValuesByArray(array $a_values, bool $a_restrict_to_value_keys=false)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
setContent(string $a_html)
Sets content for standard template.
__construct(Container $dic, ilPlugin $plugin)
@inheritDoc
$ilErr
Definition: raiseError.php:33
global $DIC
Definition: shib_login.php:26