ILIAS  release_5-1 Revision 5.0.0-5477-g43f3e3fab5f
class.ilObjExerciseAdministrationGUI.php
Go to the documentation of this file.
1<?php
2/* Copyright (c) 1998-2010 ILIAS open source, Extended GPL, see docs/LICENSE */
3
4include_once("./Services/Object/classes/class.ilObjectGUI.php");
5
17{
23 public function __construct($a_data, $a_id, $a_call_by_reference = true, $a_prepare_output = true)
24 {
25 $this->type = "excs";
26 parent::ilObjectGUI($a_data, $a_id, $a_call_by_reference, $a_prepare_output);
27
28 $this->lng->loadLanguageModule("exercise");
29 }
30
37 public function executeCommand()
38 {
39 $next_class = $this->ctrl->getNextClass($this);
40 $cmd = $this->ctrl->getCmd();
41
42 $this->prepareOutput();
43
44/* if(!$ilAccess->checkAccess('read','',$this->object->getRefId()))
45 {
46 $ilErr->raiseError($this->lng->txt('no_permission'),$ilErr->WARNING);
47 }
48*/
49 switch($next_class)
50 {
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
58 default:
59 if(!$cmd || $cmd == 'view')
60 {
61 $cmd = "editSettings";
62 }
63
64 $this->$cmd();
65 break;
66 }
67 return true;
68 }
69
76 public function getAdminTabs()
77 {
78 global $rbacsystem;
79
80 if ($rbacsystem->checkAccess("visible,read",$this->object->getRefId()))
81 {
82 $this->tabs_gui->addTarget("settings",
83 $this->ctrl->getLinkTarget($this, "editSettings"),
84 array("editSettings", "view"));
85 }
86
87 if ($rbacsystem->checkAccess('edit_permission',$this->object->getRefId()))
88 {
89 $this->tabs_gui->addTarget("perm_settings",
90 $this->ctrl->getLinkTargetByClass('ilpermissiongui',"perm"),
91 array(),'ilpermissiongui');
92 }
93 }
94
95
99 public function editSettings($a_form = null)
100 {
101 global $lng, $ilSetting;
102
103 $this->tabs_gui->setTabActive('settings');
104
105 if(!$a_form)
106 {
107 $a_form = $this->initFormSettings();
108 }
109 $this->tpl->setContent($a_form->getHTML());
110 return true;
111 }
112
116 public function saveSettings()
117 {
118 global $ilCtrl;
119
120 $this->checkPermission("write");
121
122 $form = $this->initFormSettings();
123 if($form->checkInput())
124 {
125 $exc_set = new ilSetting("excs");
126 $exc_set->set("add_to_pd", (bool)$form->getInput("pd"));
127
128 ilUtil::sendSuccess($this->lng->txt("settings_saved"),true);
129 $ilCtrl->redirect($this, "editSettings");
130 }
131
132 $form->setValuesByPost();
133 $this->editSettings($form);
134 }
135
139 public function cancel()
140 {
141 global $ilCtrl;
142
143 $ilCtrl->redirect($this, "view");
144 }
145
151 protected function initFormSettings()
152 {
153 global $lng, $ilAccess;
154
155 include_once('Services/Form/classes/class.ilPropertyFormGUI.php');
156 $form = new ilPropertyFormGUI();
157 $form->setFormAction($this->ctrl->getFormAction($this));
158 $form->setTitle($this->lng->txt('exc_admin_settings'));
159
160 if ($ilAccess->checkAccess("write", "", $this->object->getRefId()))
161 {
162 $form->addCommandButton('saveSettings',$this->lng->txt('save'));
163 $form->addCommandButton('cancel',$this->lng->txt('cancel'));
164 }
165
166 $exc_set = new ilSetting("excs");
167
168 $pd = new ilCheckboxInputGUI($lng->txt("to_desktop"), "pd");
169 $pd->setInfo($lng->txt("exc_to_desktop_info"));
170 $pd->setChecked($exc_set->get("add_to_pd", true));
171 $form->addItem($pd);
172
173 return $form;
174 }
175}
176
177?>
This class represents a checkbox property in a property form.
__construct($a_data, $a_id, $a_call_by_reference=true, $a_prepare_output=true)
Contructor.
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()
prepare output
New PermissionGUI (extends from old ilPermission2GUI) RBAC related output.
This class represents a property form user interface.
ILIAS Setting Class.
static sendSuccess($a_info="", $a_keep=false)
Send Success Message to Screen.
global $ilCtrl
Definition: ilias.php:18
global $ilSetting
Definition: privfeed.php:40
$cmd
Definition: sahs_server.php:35