ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
class.ilObjSurveyAdministrationGUI.php
Go to the documentation of this file.
1<?php
2/*
3 +-----------------------------------------------------------------------------+
4 | ILIAS open source |
5 +-----------------------------------------------------------------------------+
6 | Copyright (c) 1998-2006 ILIAS open source, University of Cologne |
7 | |
8 | This program is free software; you can redistribute it and/or |
9 | modify it under the terms of the GNU General Public License |
10 | as published by the Free Software Foundation; either version 2 |
11 | of the License, or (at your option) any later version. |
12 | |
13 | This program is distributed in the hope that it will be useful, |
14 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
15 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
16 | GNU General Public License for more details. |
17 | |
18 | You should have received a copy of the GNU General Public License |
19 | along with this program; if not, write to the Free Software |
20 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
21 +-----------------------------------------------------------------------------+
22*/
23
24include_once "./Services/Object/classes/class.ilObjectGUI.php";
25
39{
43 protected $tabs;
44
50
51 public function __construct($a_data, $a_id, $a_call_by_reference)
52 {
53 global $DIC;
54
55 $this->lng = $DIC->language();
56 $this->tabs = $DIC->tabs();
57 $this->tpl = $DIC["tpl"];
58 $this->access = $DIC->access();
59 $this->ctrl = $DIC->ctrl();
60 $lng = $DIC->language();
61
62 $this->type = "svyf";
63 $lng->loadLanguageModule("survey");
64 parent::__construct($a_data, $a_id, $a_call_by_reference, false);
65 }
66
67 public function executeCommand()
68 {
69 $ilTabs = $this->tabs;
70
71 $next_class = $this->ctrl->getNextClass($this);
72 $cmd = $this->ctrl->getCmd();
73 $this->prepareOutput();
74
75 switch ($next_class) {
76 case 'ilpermissiongui':
77 $ilTabs->activateTab("perm_settings");
78 include_once("Services/AccessControl/classes/class.ilPermissionGUI.php");
79 $perm_gui = new ilPermissionGUI($this);
80 $ret =&$this->ctrl->forwardCommand($perm_gui);
81 break;
82
83 case 'ilsettingstemplategui':
84 $ilTabs->activateTab("templates");
85 include_once("./Services/Administration/classes/class.ilSettingsTemplateGUI.php");
86 $set_tpl_gui = new ilSettingsTemplateGUI($this->getSettingsTemplateConfig());
87 $this->ctrl->forwardCommand($set_tpl_gui);
88 break;
89
90 default:
91 if ($cmd == "" || $cmd == "view") {
92 $cmd = "settings";
93 }
94 $cmd .= "Object";
95 $this->$cmd();
96
97 break;
98 }
99 return true;
100 }
101
102
110 public function settingsObject(ilPropertyFormGUI $a_form = null)
111 {
113 $ilTabs = $this->tabs;
114
115 $ilTabs->activateTab("settings");
116
117 if (!$a_form) {
118 $a_form = $this->initSettingsForm();
119 }
120
121 $tpl->setContent($a_form->getHTML());
122 }
123
124 protected function initSettingsForm()
125 {
126 $ilAccess = $this->access;
129
130 $surveySetting = new ilSetting("survey");
131 $unlimited_invitation = array_key_exists("unlimited_invitation", $_GET) ? $_GET["unlimited_invitation"] : $surveySetting->get("unlimited_invitation");
132 $use_anonymous_id = array_key_exists("use_anonymous_id", $_GET) ? $_GET["use_anonymous_id"] : $surveySetting->get("use_anonymous_id");
133
134 include_once("./Services/Form/classes/class.ilPropertyFormGUI.php");
135 $form = new ilPropertyFormGUI();
136 $form->setFormAction($ilCtrl->getFormAction($this));
137 $form->setTitle($lng->txt("survey_defaults"));
138
139 // unlimited invitation
140 $enable = new ilCheckboxInputGUI($lng->txt("survey_unlimited_invitation"), "unlimited_invitation");
141 $enable->setChecked($unlimited_invitation);
142 $enable->setInfo($lng->txt("survey_unlimited_invitation_desc"));
143 $form->addItem($enable);
144
145 // Survey Code
146 $code = new ilCheckboxInputGUI($lng->txt("use_anonymous_id"), "use_anonymous_id");
147 $code->setChecked($use_anonymous_id);
148 $code->setInfo($lng->txt("use_anonymous_id_desc"));
149 $form->addItem($code);
150
151 // Skipped
152 $eval_skipped = new ilRadioGroupInputGUI($lng->txt("svy_eval_skipped_value"), "skcust");
153 $eval_skipped->setRequired(true);
154 $form->addItem($eval_skipped);
155
156 $eval_skipped->setValue($surveySetting->get("skipped_is_custom", false)
157 ? "cust"
158 : "lng");
159
160 $skipped_lng = new ilRadioOption($lng->txt("svy_eval_skipped_value_lng"), "lng");
161 $skipped_lng->setInfo(sprintf($lng->txt("svy_eval_skipped_value_lng_info"), $lng->txt("skipped")));
162 $eval_skipped->addOption($skipped_lng);
163 $skipped_cust = new ilRadioOption($lng->txt("svy_eval_skipped_value_custom"), "cust");
164 $skipped_cust->setInfo($lng->txt("svy_eval_skipped_value_custom_info"));
165 $eval_skipped->addOption($skipped_cust);
166
167 $skipped_cust_value = new ilTextInputGUI($lng->txt("svy_eval_skipped_value_custom_value"), "cust_value");
168 $skipped_cust_value->setSize(15);
169 $skipped_cust_value->setValue($surveySetting->get("skipped_custom_value", ""));
170 $skipped_cust->addSubItem($skipped_cust_value);
171
172 $anon_part = new ilCheckboxInputGUI($lng->txt("svy_anonymous_participants"), "anon_part");
173 $anon_part->setInfo($lng->txt("svy_anonymous_participants_info"));
174 $anon_part->setChecked($surveySetting->get("anonymous_participants", false));
175 $form->addItem($anon_part);
176
177 $anon_part_min = new ilNumberInputGUI($lng->txt("svy_anonymous_participants_min"), "anon_part_min");
178 $anon_part_min->setInfo($lng->txt("svy_anonymous_participants_min_info"));
179 $anon_part_min->setSize(4);
180 $anon_part_min->setMinValue(1);
181 $anon_part_min->setValue($surveySetting->get("anonymous_participants_min", null));
182 $anon_part->addSubItem($anon_part_min);
183
184 if ($ilAccess->checkAccess("write", "", $this->object->getRefId())) {
185 $form->addCommandButton("saveSettings", $lng->txt("save"));
186 }
187
188 return $form;
189 }
190
194 public function saveSettingsObject()
195 {
197 $ilAccess = $this->access;
198
199 if (!$ilAccess->checkAccess("write", "", $this->object->getRefId())) {
200 $ilCtrl->redirect($this, "settings");
201 }
202
203 $form = $this->initSettingsForm();
204 if ($form->checkInput()) {
205 $surveySetting = new ilSetting("survey");
206 $surveySetting->set("unlimited_invitation", ($_POST["unlimited_invitation"]) ? "1" : "0");
207 $surveySetting->set("use_anonymous_id", ($_POST["use_anonymous_id"]) ? "1" : "0");
208 $surveySetting->set("anonymous_participants", ($_POST["anon_part"]) ? "1" : "0");
209 $surveySetting->set("anonymous_participants_min", (trim($_POST["anon_part_min"])) ? (int) $_POST["anon_part_min"] : null);
210
211 if ($_POST["skcust"] == "lng") {
212 $surveySetting->set("skipped_is_custom", false);
213 } else {
214 $surveySetting->set("skipped_is_custom", true);
215 $surveySetting->set("skipped_custom_value", trim($_POST["cust_value"]));
216 }
217
218 ilUtil::sendSuccess($this->lng->txt("msg_obj_modified"), true);
219 $ilCtrl->redirect($this, "settings");
220 }
221
222 $form->setValuesByPost();
223 $this->settingsObject($form);
224 }
225
226 public function getAdminTabs()
227 {
228 $this->getTabs();
229 }
230
236 public function getTabs()
237 {
239
240 if ($this->checkPermissionBool("read")) {
241 $this->tabs_gui->addTab(
242 "settings",
243 $lng->txt("settings"),
244 $this->ctrl->getLinkTarget($this, "settings")
245 );
246
247 // #7927: special users are deprecated
248 /*
249 $tabs_gui->addTab("specialusers",
250 $lng->txt("specialusers"),
251 $this->ctrl->getLinkTarget($this, "specialusers"));
252 */
253
254 if ($this->checkPermissionBool("write")) {
255 $this->tabs_gui->addTab(
256 "templates",
257 $lng->txt("adm_settings_templates"),
258 $this->ctrl->getLinkTargetByClass("ilsettingstemplategui", "")
259 );
260 }
261 }
262 if ($this->checkPermissionBool("edit_permission")) {
263 $this->tabs_gui->addTab(
264 "perm_settings",
265 $lng->txt("perm_settings"),
266 $this->ctrl->getLinkTargetByClass('ilpermissiongui', "perm")
267 );
268 }
269 }
270
276 private function getSettingsTemplateConfig()
277 {
279
280 $lng->loadLanguageModule("survey");
281 include_once "Modules/Survey/classes/class.ilObjSurvey.php";
282
283 include_once("./Services/Administration/classes/class.ilSettingsTemplateConfig.php");
285
286 $config->addHidableTab("survey_question_editor", $lng->txt("survey_question_editor_settings_template"));
287 $config->addHidableTab("constraints", $lng->txt("constraints"));
288 $config->addHidableTab("invitation", $lng->txt("invitation"));
289 $config->addHidableTab("meta_data", $lng->txt("meta_data"));
290 $config->addHidableTab("export", $lng->txt("export"));
291
292 $config->addSetting(
293 "use_pool",
295 $lng->txt("survey_question_pool_usage"),
296 true,
297 0,
298 array(1 => $this->lng->txt("survey_question_pool_usage_active"),
299 0 => $this->lng->txt("survey_question_pool_usage_inactive"))
300 );
301
302
303 $config->addSetting(
304 "enabled_start_date",
306 $lng->txt("start_date"),
307 true
308 );
309
310 $config->addSetting(
311 "enabled_end_date",
313 $lng->txt("end_date"),
314 true
315 );
316
317 $config->addSetting(
318 "show_question_titles",
320 $lng->txt("svy_show_questiontitles"),
321 true
322 );
323
324
325 // #17585
326
327 $config->addSetting(
328 "acc_codes",
330 $lng->txt("survey_access_codes"),
331 true
332 );
333
334 $config->addSetting(
335 "evaluation_access",
337 $lng->txt("evaluation_access"),
338 true,
339 0,
340 array(ilObjSurvey::EVALUATION_ACCESS_OFF => $this->lng->txt("evaluation_access_off"),
341 ilObjSurvey::EVALUATION_ACCESS_ALL => $this->lng->txt("evaluation_access_all"),
342 ilObjSurvey::EVALUATION_ACCESS_PARTICIPANTS => $this->lng->txt("evaluation_access_participants"))
343 );
344
345 $config->addSetting(
346 "anonymization_options",
348 $lng->txt("survey_results_anonymization"),
349 true,
350 0,
351 array("statpers" => $this->lng->txt("survey_results_personalized"),
352 "statanon" => $this->lng->txt("survey_results_anonymized"))
353 );
354
355 /*
356 $config->addSetting(
357 "rte_switch",
358 ilSettingsTemplateConfig::SELECT,
359 $lng->txt("set_edit_mode"),
360 true,
361 0,
362 array(0 => $this->lng->txt("rte_editor_disabled"),
363 1 => $this->lng->txt("rte_editor_enabled"))
364 );
365 */
366
367 return $config;
368 }
369} // END class.ilObjSurveyAdministrationGUI
sprintf('%.4f', $callTime)
$_GET["client_id"]
$_POST["username"]
An exception for terminatinating execution or to throw for unit testing.
This class represents a checkbox property in a property form.
This class represents a number property in a property form.
Class ilObjSurveyAdministrationGUI.
settingsObject(ilPropertyFormGUI $a_form=null)
display survey settings form
getAdminTabs()
administration tabs show only permissions and trash folder
__construct($a_data, $a_id, $a_call_by_reference)
getSettingsTemplateConfig()
Get settings template configuration object.
const EVALUATION_ACCESS_PARTICIPANTS
const EVALUATION_ACCESS_ALL
const EVALUATION_ACCESS_OFF
Class ilObjectGUI Basic methods of all Output classes.
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.
This class represents a property in a property form.
This class represents an option in a radio group.
ILIAS Setting Class.
Settings template config class.
This class represents a text property in a property form.
static sendSuccess($a_info="", $a_keep=false)
Send Success Message to Screen.
$code
Definition: example_050.php:99
global $ilCtrl
Definition: ilias.php:18
$ret
Definition: parser.php:6
if(isset($_POST['submit'])) $form
global $DIC
Definition: saml.php:7