24 include_once
"./classes/class.ilObjectGUI.php";
49 $this->
ilObjectGUI($a_data,$a_id,$a_call_by_reference,
false);
51 if (!$rbacsystem->checkAccess(
'read',$this->object->getRefId()))
53 $this->ilias->raiseError($this->lng->txt(
"msg_no_perm_read_assf"),$this->ilias->error_obj->WARNING);
59 $next_class = $this->ctrl->getNextClass($this);
60 $cmd = $this->ctrl->getCmd();
65 case 'ilpermissiongui':
66 include_once(
"Services/AccessControl/classes/class.ilPermissionGUI.php");
68 $ret =& $this->ctrl->forwardCommand($perm_gui);
101 $this->ctrl->redirect($this);
112 include_once
"./Modules/TestQuestionPool/classes/class.ilObjQuestionPool.php";
113 include_once(
"./Services/Form/classes/class.ilPropertyFormGUI.php");
115 $form->setFormAction($this->ctrl->getFormAction($this));
116 $form->setTableWidth(
"100%");
117 $form->setId(
"settings");
121 $header->setTitle($this->lng->txt(
"assessment_log_logging"));
122 $form->addItem($header);
126 $logging->setValue(1);
127 $logging->setChecked($this->object->_enabledAssessmentLogging());
128 $logging->setOptionTitle($this->lng->txt(
"activate_assessment_logging"));
129 $form->addItem($logging);
132 $reporting =
new ilSelectInputGUI($this->lng->txt(
'assessment_settings_reporting_language'),
"reporting_language");
133 $languages = $this->lng->getInstalledLanguages();
135 foreach ($languages as
$lang)
137 $options[
$lang] = $this->lng->txt(
"lang_" . $lang);
139 $reporting->setOptions($options);
140 $reporting->setValue($this->object->_getLogLanguage());
141 $form->addItem($reporting);
145 $header->setTitle($this->lng->txt(
"assf_questiontypes"));
146 $form->addItem($header);
149 $allowed =
new ilCheckboxGroupInputGUI($this->lng->txt(
'assf_allowed_questiontypes'),
"chb_allowed_questiontypes");
151 $forbidden_types = $this->
object->_getForbiddenQuestionTypes();
152 $allowedtypes = array();
153 foreach ($questiontypes as $qt)
155 if (!in_array($qt[
'question_type_id'], $forbidden_types)) array_push($allowedtypes, $qt[
'question_type_id']);
157 $allowed->setValue($allowedtypes);
158 foreach ($questiontypes as $type_name => $qtype)
160 $allowed->addOption(
new ilCheckboxOption($type_name, $qtype[
"question_type_id"]));
162 $allowed->setInfo($this->lng->txt(
'assf_allowed_questiontypes_desc'));
163 $form->addItem($allowed);
166 $manual =
new ilCheckboxGroupInputGUI($this->lng->txt(
'assessment_log_manual_scoring_activate'),
"chb_manual_scoring");
167 $manscoring = $this->
object->_getManualScoring();
169 foreach ($questiontypes as $type_name => $qtype)
171 $manual->addOption(
new ilCheckboxOption($type_name, $qtype[
"question_type_id"]));
173 $manual->setInfo($this->lng->txt(
'assessment_log_manual_scoring_desc'));
174 $form->addItem($manual);
176 if ($ilAccess->checkAccess(
"write",
"", $this->object->getRefId()))
178 $form->addCommandButton(
"saveSettings", $this->lng->txt(
"save"));
180 $this->tpl->setVariable(
"ADM_CONTENT", $form->getHTML());
189 if (!$ilAccess->checkAccess(
"write",
"", $this->object->getRefId())) $this->ctrl->redirect($this,
'settings');
191 if (
$_POST[
"chb_assessment_logging"] == 1)
193 $this->
object->_enableAssessmentLogging(1);
197 $this->
object->_enableAssessmentLogging(0);
199 $this->
object->_setLogLanguage(
$_POST[
"reporting_language"]);
200 $this->
object->_setManualScoring(
$_POST[
"chb_manual_scoring"]);
201 include_once
"./Modules/TestQuestionPool/classes/class.ilObjQuestionPool.php";
203 $forbidden_types = array();
204 foreach ($questiontypes as
$name =>
$row)
206 if (!in_array(
$row[
"question_type_id"],
$_POST[
"chb_allowed_questiontypes"]))
208 array_push($forbidden_types,
$row[
"question_type_id"]);
211 $this->
object->_setForbiddenQuestionTypes($forbidden_types);
214 $this->ctrl->redirect($this,
'settings');
222 $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']);
223 $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']);
233 $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']);
234 $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']);
240 $this->lng->txt(
"assessment_log_datetime"),
241 $this->lng->txt(
"user"),
242 $this->lng->txt(
"assessment_log_text"),
243 $this->lng->txt(
"question")
245 include_once
"./Modules/Test/classes/class.ilObjTest.php";
246 include_once
"./Modules/TestQuestionPool/classes/class.assQuestion.php";
249 $log_output =& $this->
object->getLog($from, $until,
$test);
251 foreach ($log_output as $key =>
$log)
253 if (!array_key_exists(
$log[
"user_fi"], $users))
258 if (
$log[
"question_fi"] ||
$log[
"original_fi"])
265 $title = $this->lng->txt(
"assessment_log_question") .
": " .
$title;
270 array_push($csvrow, trim($users[
$log[
"user_fi"]][
"title"] .
" " . $users[
$log[
"user_fi"]][
"firstname"] .
" " . $users[
$log[
"user_fi"]][
"lastname"]));
271 array_push($csvrow, trim($log[
"logtext"]));
272 array_push($csvrow,
$title);
276 foreach ($csv as
$row)
280 ilUtil::deliverData($csvoutput, str_replace(
" ",
"_",
"log_" . $from .
"_" . $until .
"_" . $available_tests[
$test]).
".csv");
286 public function logsObject($p_from = null, $p_until = null, $p_test = null)
288 $template =
new ilTemplate(
"tpl.assessment_logs.html", TRUE, TRUE,
"Modules/Test");
290 include_once
"./Modules/Test/classes/class.ilObjTest.php";
291 include_once
"./Modules/TestQuestionPool/classes/class.assQuestion.php";
293 if (count($available_tests) == 0)
299 include_once(
"./Services/Form/classes/class.ilPropertyFormGUI.php");
301 $form->setFormAction($this->ctrl->getFormAction($this));
302 $form->setTableWidth(
"100%");
303 $form->setId(
"logs");
306 $header->setTitle($this->lng->txt(
"assessment_log"));
307 $form->addItem($header);
312 $from->setShowTime(
true);
314 $fromdate = ($p_from) ? $p_from : ((
$_GET[
'log_from']) ?
$_GET[
'log_from'] : mktime(0, 0, 0, 1, 1, $now[
'year']));
316 $form->addItem($from);
321 $until->setShowTime(
true);
322 $untildate = ($p_until) ? $p_until : ((
$_GET[
'log_until']) ?
$_GET[
'log_until'] : time());
324 $form->addItem($until);
327 $fortest =
new ilSelectInputGUI($this->lng->txt(
'assessment_log_for_test'),
"sel_test");
329 foreach ($available_tests as $key => $value)
331 $options[$key] =
ilUtil::prepareFormOutput($value) .
" [" . $this->
object->getNrOfLogEntries($key) .
" " . $this->lng->txt(
"assessment_log_log_entries") .
"]";
333 $fortest->setOptions($options);
334 $p_test = ($p_test) ? $p_test :
$_GET[
'sel_test'];
335 if ($p_test) $fortest->setValue($p_test);
336 $form->addItem($fortest);
337 $this->ctrl->setParameter($this,
'sel_test', $p_test);
338 $this->ctrl->setParameter($this,
'log_until', $untildate);
339 $this->ctrl->setParameter($this,
'log_from', $fromdate);
340 $form->addCommandButton(
"showLog", $this->lng->txt(
"show"));
341 $form->addCommandButton(
"exportLog", $this->lng->txt(
"export"));
342 $template->setVariable(
"FORM", $form->getHTML());
346 include_once
"./Modules/Test/classes/tables/class.ilAssessmentFolderLogTableGUI.php";
348 $log_output =& $this->
object->getLog($fromdate, $untildate, $p_test);
349 $table_gui->setData($log_output);
350 $template->setVariable(
'LOG', $table_gui->getHTML());
352 $this->tpl->setVariable(
"ADM_CONTENT", $template->get());
360 if (is_array(
$_POST[
"chb_test"]) && (count(
$_POST[
"chb_test"])))
362 $this->
object->deleteLogEntries(
$_POST[
"chb_test"]);
378 $a_write_access = ($ilAccess->checkAccess(
"write",
"", $this->object->getRefId())) ?
true :
false;
380 include_once
"./Modules/Test/classes/tables/class.ilAssessmentFolderLogAdministrationTableGUI.php";
382 include_once
"./Modules/Test/classes/class.ilObjTest.php";
387 $nr = $this->
object->getNrOfLogEntries(
$obj_id);
390 $table_gui->setData(
$data);
391 $this->tpl->setVariable(
'ADM_CONTENT', $table_gui->getHTML());
404 $ilTabs->addSubTabTarget(
"ass_log_output",
405 $this->ctrl->getLinkTarget($this,
"logs"),
406 array(
"logs",
"showLog",
"exportLog")
410 $ilTabs->addSubTabTarget(
"ass_log_admin",
411 $this->ctrl->getLinkTarget($this,
"logAdmin"),
412 array(
"logAdmin",
"deleteLog"),
424 $assessmentSetting =
new ilSetting(
"assessment");
425 $user_criteria = array_key_exists(
"user_criteria",
$_GET) ?
$_GET[
"user_criteria"] : $assessmentSetting->get(
"user_criteria");
426 if (strlen($user_criteria) == 0) $user_criteria =
'usr_id';
427 $use_javascript = array_key_exists(
"use_javascript",
$_GET) ?
$_GET[
"use_javascript"] : $assessmentSetting->get(
"use_javascript");
428 $imap_line_color = array_key_exists(
"imap_line_color",
$_GET) ?
$_GET[
"imap_line_color"] : $assessmentSetting->get(
"imap_line_color");
429 if (strlen($imap_line_color) == 0) $imap_line_color =
"FF0000";
431 include_once(
"./Services/Form/classes/class.ilPropertyFormGUI.php");
433 $form->setFormAction($ilCtrl->getFormAction($this));
434 $form->setTitle($lng->txt(
"assessment_defaults"));
437 $enable =
new ilCheckboxInputGUI($lng->txt(
"assessment_use_javascript"),
"use_javascript");
439 $enable->setInfo($lng->txt(
"assessment_use_javascript_desc"));
440 $form->addItem($enable);
443 $linepicker->
setValue($imap_line_color);
444 $form->addItem($linepicker);
446 $userCriteria =
new ilSelectInputGUI($this->lng->txt(
"user_criteria"),
"user_criteria");
447 $userCriteria->
setInfo($this->lng->txt(
"user_criteria_desc"));
448 $userCriteria->setRequired(
true);
449 $userCriteria->setValue(($isSingleline) ? 0 : 1);
451 $manager = $ilDB->db->loadModule(
'Manager');
452 $fields = $manager->listTableFields(
'usr_data');
453 $usr_fields = array();
454 foreach ($fields as $field)
456 $usr_fields[$field] = $field;
458 $userCriteria->setOptions($usr_fields);
459 $userCriteria->setValue($user_criteria);
460 $form->addItem($userCriteria);
462 if ($ilAccess->checkAccess(
"write",
"", $this->object->getRefId()))
464 $form->addCommandButton(
"saveDefaults", $lng->txt(
"save"));
468 $tpl->setVariable(
"ADM_CONTENT", $form->getHTML());
478 $assessmentSetting =
new ilSetting(
"assessment");
479 if (
$_POST[
"use_javascript"])
481 $assessmentSetting->set(
"use_javascript",
"1");
485 $assessmentSetting->set(
"use_javascript",
"0");
487 if (strlen(
$_POST[
"imap_line_color"]) == 6)
489 $assessmentSetting->set(
"imap_line_color",
$_POST[
"imap_line_color"]);
491 $assessmentSetting->set(
"user_criteria",
$_POST[
"user_criteria"]);
493 $ilCtrl->redirect($this,
"defaults");
506 switch ($this->ctrl->getCmd())
517 if ($rbacsystem->checkAccess(
"visible,read",$this->object->getRefId()))
519 $tabs_gui->addTarget(
"settings",
520 $this->ctrl->getLinkTarget($this,
"settings"), array(
"settings",
"",
"view"),
"",
"");
522 $tabs_gui->addTarget(
"logs",
523 $this->ctrl->getLinkTarget($this,
"logs"),
524 array(
"logs",
"showLog",
"exportLog",
"logAdmin",
"deleteLog"),
527 $tabs_gui->addTarget(
"defaults",
528 $this->ctrl->getLinkTarget($this,
"defaults"), array(
"defaults",
"saveDefaults"),
"",
"");
531 if ($rbacsystem->checkAccess(
'edit_permission',$this->object->getRefId()))
533 $tabs_gui->addTarget(
"perm_settings",
534 $this->ctrl->getLinkTargetByClass(array(get_class($this),
'ilpermissiongui'),
"perm"), array(
"perm",
"info",
"owner"),
'ilpermissiongui');