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