ILIAS  release_8 Revision v8.24
class.ilObjStudyProgrammeAdminGUI.php
Go to the documentation of this file.
1<?php
2
3declare(strict_types=1);
4
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
42 public function executeCommand(): void
43 {
44 //Check Permissions globally for all SubGUIs. We only check write permissions
45 if (!$this->rbac_system->checkAccess("visible,read", $this->object->getRefId())) {
46 $this->error->raiseError($this->lng->txt("no_permission"), $this->error->WARNING);
47 }
48 $next_class = $this->ctrl->getNextClass($this);
49 $cmd = $this->ctrl->getCmd();
50 $this->prepareOutput();
51 switch ($next_class) {
52 case 'ilpermissiongui':
53 $this->tabs_gui->activateTab('perm_settings');
54 $perm_gui = new ilPermissionGUI($this);
55 $this->ctrl->forwardCommand($perm_gui);
56 break;
57 case 'ilstudyprogrammetypegui':
58 $this->tabs_gui->activateTab('prg_subtypes');
59 $this->type_gui->setParentGUI($this);
60 $this->ctrl->forwardCommand($this->type_gui);
61 break;
62 default:
63 if (!$cmd || $cmd === "view") {
64 $cmd = "editSettings";
65 }
66 $this->$cmd();
67 break;
68 }
69 }
70
71 public function editSettings(ilPropertyFormGUI $form = null): bool
72 {
73 $this->tabs_gui->activateTab('settings');
74 if (is_null($form)) {
75 $form = $this->initFormSettings();
76 }
77 $this->tpl->setContent($form->getHTML());
78 return true;
79 }
80
82 {
83 $form = new ilPropertyFormGUI();
84 $form->setFormAction($this->ctrl->getFormAction($this, "saveSettings"));
85 $form->setTitle($this->lng->txt("settings"));
86
87 $radio_grp = new ilRadioGroupInputGUI($this->lng->txt("prg_show_programmes"), "visible_on_personal_desktop");
88 $radio_grp->addOption(new ilRadioOption(
89 $this->lng->txt("prg_show_programmes_on_pd_always"),
91 ));
92 $radio_grp->addOption(new ilRadioOption(
93 $this->lng->txt("prg_show_programmes_on_pd_only_read"),
95 ));
98 $radio_grp->setValue($value);
99 $form->addItem($radio_grp);
100
101 if ($this->access->checkAccess("write", "", $this->object->getRefId())) {
102 $form->addCommandButton("saveSettings", $this->lng->txt("save"));
103 $form->addCommandButton("view", $this->lng->txt("cancel"));
104 }
105
106 return $form;
107 }
108
109 public function saveSettings(): void
110 {
111 $this->checkPermission("write");
112
113 $form = $this->initFormSettings();
114 if ($form->checkInput()) {
115 if ($this->save($form)) {
116 $this->settings->set(
118 $form->getInput('visible_on_personal_desktop')
119 );
120
121 $this->tpl->setOnScreenMessage("success", $this->lng->txt("settings_saved"), true);
122 $this->ctrl->redirect($this, "editSettings");
123 }
124 }
125
126 $form->setValuesByPost();
127 $this->editSettings($form);
128 }
129
130 public function getAdminTabs(): void
131 {
132 if ($this->rbac_system->checkAccess('visible,read', $this->object->getRefId())) {
133 $this->tabs_gui->addTarget(
134 'settings',
135 $this->ctrl->getLinkTargetByClass('ilObjStudyProgrammeAdminGUI', 'view')
136 );
137
138 $this->tabs_gui->addTarget(
139 'prg_subtypes',
140 $this->ctrl->getLinkTargetByClass(
141 array('ilObjStudyProgrammeAdminGUI', 'ilStudyProgrammeTypeGUI'),
142 'listTypes'
143 )
144 );
145 }
146 if ($this->rbac_system->checkAccess('edit_permission', $this->object->getRefId())) {
147 $this->tabs_gui->addTarget(
148 'perm_settings',
149 $this->ctrl->getLinkTargetByClass('ilpermissiongui', 'perm'),
150 array(),
151 'ilpermissiongui'
152 );
153 }
154 }
155
156 public function _goto($ref_id): void
157 {
158 $this->ctrl->setTargetScript('ilias.php');
159 $this->ctrl->setParameterByClass("ilObjStudyProgrammeAdminGUI", "ref_id", $ref_id);
160 $this->ctrl->setParameterByClass("ilObjStudyProgrammeAdminGUI", "admin_mode", "settings");
161 $this->ctrl->redirectByClass(array("ilAdministrationGUI", "ilObjStudyProgrammeAdminGUI"), "view");
162 }
163
164 protected function save(ilPropertyFormGUI $form): bool
165 {
166 return true;
167 }
168}
error(string $a_errmsg)
Error Handling & global info handling uses PEAR error class.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
__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
Class ilObjectGUI Basic methods of all Output classes.
checkPermission(string $perm, string $cmd="", string $type="", ?int $ref_id=null)
prepareOutput(bool $show_sub_objects=true)
New PermissionGUI (extends from old ilPermission2GUI) RBAC related output.
This class represents a property form user interface.
This class represents a property in a property form.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
__construct(Container $dic, ilPlugin $plugin)
@inheritDoc