ILIAS  release_5-1 Revision 5.0.0-5477-g43f3e3fab5f
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{
45
46 function ilObjSurveyAdministrationGUI($a_data,$a_id,$a_call_by_reference)
47 {
48 global $rbacsystem, $lng;
49
50 $this->type = "svyf";
51 $lng->loadLanguageModule("survey");
52 $this->ilObjectGUI($a_data,$a_id,$a_call_by_reference,false);
53 }
54
55 function &executeCommand()
56 {
57 global $ilTabs;
58
59 $next_class = $this->ctrl->getNextClass($this);
60 $cmd = $this->ctrl->getCmd();
61 $this->prepareOutput();
62
63 switch($next_class)
64 {
65 case 'ilpermissiongui':
66 $ilTabs->activateTab("perm_settings");
67 include_once("Services/AccessControl/classes/class.ilPermissionGUI.php");
68 $perm_gui =& new ilPermissionGUI($this);
69 $ret =& $this->ctrl->forwardCommand($perm_gui);
70 break;
71
72 case 'ilsettingstemplategui':
73 $ilTabs->activateTab("templates");
74 include_once("./Services/Administration/classes/class.ilSettingsTemplateGUI.php");
75 $set_tpl_gui = new ilSettingsTemplateGUI($this->getSettingsTemplateConfig());
76 $this->ctrl->forwardCommand($set_tpl_gui);
77 break;
78
79 default:
80 if($cmd == "" || $cmd == "view")
81 {
82 $cmd = "settings";
83 }
84 $cmd .= "Object";
85 $this->$cmd();
86
87 break;
88 }
89 return true;
90 }
91
92
97 function saveObject()
98 {
99 global $rbacadmin;
100
101 // create and insert forum in objecttree
102 $newObj = parent::saveObject();
103
104 // put here object specific stuff
105
106 // always send a message
107 ilUtil::sendSuccess($this->lng->txt("object_added"),true);
108
109 $this->ctrl->redirect($this);
110 }
111
112 function searchObject()
113 {
114 unset($_SESSION["survey_adm_found_users"]);
115 if (strlen($_POST["search"]) < 2)
116 {
117 ilUtil::sendInfo($this->lng->txt("adm_search_string_too_small"), TRUE);
118 }
119 else
120 {
121 include_once "./Services/User/classes/class.ilObjUser.php";
122 $found = ilObjUser::searchUsers($_POST["search"], $active = 1, $a_return_ids_only = false, $filter_settings = FALSE);
123 if (count($found))
124 {
125 $_SESSION["survey_adm_found_users"] = $found;
126 }
127 else
128 {
129 ilUtil::sendInfo($this->lng->txt("adm_no_users_found"), TRUE);
130
131 }
132 }
133 $this->ctrl->redirect($this, "specialusers");
134 }
135
141 {
142 // #7927: special users are deprecated
143 exit();
144
145 /*
146 if ((array_key_exists("user_id", $_POST)) && (count($_POST["user_id"])))
147 {
148 $this->object->addSpecialUsers($_POST["user_id"]);
149 unset($_SESSION["survey_adm_found_users"]);
150 }
151 else
152 {
153 ilUtil::sendInfo($this->lng->txt("adm_search_select_user"), TRUE);
154 }
155 $this->ctrl->redirect($this, "specialusers");
156 */
157 }
158
160 {
161 // #7927: special users are deprecated
162 exit();
163
164 /*
165 if ((array_key_exists("special_user_id", $_POST)) && (count($_POST["special_user_id"])))
166 {
167 $this->object->removeSpecialUsers($_POST["special_user_id"]);
168 unset($_SESSION["adm_removed_users"]);
169 }
170 else
171 {
172 ilUtil::sendInfo($this->lng->txt("adm_remove_select_user"), TRUE);
173 }
174 $this->ctrl->redirect($this, "specialusers");
175 */
176 }
177
184 {
185 global $ilAccess, $ilTabs;
186
187 // #7927: special users are deprecated
188 exit();
189
190 /*
191 $ilTabs->activateTab("specialusers");
192
193 $a_write_access = ($ilAccess->checkAccess("write", "", $this->object->getRefId())) ? true : false;
194 $this->tpl->addBlockFile("ADM_CONTENT", "adm_content", "tpl.il_svy_adm_specialusers.html", "Modules/Survey");
195 $found_users = "";
196 if (array_key_exists("survey_adm_found_users", $_SESSION))
197 {
198 if (count($_SESSION["survey_adm_found_users"]))
199 {
200 $data = $_SESSION["survey_adm_found_users"];
201 include_once("./Modules/Survey/classes/tables/class.ilFoundUsersTableGUI.php");
202 $table_gui = new ilFoundUsersTableGUI($this, "specialusers");
203 $table_gui->setPrefix("fu");
204
205 $table_gui->setTitle($this->lng->txt("found_users"));
206 $table_gui->setData($data);
207
208 if ($a_write_access)
209 {
210 $table_gui->addCommandButton("addSpecialUser", $this->lng->txt("add"));
211 $table_gui->setSelectAllCheckbox("user_id");
212 }
213 $found_users = $table_gui->getHTML();
214 }
215 }
216
217 if (strlen($found_users))
218 {
219 $this->tpl->setCurrentBlock("search_results");
220 $this->tpl->setVariable("SEARCH_RESULTS", $found_users);
221 $this->tpl->parseCurrentBlock();
222 }
223 $this->tpl->setCurrentBlock("adm_content");
224 $this->tpl->setVariable("TXT_SEARCH_USER", $this->lng->txt("search_users"));
225 $this->tpl->setVariable("TXT_SEARCH", $this->lng->txt("search"));
226 $this->tpl->setVariable("FORMACTION", $this->ctrl->getFormAction($this, "search"));
227
228 $special_users = $this->object->getSpecialUsers();
229 if (count($special_users))
230 {
231 include_once("./Modules/Survey/classes/tables/class.ilSpecialUsersTableGUI.php");
232 $table_gui = new ilSpecialUsersTableGUI($this, "specialusers", $a_write_access);
233 $table_gui->setPrefix("su");
234
235 $table_gui->setTitle($this->lng->txt("adm_special_users"));
236 $table_gui->setData($special_users);
237
238 if ($a_write_access)
239 {
240 $table_gui->addCommandButton("removeSpecialUser", $this->lng->txt("remove"));
241 $table_gui->setSelectAllCheckbox("special_user_id");
242 }
243 $this->tpl->setVariable("SPECIAL_USERS", $table_gui->getHTML());
244 }
245 else
246 {
247 $this->tpl->setVariable("SPECIAL_USERS", $this->lng->txt("adm_no_special_users"));
248 }
249 $this->tpl->parseCurrentBlock();
250 */
251 }
252
260 function settingsObject()
261 {
262 global $ilAccess, $rbacreview, $lng, $ilCtrl, $tpl, $ilTabs;
263
264 $ilTabs->activateTab("settings");
265
266 $surveySetting = new ilSetting("survey");
267 $unlimited_invitation = array_key_exists("unlimited_invitation", $_GET) ? $_GET["unlimited_invitation"] : $surveySetting->get("unlimited_invitation");
268 $use_anonymous_id = array_key_exists("use_anonymous_id", $_GET) ? $_GET["use_anonymous_id"] : $surveySetting->get("use_anonymous_id");
269
270 include_once("./Services/Form/classes/class.ilPropertyFormGUI.php");
271 $form = new ilPropertyFormGUI();
272 $form->setFormAction($ilCtrl->getFormAction($this));
273 $form->setTitle($lng->txt("survey_defaults"));
274
275 // unlimited invitation
276 $enable = new ilCheckboxInputGUI($lng->txt("survey_unlimited_invitation"), "unlimited_invitation");
277 $enable->setChecked($unlimited_invitation);
278 $enable->setInfo($lng->txt("survey_unlimited_invitation_desc"));
279 $form->addItem($enable);
280
281 // Survey Code
282 $code = new ilCheckboxInputGUI($lng->txt("use_anonymous_id"), "use_anonymous_id");
283 $code->setChecked($use_anonymous_id);
284 $code->setInfo($lng->txt("use_anonymous_id_desc"));
285 $form->addItem($code);
286
287 // Skipped
288 $eval_skipped = new ilRadioGroupInputGUI($lng->txt("svy_eval_skipped_value"), "skcust");
289 $eval_skipped->setRequired(true);
290 $form->addItem($eval_skipped);
291
292 $eval_skipped->setValue($surveySetting->get("skipped_is_custom", false)
293 ? "cust"
294 : "lng");
295
296 $skipped_lng = new ilRadioOption($lng->txt("svy_eval_skipped_value_lng"), "lng");
297 $skipped_lng->setInfo(sprintf($lng->txt("svy_eval_skipped_value_lng_info"), $lng->txt("skipped")));
298 $eval_skipped->addOption($skipped_lng);
299 $skipped_cust = new ilRadioOption($lng->txt("svy_eval_skipped_value_custom"), "cust");
300 $skipped_cust->setInfo($lng->txt("svy_eval_skipped_value_custom_info"));
301 $eval_skipped->addOption($skipped_cust);
302
303 $skipped_cust_value = new ilTextInputGUI($lng->txt("svy_eval_skipped_value_custom_value"), "cust_value");
304 $skipped_cust_value->setSize(15);
305 $skipped_cust_value->setValue($surveySetting->get("skipped_custom_value", ""));
306 $skipped_cust->addSubItem($skipped_cust_value);
307
308 if ($ilAccess->checkAccess("write", "", $this->object->getRefId()))
309 {
310 $form->addCommandButton("saveSettings", $lng->txt("save"));
311 }
312
313 $tpl->setVariable("ADM_CONTENT", $form->getHTML());
314 }
315
320 {
321 global $ilCtrl, $ilAccess;
322
323 if (!$ilAccess->checkAccess("write", "", $this->object->getRefId())) $ilCtrl->redirect($this, "settings");
324 $surveySetting = new ilSetting("survey");
325 $surveySetting->set("unlimited_invitation", ($_POST["unlimited_invitation"]) ? "1" : "0");
326 $surveySetting->set("use_anonymous_id", ($_POST["use_anonymous_id"]) ? "1" : "0");
327
328 if($_POST["skcust"] == "lng")
329 {
330 $surveySetting->set("skipped_is_custom", false);
331 }
332 else
333 {
334 $surveySetting->set("skipped_is_custom", true);
335 $surveySetting->set("skipped_custom_value", trim($_POST["cust_value"]));
336 }
337
338 ilUtil::sendSuccess($this->lng->txt("msg_obj_modified"), true);
339 $ilCtrl->redirect($this, "settings");
340 }
341
342 function getAdminTabs(&$tabs_gui)
343 {
344 $this->getTabs($tabs_gui);
345 }
346
352 function getTabs(&$tabs_gui)
353 {
354 global $ilAccess, $lng;
355
356 if ($ilAccess->checkAccess("read",'',$this->object->getRefId()))
357 {
358 $tabs_gui->addTab("settings",
359 $lng->txt("settings"),
360 $this->ctrl->getLinkTarget($this, "settings"));
361
362 // #7927: special users are deprecated
363 /*
364 $tabs_gui->addTab("specialusers",
365 $lng->txt("specialusers"),
366 $this->ctrl->getLinkTarget($this, "specialusers"));
367 */
368
369 if ($ilAccess->checkAccess("write",'',$this->object->getRefId()))
370 {
371 $tabs_gui->addTab("templates",
372 $lng->txt("adm_settings_templates"),
373 $this->ctrl->getLinkTargetByClass("ilsettingstemplategui", ""));
374 }
375 }
376 if ($ilAccess->checkAccess("edit_permission",'',$this->object->getRefId()))
377 {
378 $tabs_gui->addTab("perm_settings",
379 $lng->txt("perm_settings"),
380 $this->ctrl->getLinkTargetByClass('ilpermissiongui', "perm"));
381 }
382 }
383
389 private function getSettingsTemplateConfig()
390 {
391 global $lng;
392
393 $lng->loadLanguageModule("survey");
394 include_once "Modules/Survey/classes/class.ilObjSurvey.php";
395
396 include_once("./Services/Administration/classes/class.ilSettingsTemplateConfig.php");
397 $config = new ilSettingsTemplateConfig("svy");
398
399 $config->addHidableTab("survey_question_editor", $lng->txt("survey_question_editor_settings_template"));
400 $config->addHidableTab("constraints", $lng->txt("constraints"));
401 $config->addHidableTab("invitation", $lng->txt("invitation"));
402 $config->addHidableTab("meta_data", $lng->txt("meta_data"));
403 $config->addHidableTab("export", $lng->txt("export"));
404
405 $config->addSetting(
406 "use_pool",
408 $lng->txt("survey_question_pool_usage"),
409 true,
410 0,
411 array(1 => $this->lng->txt("survey_question_pool_usage_active"),
412 0 => $this->lng->txt("survey_question_pool_usage_inactive"))
413 );
414
415
416 $config->addSetting(
417 "enabled_start_date",
419 $lng->txt("start_date"),
420 true
421 );
422
423 $config->addSetting(
424 "enabled_end_date",
426 $lng->txt("end_date"),
427 true
428 );
429
430 $config->addSetting(
431 "show_question_titles",
433 $lng->txt("svy_show_questiontitles"),
434 true
435 );
436
437
438 // #17585
439
440 $config->addSetting(
441 "acc_codes",
443 $lng->txt("survey_access_codes"),
444 true
445 );
446
447 $config->addSetting(
448 "evaluation_access",
450 $lng->txt("evaluation_access"),
451 true,
452 0,
453 array(ilObjSurvey::EVALUATION_ACCESS_OFF => $this->lng->txt("evaluation_access_off"),
454 ilObjSurvey::EVALUATION_ACCESS_ALL => $this->lng->txt("evaluation_access_all"),
455 ilObjSurvey::EVALUATION_ACCESS_PARTICIPANTS => $this->lng->txt("evaluation_access_participants"))
456 );
457
458 $config->addSetting(
459 "anonymization_options",
461 $lng->txt("survey_results_anonymization"),
462 true,
463 0,
464 array("statpers" => $this->lng->txt("survey_results_personalized"),
465 "statanon" => $this->lng->txt("survey_results_anonymized"))
466 );
467
468 /*
469 $config->addSetting(
470 "rte_switch",
471 ilSettingsTemplateConfig::SELECT,
472 $lng->txt("set_edit_mode"),
473 true,
474 0,
475 array(0 => $this->lng->txt("rte_editor_disabled"),
476 1 => $this->lng->txt("rte_editor_enabled"))
477 );
478 */
479
480 return $config;
481 }
482
483} // END class.ilObjSurveyAdministrationGUI
484?>
$_GET["client_id"]
$_SESSION["AccountId"]
This class represents a checkbox property in a property form.
Class ilObjSurveyAdministrationGUI.
ilObjSurveyAdministrationGUI($a_data, $a_id, $a_call_by_reference)
addSpecialUserObject()
Add one or more users as special users.
specialusersObject()
Add/remove users who may run a survey multiple times.
getAdminTabs(&$tabs_gui)
administration tabs show only permissions and trash folder
getTabs(&$tabs_gui)
get tabs @access public
getSettingsTemplateConfig()
Get settings template configuration object.
const EVALUATION_ACCESS_PARTICIPANTS
const EVALUATION_ACCESS_ALL
const EVALUATION_ACCESS_OFF
static searchUsers($a_search_str, $active=1, $a_return_ids_only=false, $filter_settings=FALSE)
STATIC METHOD get the user_ids which correspond a search string.
Class ilObjectGUI Basic methods of all Output classes.
ilObjectGUI($a_data, $a_id=0, $a_call_by_reference=true, $a_prepare_output=true)
Constructor @access public.
prepareOutput()
prepare output
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.
static sendInfo($a_info="", $a_keep=false)
Send Info Message to Screen.
$_POST['username']
Definition: cron.php:12
$code
Definition: example_050.php:99
global $ilCtrl
Definition: ilias.php:18
exit
Definition: login.php:54
$cmd
Definition: sahs_server.php:35