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())
94 function notify($a_event,$a_ref_id,$a_parent_non_rbac_id,$a_node_id,$a_params = 0)
134 if ($a_node_id==
$_GET[
"ref_id"])
136 $parent_obj =& $this->ilias->obj_factory->getInstanceByRefId($a_node_id);
137 $parent_type = $parent_obj->getType();
138 if($parent_type == $this->
getType())
140 $a_node_id = (int) $tree->getParentId($a_node_id);
144 parent::notify($a_event,$a_ref_id,$a_parent_non_rbac_id,$a_node_id,$a_params);
156 $setting->set(
"assessment_logging", 1);
160 $setting->set(
"assessment_logging", 0);
171 $setting->set(
"assessment_log_language", $a_language);
181 return (
boolean)
$setting->get(
"assessment_logging");
190 $types =
$setting->get(
"forbidden_questiontypes");
192 if (strlen(trim($types)) == 0)
212 if (is_array($a_types) && (count($a_types) > 0))
214 $types = serialize($a_types);
216 $setting->set(
"forbidden_questiontypes", $types);
227 if (strlen(
$lang) == 0)
245 if( count(self::_getManualScoring()) > 0 )
260 $types =
$setting->get(
"assessment_manual_scoring");
261 return explode(
",", $types);
271 $result = $ilDB->query(
"SELECT * FROM qpl_qst_type");
275 $dbtypes[
$row[
"question_type_id"]] = $row[
"type_tag"];
278 $types =
$setting->get(
"assessment_manual_scoring");
279 $ids = explode(
",", $types);
280 foreach ($ids as $key => $value)
282 $ids[$key] = $dbtypes[$value];
295 if ((!is_array($type_ids)) || (count($type_ids) == 0))
297 $setting->delete(
"assessment_manual_scoring");
301 $setting->set(
"assessment_manual_scoring", implode($type_ids,
","));
309 $types =
$setting->get(
"assessment_scoring_adjustment");
310 return explode(
",", $types);
316 if ((!is_array($type_ids)) || (count($type_ids) == 0))
318 $setting->delete(
"assessment_scoring_adjustment");
322 $setting->set(
"assessment_scoring_adjustment", implode($type_ids,
","));
329 return $setting->get(
'assessment_adjustments_enabled');
335 $setting->set(
'assessment_adjustments_enabled', (
bool) $active);
348 function _addLog($user_id, $object_id, $logtext, $question_id =
"", $original_id =
"", $test_only = FALSE, $test_ref_id = NULL)
351 if (strlen($question_id) == 0) $question_id = NULL;
352 if (strlen($original_id) == 0) $original_id = NULL;
353 if (strlen($test_ref_id) == 0) $test_ref_id = NULL;
354 $only = ($test_only == TRUE) ? 1 : 0;
355 $next_id = $ilDB->nextId(
'ass_log');
356 $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)",
357 array(
'integer',
'integer',
'integer',
'text',
'integer',
'integer',
'text',
'integer',
'integer'),
380 function &
getLog($ts_from, $ts_to, $test_id, $test_only = FALSE)
385 if ($test_only == TRUE)
387 $result = $ilDB->queryF(
"SELECT * FROM ass_log WHERE obj_fi = %s AND tstamp > %s AND tstamp < %s AND test_only = %s ORDER BY tstamp",
388 array(
'integer',
'integer',
'integer',
'text'),
399 $result = $ilDB->queryF(
"SELECT * FROM ass_log WHERE obj_fi = %s AND tstamp > %s AND tstamp < %s ORDER BY tstamp",
400 array(
'integer',
'integer',
'integer'),
410 if (!array_key_exists(
$row[
"tstamp"],
$log))
414 array_push(
$log[
$row[
"tstamp"]], $row);
418 $log_array = array();
419 foreach (
$log as $key => $value)
421 foreach ($value as $index =>
$row)
423 array_push($log_array,
$row);
437 function &
_getLog($ts_from, $ts_to, $test_id, $test_only = FALSE)
442 if ($test_only == TRUE)
444 $result = $ilDB->queryF(
"SELECT * FROM ass_log WHERE obj_fi = %s AND tstamp > %s AND tstamp < %s AND test_only = %s ORDER BY tstamp",
445 array(
'integer',
'integer',
'integer',
'text'),
446 array($test_id, $ts_from, $ts_to, 1)
451 $result = $ilDB->queryF(
"SELECT * FROM ass_log WHERE obj_fi = %s AND tstamp > %s AND tstamp < %s ORDER BY tstamp",
452 array(
'integer',
'integer',
'integer'),
453 array($test_id, $ts_from, $ts_to)
458 if (!array_key_exists(
$row[
"tstamp"],
$log))
463 if (array_key_exists(
"ref_id",
$row))
465 if (
$row[
"ref_id"] > 0)
471 $type_href = sprintf(
"goto.php?target=tst_%s&client_id=" . CLIENT_ID,
$row[
"ref_id"]);
474 $type_href = sprintf(
"goto.php?target=cat_%s&client_id=" . CLIENT_ID,
$row[
"ref_id"]);
479 $row[
"href"] = $type_href;
480 array_push(
$log[
$row[
"tstamp"]], $row);
484 $log_array = array();
485 foreach (
$log as $key => $value)
487 foreach ($value as $index =>
$row)
489 array_push($log_array,
$row);
504 $result = $ilDB->queryF(
"SELECT COUNT(obj_fi) logcount FROM ass_log WHERE obj_fi = %s",
511 return $row[
"logcount"];
529 $pathelements = array();
538 array_push($pathelements,
"<a href=\"./goto.php?target=" . $data[
"type"] .
"_" . $data[
"ref_id"] .
"&client=" . CLIENT_ID .
"\">" .
542 return implode(
" > ", $pathelements);
555 foreach ($a_array as $object_id)
557 $affectedRows = $ilDB->manipulateF(
"DELETE FROM ass_log WHERE obj_fi = %s",
561 $this->
_addLog($ilUser->getId(), $object_id, $this->lng->txt(
"assessment_log_deleted"));
573 require_once
'Modules/TestQuestionPool/classes/class.assQuestion.php';
577 $isPageEditorEnabled = $ilSetting->get(
578 'enable_tst_page_edit', self::ADDITIONAL_QUESTION_CONTENT_EDITING_MODE_PAGE_OBJECT_DISABLED
581 return $isPageEditorEnabled;
586 return $this->setting->get(
'ass_process_lock_mode', self::ASS_PROC_LOCK_MODE_NONE);
591 $this->setting->set(
'ass_process_lock_mode', $lockMode);
596 return array(self::ASS_PROC_LOCK_MODE_NONE, self::ASS_PROC_LOCK_MODE_FILE, self::ASS_PROC_LOCK_MODE_DB);