4 require_once
"./Services/Object/classes/class.ilObject.php";
5 require_once
'Modules/TestQuestionPool/classes/class.ilAssQuestionProcessLocker.php';
36 include_once
"./Services/Administration/classes/class.ilSetting.php";
37 $this->setting =
new ilSetting(
"assessment");
39 $this->
ilObject($a_id,$a_call_by_reference);
50 if (!parent::update())
70 if (!parent::delete())
108 function notify($a_event,$a_ref_id,$a_parent_non_rbac_id,$a_node_id,$a_params = 0)
148 if ($a_node_id==
$_GET[
"ref_id"])
150 $parent_obj =& $this->ilias->obj_factory->getInstanceByRefId($a_node_id);
151 $parent_type = $parent_obj->getType();
152 if($parent_type == $this->
getType())
154 $a_node_id = (int) $tree->getParentId($a_node_id);
158 parent::notify($a_event,$a_ref_id,$a_parent_non_rbac_id,$a_node_id,$a_params);
170 $setting->set(
"assessment_logging", 1);
174 $setting->set(
"assessment_logging", 0);
185 $setting->set(
"assessment_log_language", $a_language);
195 return (
boolean)
$setting->get(
"assessment_logging");
204 $types =
$setting->get(
"forbidden_questiontypes");
206 if (strlen(trim($types)) == 0)
226 if (is_array($a_types) && (count($a_types) > 0))
228 $types = serialize($a_types);
230 $setting->set(
"forbidden_questiontypes", $types);
241 if (strlen(
$lang) == 0)
259 if( count(self::_getManualScoring()) > 0 )
274 $types =
$setting->get(
"assessment_manual_scoring");
275 return explode(
",", $types);
285 $result = $ilDB->query(
"SELECT * FROM qpl_qst_type");
289 $dbtypes[
$row[
"question_type_id"]] = $row[
"type_tag"];
292 $types =
$setting->get(
"assessment_manual_scoring");
293 $ids = explode(
",", $types);
294 foreach ($ids as $key => $value)
296 $ids[$key] = $dbtypes[$value];
309 if ((!is_array($type_ids)) || (count($type_ids) == 0))
311 $setting->delete(
"assessment_manual_scoring");
315 $setting->set(
"assessment_manual_scoring", implode($type_ids,
","));
323 $types =
$setting->get(
"assessment_scoring_adjustment");
324 return explode(
",", $types);
330 if ((!is_array($type_ids)) || (count($type_ids) == 0))
332 $setting->delete(
"assessment_scoring_adjustment");
336 $setting->set(
"assessment_scoring_adjustment", implode($type_ids,
","));
343 return $setting->get(
'assessment_adjustments_enabled');
349 $setting->set(
'assessment_adjustments_enabled', (
bool) $active);
362 function _addLog($user_id, $object_id, $logtext, $question_id =
"", $original_id =
"", $test_only = FALSE, $test_ref_id = NULL)
365 if (strlen($question_id) == 0) $question_id = NULL;
366 if (strlen($original_id) == 0) $original_id = NULL;
367 if (strlen($test_ref_id) == 0) $test_ref_id = NULL;
368 $only = ($test_only == TRUE) ? 1 : 0;
369 $next_id = $ilDB->nextId(
'ass_log');
370 $affectedRows = $ilDB->manipulateF(
"INSERT INTO ass_log (ass_log_id, user_fi, obj_fi, logtext, question_fi, original_fi, test_only, ref_id, tstamp) VALUES (%s, %s, %s, %s, %s, %s, %s, %s, %s)",
371 array(
'integer',
'integer',
'integer',
'text',
'integer',
'integer',
'text',
'integer',
'integer'),
394 function &
getLog($ts_from, $ts_to, $test_id, $test_only = FALSE)
399 if ($test_only == TRUE)
401 $result = $ilDB->queryF(
"SELECT * FROM ass_log WHERE obj_fi = %s AND tstamp > %s AND tstamp < %s AND test_only = %s ORDER BY tstamp",
402 array(
'integer',
'integer',
'integer',
'text'),
413 $result = $ilDB->queryF(
"SELECT * FROM ass_log WHERE obj_fi = %s AND tstamp > %s AND tstamp < %s ORDER BY tstamp",
414 array(
'integer',
'integer',
'integer'),
424 if (!array_key_exists(
$row[
"tstamp"],
$log))
428 array_push(
$log[
$row[
"tstamp"]], $row);
432 $log_array = array();
433 foreach (
$log as $key => $value)
435 foreach ($value as $index =>
$row)
437 array_push($log_array,
$row);
451 function &
_getLog($ts_from, $ts_to, $test_id, $test_only = FALSE)
456 if ($test_only == TRUE)
458 $result = $ilDB->queryF(
"SELECT * FROM ass_log WHERE obj_fi = %s AND tstamp > %s AND tstamp < %s AND test_only = %s ORDER BY tstamp",
459 array(
'integer',
'integer',
'integer',
'text'),
460 array($test_id, $ts_from, $ts_to, 1)
465 $result = $ilDB->queryF(
"SELECT * FROM ass_log WHERE obj_fi = %s AND tstamp > %s AND tstamp < %s ORDER BY tstamp",
466 array(
'integer',
'integer',
'integer'),
467 array($test_id, $ts_from, $ts_to)
472 if (!array_key_exists(
$row[
"tstamp"],
$log))
477 if (array_key_exists(
"ref_id",
$row))
479 if (
$row[
"ref_id"] > 0)
485 $type_href = sprintf(
"goto.php?target=tst_%s&client_id=" . CLIENT_ID,
$row[
"ref_id"]);
488 $type_href = sprintf(
"goto.php?target=cat_%s&client_id=" . CLIENT_ID,
$row[
"ref_id"]);
493 $row[
"href"] = $type_href;
494 array_push(
$log[
$row[
"tstamp"]], $row);
498 $log_array = array();
499 foreach (
$log as $key => $value)
501 foreach ($value as $index =>
$row)
503 array_push($log_array,
$row);
518 $result = $ilDB->queryF(
"SELECT COUNT(obj_fi) logcount FROM ass_log WHERE obj_fi = %s",
525 return $row[
"logcount"];
543 $pathelements = array();
552 array_push($pathelements,
"<a href=\"./goto.php?target=" . $data[
"type"] .
"_" . $data[
"ref_id"] .
"&client=" . CLIENT_ID .
"\">" .
556 return implode(
" > ", $pathelements);
569 foreach ($a_array as $object_id)
571 $affectedRows = $ilDB->manipulateF(
"DELETE FROM ass_log WHERE obj_fi = %s",
575 $this->
_addLog($ilUser->getId(), $object_id, $this->lng->txt(
"assessment_log_deleted"));
587 require_once
'Modules/TestQuestionPool/classes/class.assQuestion.php';
591 $isPageEditorEnabled = $ilSetting->get(
592 'enable_tst_page_edit', self::ADDITIONAL_QUESTION_CONTENT_EDITING_MODE_PAGE_OBJECT_DISABLED
595 return $isPageEditorEnabled;
600 return $this->setting->get(
'ass_process_lock_mode', self::ASS_PROC_LOCK_MODE_NONE);
605 $this->setting->set(
'ass_process_lock_mode', $lockMode);
610 return array(self::ASS_PROC_LOCK_MODE_NONE, self::ASS_PROC_LOCK_MODE_FILE, self::ASS_PROC_LOCK_MODE_DB);