ILIAS  release_6 Revision v6.24-5-g0c8bfefb3b8
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
14{
20 public function __construct($a_data, $a_id, $a_call_by_reference = true, $a_prepare_output = true)
21 {
22 global $DIC;
23
24 $this->lng = $DIC->language();
25 $this->settings = $DIC->settings();
26 $this->ctrl = $DIC->ctrl();
27 $this->access = $DIC->access();
28 $this->type = "excs";
29 parent::__construct($a_data, $a_id, $a_call_by_reference, $a_prepare_output);
30
31 $this->lng->loadLanguageModule("exercise");
32 }
33
40 public function executeCommand()
41 {
42 $next_class = $this->ctrl->getNextClass($this);
43 $cmd = $this->ctrl->getCmd();
44
45 $this->prepareOutput();
46
47 switch ($next_class) {
48 case 'ilpermissiongui':
49 $this->tabs_gui->setTabActive('perm_settings');
50 $perm_gui = new ilPermissionGUI($this);
51 $this->ctrl->forwardCommand($perm_gui);
52 break;
53
54 default:
55 if (!$cmd || $cmd == 'view') {
56 $cmd = "editSettings";
57 }
58
59 $this->$cmd();
60 break;
61 }
62 return true;
63 }
64
71 public function getAdminTabs()
72 {
73 if ($this->checkPermissionBool("visible,read")) {
74 $this->tabs_gui->addTarget(
75 "settings",
76 $this->ctrl->getLinkTarget($this, "editSettings"),
77 array("editSettings", "view")
78 );
79 }
80
81 if ($this->checkPermissionBool('edit_permission')) {
82 $this->tabs_gui->addTarget(
83 "perm_settings",
84 $this->ctrl->getLinkTargetByClass('ilpermissiongui', "perm"),
85 array(),
86 'ilpermissiongui'
87 );
88 }
89 }
90
91
95 public function editSettings($a_form = null)
96 {
99
100 $this->tabs_gui->setTabActive('settings');
101
102 if (!$a_form) {
103 $a_form = $this->initFormSettings();
104 }
105 $this->tpl->setContent($a_form->getHTML());
106 return true;
107 }
108
112 public function saveSettings()
113 {
115
116 $this->checkPermission("write");
117
118 $form = $this->initFormSettings();
119 if ($form->checkInput()) {
120 $exc_set = new ilSetting("excs");
121 $exc_set->set("add_to_pd", (bool) $form->getInput("pd"));
122
123 ilUtil::sendSuccess($this->lng->txt("settings_saved"), true);
124 $ilCtrl->redirect($this, "editSettings");
125 }
126
127 $form->setValuesByPost();
128 $this->editSettings($form);
129 }
130
134 public function cancel()
135 {
137
138 $ilCtrl->redirect($this, "view");
139 }
140
146 protected function initFormSettings()
147 {
149 $ilAccess = $this->access;
150
151 $form = new ilPropertyFormGUI();
152 $form->setFormAction($this->ctrl->getFormAction($this));
153 $form->setTitle($this->lng->txt('exc_admin_settings'));
154
155 if ($this->checkPermissionBool("write")) {
156 $form->addCommandButton('saveSettings', $this->lng->txt('save'));
157 $form->addCommandButton('cancel', $this->lng->txt('cancel'));
158 }
159
160 $exc_set = new ilSetting("excs");
161
162 $pd = new ilCheckboxInputGUI($lng->txt("to_desktop"), "pd");
163 $pd->setInfo($lng->txt("exc_to_desktop_info"));
164 $pd->setChecked($exc_set->get("add_to_pd", true));
165 $form->addItem($pd);
166
167 return $form;
168 }
169}
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.
global $ilCtrl
Definition: ilias.php:18
__construct(Container $dic, ilPlugin $plugin)
@inheritDoc
global $ilSetting
Definition: privfeed.php:17
settings()
Definition: settings.php:2
$DIC
Definition: xapitoken.php:46