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);
107 $this->ctrl->redirect($this);
118 include_once
"./Modules/TestQuestionPool/classes/class.ilObjQuestionPool.php";
119 include_once(
"./Services/Form/classes/class.ilPropertyFormGUI.php");
121 $form->setFormAction($this->ctrl->getFormAction($this));
122 $form->setTableWidth(
"100%");
123 $form->setId(
"settings");
127 $header->setTitle($this->lng->txt(
"assessment_log_logging"));
128 $form->addItem($header);
132 $logging->setValue(1);
133 $logging->setChecked($this->object->_enabledAssessmentLogging());
134 $logging->setOptionTitle($this->lng->txt(
"activate_assessment_logging"));
135 $form->addItem($logging);
138 $reporting =
new ilSelectInputGUI($this->lng->txt(
'assessment_settings_reporting_language'),
"reporting_language");
139 $languages = $this->lng->getInstalledLanguages();
141 foreach ($languages as
$lang)
143 $options[
$lang] = $this->lng->txt(
"lang_" . $lang);
145 $reporting->setOptions($options);
146 $reporting->setValue($this->object->_getLogLanguage());
147 $form->addItem($reporting);
151 $header->setTitle($this->lng->txt(
"assf_questiontypes"));
152 $form->addItem($header);
155 $allowed =
new ilCheckboxGroupInputGUI($this->lng->txt(
'assf_allowed_questiontypes'),
"chb_allowed_questiontypes");
157 $forbidden_types = $this->
object->_getForbiddenQuestionTypes();
158 $allowedtypes = array();
159 foreach ($questiontypes as $qt)
161 if (!in_array($qt[
'question_type_id'], $forbidden_types)) array_push($allowedtypes, $qt[
'question_type_id']);
163 $allowed->setValue($allowedtypes);
164 foreach ($questiontypes as $type_name => $qtype)
166 $allowed->addOption(
new ilCheckboxOption($type_name, $qtype[
"question_type_id"]));
168 $allowed->setInfo($this->lng->txt(
'assf_allowed_questiontypes_desc'));
169 $form->addItem($allowed);
172 $manual =
new ilCheckboxGroupInputGUI($this->lng->txt(
'assessment_log_manual_scoring_activate'),
"chb_manual_scoring");
173 $manscoring = $this->
object->_getManualScoring();
175 foreach ($questiontypes as $type_name => $qtype)
177 $manual->addOption(
new ilCheckboxOption($type_name, $qtype[
"question_type_id"]));
179 $manual->setInfo($this->lng->txt(
'assessment_log_manual_scoring_desc'));
180 $form->addItem($manual);
182 if ($ilAccess->checkAccess(
"write",
"", $this->object->getRefId()))
184 $form->addCommandButton(
"saveSettings", $this->lng->txt(
"save"));
186 $this->tpl->setVariable(
"ADM_CONTENT", $form->getHTML());
195 if (!$ilAccess->checkAccess(
"write",
"", $this->object->getRefId())) $this->ctrl->redirect($this,
'settings');
197 if (
$_POST[
"chb_assessment_logging"] == 1)
199 $this->
object->_enableAssessmentLogging(1);
203 $this->
object->_enableAssessmentLogging(0);
205 $this->
object->_setLogLanguage(
$_POST[
"reporting_language"]);
206 $this->
object->_setManualScoring(
$_POST[
"chb_manual_scoring"]);
207 include_once
"./Modules/TestQuestionPool/classes/class.ilObjQuestionPool.php";
209 $forbidden_types = array();
210 foreach ($questiontypes as
$name =>
$row)
212 if (!in_array(
$row[
"question_type_id"],
$_POST[
"chb_allowed_questiontypes"]))
214 array_push($forbidden_types,
$row[
"question_type_id"]);
217 $this->
object->_setForbiddenQuestionTypes($forbidden_types);
220 $this->ctrl->redirect($this,
'settings');
228 $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']);
229 $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']);
239 $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']);
240 $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']);
246 $this->lng->txt(
"assessment_log_datetime"),
247 $this->lng->txt(
"user"),
248 $this->lng->txt(
"assessment_log_text"),
249 $this->lng->txt(
"question")
251 include_once
"./Modules/Test/classes/class.ilObjTest.php";
252 include_once
"./Modules/TestQuestionPool/classes/class.assQuestion.php";
255 $log_output =& $this->
object->getLog($from, $until,
$test);
257 foreach ($log_output as
$key =>
$log)
259 if (!array_key_exists(
$log[
"user_fi"], $users))
264 if (
$log[
"question_fi"] ||
$log[
"original_fi"])
271 $title = $this->lng->txt(
"assessment_log_question") .
": " .
$title;
276 array_push($csvrow, trim($users[
$log[
"user_fi"]][
"title"] .
" " . $users[
$log[
"user_fi"]][
"firstname"] .
" " . $users[
$log[
"user_fi"]][
"lastname"]));
277 array_push($csvrow, trim($log[
"logtext"]));
278 array_push($csvrow,
$title);
282 foreach ($csv as
$row)
286 ilUtil::deliverData($csvoutput, str_replace(
" ",
"_",
"log_" . $from .
"_" . $until .
"_" . $available_tests[
$test]).
".csv");
292 public function logsObject($p_from = null, $p_until = null, $p_test = null)
294 $template =
new ilTemplate(
"tpl.assessment_logs.html", TRUE, TRUE,
"Modules/Test");
296 include_once
"./Modules/Test/classes/class.ilObjTest.php";
297 include_once
"./Modules/TestQuestionPool/classes/class.assQuestion.php";
299 if (count($available_tests) == 0)
305 include_once(
"./Services/Form/classes/class.ilPropertyFormGUI.php");
307 $form->setFormAction($this->ctrl->getFormAction($this));
308 $form->setTableWidth(
"100%");
309 $form->setId(
"logs");
312 $header->setTitle($this->lng->txt(
"assessment_log"));
313 $form->addItem($header);
318 $from->setShowTime(
true);
320 $fromdate = ($p_from) ? $p_from : ((
$_GET[
'log_from']) ?
$_GET[
'log_from'] : mktime(0, 0, 0, 1, 1, $now[
'year']));
322 $form->addItem($from);
327 $until->setShowTime(
true);
328 $untildate = ($p_until) ? $p_until : ((
$_GET[
'log_until']) ?
$_GET[
'log_until'] : time());
330 $form->addItem($until);
333 $fortest =
new ilSelectInputGUI($this->lng->txt(
'assessment_log_for_test'),
"sel_test");
335 foreach ($available_tests as
$key => $value)
339 $fortest->setOptions($options);
340 $p_test = ($p_test) ? $p_test :
$_GET[
'sel_test'];
341 if ($p_test) $fortest->setValue($p_test);
342 $form->addItem($fortest);
343 $this->ctrl->setParameter($this,
'sel_test', $p_test);
344 $this->ctrl->setParameter($this,
'log_until', $untildate);
345 $this->ctrl->setParameter($this,
'log_from', $fromdate);
346 $form->addCommandButton(
"showLog", $this->lng->txt(
"show"));
347 $form->addCommandButton(
"exportLog", $this->lng->txt(
"export"));
348 $template->setVariable(
"FORM", $form->getHTML());
352 include_once
"./Modules/Test/classes/tables/class.ilAssessmentFolderLogTableGUI.php";
354 $log_output =& $this->
object->getLog($fromdate, $untildate, $p_test);
355 $table_gui->setData($log_output);
356 $template->setVariable(
'LOG', $table_gui->getHTML());
358 $this->tpl->setVariable(
"ADM_CONTENT", $template->get());
366 if (is_array(
$_POST[
"chb_test"]) && (count(
$_POST[
"chb_test"])))
368 $this->
object->deleteLogEntries(
$_POST[
"chb_test"]);
384 $a_write_access = ($ilAccess->checkAccess(
"write",
"", $this->object->getRefId())) ?
true :
false;
386 include_once
"./Modules/Test/classes/tables/class.ilAssessmentFolderLogAdministrationTableGUI.php";
388 include_once
"./Modules/Test/classes/class.ilObjTest.php";
393 $nr = $this->
object->getNrOfLogEntries(
$obj_id);
396 $table_gui->setData(
$data);
397 $this->tpl->setVariable(
'ADM_CONTENT', $table_gui->getHTML());
410 $ilTabs->addSubTabTarget(
"ass_log_output",
411 $this->ctrl->getLinkTarget($this,
"logs"),
412 array(
"logs",
"showLog",
"exportLog")
416 $ilTabs->addSubTabTarget(
"ass_log_admin",
417 $this->ctrl->getLinkTarget($this,
"logAdmin"),
418 array(
"logAdmin",
"deleteLog"),
430 $assessmentSetting =
new ilSetting(
"assessment");
431 $use_javascript = array_key_exists(
"use_javascript",
$_GET) ?
$_GET[
"use_javascript"] : $assessmentSetting->get(
"use_javascript");
432 $imap_line_color = array_key_exists(
"imap_line_color",
$_GET) ?
$_GET[
"imap_line_color"] : $assessmentSetting->get(
"imap_line_color");
433 if (strlen($imap_line_color) == 0) $imap_line_color =
"FF0000";
435 include_once(
"./Services/Form/classes/class.ilPropertyFormGUI.php");
437 $form->setFormAction($ilCtrl->getFormAction($this));
438 $form->setTitle($lng->txt(
"assessment_defaults"));
441 $enable =
new ilCheckboxInputGUI($lng->txt(
"assessment_use_javascript"),
"use_javascript");
443 $enable->setInfo($lng->txt(
"assessment_use_javascript_desc"));
444 $form->addItem($enable);
447 $linepicker->
setValue($imap_line_color);
448 $form->addItem($linepicker);
450 if ($ilAccess->checkAccess(
"write",
"", $this->object->getRefId()))
452 $form->addCommandButton(
"saveDefaults", $lng->txt(
"save"));
456 $tpl->setVariable(
"ADM_CONTENT", $form->getHTML());
466 $assessmentSetting =
new ilSetting(
"assessment");
467 if (
$_POST[
"use_javascript"])
469 $assessmentSetting->set(
"use_javascript",
"1");
473 $assessmentSetting->set(
"use_javascript",
"0");
475 if (strlen(
$_POST[
"imap_line_color"]) == 6)
477 $assessmentSetting->set(
"imap_line_color",
$_POST[
"imap_line_color"]);
480 $ilCtrl->redirect($this,
"defaults");
493 switch ($this->ctrl->getCmd())
504 if ($rbacsystem->checkAccess(
"visible,read",$this->object->getRefId()))
506 $tabs_gui->addTarget(
"settings",
507 $this->ctrl->getLinkTarget($this,
"settings"), array(
"settings",
"",
"view"),
"",
"");
509 $tabs_gui->addTarget(
"logs",
510 $this->ctrl->getLinkTarget($this,
"logs"),
511 array(
"logs",
"showLog",
"exportLog",
"logAdmin",
"deleteLog"),
514 $tabs_gui->addTarget(
"defaults",
515 $this->ctrl->getLinkTarget($this,
"defaults"), array(
"defaults",
"saveDefaults"),
"",
"");
518 if ($rbacsystem->checkAccess(
'edit_permission',$this->object->getRefId()))
520 $tabs_gui->addTarget(
"perm_settings",
521 $this->ctrl->getLinkTargetByClass(array(get_class($this),
'ilpermissiongui'),
"perm"), array(
"perm",
"info",
"owner"),
'ilpermissiongui');