4 require_once
"./Services/Object/classes/class.ilObjectGUI.php";
6 require_once
'Modules/Test/classes/class.ilObjTest.php';
7 require_once
'Modules/TestQuestionPool/classes/class.ilAssQuestionProcessLocker.php';
31 $this->
ilObjectGUI($a_data,$a_id,$a_call_by_reference,
false);
33 if (!$rbacsystem->checkAccess(
'read',$this->object->getRefId()))
35 $this->ilias->raiseError($this->lng->txt(
"msg_no_perm_read_assf"),$this->ilias->error_obj->WARNING);
38 $this->lng->loadLanguageModule(
'assessment');
47 global $rbacsystem, $ilTabs;
49 $next_class = $this->ctrl->getNextClass($this);
50 $cmd = $this->ctrl->getCmd();
55 case 'ilpermissiongui':
56 $ilTabs->activateTab(
'perm_settings');
57 include_once(
"Services/AccessControl/classes/class.ilPermissionGUI.php");
59 $ret =& $this->ctrl->forwardCommand($perm_gui);
62 case 'ilsettingstemplategui':
66 case 'ilglobalunitconfigurationgui':
67 if(!$rbacsystem->checkAccess(
'write', $this->object->getRefId()))
69 $this->ilias->raiseError($this->lng->txt(
'permission_denied'), $this->ilias->error_obj->WARNING);
72 $ilTabs->setTabActive(
'units');
74 require_once
'Modules/TestQuestionPool/classes/class.ilGlobalUnitConfigurationGUI.php';
75 require_once
'Modules/TestQuestionPool/classes/class.ilUnitConfigurationRepository.php';
79 $this->ctrl->forwardCommand($gui);
112 $this->ctrl->redirect($this);
123 $ilTabs->setTabActive(
'settings');
127 $form = $this->buildSettingsForm();
130 $this->tpl->setVariable(
"ADM_CONTENT", $form->getHTML());
133 private function buildSettingsForm()
140 include_once
"./Modules/TestQuestionPool/classes/class.ilObjQuestionPool.php";
141 include_once(
"./Services/Form/classes/class.ilPropertyFormGUI.php");
143 $form->setFormAction($this->ctrl->getFormAction($this));
144 $form->setTableWidth(
"100%");
145 $form->setId(
"settings");
148 $header->setTitle($this->lng->txt(
'settings'));
149 $form->addItem($header);
152 $chb =
new ilCheckboxInputGUI($this->lng->txt(
'ass_process_lock'),
'ass_process_lock');
154 $chb->setInfo($this->lng->txt(
'ass_process_lock_desc'));
155 $form->addItem($chb);
156 $rg =
new ilRadioGroupInputGUI($this->lng->txt(
'ass_process_lock_mode'),
'ass_process_lock_mode');
159 $opt->
setInfo($this->lng->txt(
'ass_process_lock_mode_file_desc'));
160 $rg->addOption($opt);
162 $opt->
setInfo($this->lng->txt(
'ass_process_lock_mode_db_desc'));
163 $rg->addOption($opt);
166 $rg->setValue($this->object->getAssessmentProcessLockMode());
168 $chb->addSubItem($rg);
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) $imap_line_color =
'FF0000';
174 $linepicker =
new ilColorPickerInputGUI($this->lng->txt(
'assessment_imap_line_color'),
'imap_line_color');
175 $linepicker->
setValue($imap_line_color);
176 $form->addItem($linepicker);
178 $user_criteria = array_key_exists(
'user_criteria',
$_GET) ?
$_GET[
'user_criteria'] : $assessmentSetting->get(
'user_criteria');
179 $userCriteria =
new ilSelectInputGUI($this->lng->txt(
'user_criteria'),
'user_criteria');
180 $userCriteria->
setInfo($this->lng->txt(
'user_criteria_desc'));
181 $userCriteria->setRequired(
true);
183 $fields = array(
'usr_id',
'login',
'email',
'matriculation',
'ext_account');
184 $usr_fields = array();
185 foreach($fields as $field)
187 $usr_fields[$field] = $field;
189 $userCriteria->setOptions($usr_fields);
190 $userCriteria->setValue($user_criteria);
191 $form->addItem($userCriteria);
195 $header->setTitle($this->lng->txt(
"assf_questiontypes"));
196 $form->addItem($header);
199 $allowed =
new ilCheckboxGroupInputGUI($this->lng->txt(
'assf_allowed_questiontypes'),
"chb_allowed_questiontypes");
201 $forbidden_types = $this->
object->_getForbiddenQuestionTypes();
202 $allowedtypes = array();
203 foreach ($questiontypes as $qt)
205 if (!in_array($qt[
'question_type_id'], $forbidden_types)) array_push($allowedtypes, $qt[
'question_type_id']);
207 $allowed->setValue($allowedtypes);
208 foreach ($questiontypes as $type_name => $qtype)
210 $allowed->addOption(
new ilCheckboxOption($type_name, $qtype[
"question_type_id"]));
212 $allowed->setInfo($this->lng->txt(
'assf_allowed_questiontypes_desc'));
213 $form->addItem($allowed);
216 $manual =
new ilCheckboxGroupInputGUI($this->lng->txt(
'assessment_log_manual_scoring_activate'),
"chb_manual_scoring");
217 $manscoring = $this->
object->_getManualScoring();
219 foreach ($questiontypes as $type_name => $qtype)
221 $manual->addOption(
new ilCheckboxOption($type_name, $qtype[
"question_type_id"]));
223 $manual->setInfo($this->lng->txt(
'assessment_log_manual_scoring_desc'));
224 $form->addItem($manual);
227 $scoring_activation =
new ilCheckboxInputGUI($this->lng->txt(
'assessment_scoring_adjust'),
'chb_scoring_adjust');
228 $scoring_activation->
setChecked($this->object->getScoringAdjustmentEnabled());
229 $scoring_activation->setInfo($this->lng->txt(
'assessment_scoring_adjust_desc'));
230 $form->addItem($scoring_activation);
233 $scoring =
new ilCheckboxGroupInputGUI($this->lng->txt(
'assessment_log_scoring_adjustment_activate'),
"chb_scoring_adjustment");
234 $scoring_active = $this->
object->getScoringAdjustableQuestions();
235 $scoring->
setValue($scoring_active);
236 foreach ($questiontypes as $type_name => $qtype)
238 $scoring->addOption(
new ilCheckboxOption($type_name, $qtype[
"question_type_id"]));
240 $scoring->setInfo($this->lng->txt(
'assessment_log_scoring_adjustment_desc'));
241 $form->addItem($scoring);
243 if ($ilAccess->checkAccess(
"write",
"", $this->object->getRefId()))
245 $form->addCommandButton(
"saveSettings", $this->lng->txt(
"save"));
257 if (!$ilAccess->checkAccess(
"write",
"", $this->object->getRefId())) $this->ctrl->redirect($this,
'settings');
259 $form = $this->buildSettingsForm();
260 if(!$form->checkInput())
262 $form->setValuesByPost();
266 $this->
object->_setManualScoring(
$_POST[
"chb_manual_scoring"]);
267 include_once
"./Modules/TestQuestionPool/classes/class.ilObjQuestionPool.php";
269 $forbidden_types = array();
270 foreach ($questiontypes as $name =>
$row)
272 if (!in_array(
$row[
"question_type_id"],
$_POST[
"chb_allowed_questiontypes"]))
274 array_push($forbidden_types,
$row[
"question_type_id"]);
277 $this->
object->_setForbiddenQuestionTypes($forbidden_types);
279 $this->
object->setScoringAdjustmentEnabled(
$_POST[
'chb_scoring_adjust']);
280 $scoring_types = array();
281 foreach ($questiontypes as $name =>
$row)
283 if (in_array(
$row[
"question_type_id"], (array)
$_POST[
"chb_scoring_adjustment"]))
285 array_push($scoring_types,
$row[
"question_type_id"]);
288 $this->
object->setScoringAdjustableQuestions($scoring_types);
290 if( !
$_POST[
'ass_process_lock'] )
296 $this->
object->setAssessmentProcessLockMode(
$_POST[
'ass_process_lock_mode']);
299 $assessmentSetting =
new ilSetting(
'assessment');
300 $assessmentSetting->set(
'use_javascript',
'1');
301 if(strlen(
$_POST[
'imap_line_color']) == 6)
309 $this->ctrl->redirect($this,
'settings');
317 $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']);
318 $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']);
328 $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']);
329 $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']);
335 $this->lng->txt(
"assessment_log_datetime"),
336 $this->lng->txt(
"user"),
337 $this->lng->txt(
"assessment_log_text"),
338 $this->lng->txt(
"question")
340 include_once
"./Modules/Test/classes/class.ilObjTest.php";
341 include_once
"./Modules/TestQuestionPool/classes/class.assQuestion.php";
344 $log_output =& $this->
object->getLog($from, $until,
$test);
346 foreach ($log_output as $key =>
$log)
348 if (!array_key_exists(
$log[
"user_fi"], $users))
353 if (
$log[
"question_fi"] ||
$log[
"original_fi"])
356 if (strlen($title) == 0)
360 $title = $this->lng->txt(
"assessment_log_question") .
": " . $title;
365 array_push($csvrow, trim($users[
$log[
"user_fi"]][
"title"] .
" " . $users[
$log[
"user_fi"]][
"firstname"] .
" " . $users[
$log[
"user_fi"]][
"lastname"]));
366 array_push($csvrow, trim($log[
"logtext"]));
367 array_push($csvrow, $title);
371 foreach ($csv as
$row)
375 ilUtil::deliverData($csvoutput, str_replace(
" ",
"_",
"log_" . $from .
"_" . $until .
"_" . $available_tests[
$test]).
".csv");
381 public function logsObject($p_from = null, $p_until = null, $p_test = null)
384 $ilTabs->activateTab(
'logs');
386 $template =
new ilTemplate(
"tpl.assessment_logs.html", TRUE, TRUE,
"Modules/Test");
388 include_once
"./Modules/Test/classes/class.ilObjTest.php";
389 include_once
"./Modules/TestQuestionPool/classes/class.assQuestion.php";
391 if (count($available_tests) == 0)
397 include_once(
"./Services/Form/classes/class.ilPropertyFormGUI.php");
399 $form->setFormAction($this->ctrl->getFormAction($this));
400 $form->setTableWidth(
"100%");
401 $form->setId(
"logs");
404 $header->setTitle($this->lng->txt(
"assessment_log"));
405 $form->addItem($header);
411 $fromdate = ($p_from) ? $p_from : ((
$_GET[
'log_from']) ?
$_GET[
'log_from'] : mktime(0, 0, 0, 1, 1, $now[
'year']));
413 $form->addItem($from);
418 $untildate = ($p_until) ? $p_until : ((
$_GET[
'log_until']) ?
$_GET[
'log_until'] : time());
420 $form->addItem($until);
423 $fortest =
new ilSelectInputGUI($this->lng->txt(
'assessment_log_for_test'),
"sel_test");
424 $sorted_options = array();
425 foreach($available_tests as $key => $value)
427 $sorted_options[] = array(
428 'title' =>
ilUtil::prepareFormOutput($value) .
" [" . $this->object->getNrOfLogEntries($key) .
" " . $this->lng->txt(
"assessment_log_log_entries") .
"]",
434 foreach($sorted_options as $option)
436 $options[$option[
'key']] = $option[
'title'];
439 $p_test = ($p_test) ? $p_test :
$_GET[
'sel_test'];
440 if ($p_test) $fortest->setValue($p_test);
441 $form->addItem($fortest);
442 $this->ctrl->setParameter($this,
'sel_test', $p_test);
443 $this->ctrl->setParameter($this,
'log_until', $untildate);
444 $this->ctrl->setParameter($this,
'log_from', $fromdate);
445 $form->addCommandButton(
"showLog", $this->lng->txt(
"show"));
446 $form->addCommandButton(
"exportLog", $this->lng->txt(
"export"));
447 $template->setVariable(
"FORM", $form->getHTML());
451 include_once
"./Modules/Test/classes/tables/class.ilAssessmentFolderLogTableGUI.php";
453 $log_output =& $this->
object->getLog($fromdate, $untildate, $p_test);
454 $table_gui->setData($log_output);
455 $template->setVariable(
'LOG', $table_gui->getHTML());
457 $this->tpl->setVariable(
"ADM_CONTENT", $template->get());
465 if (is_array(
$_POST[
"chb_test"]) && (count(
$_POST[
"chb_test"])))
467 $this->
object->deleteLogEntries(
$_POST[
"chb_test"]);
482 global $ilAccess, $ilTabs;
484 $ilTabs->activateTab(
'logs');
486 $a_write_access = ($ilAccess->checkAccess(
"write",
"", $this->object->getRefId())) ?
true :
false;
488 include_once
"./Modules/Test/classes/tables/class.ilAssessmentFolderLogAdministrationTableGUI.php";
490 include_once
"./Modules/Test/classes/class.ilObjTest.php";
493 foreach ($available_tests as
$obj_id => $title)
495 $nr = $this->
object->getNrOfLogEntries(
$obj_id);
496 array_push(
$data, array(
"title" => $title,
"nr" => $nr,
"id" =>
$obj_id));
498 $table_gui->setData(
$data);
499 $this->tpl->setVariable(
'ADM_CONTENT', $table_gui->getHTML());
512 $ilTabs->addSubTabTarget(
"settings",
513 $this->ctrl->getLinkTarget($this,
"showLogSettings"),
514 array(
"saveLogSettings",
"showLogSettings")
518 $ilTabs->addSubTabTarget(
"ass_log_output",
519 $this->ctrl->getLinkTarget($this,
"logs"),
520 array(
"logs",
"showLog",
"exportLog")
524 $ilTabs->addSubTabTarget(
"ass_log_admin",
525 $this->ctrl->getLinkTarget($this,
"logAdmin"),
526 array(
"logAdmin",
"deleteLog"),
538 global $rbacsystem,
$lng;
540 switch ($this->ctrl->getCmd())
542 case "saveLogSettings":
543 case "showLogSettings":
553 if ($rbacsystem->checkAccess(
"visible,read",$this->object->getRefId()))
555 $tabs_gui->addTarget(
"settings",
556 $this->ctrl->getLinkTarget($this,
"settings"), array(
"settings",
"",
"view"),
"",
"");
558 $tabs_gui->addTarget(
"logs",
559 $this->ctrl->getLinkTarget($this,
"showLogSettings"),
560 array(
'saveLogSettings',
'showLogSettings',
"logs",
"showLog",
"exportLog",
"logAdmin",
"deleteLog"),
563 $tabs_gui->addTab(
"templates",
564 $lng->txt(
"adm_settings_templates"),
565 $this->ctrl->getLinkTargetByClass(
"ilsettingstemplategui",
""));
568 if ($rbacsystem->checkAccess(
"write",$this->object->getRefId()))
570 $tabs_gui->addTarget(
'units', $this->ctrl->getLinkTargetByClass(
'ilGlobalUnitConfigurationGUI',
''),
'',
'ilglobalunitconfigurationgui');
573 if ($rbacsystem->checkAccess(
'edit_permission',$this->object->getRefId()))
575 $tabs_gui->addTarget(
"perm_settings",
576 $this->ctrl->getLinkTargetByClass(array(get_class($this),
'ilpermissiongui'),
"perm"), array(
"perm",
"info",
"owner"),
'ilpermissiongui');
585 $this->tabs_gui->activateTab(
'logs');
589 $form = $this->getLogSettingsForm();
590 $form->setValuesByArray(array(
591 'chb_assessment_logging' => $this->object->_enabledAssessmentLogging(),
592 'reporting_language' => $this->
object->_getLogLanguage()
596 $this->tpl->setContent($form->getHTML());
602 protected function saveLogSettingsObject()
609 if(!$ilAccess->checkAccess(
'write',
'', $this->object->getRefId()))
611 $this->ilias->raiseError($this->lng->txt(
"permission_denied"),$this->ilias->error_obj->WARNING);
614 $form = $this->getLogSettingsForm();
615 if($form->checkInput())
617 $this->
object->_enableAssessmentLogging((
int)$form->getInput(
'chb_assessment_logging'));
618 $this->
object->_setLogLanguage($form->getInput(
'reporting_language'));
619 $this->
object->update();
623 $form->setValuesByPost();
630 protected function getLogSettingsForm()
637 require_once
'Services/Form/classes/class.ilPropertyFormGUI.php';
639 $form->setFormAction($this->ctrl->getFormAction($this,
'saveLogSettings'));
640 $form->setTitle($this->lng->txt(
'assessment_log_logging'));
643 $logging->setValue(1);
644 $logging->setOptionTitle($this->lng->txt(
'activate_assessment_logging'));
645 $form->addItem($logging);
647 $reporting =
new ilSelectInputGUI($this->lng->txt(
'assessment_settings_reporting_language'),
'reporting_language');
648 $languages = $this->lng->getInstalledLanguages();
649 $this->lng->loadLanguageModule(
'meta');
651 foreach($languages as
$lang)
656 $form->addItem($reporting);
658 if($ilAccess->checkAccess(
'write',
'', $this->object->getRefId()))
660 $form->addCommandButton(
'saveLogSettings', $this->lng->txt(
'save'));
670 $ilTabs->setTabActive(
'templates');
672 require_once
'Services/Administration/classes/class.ilSettingsTemplateGUI.php';
675 $this->ctrl->forwardCommand($gui);
685 require_once
'Modules/Test/classes/class.ilTestSettingsTemplateConfig.php';