ILIAS  release_7 Revision v7.30-3-g800a261c036
class.ilObjStudyProgrammeAdminGUI.php
Go to the documentation of this file.
1<?php
2/* Copyright (c) 1998-2010 ILIAS open source, Extended GPL, see docs/LICENSE */
3include_once('./Services/Object/classes/class.ilObjectGUI.php');
4include_once('./Modules/StudyProgramme/classes/types/class.ilStudyProgrammeTypeGUI.php');
5require_once('./Modules/StudyProgramme/classes/class.ilObjStudyProgrammeAdmin.php');
6
19{
20 protected $type_gui;
21
25 protected $error;
32 public function __construct($a_data, $a_id, $a_call_by_reference = true, $a_prepare_output = true)
33 {
34 global $DIC, $ilErr;
35 $ilCtrl = $DIC['ilCtrl'];
36 $ilAccess = $DIC['ilAccess'];
37 $ilSetting = $DIC['ilSetting'];
38 $this->error = $ilErr;
39 $this->ctrl = $ilCtrl;
40 $this->ilAccess = $ilAccess;
41 $this->ilSetting = $ilSetting;
42 $this->type = 'prgs';
43 parent::__construct($a_data, $a_id, $a_call_by_reference, $a_prepare_output);
44 $this->lng->loadLanguageModule('prg');
45 $this->type_gui = ilStudyProgrammeDIC::dic()['ilStudyProgrammeTypeGUI'];
46 }
47
48
53 public function executeCommand()
54 {
55 //Check Permissions globally for all SubGUIs. We only check write permissions
56 if (!$this->rbacsystem->checkAccess("visible,read", $this->object->getRefId())) {
57 $this->error->raiseError($this->lng->txt("no_permission"), $this->error->WARNING);
58 }
59 $next_class = $this->ctrl->getNextClass($this);
60 $cmd = $this->ctrl->getCmd();
61 $this->prepareOutput();
62 switch ($next_class) {
63 case 'ilpermissiongui':
64 $this->tabs_gui->setTabActive('perm_settings');
65 include_once('Services/AccessControl/classes/class.ilPermissionGUI.php');
66 $perm_gui = new ilPermissionGUI($this);
67 $this->ctrl->forwardCommand($perm_gui);
68 break;
69 case 'ilstudyprogrammetypegui':
70 $this->tabs_gui->setTabActive('prg_subtypes');
71 $this->type_gui->setParentGUI($this);
72 $this->ctrl->forwardCommand($this->type_gui);
73 break;
74 default:
75 if (!$cmd || $cmd == "view") {
76 $cmd = "editSettings";
77 }
78 $this->$cmd();
79 break;
80 }
81 }
82
83 public function editSettings()
84 {
85 $this->tabs_gui->setTabActive('settings');
86
87 if (!$a_form) {
88 $a_form = $this->initFormSettings();
89 }
90 $this->tpl->setContent($a_form->getHTML());
91 return true;
92 }
93
94 public function initFormSettings(ilPropertyFormGUI $a_form = null)
95 {
96 include_once "Services/Form/classes/class.ilPropertyFormGUI.php";
97 $form = new ilPropertyFormGUI();
98 $form->setFormAction($this->ctrl->getFormAction($this, "saveSettings"));
99 $form->setTitle($this->lng->txt("settings"));
100
101 $radio_grp = new ilRadioGroupInputGUI($this->lng->txt("prg_show_programmes"), "visible_on_personal_desktop");
102 $radio_grp->addOption(new ilRadioOption($this->lng->txt("prg_show_programmes_on_pd_always"), ilObjStudyProgrammeAdmin::SETTING_VISIBLE_ON_PD_ALLWAYS));
103 $radio_grp->addOption(new ilRadioOption($this->lng->txt("prg_show_programmes_on_pd_only_read"), ilObjStudyProgrammeAdmin::SETTING_VISIBLE_ON_PD_READ));
105 $value = ($value) ? $value : ilObjStudyProgrammeAdmin::SETTING_VISIBLE_ON_PD_READ;
106 $radio_grp->setValue($value);
107 $form->addItem($radio_grp);
108
109 if ($this->ilAccess->checkAccess("write", "", $this->object->getRefId())) {
110 $form->addCommandButton("saveSettings", $this->lng->txt("save"));
111 $form->addCommandButton("view", $this->lng->txt("cancel"));
112 }
113
114 return $form;
115 }
116
117 public function saveSettings()
118 {
119 $this->checkPermission("write");
120
121 $form = $this->initFormSettings();
122 if ($form->checkInput()) {
123 if ($this->save($form)) {
124 $this->ilSetting->set(
126 $form->getInput('visible_on_personal_desktop')
127 );
128
129 ilUtil::sendSuccess($this->lng->txt("settings_saved"), true);
130 $this->ctrl->redirect($this, "editSettings");
131 }
132 }
133
134 $form->setValuesByPost();
135 $this->editSettings($form);
136 }
137
138 public function getAdminTabs()
139 {
140 global $DIC;
141 $rbacsystem = $DIC['rbacsystem'];
146 if ($rbacsystem->checkAccess('visible,read', $this->object->getRefId())) {
147 $this->tabs_gui->addTarget('settings', $this->ctrl->getLinkTargetByClass('ilObjStudyProgrammeAdminGUI', 'view'));
148
149 $this->tabs_gui->addTarget('prg_subtypes', $this->ctrl->getLinkTargetByClass(array(
150 'ilObjStudyProgrammeAdminGUI',
151 'ilStudyProgrammeTypeGUI'
152 ), 'listTypes'));
153 }
154 if ($rbacsystem->checkAccess('edit_permission', $this->object->getRefId())) {
155 $this->tabs_gui->addTarget('perm_settings', $this->ctrl->getLinkTargetByClass('ilpermissiongui', 'perm'), array(), 'ilpermissiongui');
156 }
157 }
158
159 public function _goto($ref_id)
160 {
161 $this->ctrl->initBaseClass("ilAdministrationGUI");
162 $this->ctrl->setParameterByClass("ilObjStudyProgrammeAdminGUI", "ref_id", $ref_id);
163 $this->ctrl->setParameterByClass("ilObjStudyProgrammeAdminGUI", "admin_mode", "settings");
164 $this->ctrl->redirectByClass(array( "ilAdministrationGUI", "ilObjStudyProgrammeAdminGUI" ), "view");
165 }
166
167 protected function save(ilPropertyFormGUI $a_form)
168 {
169 return true;
170 }
171}
An exception for terminatinating execution or to throw for unit testing.
error($a_errmsg)
set error message @access public
Class ilAccessHandler.
checkAccess($a_permission, $a_cmd, $a_ref_id, $a_type="", $a_obj_id="", $a_tree_id="")
check access for an object (provide $a_type and $a_obj_id if available for better performance)
StudyProgramme Administration Settings.
initFormSettings(ilPropertyFormGUI $a_form=null)
__construct($a_data, $a_id, $a_call_by_reference=true, $a_prepare_output=true)
Class ilObjectGUI Basic methods of all Output classes.
checkPermission($a_perm, $a_cmd="", $a_type="", $a_ref_id=null)
Check permission and redirect on error.
prepareOutput($a_show_subobjects=true)
prepare output
getAdminTabs()
administration tabs show only permissions and trash folder
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 class represents an option in a radio group.
ILIAS Setting Class.
set($a_key, $a_val)
write one value to db-table settings @access public
get($a_keyword, $a_default_value=false)
get setting
global $DIC
Definition: goto.php:24
__construct(Container $dic, ilPlugin $plugin)
@inheritDoc
global $ilSetting
Definition: privfeed.php:17