ILIAS  release_5-0 Revision 5.0.0-1144-gc4397b1f870
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 $tabs_gui->addTab("templates",
370 $lng->txt("adm_settings_templates"),
371 $this->ctrl->getLinkTargetByClass("ilsettingstemplategui", ""));
372 }
373 if ($ilAccess->checkAccess("edit_permission",'',$this->object->getRefId()))
374 {
375 $tabs_gui->addTab("perm_settings",
376 $lng->txt("perm_settings"),
377 $this->ctrl->getLinkTargetByClass('ilpermissiongui', "perm"));
378 }
379 }
380
386 private function getSettingsTemplateConfig()
387 {
388 global $lng;
389
390 $lng->loadLanguageModule("survey");
391
392 include_once("./Services/Administration/classes/class.ilSettingsTemplateConfig.php");
393 $config = new ilSettingsTemplateConfig("svy");
394
395 $config->addHidableTab("survey_question_editor", $lng->txt("survey_question_editor_settings_template"));
396 $config->addHidableTab("constraints", $lng->txt("constraints"));
397 $config->addHidableTab("invitation", $lng->txt("invitation"));
398 $config->addHidableTab("meta_data", $lng->txt("meta_data"));
399 $config->addHidableTab("export", $lng->txt("export"));
400
401 $config->addSetting(
402 "use_pool",
404 $lng->txt("survey_question_pool_usage"),
405 true
406 );
407
408 $config->addSetting(
409 "anonymization_options",
411 $lng->txt("survey_auth_mode"),
412 true,
413 'personalized',
414 array('personalized' => $this->lng->txt("anonymize_personalized"),
415 'anonymize_without_code' => $this->lng->txt("anonymize_without_code"),
416 'anonymize_with_code' => $this->lng->txt("anonymize_with_code"))
417 );
418
419 $config->addSetting(
420 "rte_switch",
422 $lng->txt("set_edit_mode"),
423 true,
424 0,
425 array(0 => $this->lng->txt("rte_editor_disabled"),
426 1 => $this->lng->txt("rte_editor_enabled"))
427 );
428
429 $config->addSetting(
430 "enabled_start_date",
432 $lng->txt("start_date"),
433 true
434 );
435
436 $config->addSetting(
437 "enabled_end_date",
439 $lng->txt("end_date"),
440 true
441 );
442
443 $config->addSetting(
444 "show_question_titles",
446 $lng->txt("svy_show_questiontitles"),
447 true
448 );
449
450 return $config;
451 }
452
453} // END class.ilObjSurveyAdministrationGUI
454?>
$_GET["client_id"]
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.
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
< a tabindex="-1" style="border-style: none;" href="#" title="Refresh Image" onclick="document.getElementById('siimage').src = './securimage_show.php?sid=' + Math.random(); this.blur(); return false">< img src="./images/refresh.png" alt="Reload Image" height="32" width="32" onclick="this.blur()" align="bottom" border="0"/></a >< br/>< strong > Enter Code *if($_SERVER['REQUEST_METHOD']=='POST' &&@ $_POST['do']=='contact') $_SESSION['ctform']['success']
global $ilCtrl
Definition: ilias.php:18
exit
Definition: login.php:54
$cmd
Definition: sahs_server.php:35