ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
class.ilObjAssessmentFolderGUI.php
Go to the documentation of this file.
1 <?php
2 /* Copyright (c) 1998-2013 ILIAS open source, Extended GPL, see docs/LICENSE */
3 
4 require_once "./Services/Object/classes/class.ilObjectGUI.php";
5 
6 require_once 'Modules/Test/classes/class.ilObjTest.php';
7 require_once 'Modules/TestQuestionPool/classes/class.ilAssQuestionProcessLocker.php';
8 
20 {
21  public $conditions;
22 
26  public function __construct($a_data, $a_id = 0, $a_call_by_reference = true, $a_prepare_output = true)
27  {
28  global $rbacsystem;
29 
30  $this->type = "assf";
31  parent::__construct($a_data, $a_id, $a_call_by_reference, false);
32 
33  if (!$rbacsystem->checkAccess('read', $this->object->getRefId())) {
34  $this->ilias->raiseError($this->lng->txt("msg_no_perm_read_assf"), $this->ilias->error_obj->WARNING);
35  }
36 
37  $this->lng->loadLanguageModule('assessment');
38  }
39 
40  public function executeCommand()
41  {
46  global $rbacsystem, $ilTabs;
47 
48  $next_class = $this->ctrl->getNextClass($this);
49  $cmd = $this->ctrl->getCmd();
50  $this->prepareOutput();
51 
52  switch ($next_class) {
53  case 'ilpermissiongui':
54  $ilTabs->activateTab('perm_settings');
55  include_once("Services/AccessControl/classes/class.ilPermissionGUI.php");
56  $perm_gui = new ilPermissionGUI($this);
57  $ret =&$this->ctrl->forwardCommand($perm_gui);
58  break;
59 
60  case 'ilsettingstemplategui':
62  break;
63 
64  case 'ilglobalunitconfigurationgui':
65  if (!$rbacsystem->checkAccess('write', $this->object->getRefId())) {
66  $this->ilias->raiseError($this->lng->txt('permission_denied'), $this->ilias->error_obj->WARNING);
67  }
68 
69  $ilTabs->setTabActive('units');
70 
71  require_once 'Modules/TestQuestionPool/classes/class.ilGlobalUnitConfigurationGUI.php';
72  require_once 'Modules/TestQuestionPool/classes/class.ilUnitConfigurationRepository.php';
75  );
76  $this->ctrl->forwardCommand($gui);
77  break;
78 
79  default:
80  if ($cmd == "" || $cmd == "view") {
81  $cmd = "settings";
82  }
83  $cmd .= "Object";
84  $this->$cmd();
85 
86  break;
87  }
88  return true;
89  }
90 
91 
96  public function saveObject()
97  {
98  global $rbacadmin;
99 
100  // create and insert forum in objecttree
101  $newObj = parent::saveObject();
102 
103  // put here object specific stuff
104 
105  // always send a message
106  ilUtil::sendSuccess($this->lng->txt("object_added"), true);
107 
108  $this->ctrl->redirect($this);
109  }
110 
111 
115  public function settingsObject(ilPropertyFormGUI $form = null)
116  {
117  global $ilTabs;
118 
119  $ilTabs->setTabActive('settings');
120 
121  if ($form === null) {
122  $form = $this->buildSettingsForm();
123  }
124 
125  $this->tpl->setVariable("ADM_CONTENT", $form->getHTML());
126  }
127 
128  private function buildSettingsForm()
129  {
133  global $ilAccess;
134 
135  include_once "./Modules/TestQuestionPool/classes/class.ilObjQuestionPool.php";
136  include_once("./Services/Form/classes/class.ilPropertyFormGUI.php");
137  $form = new ilPropertyFormGUI();
138  $form->setFormAction($this->ctrl->getFormAction($this));
139  $form->setTableWidth("100%");
140  $form->setId("settings");
141 
143  $header->setTitle($this->lng->txt('settings'));
144  $form->addItem($header);
145 
146  // question process locking behaviour (e.g. on saving users working data)
147  $chb = new ilCheckboxInputGUI($this->lng->txt('ass_process_lock'), 'ass_process_lock');
148  $chb->setChecked($this->object->getAssessmentProcessLockMode() != ilObjAssessmentFolder::ASS_PROC_LOCK_MODE_NONE);
149  $chb->setInfo($this->lng->txt('ass_process_lock_desc'));
150  $form->addItem($chb);
151  $rg = new ilRadioGroupInputGUI($this->lng->txt('ass_process_lock_mode'), 'ass_process_lock_mode');
152  $rg->setRequired(true);
153  $opt = new ilRadioOption($this->lng->txt('ass_process_lock_mode_file'), ilObjAssessmentFolder::ASS_PROC_LOCK_MODE_FILE);
154  $opt->setInfo($this->lng->txt('ass_process_lock_mode_file_desc'));
155  $rg->addOption($opt);
156  $opt = new ilRadioOption($this->lng->txt('ass_process_lock_mode_db'), ilObjAssessmentFolder::ASS_PROC_LOCK_MODE_DB);
157  $opt->setInfo($this->lng->txt('ass_process_lock_mode_db_desc'));
158  $rg->addOption($opt);
159  if ($this->object->getAssessmentProcessLockMode() != ilObjAssessmentFolder::ASS_PROC_LOCK_MODE_NONE) {
160  $rg->setValue($this->object->getAssessmentProcessLockMode());
161  }
162  $chb->addSubItem($rg);
163 
164  $assessmentSetting = new ilSetting('assessment');
165  $imap_line_color = array_key_exists('imap_line_color', $_GET) ? $_GET['imap_line_color'] : $assessmentSetting->get('imap_line_color');
166  if (strlen($imap_line_color) == 0) {
167  $imap_line_color = 'FF0000';
168  }
169 
170  $linepicker = new ilColorPickerInputGUI($this->lng->txt('assessment_imap_line_color'), 'imap_line_color');
171  $linepicker->setValue($imap_line_color);
172  $form->addItem($linepicker);
173 
174  $user_criteria = array_key_exists('user_criteria', $_GET) ? $_GET['user_criteria'] : $assessmentSetting->get('user_criteria');
175  $userCriteria = new ilSelectInputGUI($this->lng->txt('user_criteria'), 'user_criteria');
176  $userCriteria->setInfo($this->lng->txt('user_criteria_desc'));
177  $userCriteria->setRequired(true);
178 
179  $fields = array('usr_id', 'login', 'email', 'matriculation', 'ext_account');
180  $usr_fields = array();
181  foreach ($fields as $field) {
182  $usr_fields[$field] = $field;
183  }
184  $userCriteria->setOptions($usr_fields);
185  $userCriteria->setValue($user_criteria);
186  $form->addItem($userCriteria);
187 
188  $numRequiredAnswers = new ilNumberInputGUI(
189  $this->lng->txt('tst_skill_triggerings_num_req_answers'),
190  'num_req_answers'
191  );
192  $numRequiredAnswers->setInfo($this->lng->txt('tst_skill_triggerings_num_req_answers_desc'));
193  $numRequiredAnswers->setSize(4);
194  $numRequiredAnswers->allowDecimals(false);
195  $numRequiredAnswers->setMinValue(1);
196  $numRequiredAnswers->setMinvalueShouldBeGreater(false);
197  $numRequiredAnswers->setValue($this->object->getSkillTriggeringNumAnswersBarrier());
198  $form->addItem($numRequiredAnswers);
199 
200  $ceeqwh = new ilCheckboxInputGUI($this->lng->txt('export_essay_qst_with_html'), 'export_essay_qst_with_html');
201  $ceeqwh->setChecked($this->object->getExportEssayQuestionsWithHtml());
202  $ceeqwh->setInfo($this->lng->txt('export_essay_qst_with_html_desc'));
203  $form->addItem($ceeqwh);
204 
205  // question settings
207  $header->setTitle($this->lng->txt("assf_questiontypes"));
208  $form->addItem($header);
209 
210  // available question types
211  $allowed = new ilCheckboxGroupInputGUI($this->lng->txt('assf_allowed_questiontypes'), "chb_allowed_questiontypes");
212  $questiontypes =&ilObjQuestionPool::_getQuestionTypes(true);
214  $allowedtypes = array();
215  foreach ($questiontypes as $qt) {
216  if (!in_array($qt['question_type_id'], $forbidden_types)) {
217  array_push($allowedtypes, $qt['question_type_id']);
218  }
219  }
220  $allowed->setValue($allowedtypes);
221  foreach ($questiontypes as $type_name => $qtype) {
222  $allowed->addOption(new ilCheckboxOption($type_name, $qtype["question_type_id"]));
223  }
224  $allowed->setInfo($this->lng->txt('assf_allowed_questiontypes_desc'));
225  $form->addItem($allowed);
226 
227  // manual scoring
228  $manual = new ilCheckboxGroupInputGUI($this->lng->txt('assessment_log_manual_scoring_activate'), "chb_manual_scoring");
230  $manual->setValue($manscoring);
231  foreach ($questiontypes as $type_name => $qtype) {
232  $manual->addOption(new ilCheckboxOption($type_name, $qtype["question_type_id"]));
233  }
234  $manual->setInfo($this->lng->txt('assessment_log_manual_scoring_desc'));
235  $form->addItem($manual);
236 
237  // scoring adjustment active
238  $scoring_activation = new ilCheckboxInputGUI($this->lng->txt('assessment_scoring_adjust'), 'chb_scoring_adjust');
239  $scoring_activation->setChecked($this->object->getScoringAdjustmentEnabled());
240  $scoring_activation->setInfo($this->lng->txt('assessment_scoring_adjust_desc'));
241  $form->addItem($scoring_activation);
242 
243  // scoring adjustment
244  $scoring = new ilCheckboxGroupInputGUI($this->lng->txt('assessment_log_scoring_adjustment_activate'), "chb_scoring_adjustment");
245  $scoring_active = $this->object->getScoringAdjustableQuestions();
246  $scoring->setValue($scoring_active);
247  foreach ($this->object->fetchScoringAdjustableTypes($questiontypes) as $type_name => $qtype) {
248  $scoring->addOption(new ilCheckboxOption($type_name, $qtype["question_type_id"]));
249  }
250  $scoring->setInfo($this->lng->txt('assessment_log_scoring_adjustment_desc'));
251  $form->addItem($scoring);
252 
253  if ($ilAccess->checkAccess("write", "", $this->object->getRefId())) {
254  $form->addCommandButton("saveSettings", $this->lng->txt("save"));
255  }
256 
257  return $form;
258  }
259 
263  public function saveSettingsObject()
264  {
265  global $ilAccess;
266  if (!$ilAccess->checkAccess("write", "", $this->object->getRefId())) {
267  $this->ctrl->redirect($this, 'settings');
268  }
269 
270  $form = $this->buildSettingsForm();
271  if (!$form->checkInput()) {
272  $form->setValuesByPost();
273  return $this->settingsObject($form);
274  }
275 
276  $this->object->setSkillTriggeringNumAnswersBarrier((int) $_POST['num_req_answers']);
277  $this->object->setExportEssayQuestionsWithHtml((int) $_POST["export_essay_qst_with_html"] == 1);
278  $this->object->_setManualScoring($_POST["chb_manual_scoring"]);
279  include_once "./Modules/TestQuestionPool/classes/class.ilObjQuestionPool.php";
280  $questiontypes =&ilObjQuestionPool::_getQuestionTypes(true);
281  $forbidden_types = array();
282  foreach ($questiontypes as $name => $row) {
283  if (!in_array($row["question_type_id"], $_POST["chb_allowed_questiontypes"])) {
284  array_push($forbidden_types, $row["question_type_id"]);
285  }
286  }
287  $this->object->_setForbiddenQuestionTypes($forbidden_types);
288 
289  $this->object->setScoringAdjustmentEnabled($_POST['chb_scoring_adjust']);
290  $scoring_types = array();
291  foreach ($questiontypes as $name => $row) {
292  if (in_array($row["question_type_id"], (array) $_POST["chb_scoring_adjustment"])) {
293  array_push($scoring_types, $row["question_type_id"]);
294  }
295  }
296  $this->object->setScoringAdjustableQuestions($scoring_types);
297 
298  if (!$_POST['ass_process_lock']) {
299  $this->object->setAssessmentProcessLockMode(ilObjAssessmentFolder::ASS_PROC_LOCK_MODE_NONE);
300  } elseif (in_array($_POST['ass_process_lock_mode'], ilObjAssessmentFolder::getValidAssessmentProcessLockModes())) {
301  $this->object->setAssessmentProcessLockMode($_POST['ass_process_lock_mode']);
302  }
303 
304  $assessmentSetting = new ilSetting('assessment');
305  $assessmentSetting->set('use_javascript', '1');
306  if (strlen($_POST['imap_line_color']) == 6) {
307  $assessmentSetting->set('imap_line_color', ilUtil::stripSlashes($_POST['imap_line_color']));
308  }
309  $assessmentSetting->set('user_criteria', ilUtil::stripSlashes($_POST['user_criteria']));
310 
311  ilUtil::sendSuccess($this->lng->txt("msg_obj_modified"), true);
312 
313  $this->ctrl->redirect($this, 'settings');
314  }
315 
319  public function showLogObject()
320  {
321  $form = $this->getLogDataOutputForm();
322  $form->checkInput();
323 
324  $form->setValuesByPost();
325  $this->logsObject($form);
326  }
327 
331  public function exportLogObject()
332  {
333  $form = $this->getLogDataOutputForm();
334  if (!$form->checkInput()) {
335  $form->setValuesByPost();
336  $this->logsObject($form);
337  return;
338  }
339 
340  $test = $form->getInput('sel_test');
341  $from = $form->getItemByPostVar('log_from')->getDate()->get(IL_CAL_UNIX);
342  $until = $form->getItemByPostVar('log_until')->getDate()->get(IL_CAL_UNIX);
343 
344  $csv = array();
345  $separator = ";";
346  $row = array(
347  $this->lng->txt("assessment_log_datetime"),
348  $this->lng->txt("user"),
349  $this->lng->txt("assessment_log_text"),
350  $this->lng->txt("question")
351  );
352  include_once "./Modules/Test/classes/class.ilObjTest.php";
353  include_once "./Modules/TestQuestionPool/classes/class.assQuestion.php";
354  $available_tests =&ilObjTest::_getAvailableTests(1);
355  array_push($csv, ilUtil::processCSVRow($row, true, $separator));
356  $log_output = ilObjAssessmentFolder::getLog($from, $until, $test);
357  $users = array();
358  foreach ($log_output as $key => $log) {
359  if (!array_key_exists($log["user_fi"], $users)) {
360  $users[$log["user_fi"]] = ilObjUser::_lookupName($log["user_fi"]);
361  }
362  $title = "";
363  if ($log["question_fi"] || $log["original_fi"]) {
364  $title = assQuestion::_getQuestionTitle($log["question_fi"]);
365  if (strlen($title) == 0) {
366  $title = assQuestion::_getQuestionTitle($log["original_fi"]);
367  }
368  $title = $this->lng->txt("assessment_log_question") . ": " . $title;
369  }
370  $csvrow = array();
371  $date = new ilDateTime($log['tstamp'], IL_CAL_UNIX);
372  array_push($csvrow, $date->get(IL_CAL_FKT_DATE, 'Y-m-d H:i'));
373  array_push($csvrow, trim($users[$log["user_fi"]]["title"] . " " . $users[$log["user_fi"]]["firstname"] . " " . $users[$log["user_fi"]]["lastname"]));
374  array_push($csvrow, trim($log["logtext"]));
375  array_push($csvrow, $title);
376  array_push($csv, ilUtil::processCSVRow($csvrow, true, $separator));
377  }
378  $csvoutput = "";
379  foreach ($csv as $row) {
380  $csvoutput .= join($row, $separator) . "\n";
381  }
382  ilUtil::deliverData($csvoutput, str_replace(" ", "_", "log_" . $from . "_" . $until . "_" . $available_tests[$test]) . ".csv");
383  }
384 
388  protected function getLogDataOutputForm()
389  {
390  require_once 'Services/Form/classes/class.ilPropertyFormGUI.php';
391  $form = new ilPropertyFormGUI();
392  $form->setPreventDoubleSubmission(false);
393  $form->setFormAction($this->ctrl->getFormAction($this));
394  $form->setTableWidth("100%");
395  $form->setId("logs");
396 
398  $header->setTitle($this->lng->txt("assessment_log"));
399  $form->addItem($header);
400 
401  // from
402  $from = new ilDateTimeInputGUI($this->lng->txt('cal_from'), "log_from");
403  $from->setShowTime(true);
404  $from->setRequired(true);
405  $form->addItem($from);
406 
407  // until
408  $until = new ilDateTimeInputGUI($this->lng->txt('cal_until'), "log_until");
409  $until->setShowTime(true);
410  $until->setRequired(true);
411  $form->addItem($until);
412 
413  require_once 'Modules/Test/classes/class.ilObjTest.php';
414  require_once 'Modules/TestQuestionPool/classes/class.assQuestion.php';
415  $available_tests = ilObjTest::_getAvailableTests(1);
416 
417  // tests
418  $fortest = new ilSelectInputGUI($this->lng->txt('assessment_log_for_test'), "sel_test");
419  $fortest->setRequired(true);
420  $sorted_options = array();
421  foreach ($available_tests as $key => $value) {
422  $sorted_options[] = array(
423  'title' => ilUtil::prepareFormOutput($value) . " [" . $this->object->getNrOfLogEntries($key) . " " . $this->lng->txt("assessment_log_log_entries") . "]",
424  'key' => $key
425  );
426  }
427  $sorted_options = ilUtil::sortArray($sorted_options, 'title', 'asc');
428  $options = array('' => $this->lng->txt('please_choose'));
429  foreach ($sorted_options as $option) {
430  $options[$option['key']] = $option['title'];
431  }
432  $fortest->setOptions($options);
433  $form->addItem($fortest);
434 
435  $form->addCommandButton('showLog', $this->lng->txt('show'));
436  $form->addCommandButton('exportLog', $this->lng->txt('export'));
437 
438  return $form;
439  }
440 
444  public function logsObject(ilPropertyFormGUI $form = null)
445  {
449  global $ilTabs;
450 
451  $ilTabs->activateTab('logs');
452 
453  $template = new ilTemplate("tpl.assessment_logs.html", true, true, "Modules/Test");
454 
455  $p_test = 0;
456  $fromdate = 0;
457  $untildate = 0;
458 
459  if (!($form instanceof ilPropertyFormGUI)) {
460  $form = $this->getLogDataOutputForm();
461 
462  $values = array();
463  if (isset($_GET['sel_test'])) {
464  $p_test = $values['sel_test'] = (int) $_GET['sel_test'];
465  }
466 
467  if (isset($_GET['log_from'])) {
468  $fromdate = (int) $_GET['log_from'];
469  } else {
470  $fromdate = mktime(0, 0, 0, 1, 1, date('Y'));
471  }
472 
473  if (isset($_GET['log_until'])) {
474  $untildate = (int) $_GET['log_until'];
475  } else {
476  $untildate = time();
477  }
478 
479  $values['log_from'] = new ilDateTime($fromdate, IL_CAL_UNIX);
480  $values['log_until'] = new ilDateTime($untildate, IL_CAL_UNIX);
481 
482  $form->setValuesByArray($values);
483  } else {
484  $fromdate_input = $form->getItemByPostVar('log_from')->getDate();
485  $untildate_input = $form->getItemByPostVar('log_until')->getDate();
486  if ($fromdate_input instanceof ilDateTime && $untildate_input instanceof ilDateTime) {
487  $p_test = $form->getInput('sel_test');
488 
489  $fromdate = $fromdate_input->get(IL_CAL_UNIX);
490  $untildate = $untildate_input->get(IL_CAL_UNIX);
491  }
492  }
493 
494  $this->ctrl->setParameter($this, 'sel_test', (int) $p_test);
495  $this->ctrl->setParameter($this, 'log_until', (int) $untildate);
496  $this->ctrl->setParameter($this, 'log_from', (int) $fromdate);
497 
498  $template->setVariable("FORM", $form->getHTML());
499 
500  if ($p_test) {
501  require_once "Services/Link/classes/class.ilLink.php";
502  include_once "./Modules/Test/classes/tables/class.ilAssessmentFolderLogTableGUI.php";
503  $table_gui = new ilAssessmentFolderLogTableGUI($this, 'logs');
504  $log_output = ilObjAssessmentFolder::getLog($fromdate, $untildate, $p_test);
505 
506  $self = $this;
507  array_walk($log_output, function (&$row) use ($self) {
508  if (is_numeric($row['ref_id']) && $row['ref_id'] > 0) {
509  $row['location_href'] = ilLink::_getLink($row['ref_id'], 'tst');
510  $row['location_txt'] = $self->lng->txt("perma_link");
511  }
512  });
513 
514  $table_gui->setData($log_output);
515  $template->setVariable('LOG', $table_gui->getHTML());
516  }
517  $this->tpl->setVariable("ADM_CONTENT", $template->get());
518  }
519 
523  public function deleteLogObject()
524  {
525  if (is_array($_POST["chb_test"]) && (count($_POST["chb_test"]))) {
526  $this->object->deleteLogEntries($_POST["chb_test"]);
527  ilUtil::sendSuccess($this->lng->txt("ass_log_deleted"));
528  } else {
529  ilUtil::sendInfo($this->lng->txt("ass_log_delete_no_selection"));
530  }
531  $this->logAdminObject();
532  }
533 
537  public function logAdminObject()
538  {
539  global $ilAccess, $ilTabs;
540 
541  $ilTabs->activateTab('logs');
542 
543  $a_write_access = ($ilAccess->checkAccess("write", "", $this->object->getRefId())) ? true : false;
544 
545  include_once "./Modules/Test/classes/tables/class.ilAssessmentFolderLogAdministrationTableGUI.php";
546  $table_gui = new ilAssessmentFolderLogAdministrationTableGUI($this, 'logAdmin', $a_write_access);
547  include_once "./Modules/Test/classes/class.ilObjTest.php";
548  require_once "./Services/Link/classes/class.ilLink.php";
549  $available_tests = ilObjTest::_getAvailableTests(false);
550  $data = array();
551  foreach ($available_tests as $ref_id => $title) {
553  array_push($data, array(
554  "title" => $title,
555  "nr" => $this->object->getNrOfLogEntries($obj_id),
556  "id" => $obj_id,
557  "location_href" => ilLink::_getLink($ref_id, 'tst'),
558  "location_txt" => $this->lng->txt("perma_link")
559  ));
560  }
561  $table_gui->setData($data);
562  $this->tpl->setVariable('ADM_CONTENT', $table_gui->getHTML());
563  }
564 
565  public function getAdminTabs()
566  {
567  $this->getTabs();
568  }
569 
570  public function getLogdataSubtabs()
571  {
572  global $ilTabs;
573 
574  // log settings
575  $ilTabs->addSubTabTarget(
576  "settings",
577  $this->ctrl->getLinkTarget($this, "showLogSettings"),
578  array("saveLogSettings", "showLogSettings"),
579  ""
580  );
581 
582  // log output
583  $ilTabs->addSubTabTarget(
584  "ass_log_output",
585  $this->ctrl->getLinkTarget($this, "logs"),
586  array("logs", "showLog", "exportLog"),
587  ""
588  );
589 
590  // log administration
591  $ilTabs->addSubTabTarget(
592  "ass_log_admin",
593  $this->ctrl->getLinkTarget($this, "logAdmin"),
594  array("logAdmin", "deleteLog"),
595  "",
596  ""
597  );
598  }
599 
605  public function getTabs()
606  {
607  global $rbacsystem, $lng;
608 
609  switch ($this->ctrl->getCmd()) {
610  case "saveLogSettings":
611  case "showLogSettings":
612  case "logs":
613  case "showLog":
614  case "exportLog":
615  case "logAdmin":
616  case "deleteLog":
617  $this->getLogdataSubtabs();
618  break;
619  }
620 
621  if ($rbacsystem->checkAccess("visible,read", $this->object->getRefId())) {
622  $this->tabs_gui->addTarget(
623  "settings",
624  $this->ctrl->getLinkTarget($this, "settings"),
625  array("settings","","view"),
626  "",
627  ""
628  );
629 
630  $this->tabs_gui->addTarget(
631  "logs",
632  $this->ctrl->getLinkTarget($this, "showLogSettings"),
633  array('saveLogSettings', 'showLogSettings', "logs","showLog", "exportLog", "logAdmin", "deleteLog"),
634  "",
635  ""
636  );
637 
638  $this->tabs_gui->addTab(
639  "templates",
640  $lng->txt("adm_settings_templates"),
641  $this->ctrl->getLinkTargetByClass("ilsettingstemplategui", "")
642  );
643  }
644 
645  if ($rbacsystem->checkAccess("write", $this->object->getRefId())) {
646  $this->tabs_gui->addTarget('units', $this->ctrl->getLinkTargetByClass('ilGlobalUnitConfigurationGUI', ''), '', 'ilglobalunitconfigurationgui');
647  }
648 
649  if ($rbacsystem->checkAccess('edit_permission', $this->object->getRefId())) {
650  $this->tabs_gui->addTarget(
651  "perm_settings",
652  $this->ctrl->getLinkTargetByClass(array(get_class($this),'ilpermissiongui'), "perm"),
653  array("perm","info","owner"),
654  'ilpermissiongui'
655  );
656  }
657  }
658 
662  protected function showLogSettingsObject(ilPropertyFormGUI $form = null)
663  {
664  $this->tabs_gui->activateTab('logs');
665 
666  if (!($form instanceof ilPropertyFormGUI)) {
667  $form = $this->getLogSettingsForm();
668  $form->setValuesByArray(array(
669  'chb_assessment_logging' => ilObjAssessmentFolder::_enabledAssessmentLogging(),
670  'reporting_language' => ilObjAssessmentFolder::_getLogLanguage()
671  ));
672  }
673 
674  $this->tpl->setContent($form->getHTML());
675  }
676 
680  protected function saveLogSettingsObject()
681  {
685  global $ilAccess;
686 
687  if (!$ilAccess->checkAccess('write', '', $this->object->getRefId())) {
688  $this->ilias->raiseError($this->lng->txt("permission_denied"), $this->ilias->error_obj->WARNING);
689  }
690 
691  $form = $this->getLogSettingsForm();
692  if ($form->checkInput()) {
693  $this->object->_enableAssessmentLogging((int) $form->getInput('chb_assessment_logging'));
694  $this->object->_setLogLanguage($form->getInput('reporting_language'));
695  $this->object->update();
696  ilUtil::sendSuccess($this->lng->txt('saved_successfully'));
697  }
698 
699  $form->setValuesByPost();
701  }
702 
706  protected function getLogSettingsForm()
707  {
711  global $ilAccess;
712 
713  require_once 'Services/Form/classes/class.ilPropertyFormGUI.php';
714  $form = new ilPropertyFormGUI();
715  $form->setFormAction($this->ctrl->getFormAction($this, 'saveLogSettings'));
716  $form->setTitle($this->lng->txt('assessment_log_logging'));
717 
718  $logging = new ilCheckboxInputGUI('', 'chb_assessment_logging');
719  $logging->setValue(1);
720  $logging->setOptionTitle($this->lng->txt('activate_assessment_logging'));
721  $form->addItem($logging);
722 
723  $reporting = new ilSelectInputGUI($this->lng->txt('assessment_settings_reporting_language'), 'reporting_language');
724  $languages = $this->lng->getInstalledLanguages();
725  $this->lng->loadLanguageModule('meta');
726  $options = array();
727  foreach ($languages as $lang) {
728  $options[$lang] = $this->lng->txt('meta_l_' . $lang);
729  }
730  $reporting->setOptions($options);
731  $form->addItem($reporting);
732 
733  if ($ilAccess->checkAccess('write', '', $this->object->getRefId())) {
734  $form->addCommandButton('saveLogSettings', $this->lng->txt('save'));
735  }
736 
737  return $form;
738  }
739 
740  private function forwardToSettingsTemplateGUI()
741  {
742  global $ilTabs;
743 
744  $ilTabs->setTabActive('templates');
745 
746  require_once 'Services/Administration/classes/class.ilSettingsTemplateGUI.php';
747  $gui = new ilSettingsTemplateGUI(self::getSettingsTemplateConfig());
748 
749  $this->ctrl->forwardCommand($gui);
750  }
751 
755  public static function getSettingsTemplateConfig()
756  {
757  global $lng;
758 
759  require_once 'Modules/Test/classes/class.ilTestSettingsTemplateConfig.php';
761  $config->init();
762 
763  return $config;
764  }
765 }
static sendSuccess($a_info="", $a_keep=false)
Send Success Message to Screen.
static sortArray( $array, $a_array_sortby, $a_array_sortorder=0, $a_numeric=false, $a_keep_keys=false)
sortArray
static _lookupName($a_user_id)
lookup user name
static prepareFormOutput($a_str, $a_strip=false)
prepares string output for html forms public
This class represents an option in a radio group.
static deliverData($a_data, $a_filename, $mime="application/octet-stream", $charset="")
deliver data for download via browser.
This class represents an option in a checkbox group.
This class represents a selection list property in a property form.
$template
This class represents a property form user interface.
settingsObject(ilPropertyFormGUI $form=null)
display assessment folder settings form
$_GET["client_id"]
This class represents a section header in a property form.
Class ilObjAssessmentFolderGUI.
static getLog($ts_from, $ts_to, $test_id, $test_only=false)
Retrieve assessment log datasets from the database.
Color picker form for selecting color hexcodes using yui library.
Class ilGlobalUnitConfigurationGUI.
Class ilUnitConfigurationRepository.
This class represents a checkbox property in a property form.
static _getQuestionTypes($all_tags=false, $fixOrder=false)
$from
const IL_CAL_UNIX
setInfo($a_info)
Set Info.
This class represents a date/time property in a property form.
static _lookupObjectId($a_ref_id)
lookup object id
static & processCSVRow(&$row, $quoteAll=false, $separator=";", $outUTF8=false, $compatibleWithMSExcel=true)
Convertes an array for CSV usage.
setInfo($a_info)
Set Information Text.
static sendInfo($a_info="", $a_keep=false)
Send Info Message to Screen.
logAdminObject()
Administration output for assessment log files.
setChecked($a_checked)
Set Checked.
static _getLogLanguage()
retrieve the log language for assessment logging
prepareOutput($a_show_subobjects=true)
prepare output
if($format !==null) $name
Definition: metadata.php:146
static _enabledAssessmentLogging()
check wether assessment logging is enabled or not
This class represents a property in a property form.
if(isset($_POST['submit'])) $form
saveSettingsObject()
Save Assessment settings.
This class represents a number property in a property form.
Class ilObjectGUI Basic methods of all Output classes.
date( 'd-M-Y', $objPHPExcel->getProperties() ->getCreated())
special template class to simplify handling of ITX/PEAR
static _getForbiddenQuestionTypes()
Returns the forbidden questiontypes for ILIAS.
const IL_CAL_FKT_DATE
Date and time handling
redirection script todo: (a better solution should control the processing via a xml file) ...
This class represents a property in a property form.
static stripSlashes($a_str, $a_strip_html=true, $a_allow="")
strip slashes if magic qoutes is enabled
showLogSettingsObject(ilPropertyFormGUI $form=null)
Create styles array
The data for the language used.
$users
Definition: authpage.php:44
__construct($a_data, $a_id=0, $a_call_by_reference=true, $a_prepare_output=true)
Constructor.
Create new PHPExcel object
obj_idprivate
static _getManualScoring()
Retrieve the manual scoring settings.
static _getAvailableTests($use_object_id=false)
Returns the available tests for the active user.
$ret
Definition: parser.php:6
New PermissionGUI (extends from old ilPermission2GUI) RBAC related output.
Add data(end) time
Method that wraps PHPs time in order to allow simulations with the workflow.
showLogObject()
Called when the a log should be shown.
exportLogObject()
Called when the a log should be exported.
$key
Definition: croninfo.php:18
static _getQuestionTitle($question_id)
Returns the question title of a question with a given id.
$_POST["username"]
executeCommand()
execute command
setRequired($a_required)
Set Required.
deleteLogObject()
Deletes the log entries for one or more tests.
setShowTime($a_showtime)
Set Show Time Information.
if(!isset($_REQUEST['ReturnTo'])) if(!isset($_REQUEST['AuthId'])) $options
Definition: as_login.php:20
$test
Definition: Utf8Test.php:84