ILIAS  release_5-2 Revision v5.2.25-18-g3f80b828510
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 
24 include_once "./Services/Object/classes/class.ilObjectGUI.php";
25 
39 {
45 
46  function __construct($a_data,$a_id,$a_call_by_reference)
47  {
48  global $lng;
49 
50  $this->type = "svyf";
51  $lng->loadLanguageModule("survey");
52  parent::__construct($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 
100  function settingsObject(ilPropertyFormGUI $a_form = null)
101  {
102  global $tpl, $ilTabs;
103 
104  $ilTabs->activateTab("settings");
105 
106  if(!$a_form)
107  {
108  $a_form = $this->initSettingsForm();
109  }
110 
111  $tpl->setContent($a_form->getHTML());
112  }
113 
114  protected function initSettingsForm()
115  {
116  global $ilAccess, $lng, $ilCtrl;
117 
118  $surveySetting = new ilSetting("survey");
119  $unlimited_invitation = array_key_exists("unlimited_invitation", $_GET) ? $_GET["unlimited_invitation"] : $surveySetting->get("unlimited_invitation");
120  $use_anonymous_id = array_key_exists("use_anonymous_id", $_GET) ? $_GET["use_anonymous_id"] : $surveySetting->get("use_anonymous_id");
121 
122  include_once("./Services/Form/classes/class.ilPropertyFormGUI.php");
123  $form = new ilPropertyFormGUI();
124  $form->setFormAction($ilCtrl->getFormAction($this));
125  $form->setTitle($lng->txt("survey_defaults"));
126 
127  // unlimited invitation
128  $enable = new ilCheckboxInputGUI($lng->txt("survey_unlimited_invitation"), "unlimited_invitation");
129  $enable->setChecked($unlimited_invitation);
130  $enable->setInfo($lng->txt("survey_unlimited_invitation_desc"));
131  $form->addItem($enable);
132 
133  // Survey Code
134  $code = new ilCheckboxInputGUI($lng->txt("use_anonymous_id"), "use_anonymous_id");
135  $code->setChecked($use_anonymous_id);
136  $code->setInfo($lng->txt("use_anonymous_id_desc"));
137  $form->addItem($code);
138 
139  // Skipped
140  $eval_skipped = new ilRadioGroupInputGUI($lng->txt("svy_eval_skipped_value"), "skcust");
141  $eval_skipped->setRequired(true);
142  $form->addItem($eval_skipped);
143 
144  $eval_skipped->setValue($surveySetting->get("skipped_is_custom", false)
145  ? "cust"
146  : "lng");
147 
148  $skipped_lng = new ilRadioOption($lng->txt("svy_eval_skipped_value_lng"), "lng");
149  $skipped_lng->setInfo(sprintf($lng->txt("svy_eval_skipped_value_lng_info"), $lng->txt("skipped")));
150  $eval_skipped->addOption($skipped_lng);
151  $skipped_cust = new ilRadioOption($lng->txt("svy_eval_skipped_value_custom"), "cust");
152  $skipped_cust->setInfo($lng->txt("svy_eval_skipped_value_custom_info"));
153  $eval_skipped->addOption($skipped_cust);
154 
155  $skipped_cust_value = new ilTextInputGUI($lng->txt("svy_eval_skipped_value_custom_value"), "cust_value");
156  $skipped_cust_value->setSize(15);
157  $skipped_cust_value->setValue($surveySetting->get("skipped_custom_value", ""));
158  $skipped_cust->addSubItem($skipped_cust_value);
159 
160  $anon_part = new ilCheckboxInputGUI($lng->txt("svy_anonymous_participants"), "anon_part");
161  $anon_part->setInfo($lng->txt("svy_anonymous_participants_info"));
162  $anon_part->setChecked($surveySetting->get("anonymous_participants", false));
163  $form->addItem($anon_part);
164 
165  $anon_part_min = new ilNumberInputGUI($lng->txt("svy_anonymous_participants_min"), "anon_part_min");
166  $anon_part_min->setInfo($lng->txt("svy_anonymous_participants_min_info"));
167  $anon_part_min->setSize(4);
168  $anon_part_min->setMinValue(1);
169  $anon_part_min->setValue($surveySetting->get("anonymous_participants_min", null));
170  $anon_part->addSubItem($anon_part_min);
171 
172  if ($ilAccess->checkAccess("write", "", $this->object->getRefId()))
173  {
174  $form->addCommandButton("saveSettings", $lng->txt("save"));
175  }
176 
177  return $form;
178  }
179 
184  {
185  global $ilCtrl, $ilAccess;
186 
187  if (!$ilAccess->checkAccess("write", "", $this->object->getRefId()))
188  {
189  $ilCtrl->redirect($this, "settings");
190  }
191 
192  $form = $this->initSettingsForm();
193  if($form->checkInput())
194  {
195  $surveySetting = new ilSetting("survey");
196  $surveySetting->set("unlimited_invitation", ($_POST["unlimited_invitation"]) ? "1" : "0");
197  $surveySetting->set("use_anonymous_id", ($_POST["use_anonymous_id"]) ? "1" : "0");
198  $surveySetting->set("anonymous_participants", ($_POST["anon_part"]) ? "1" : "0");
199  $surveySetting->set("anonymous_participants_min", (trim($_POST["anon_part_min"])) ? (int)$_POST["anon_part_min"] : null);
200 
201  if($_POST["skcust"] == "lng")
202  {
203  $surveySetting->set("skipped_is_custom", false);
204  }
205  else
206  {
207  $surveySetting->set("skipped_is_custom", true);
208  $surveySetting->set("skipped_custom_value", trim($_POST["cust_value"]));
209  }
210 
211  ilUtil::sendSuccess($this->lng->txt("msg_obj_modified"), true);
212  $ilCtrl->redirect($this, "settings");
213  }
214 
215  $form->setValuesByPost();
216  $this->settingsObject($form);
217  }
218 
219  function getAdminTabs()
220  {
221  $this->getTabs();
222  }
223 
229  function getTabs()
230  {
231  global $lng;
232 
233  if ($this->checkPermissionBool("read"))
234  {
235  $this->tabs_gui->addTab("settings",
236  $lng->txt("settings"),
237  $this->ctrl->getLinkTarget($this, "settings"));
238 
239  // #7927: special users are deprecated
240  /*
241  $tabs_gui->addTab("specialusers",
242  $lng->txt("specialusers"),
243  $this->ctrl->getLinkTarget($this, "specialusers"));
244  */
245 
246  if ($this->checkPermissionBool("write"))
247  {
248  $this->tabs_gui->addTab("templates",
249  $lng->txt("adm_settings_templates"),
250  $this->ctrl->getLinkTargetByClass("ilsettingstemplategui", ""));
251  }
252  }
253  if ($this->checkPermissionBool("edit_permission"))
254  {
255  $this->tabs_gui->addTab("perm_settings",
256  $lng->txt("perm_settings"),
257  $this->ctrl->getLinkTargetByClass('ilpermissiongui', "perm"));
258  }
259  }
260 
266  private function getSettingsTemplateConfig()
267  {
268  global $lng;
269 
270  $lng->loadLanguageModule("survey");
271  include_once "Modules/Survey/classes/class.ilObjSurvey.php";
272 
273  include_once("./Services/Administration/classes/class.ilSettingsTemplateConfig.php");
274  $config = new ilSettingsTemplateConfig("svy");
275 
276  $config->addHidableTab("survey_question_editor", $lng->txt("survey_question_editor_settings_template"));
277  $config->addHidableTab("constraints", $lng->txt("constraints"));
278  $config->addHidableTab("invitation", $lng->txt("invitation"));
279  $config->addHidableTab("meta_data", $lng->txt("meta_data"));
280  $config->addHidableTab("export", $lng->txt("export"));
281 
282  $config->addSetting(
283  "use_pool",
285  $lng->txt("survey_question_pool_usage"),
286  true,
287  0,
288  array(1 => $this->lng->txt("survey_question_pool_usage_active"),
289  0 => $this->lng->txt("survey_question_pool_usage_inactive"))
290  );
291 
292 
293  $config->addSetting(
294  "enabled_start_date",
296  $lng->txt("start_date"),
297  true
298  );
299 
300  $config->addSetting(
301  "enabled_end_date",
303  $lng->txt("end_date"),
304  true
305  );
306 
307  $config->addSetting(
308  "show_question_titles",
310  $lng->txt("svy_show_questiontitles"),
311  true
312  );
313 
314 
315  // #17585
316 
317  $config->addSetting(
318  "acc_codes",
320  $lng->txt("survey_access_codes"),
321  true
322  );
323 
324  $config->addSetting(
325  "evaluation_access",
327  $lng->txt("evaluation_access"),
328  true,
329  0,
330  array(ilObjSurvey::EVALUATION_ACCESS_OFF => $this->lng->txt("evaluation_access_off"),
331  ilObjSurvey::EVALUATION_ACCESS_ALL => $this->lng->txt("evaluation_access_all"),
332  ilObjSurvey::EVALUATION_ACCESS_PARTICIPANTS => $this->lng->txt("evaluation_access_participants"))
333  );
334 
335  $config->addSetting(
336  "anonymization_options",
338  $lng->txt("survey_results_anonymization"),
339  true,
340  0,
341  array("statpers" => $this->lng->txt("survey_results_personalized"),
342  "statanon" => $this->lng->txt("survey_results_anonymized"))
343  );
344 
345  /*
346  $config->addSetting(
347  "rte_switch",
348  ilSettingsTemplateConfig::SELECT,
349  $lng->txt("set_edit_mode"),
350  true,
351  0,
352  array(0 => $this->lng->txt("rte_editor_disabled"),
353  1 => $this->lng->txt("rte_editor_enabled"))
354  );
355  */
356 
357  return $config;
358  }
359 
360 } // END class.ilObjSurveyAdministrationGUI
361 ?>
static sendSuccess($a_info="", $a_keep=false)
Send Success Message to Screen.
This class represents an option in a radio group.
ILIAS Setting Class.
getSettingsTemplateConfig()
Get settings template configuration object.
const EVALUATION_ACCESS_OFF
This class represents a property form user interface.
const EVALUATION_ACCESS_PARTICIPANTS
$_GET["client_id"]
$code
Definition: example_050.php:99
$cmd
Definition: sahs_server.php:35
This class represents a checkbox property in a property form.
setInfo($a_info)
Set Info.
global $ilCtrl
Definition: ilias.php:18
setInfo($a_info)
Set Information Text.
setChecked($a_checked)
Set Checked.
prepareOutput($a_show_subobjects=true)
prepare output
This class represents a property in a property form.
This class represents a number property in a property form.
Class ilObjectGUI Basic methods of all Output classes.
setSize($a_size)
Set Size.
This class represents a text property in a property form.
Create styles array
The data for the language used.
Settings template config class.
const EVALUATION_ACCESS_ALL
$ret
Definition: parser.php:6
New PermissionGUI (extends from old ilPermission2GUI) RBAC related output.
settingsObject(ilPropertyFormGUI $a_form=null)
display survey settings form
checkPermissionBool($a_perm, $a_cmd="", $a_type="", $a_ref_id=null)
Check permission.
Class ilObjSurveyAdministrationGUI.
$_POST["username"]
__construct($a_data, $a_id, $a_call_by_reference)
setRequired($a_required)
Set Required.