ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
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 global $DIC;
26
27 $this->lng = $DIC->language();
28 $this->settings = $DIC->settings();
29 $this->ctrl = $DIC->ctrl();
30 $this->access = $DIC->access();
31 $this->type = "excs";
32 parent::__construct($a_data, $a_id, $a_call_by_reference, $a_prepare_output);
33
34 $this->lng->loadLanguageModule("exercise");
35 }
36
43 public function executeCommand()
44 {
45 $next_class = $this->ctrl->getNextClass($this);
46 $cmd = $this->ctrl->getCmd();
47
48 $this->prepareOutput();
49
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
58 default:
59 if (!$cmd || $cmd == 'view') {
60 $cmd = "editSettings";
61 }
62
63 $this->$cmd();
64 break;
65 }
66 return true;
67 }
68
75 public function getAdminTabs()
76 {
77 if ($this->checkPermissionBool("visible,read")) {
78 $this->tabs_gui->addTarget(
79 "settings",
80 $this->ctrl->getLinkTarget($this, "editSettings"),
81 array("editSettings", "view")
82 );
83 }
84
85 if ($this->checkPermissionBool('edit_permission')) {
86 $this->tabs_gui->addTarget(
87 "perm_settings",
88 $this->ctrl->getLinkTargetByClass('ilpermissiongui', "perm"),
89 array(),
90 'ilpermissiongui'
91 );
92 }
93 }
94
95
99 public function editSettings($a_form = null)
100 {
103
104 $this->tabs_gui->setTabActive('settings');
105
106 if (!$a_form) {
107 $a_form = $this->initFormSettings();
108 }
109 $this->tpl->setContent($a_form->getHTML());
110 return true;
111 }
112
116 public function saveSettings()
117 {
119
120 $this->checkPermission("write");
121
122 $form = $this->initFormSettings();
123 if ($form->checkInput()) {
124 $exc_set = new ilSetting("excs");
125 $exc_set->set("add_to_pd", (bool) $form->getInput("pd"));
126
127 ilUtil::sendSuccess($this->lng->txt("settings_saved"), true);
128 $ilCtrl->redirect($this, "editSettings");
129 }
130
131 $form->setValuesByPost();
132 $this->editSettings($form);
133 }
134
138 public function cancel()
139 {
141
142 $ilCtrl->redirect($this, "view");
143 }
144
150 protected function initFormSettings()
151 {
153 $ilAccess = $this->access;
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 ($this->checkPermissionBool("write")) {
161 $form->addCommandButton('saveSettings', $this->lng->txt('save'));
162 $form->addCommandButton('cancel', $this->lng->txt('cancel'));
163 }
164
165 $exc_set = new ilSetting("excs");
166
167 $pd = new ilCheckboxInputGUI($lng->txt("to_desktop"), "pd");
168 $pd->setInfo($lng->txt("exc_to_desktop_info"));
169 $pd->setChecked($exc_set->get("add_to_pd", true));
170 $form->addItem($pd);
171
172 return $form;
173 }
174}
An exception for terminatinating execution or to throw for unit testing.
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($a_show_subobjects=true)
prepare output
checkPermissionBool($a_perm, $a_cmd="", $a_type="", $a_ref_id=null)
Check permission.
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:17
if(isset($_POST['submit'])) $form
global $DIC
Definition: saml.php:7
settings()
Definition: settings.php:2