ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
class.ilObjStudyProgrammeAdminGUI.php
Go to the documentation of this file.
1<?php
2
19declare(strict_types=1);
20
29{
32
33 public function __construct($data, int $id, bool $call_by_reference = true, bool $prepare_output = true)
34 {
36
37 $this->type = 'prgs';
38 $this->lng->loadLanguageModule('prg');
39 $this->type_gui = ilStudyProgrammeDIC::dic()['ilStudyProgrammeTypeGUI'];
40 }
41
45 protected function getType(): string
46 {
47 return "prgs";
48 }
49
53 protected function getParentObjType(): string
54 {
55 return "prg";
56 }
57
61 protected function getAdministrationFormId(): int
62 {
64 }
65
70 {
71 return $form;
72 }
73
77 protected function saveChildSettings(ilPropertyFormGUI $form): void
78 {
79 }
80
84 protected function getChildSettingsInfo($a_form_id): array
85 {
86 return [];
87 }
88
89 public function executeCommand(): void
90 {
91 //Check Permissions globally for all SubGUIs. We only check write permissions
92 if (!$this->rbac_system->checkAccess("visible,read", $this->object->getRefId())) {
93 $this->error->raiseError($this->lng->txt("no_permission"), $this->error->WARNING);
94 }
95 $next_class = $this->ctrl->getNextClass($this);
96 $cmd = $this->ctrl->getCmd();
97 $this->prepareOutput();
98 switch ($next_class) {
99 case 'ilpermissiongui':
100 $this->tabs_gui->activateTab('perm_settings');
101 $perm_gui = new ilPermissionGUI($this);
102 $this->ctrl->forwardCommand($perm_gui);
103 break;
104 case 'ilstudyprogrammetypegui':
105 $this->tabs_gui->activateTab('prg_subtypes');
106 $this->type_gui->setParentGUI($this);
107 $this->ctrl->forwardCommand($this->type_gui);
108 break;
109 default:
110 if (!$cmd || $cmd === "view") {
111 $cmd = "editSettings";
112 }
113 $this->$cmd();
114 break;
115 }
116 }
117
118 public function editSettings(?ilPropertyFormGUI $form = null): void
119 {
120 $this->tabs_gui->activateTab('settings');
121 if (is_null($form)) {
122 $form = $this->initFormSettings();
123 }
124 $this->tpl->setContent($form->getHTML());
125 }
126
128 {
129 $form = new ilPropertyFormGUI();
130 $form->setFormAction($this->ctrl->getFormAction($this, "saveSettings"));
131 $form->setTitle($this->lng->txt("settings"));
132
133 $this->addFieldsToForm($form);
134
137 $form,
138 $this
139 );
140
141 $radio_grp = new ilRadioGroupInputGUI($this->lng->txt("prg_show_programmes"), "visible_on_personal_desktop");
142 $radio_grp->addOption(new ilRadioOption(
143 $this->lng->txt("prg_show_programmes_on_pd_always"),
145 ));
146 $radio_grp->addOption(new ilRadioOption(
147 $this->lng->txt("prg_show_programmes_on_pd_only_read"),
149 ));
152 $radio_grp->setValue($value);
153 $form->addItem($radio_grp);
154
155 if ($this->access->checkAccess("write", "", $this->object->getRefId())) {
156 $form->addCommandButton("saveSettings", $this->lng->txt("save"));
157 $form->addCommandButton("view", $this->lng->txt("cancel"));
158 }
159
160 return $form;
161 }
162
163 public function saveSettings(): void
164 {
165 $this->checkPermission("write");
166
167 $form = $this->initFormSettings();
168 if ($form->checkInput()) {
169 if ($this->save($form)) {
170 $this->settings->set(
172 $form->getInput('visible_on_personal_desktop')
173 );
174
175 $this->tpl->setOnScreenMessage("success", $this->lng->txt("settings_saved"), true);
176 $this->ctrl->redirect($this, "editSettings");
177 }
178 }
179
180 $form->setValuesByPost();
181 $this->editSettings($form);
182 }
183
184 public function getAdminTabs(): void
185 {
186 if ($this->rbac_system->checkAccess('visible,read', $this->object->getRefId())) {
187 $this->tabs_gui->addTarget(
188 'settings',
189 $this->ctrl->getLinkTargetByClass('ilObjStudyProgrammeAdminGUI', 'view')
190 );
191
192 $this->tabs_gui->addTarget(
193 'prg_subtypes',
194 $this->ctrl->getLinkTargetByClass(
195 array('ilObjStudyProgrammeAdminGUI', 'ilStudyProgrammeTypeGUI'),
196 'listTypes'
197 )
198 );
199 }
200 if ($this->rbac_system->checkAccess('edit_permission', $this->object->getRefId())) {
201 $this->tabs_gui->addTarget(
202 'perm_settings',
203 $this->ctrl->getLinkTargetByClass('ilpermissiongui', 'perm'),
204 array(),
205 'ilpermissiongui'
206 );
207 }
208 }
209
210 public function _goto($ref_id): void
211 {
212 $this->ctrl->setTargetScript('ilias.php');
213 $this->ctrl->setParameterByClass("ilObjStudyProgrammeAdminGUI", "ref_id", $ref_id);
214 $this->ctrl->setParameterByClass("ilObjStudyProgrammeAdminGUI", "admin_mode", "settings");
215 $this->ctrl->redirectByClass(array("ilAdministrationGUI", "ilObjStudyProgrammeAdminGUI"), "view");
216 }
217
218 protected function save(ilPropertyFormGUI $form): bool
219 {
220 return true;
221 }
222}
error(string $a_errmsg)
static addFieldsToForm(int $a_form_id, ilPropertyFormGUI $a_form, ilObjectGUI $a_parent_gui)
Error Handling & global info handling.
StudyProgramme Administration Settings.
__construct($data, int $id, bool $call_by_reference=true, bool $prepare_output=true)
editSettings(?ilPropertyFormGUI $form=null)
getAdminTabs()
administration tabs show only permissions and trash folder
checkPermission(string $perm, string $cmd="", string $type="", ?int $ref_id=null)
prepareOutput(bool $show_sub_objects=true)
This class represents a property form user interface.
This class represents a property in a property form.
This class represents an option in a radio group.
__construct(Container $dic, ilPlugin $plugin)
@inheritDoc