ILIAS  release_4-3 Revision
 All Data Structures Namespaces Files Functions Variables Groups Pages
class.ilObjAssessmentFolderGUI.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 
37 {
43 
44  public function ilObjAssessmentFolderGUI($a_data,$a_id,$a_call_by_reference)
45  {
46  global $rbacsystem;
47 
48  $this->type = "assf";
49  $this->ilObjectGUI($a_data,$a_id,$a_call_by_reference,false);
50 
51  if (!$rbacsystem->checkAccess('read',$this->object->getRefId()))
52  {
53  $this->ilias->raiseError($this->lng->txt("msg_no_perm_read_assf"),$this->ilias->error_obj->WARNING);
54  }
55  }
56 
57  public function &executeCommand()
58  {
59  $next_class = $this->ctrl->getNextClass($this);
60  $cmd = $this->ctrl->getCmd();
61  $this->prepareOutput();
62 
63  global $ilTabs;
64 
65  switch($next_class)
66  {
67  case 'ilpermissiongui':
68  $ilTabs->activateTab('perm_settings');
69  include_once("Services/AccessControl/classes/class.ilPermissionGUI.php");
70  $perm_gui =& new ilPermissionGUI($this);
71  $ret =& $this->ctrl->forwardCommand($perm_gui);
72  break;
73 
74  case 'ilsettingstemplategui':
75  $ilTabs->setTabActive("templates");
76  include_once("./Services/Administration/classes/class.ilSettingsTemplateGUI.php");
77  $set_tpl_gui = new ilSettingsTemplateGUI($this->getSettingsTemplateConfig());
78  $this->ctrl->forwardCommand($set_tpl_gui);
79  break;
80 
81  default:
82  if($cmd == "" || $cmd == "view")
83  {
84  $cmd = "settings";
85  }
86  $cmd .= "Object";
87  $this->$cmd();
88 
89  break;
90  }
91  return true;
92  }
93 
94 
99  public function saveObject()
100  {
101  global $rbacadmin;
102 
103  // create and insert forum in objecttree
104  $newObj = parent::saveObject();
105 
106  // put here object specific stuff
107 
108  // always send a message
109  ilUtil::sendSuccess($this->lng->txt("object_added"),true);
110 
111  $this->ctrl->redirect($this);
112  }
113 
114 
118  public function settingsObject()
119  {
120  global $ilAccess;
121 
122  global $ilTabs;
123  $ilTabs->setTabActive('settings');
124 
125  include_once "./Modules/TestQuestionPool/classes/class.ilObjQuestionPool.php";
126  include_once("./Services/Form/classes/class.ilPropertyFormGUI.php");
127  $form = new ilPropertyFormGUI();
128  $form->setFormAction($this->ctrl->getFormAction($this));
129  $form->setTableWidth("100%");
130  $form->setId("settings");
131 
132  // question settings
133  $header = new ilFormSectionHeaderGUI();
134  $header->setTitle($this->lng->txt("assf_questiontypes"));
135  $form->addItem($header);
136 
137  // available question types
138  $allowed = new ilCheckboxGroupInputGUI($this->lng->txt('assf_allowed_questiontypes'), "chb_allowed_questiontypes");
139  $questiontypes =& ilObjQuestionPool::_getQuestionTypes(TRUE);
140  $forbidden_types = $this->object->_getForbiddenQuestionTypes();
141  $allowedtypes = array();
142  foreach ($questiontypes as $qt)
143  {
144  if (!in_array($qt['question_type_id'], $forbidden_types)) array_push($allowedtypes, $qt['question_type_id']);
145  }
146  $allowed->setValue($allowedtypes);
147  foreach ($questiontypes as $type_name => $qtype)
148  {
149  $allowed->addOption(new ilCheckboxOption($type_name, $qtype["question_type_id"]));
150  }
151  $allowed->setInfo($this->lng->txt('assf_allowed_questiontypes_desc'));
152  $form->addItem($allowed);
153 
154  // manual scoring
155  $manual = new ilCheckboxGroupInputGUI($this->lng->txt('assessment_log_manual_scoring_activate'), "chb_manual_scoring");
156  $manscoring = $this->object->_getManualScoring();
157  $manual->setValue($manscoring);
158  foreach ($questiontypes as $type_name => $qtype)
159  {
160  $manual->addOption(new ilCheckboxOption($type_name, $qtype["question_type_id"]));
161  }
162  $manual->setInfo($this->lng->txt('assessment_log_manual_scoring_desc'));
163  $form->addItem($manual);
164 
165  if ($ilAccess->checkAccess("write", "", $this->object->getRefId()))
166  {
167  $form->addCommandButton("saveSettings", $this->lng->txt("save"));
168  }
169  $this->tpl->setVariable("ADM_CONTENT", $form->getHTML());
170  }
171 
175  public function saveSettingsObject()
176  {
177  global $ilAccess;
178  if (!$ilAccess->checkAccess("write", "", $this->object->getRefId())) $this->ctrl->redirect($this,'settings');
179 
180  $this->object->_setManualScoring($_POST["chb_manual_scoring"]);
181  include_once "./Modules/TestQuestionPool/classes/class.ilObjQuestionPool.php";
182  $questiontypes =& ilObjQuestionPool::_getQuestionTypes(TRUE);
183  $forbidden_types = array();
184  foreach ($questiontypes as $name => $row)
185  {
186  if (!in_array($row["question_type_id"], $_POST["chb_allowed_questiontypes"]))
187  {
188  array_push($forbidden_types, $row["question_type_id"]);
189  }
190  }
191  $this->object->_setForbiddenQuestionTypes($forbidden_types);
192  ilUtil::sendSuccess($this->lng->txt("msg_obj_modified"),true);
193 
194  $this->ctrl->redirect($this,'settings');
195  }
196 
200  public function showLogObject()
201  {
202  $from = mktime($_POST['log_from']['time']['h'], $_POST['log_from']['time']['m'], 0, $_POST['log_from']['date']['m'], $_POST['log_from']['date']['d'], $_POST['log_from']['date']['y']);
203  $until = mktime($_POST['log_until']['time']['h'], $_POST['log_until']['time']['m'], 0, $_POST['log_until']['date']['m'], $_POST['log_until']['date']['d'], $_POST['log_until']['date']['y']);
204  $test = $_POST['sel_test'];
205  $this->logsObject($from, $until, $test);
206  }
207 
211  public function exportLogObject()
212  {
213  $from = mktime($_POST['log_from']['time']['h'], $_POST['log_from']['time']['m'], 0, $_POST['log_from']['date']['m'], $_POST['log_from']['date']['d'], $_POST['log_from']['date']['y']);
214  $until = mktime($_POST['log_until']['time']['h'], $_POST['log_until']['time']['m'], 0, $_POST['log_until']['date']['m'], $_POST['log_until']['date']['d'], $_POST['log_until']['date']['y']);
215  $test = $_POST['sel_test'];
216 
217  $csv = array();
218  $separator = ";";
219  $row = array(
220  $this->lng->txt("assessment_log_datetime"),
221  $this->lng->txt("user"),
222  $this->lng->txt("assessment_log_text"),
223  $this->lng->txt("question")
224  );
225  include_once "./Modules/Test/classes/class.ilObjTest.php";
226  include_once "./Modules/TestQuestionPool/classes/class.assQuestion.php";
227  $available_tests =& ilObjTest::_getAvailableTests(1);
228  array_push($csv, ilUtil::processCSVRow($row, TRUE, $separator));
229  $log_output =& $this->object->getLog($from, $until, $test);
230  $users = array();
231  foreach ($log_output as $key => $log)
232  {
233  if (!array_key_exists($log["user_fi"], $users))
234  {
235  $users[$log["user_fi"]] = ilObjUser::_lookupName($log["user_fi"]);
236  }
237  $title = "";
238  if ($log["question_fi"] || $log["original_fi"])
239  {
240  $title = assQuestion::_getQuestionTitle($log["question_fi"]);
241  if (strlen($title) == 0)
242  {
243  $title = assQuestion::_getQuestionTitle($log["original_fi"]);
244  }
245  $title = $this->lng->txt("assessment_log_question") . ": " . $title;
246  }
247  $csvrow = array();
248  $date = new ilDateTime($log['tstamp'],IL_CAL_UNIX);
249  array_push($csvrow, $date->get(IL_CAL_FKT_DATE,'Y-m-d H:i'));
250  array_push($csvrow, trim($users[$log["user_fi"]]["title"] . " " . $users[$log["user_fi"]]["firstname"] . " " . $users[$log["user_fi"]]["lastname"]));
251  array_push($csvrow, trim($log["logtext"]));
252  array_push($csvrow, $title);
253  array_push($csv, ilUtil::processCSVRow($csvrow, TRUE, $separator));
254  }
255  $csvoutput = "";
256  foreach ($csv as $row)
257  {
258  $csvoutput .= join($row, $separator) . "\n";
259  }
260  ilUtil::deliverData($csvoutput, str_replace(" ", "_", "log_" . $from . "_" . $until . "_" . $available_tests[$test]).".csv");
261  }
262 
266  public function logsObject($p_from = null, $p_until = null, $p_test = null)
267  {
268  global $ilTabs;
269  $ilTabs->activateTab('logs');
270 
271  $template = new ilTemplate("tpl.assessment_logs.html", TRUE, TRUE, "Modules/Test");
272 
273  include_once "./Modules/Test/classes/class.ilObjTest.php";
274  include_once "./Modules/TestQuestionPool/classes/class.assQuestion.php";
275  $available_tests =& ilObjTest::_getAvailableTests(1);
276  if (count($available_tests) == 0)
277  {
278  ilUtil::sendInfo($this->lng->txt('assessment_log_no_data'));
279  return;
280  }
281 
282  include_once("./Services/Form/classes/class.ilPropertyFormGUI.php");
283  $form = new ilPropertyFormGUI();
284  $form->setFormAction($this->ctrl->getFormAction($this));
285  $form->setTableWidth("100%");
286  $form->setId("logs");
287 
288  $header = new ilFormSectionHeaderGUI();
289  $header->setTitle($this->lng->txt("assessment_log"));
290  $form->addItem($header);
291 
292  // from
293  $from = new ilDateTimeInputGUI($this->lng->txt('cal_from'), "log_from");
294  $from->setShowDate(true);
295  $from->setShowTime(true);
296  $now = getdate();
297  $fromdate = ($p_from) ? $p_from : (($_GET['log_from']) ? $_GET['log_from'] : mktime(0, 0, 0, 1, 1, $now['year']));
298  $from->setDate(new ilDateTime($fromdate, IL_CAL_UNIX));
299  $form->addItem($from);
300 
301  // until
302  $until = new ilDateTimeInputGUI($this->lng->txt('cal_until'), "log_until");
303  $until->setShowDate(true);
304  $until->setShowTime(true);
305  $untildate = ($p_until) ? $p_until : (($_GET['log_until']) ? $_GET['log_until'] : time());
306  $until->setDate(new ilDateTime($untildate, IL_CAL_UNIX));
307  $form->addItem($until);
308 
309  // tests
310  $fortest = new ilSelectInputGUI($this->lng->txt('assessment_log_for_test'), "sel_test");
311  $sorted_options = array();
312  foreach($available_tests as $key => $value)
313  {
314  $sorted_options[] = array(
315  'title' => ilUtil::prepareFormOutput($value) . " [" . $this->object->getNrOfLogEntries($key) . " " . $this->lng->txt("assessment_log_log_entries") . "]",
316  'key' => $key
317  );
318  }
319  $sorted_options = ilUtil::sortArray($sorted_options, 'title','asc');
320  $options = array();
321  foreach($sorted_options as $option)
322  {
323  $options[$option['key']] = $option['title'];
324  }
325  $fortest->setOptions($options);
326  $p_test = ($p_test) ? $p_test : $_GET['sel_test'];
327  if ($p_test) $fortest->setValue($p_test);
328  $form->addItem($fortest);
329  $this->ctrl->setParameter($this, 'sel_test', $p_test);
330  $this->ctrl->setParameter($this, 'log_until', $untildate);
331  $this->ctrl->setParameter($this, 'log_from', $fromdate);
332  $form->addCommandButton("showLog", $this->lng->txt("show"));
333  $form->addCommandButton("exportLog", $this->lng->txt("export"));
334  $template->setVariable("FORM", $form->getHTML());
335 
336  if ($p_test)
337  {
338  include_once "./Modules/Test/classes/tables/class.ilAssessmentFolderLogTableGUI.php";
339  $table_gui = new ilAssessmentFolderLogTableGUI($this, 'logs');
340  $log_output =& $this->object->getLog($fromdate, $untildate, $p_test);
341  $table_gui->setData($log_output);
342  $template->setVariable('LOG', $table_gui->getHTML());
343  }
344  $this->tpl->setVariable("ADM_CONTENT", $template->get());
345  }
346 
350  public function deleteLogObject()
351  {
352  if (is_array($_POST["chb_test"]) && (count($_POST["chb_test"])))
353  {
354  $this->object->deleteLogEntries($_POST["chb_test"]);
355  ilUtil::sendSuccess($this->lng->txt("ass_log_deleted"));
356  }
357  else
358  {
359  ilUtil::sendInfo($this->lng->txt("ass_log_delete_no_selection"));
360  }
361  $this->logAdminObject();
362  }
363 
367  public function logAdminObject()
368  {
369  global $ilAccess, $ilTabs;
370 
371  $ilTabs->activateTab('logs');
372 
373  $a_write_access = ($ilAccess->checkAccess("write", "", $this->object->getRefId())) ? true : false;
374 
375  include_once "./Modules/Test/classes/tables/class.ilAssessmentFolderLogAdministrationTableGUI.php";
376  $table_gui = new ilAssessmentFolderLogAdministrationTableGUI($this, 'logAdmin', $a_write_access);
377  include_once "./Modules/Test/classes/class.ilObjTest.php";
378  $available_tests =& ilObjTest::_getAvailableTests(true);
379  $data = array();
380  foreach ($available_tests as $obj_id => $title)
381  {
382  $nr = $this->object->getNrOfLogEntries($obj_id);
383  array_push($data, array("title" => $title, "nr" => $nr, "id" => $obj_id));
384  }
385  $table_gui->setData($data);
386  $this->tpl->setVariable('ADM_CONTENT', $table_gui->getHTML());
387  }
388 
389  public function getAdminTabs(&$tabs_gui)
390  {
391  $this->getTabs($tabs_gui);
392  }
393 
394  public function getLogdataSubtabs()
395  {
396  global $ilTabs;
397 
398  // log settings
399  $ilTabs->addSubTabTarget("settings",
400  $this->ctrl->getLinkTarget($this, "showLogSettings"),
401  array("saveLogSettings", "showLogSettings")
402  , "");
403 
404  // log output
405  $ilTabs->addSubTabTarget("ass_log_output",
406  $this->ctrl->getLinkTarget($this, "logs"),
407  array("logs", "showLog", "exportLog")
408  , "");
409 
410  // log administration
411  $ilTabs->addSubTabTarget("ass_log_admin",
412  $this->ctrl->getLinkTarget($this, "logAdmin"),
413  array("logAdmin", "deleteLog"),
414  "", "");
415 
416  }
417 
421  public function defaultsObject()
422  {
423  global $ilAccess, $rbacreview, $lng, $ilCtrl, $tpl, $ilTabs;
424 
425  $ilTabs->activateTab('defaults');
426 
427  $assessmentSetting = new ilSetting("assessment");
428  $use_javascript = array_key_exists("use_javascript", $_GET) ? $_GET["use_javascript"] : $assessmentSetting->get("use_javascript");
429  $imap_line_color = array_key_exists("imap_line_color", $_GET) ? $_GET["imap_line_color"] : $assessmentSetting->get("imap_line_color");
430  if (strlen($imap_line_color) == 0) $imap_line_color = "FF0000";
431 
432  include_once("./Services/Form/classes/class.ilPropertyFormGUI.php");
433  $form = new ilPropertyFormGUI();
434  $form->setFormAction($ilCtrl->getFormAction($this));
435  $form->setTitle($lng->txt("assessment_defaults"));
436 
437  // Enable javascript
438  $enable = new ilCheckboxInputGUI($lng->txt("assessment_use_javascript"), "use_javascript");
439  $enable->setChecked($use_javascript);
440  $enable->setInfo($lng->txt("assessment_use_javascript_desc"));
441  $form->addItem($enable);
442 
443  $linepicker = new ilColorPickerInputGUI($lng->txt("assessment_imap_line_color"), "imap_line_color");
444  $linepicker->setValue($imap_line_color);
445  $form->addItem($linepicker);
446 
447  if (@file_exists("./Modules/Test/classes/class.ilTestResultsToXML.php"))
448  {
449  global $ilDB;
450  $user_criteria = array_key_exists("user_criteria", $_GET) ? $_GET["user_criteria"] : $assessmentSetting->get("user_criteria");
451  $userCriteria = new ilSelectInputGUI($this->lng->txt("user_criteria"), "user_criteria");
452  $userCriteria->setInfo($this->lng->txt("user_criteria_desc"));
453  $userCriteria->setRequired(true);
454  $userCriteria->setValue(($isSingleline) ? 0 : 1);
455 
456  $manager = $ilDB->db->loadModule('Manager');
457  $fields = $manager->listTableFields('usr_data');
458  $usr_fields = array();
459  foreach ($fields as $field)
460  {
461  $usr_fields[$field] = $field;
462  }
463  $userCriteria->setOptions($usr_fields);
464  $userCriteria->setValue($user_criteria);
465  $form->addItem($userCriteria);
466  }
467 
468  if ($ilAccess->checkAccess("write", "", $this->object->getRefId()))
469  {
470  $form->addCommandButton("saveDefaults", $lng->txt("save"));
471  }
472 
473 
474  $tpl->setVariable("ADM_CONTENT", $form->getHTML());
475  }
476 
480  public function saveDefaultsObject()
481  {
482  global $ilCtrl;
483 
484  $assessmentSetting = new ilSetting("assessment");
485  if ($_POST["use_javascript"])
486  {
487  $assessmentSetting->set("use_javascript", "1");
488  }
489  else
490  {
491  $assessmentSetting->set("use_javascript", "0");
492  }
493  if (strlen($_POST["imap_line_color"]) == 6)
494  {
495  $assessmentSetting->set("imap_line_color", $_POST["imap_line_color"]);
496  }
497  if (@file_exists("./Modules/Test/classes/class.ilTestResultsToXML.php"))
498  {
499  $assessmentSetting->set("user_criteria", $_POST["user_criteria"]);
500  }
501  ilUtil::sendSuccess($this->lng->txt("msg_obj_modified"), true);
502  $ilCtrl->redirect($this, "defaults");
503  }
504 
505 
511  public function getTabs(&$tabs_gui)
512  {
513  global $rbacsystem, $lng;
514 
515  switch ($this->ctrl->getCmd())
516  {
517  case "saveLogSettings":
518  case "showLogSettings":
519  case "logs":
520  case "showLog":
521  case "exportLog":
522  case "logAdmin":
523  case "deleteLog":
524  $this->getLogdataSubtabs();
525  break;
526  }
527 
528  if ($rbacsystem->checkAccess("visible,read",$this->object->getRefId()))
529  {
530  $tabs_gui->addTarget("settings",
531  $this->ctrl->getLinkTarget($this, "settings"), array("settings","","view"), "", "");
532 
533  $tabs_gui->addTarget("logs",
534  $this->ctrl->getLinkTarget($this, "showLogSettings"),
535  array('saveLogSettings', 'showLogSettings', "logs","showLog", "exportLog", "logAdmin", "deleteLog"),
536  "", "");
537 
538  $tabs_gui->addTarget("defaults",
539  $this->ctrl->getLinkTarget($this, "defaults"), array("defaults","saveDefaults"), "", "");
540 
541  $tabs_gui->addTab("templates",
542  $lng->txt("adm_settings_templates"),
543  $this->ctrl->getLinkTargetByClass("ilsettingstemplategui", ""));
544  }
545 
546  if ($rbacsystem->checkAccess('edit_permission',$this->object->getRefId()))
547  {
548  $tabs_gui->addTarget("perm_settings",
549  $this->ctrl->getLinkTargetByClass(array(get_class($this),'ilpermissiongui'), "perm"), array("perm","info","owner"), 'ilpermissiongui');
550  }
551  }
552 
553 
559  public static function getSettingsTemplateConfig()
560  {
561  global $lng;
562 
563  $lng->loadLanguageModule("tst");
564  $lng->loadLanguageModule("assessment");
565 
566  include_once("./Services/Administration/classes/class.ilSettingsTemplateConfig.php");
567  $config = new ilSettingsTemplateConfig("tst");
568 
569  $config->addHidableTab("questions", $lng->txt('edit_test_questions'));
570  $config->addHidableTab("mark_schema", $lng->txt('settings') . ' - ' . $lng->txt("mark_schema"));
571  $config->addHidableTab("certificate", $lng->txt('settings') . ' - ' . $lng->txt("certificate"));
572  $config->addHidableTab("defaults", $lng->txt('settings') . ' - ' . $lng->txt("defaults"));
573 
574  $config->addHidableTab("learning_progress", $lng->txt("learning_progress"));
575  $config->addHidableTab("manscoring", $lng->txt("manscoring"));
576  $config->addHidableTab("history", $lng->txt("history"));
577  $config->addHidableTab("meta_data", $lng->txt("meta_data"));
578  $config->addHidableTab("export", $lng->txt("export"));
579  $config->addHidableTab("permissions", $lng->txt("permission"));
580 
582  // Settings
584 
585  //general properties
586  $config->addSetting(
587  "anonymity",
589  $lng->txt("tst_anonymity"),
590  false,
591  0,
592  array(
593  '0' => $lng->txt("tst_anonymity_no_anonymization"),
594  '1' => $lng->txt("tst_anonymity_anonymous_test"),
595  )
596  );
597 
598  $config->addSetting(
599  "title_output",
601  $lng->txt("tst_title_output"),
602  true,
603  0,
604  array(
605  '0' => $lng->txt("test_enable_view_table"),
606  '1' => $lng->txt("test_enable_view_express"),
607  '2' => $lng->txt("test_enable_view_both"),
608  )
609  );
610  $config->addSetting(
611  "random_test",
613  $lng->txt("tst_random_selection"),
614  true
615  );
616 
617  $config->addSetting(
618  "use_pool",
620  $lng->txt("test_question_pool_usage"),
621  true
622  );
623 
624  // Information at beginning and end of test
625  $config->addSetting(
626  "showinfo",
628  $lng->txt("showinfo"),
629  true
630  );
631 
632  $config->addSetting(
633  "showfinalstatement",
635  $lng->txt("final_statement_show"),
636  false
637  );
638 
639  // Session Settings
640  $config->addSetting(
641  "nr_of_tries",
643  $lng->txt("tst_nr_of_tries"),
644  false,
645  3
646  );
647 
648 
649  $config->addSetting(
650  "chb_processing_time",
652  $lng->txt("tst_processing_time"),
653  false
654  );
655 
656  $config->addSetting(
657  "chb_starting_time",
659  $lng->txt("tst_starting_time"),
660  false
661  );
662 
663  $config->addSetting(
664  "chb_ending_time",
666  $lng->txt("tst_ending_time"),
667  false
668  );
669 
670  $config->addSetting(
671  "password",
673  $lng->txt("tst_password"),
674  true,
675  20
676  );
677 
678  // Presentation Properties
679 
680  $config->addSetting(
681  "chb_use_previous_answers",
683  $lng->txt("tst_use_previous_answers"),
684  false
685  );
686  $config->addSetting(
687  "forcejs",
689  $lng->txt("forcejs_short"),
690  true
691  );
692 
693  $config->addSetting(
694  "title_output",
696  $lng->txt("tst_title_output"),
697  true,
698  0,
699  array(
700  '0' => $lng->txt("test_enable_view_table"),
701  '1' => $lng->txt("test_enable_view_express"),
702  '2' => $lng->txt("test_enable_view_both"),
703  )
704  );
705 
706  // Sequence Properties
707 
708  $config->addSetting(
709  "chb_postpone",
711  $lng->txt("tst_postpone"),
712  true
713  );
714  $config->addSetting(
715  "chb_shuffle_questions",
717  $lng->txt("tst_shuffle_questions"),
718  false
719  );
720  $config->addSetting(
721  "list_of_questions",
723  $lng->txt("tst_show_summary"),
724  false
725  );
726 
727  $config->addSetting(
728  "chb_show_marker",
730  $lng->txt("question_marking"),
731  true
732  );
733  $config->addSetting(
734  "chb_show_cancel",
736  $lng->txt("tst_show_cancel"),
737  true
738  );
739 
740  // Notifications
741 
742  $config->addSetting(
743  "mailnotification",
745  $lng->txt("tst_finish_notification"),
746  true,
747  0,
748  array(
749  '0' => $lng->txt("tst_finish_notification_no"),
750  '1' => $lng->txt("tst_finish_notification_simple"),
751  '2' => $lng->txt("tst_finish_notification_advanced"),
752  )
753  );
754 
755  $config->addSetting(
756  "mailnottype",
758  $lng->txt("mailnottype"),
759  true
760  );
761 
762  // Kiosk Mode
763 
764  $config->addSetting(
765  "kiosk",
767  $lng->txt("kiosk"),
768  true
769  );
770 
771 
772  // Participants Restriction
773 
774  $config->addSetting(
775  "fixedparticipants",
777  $lng->txt("participants_invitation"),
778  true
779  );
780 
781  $config->addSetting(
782  "allowedUsers",
784  $lng->txt("tst_allowed_users"),
785  true,
786  3
787  );
788 
789  $config->addSetting(
790  "allowedUsersTimeGap",
792  $lng->txt("tst_allowed_users_time_gap"),
793  true,
794  4
795  );
796 
798  // Scoring and Results
800 
801  $config->addSetting(
802  "count_system",
804  $lng->txt("tst_text_count_system"),
805  true,
806  0,
807  array(
808  '0' => $lng->txt("tst_count_partial_solutions"),
809  '1' => $lng->txt("tst_count_correct_solutions"),
810  )
811  );
812 
813  $config->addSetting(
814  "mc_scoring",
816  $lng->txt("tst_score_mcmr_questions"),
817  true,
818  0,
819  array(
820  '0' => $lng->txt("tst_score_mcmr_zero_points_when_unanswered"),
821  '1' => $lng->txt("tst_score_mcmr_use_scoring_system"),
822  )
823  );
824 
825  $config->addSetting(
826  "score_cutting",
828  $lng->txt("tst_score_cutting"),
829  true,
830  0,
831  array(
832  '0' => $lng->txt("tst_score_cut_question"),
833  '1' => $lng->txt("tst_score_cut_test"),
834  )
835  );
836 
837  $config->addSetting(
838  "pass_scoring",
840  $lng->txt("tst_pass_scoring"),
841  false,
842  0,
843  array(
844  '0' => $lng->txt("tst_pass_last_pass"),
845  '1' => $lng->txt("tst_pass_best_pass"),
846  )
847  );
848 
849  $config->addSetting(
850  "instant_feedback",
852  $lng->txt("tst_instant_feedback"),
853  false,
854  0,
855  array(
856  'instant_feedback_answer' => $lng->txt("tst_instant_feedback_answer_specific"),
857  'instant_feedback_points' => $lng->txt("tst_instant_feedback_results"),
858  'instant_feedback_solution' => $lng->txt("tst_instant_feedback_solution"),
859  )
860  );
861 
862  $config->addSetting(
863  "results_access",
865  $lng->txt("tst_results_access"),
866  false,
867  0,
868  array(
869  '1' => $lng->txt("tst_results_access_finished"),
870  '2' => $lng->txt("tst_results_access_always"),
871  '3' => $lng->txt("tst_results_access_never"),
872  '4' => $lng->txt("tst_results_access_date"),
873  )
874  );
875 
876  $config->addSetting(
877  "print_bs_with_res",
879  $lng->txt("tst_results_print_best_solution"),
880  true
881  );
882 
883  $config->addSetting(
884  "results_presentation",
886  $lng->txt("tst_results_presentation"),
887  false,
888  0,
889  array(
890  'pass_details' => $lng->txt("tst_show_pass_details"),
891  'solution_details' => $lng->txt("tst_show_solution_details"),
892  'solution_printview' => $lng->txt("tst_show_solution_printview"),
893  'solution_feedback' => $lng->txt("tst_show_solution_feedback"),
894  'solution_answers_only' => $lng->txt("tst_show_solution_answers_only"),
895  'solution_signature' => $lng->txt("tst_show_solution_signature"),
896  'solution_suggested' => $lng->txt("tst_show_solution_suggested"),
897  )
898  );
899 
900  $config->addSetting(
901  "export_settings",
903  $lng->txt("tst_export_settings"),
904  true
905  );
906  return $config;
907  }
908 
912  protected function showLogSettingsObject(ilPropertyFormGUI $form = null)
913  {
914  $this->tabs_gui->activateTab('logs');
915 
916  if(!($form instanceof ilPropertyFormGUI))
917  {
918  $form = $this->getLogSettingsForm();
919  $form->setValuesByArray(array(
920  'chb_assessment_logging' => $this->object->_enabledAssessmentLogging(),
921  'reporting_language' => $this->object->_getLogLanguage()
922  ));
923  }
924 
925  $this->tpl->setContent($form->getHTML());
926  }
927 
931  protected function saveLogSettingsObject()
932  {
936  global $ilAccess;
937 
938  if(!$ilAccess->checkAccess('write', '', $this->object->getRefId()))
939  {
940  $this->ilias->raiseError($this->lng->txt("permission_denied"),$this->ilias->error_obj->WARNING);
941  }
942 
943  $form = $this->getLogSettingsForm();
944  if($form->checkInput())
945  {
946  $this->object->_enableAssessmentLogging((int)$form->getInput('chb_assessment_logging'));
947  $this->object->_setLogLanguage($form->getInput('reporting_language'));
948  $this->object->update();
949  ilUtil::sendSuccess($this->lng->txt('saved_successfully'));
950  }
951 
952  $form->setValuesByPost();
953  $this->showLogSettingsObject($form);
954  }
955 
959  protected function getLogSettingsForm()
960  {
964  global $ilAccess;
965 
966  require_once 'Services/Form/classes/class.ilPropertyFormGUI.php';
967  $form = new ilPropertyFormGUI();
968  $form->setFormAction($this->ctrl->getFormAction($this, 'saveLogSettings'));
969  $form->setTitle($this->lng->txt('assessment_log_logging'));
970 
971  $logging = new ilCheckboxInputGUI('', 'chb_assessment_logging');
972  $logging->setValue(1);
973  $logging->setOptionTitle($this->lng->txt('activate_assessment_logging'));
974  $form->addItem($logging);
975 
976  $reporting = new ilSelectInputGUI($this->lng->txt('assessment_settings_reporting_language'), 'reporting_language');
977  $languages = $this->lng->getInstalledLanguages();
978  $this->lng->loadLanguageModule('meta');
979  $options = array();
980  foreach($languages as $lang)
981  {
982  $options[$lang] = $this->lng->txt('meta_l_' . $lang);
983  }
984  $reporting->setOptions($options);
985  $form->addItem($reporting);
986 
987  if($ilAccess->checkAccess('write', '', $this->object->getRefId()))
988  {
989  $form->addCommandButton('saveLogSettings', $this->lng->txt('save'));
990  }
991 
992  return $form;
993  }
994 } // END class.ilObjAssessmentFolderGUI
995 ?>