ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
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
17{
24 public function __construct($a_data, $a_id, $a_call_by_reference = true, $a_prepare_output = true)
25 {
26 global $DIC;
27 $ilCtrl = $DIC['ilCtrl'];
28 $ilAccess = $DIC['ilAccess'];
29 $ilSetting = $DIC['ilSetting'];
30 $this->ctrl = $ilCtrl;
31 $this->ilAccess = $ilAccess;
32 $this->ilSetting = $ilSetting;
33 $this->type = 'prgs';
34 parent::__construct($a_data, $a_id, $a_call_by_reference, $a_prepare_output);
35 $this->lng->loadLanguageModule('prg');
36 }
37
38
43 public function executeCommand()
44 {
45 //Check Permissions globally for all SubGUIs. We only check write permissions
46 $this->checkPermission('read');
47 $next_class = $this->ctrl->getNextClass($this);
48 $cmd = $this->ctrl->getCmd();
49 $this->prepareOutput();
50 switch ($next_class) {
51 case 'ilpermissiongui':
52 $this->tabs_gui->setTabActive('perm_settings');
53 include_once('Services/AccessControl/classes/class.ilPermissionGUI.php');
54 $perm_gui = new ilPermissionGUI($this);
55 $this->ctrl->forwardCommand($perm_gui);
56 break;
57 case 'ilstudyprogrammetypegui':
58 $this->tabs_gui->setTabActive('prg_subtypes');
59 $type_gui = new ilStudyProgrammeTypeGUI($this);
60 $this->ctrl->forwardCommand($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()
72 {
73 $this->tabs_gui->setTabActive('settings');
74
75 if (!$a_form) {
76 $a_form = $this->initFormSettings();
77 }
78 $this->tpl->setContent($a_form->getHTML());
79 return true;
80 }
81
82 public function initFormSettings(ilPropertyFormGUI $a_form = null)
83 {
84 include_once "Services/Form/classes/class.ilPropertyFormGUI.php";
86 $form->setFormAction($this->ctrl->getFormAction($this, "saveSettings"));
87 $form->setTitle($this->lng->txt("settings"));
88
89 $radio_grp = new ilRadioGroupInputGUI($this->lng->txt("prg_show_programmes"), "visible_on_personal_desktop");
90 $radio_grp->addOption(new ilRadioOption($this->lng->txt("prg_show_programmes_on_pd_always"), ilObjStudyProgrammeAdmin::SETTING_VISIBLE_ON_PD_ALLWAYS));
91 $radio_grp->addOption(new ilRadioOption($this->lng->txt("prg_show_programmes_on_pd_only_read"), ilObjStudyProgrammeAdmin::SETTING_VISIBLE_ON_PD_READ));
94 $radio_grp->setValue($value);
95 $form->addItem($radio_grp);
96
97 if ($this->ilAccess->checkAccess("write", "", $this->object->getRefId())) {
98 $form->addCommandButton("saveSettings", $this->lng->txt("save"));
99 $form->addCommandButton("view", $this->lng->txt("cancel"));
100 }
101
102 return $form;
103 }
104
105 public function saveSettings()
106 {
107 $this->checkPermission("write");
108
109 $form = $this->initFormSettings();
110 if ($form->checkInput()) {
111 if ($this->save($form)) {
112 $this->ilSetting->set(
114 $form->getInput('visible_on_personal_desktop')
115 );
116
117 ilUtil::sendSuccess($this->lng->txt("settings_saved"), true);
118 $this->ctrl->redirect($this, "editSettings");
119 }
120 }
121
122 $form->setValuesByPost();
123 $this->editSettings($form);
124 }
125
126 public function getAdminTabs()
127 {
128 global $DIC;
129 $rbacsystem = $DIC['rbacsystem'];
134 if ($rbacsystem->checkAccess('visible,read', $this->object->getRefId())) {
135 $this->tabs_gui->addTarget('settings', $this->ctrl->getLinkTargetByClass('ilObjStudyProgrammeAdminGUI', 'view'));
136
137 $this->tabs_gui->addTarget('prg_subtypes', $this->ctrl->getLinkTargetByClass(array(
138 'ilObjStudyProgrammeAdminGUI',
139 'ilStudyProgrammeTypeGUI'
140 ), 'listTypes'));
141 }
142 if ($rbacsystem->checkAccess('edit_permission', $this->object->getRefId())) {
143 $this->tabs_gui->addTarget('perm_settings', $this->ctrl->getLinkTargetByClass('ilpermissiongui', 'perm'), array(), 'ilpermissiongui');
144 }
145 }
146
147 public function _goto($ref_id)
148 {
149 $this->ctrl->initBaseClass("ilAdministrationGUI");
150 $this->ctrl->setTargetScript("ilias.php");
151 $this->ctrl->setParameterByClass("ilObjStudyProgrammeAdminGUI", "ref_id", $ref_id);
152 $this->ctrl->setParameterByClass("ilObjStudyProgrammeAdminGUI", "admin_mode", "settings");
153 $this->ctrl->redirectByClass(array( "ilAdministrationGUI", "ilObjStudyProgrammeAdminGUI" ), "view");
154 }
155
156 protected function save(ilPropertyFormGUI $a_form)
157 {
158 return true;
159 }
160}
An exception for terminatinating execution or to throw for unit testing.
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
Class ilStudyProgrammeTypeGUI.
static sendSuccess($a_info="", $a_keep=false)
Send Success Message to Screen.
global $ilCtrl
Definition: ilias.php:18
global $ilSetting
Definition: privfeed.php:17
if(isset($_POST['submit'])) $form
global $DIC
Definition: saml.php:7