34 require_once
"./Services/Object/classes/class.ilObject.php";
48 include_once
"./Services/Administration/classes/class.ilSetting.php";
49 $this->setting =
new ilSetting(
"assessment");
51 $this->
ilObject($a_id,$a_call_by_reference);
62 if (!parent::update())
82 if (!parent::delete())
120 function notify($a_event,$a_ref_id,$a_parent_non_rbac_id,$a_node_id,$a_params = 0)
160 if ($a_node_id==
$_GET[
"ref_id"])
162 $parent_obj =& $this->ilias->obj_factory->getInstanceByRefId($a_node_id);
163 $parent_type = $parent_obj->getType();
164 if($parent_type == $this->
getType())
166 $a_node_id = (int) $tree->getParentId($a_node_id);
170 parent::notify($a_event,$a_ref_id,$a_parent_non_rbac_id,$a_node_id,$a_params);
182 $setting->set(
"assessment_logging", 1);
186 $setting->set(
"assessment_logging", 0);
197 $setting->set(
"assessment_log_language", $a_language);
207 return (
boolean)
$setting->get(
"assessment_logging");
216 $types =
$setting->get(
"forbidden_questiontypes");
218 if (strlen(trim($types)) == 0)
238 if (is_array($a_types) && (count($a_types) > 0))
240 $types = serialize($a_types);
242 $setting->set(
"forbidden_questiontypes", $types);
253 if (strlen(
$lang) == 0)
271 if( count(self::_getManualScoring()) > 0 )
286 $types =
$setting->get(
"assessment_manual_scoring");
287 return explode(
",", $types);
297 $result = $ilDB->query(
"SELECT * FROM qpl_qst_type");
301 $dbtypes[
$row[
"question_type_id"]] = $row[
"type_tag"];
304 $types =
$setting->get(
"assessment_manual_scoring");
305 $ids = explode(
",", $types);
306 foreach ($ids as $key => $value)
308 $ids[$key] = $dbtypes[$value];
321 if ((!is_array($type_ids)) || (count($type_ids) == 0))
323 $setting->delete(
"assessment_manual_scoring");
327 $setting->set(
"assessment_manual_scoring", implode($type_ids,
","));
341 function _addLog($user_id, $object_id, $logtext, $question_id =
"", $original_id =
"", $test_only = FALSE, $test_ref_id = NULL)
344 if (strlen($question_id) == 0) $question_id = NULL;
345 if (strlen($original_id) == 0) $original_id = NULL;
346 if (strlen($test_ref_id) == 0) $test_ref_id = NULL;
347 $only = ($test_only == TRUE) ? 1 : 0;
348 $next_id = $ilDB->nextId(
'ass_log');
349 $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)",
350 array(
'integer',
'integer',
'integer',
'text',
'integer',
'integer',
'text',
'integer',
'integer'),
373 function &
getLog($ts_from, $ts_to, $test_id, $test_only = FALSE)
378 if ($test_only == TRUE)
380 $result = $ilDB->queryF(
"SELECT * FROM ass_log WHERE obj_fi = %s AND tstamp > %s AND tstamp < %s AND test_only = %s ORDER BY tstamp",
381 array(
'integer',
'integer',
'integer',
'text'),
392 $result = $ilDB->queryF(
"SELECT * FROM ass_log WHERE obj_fi = %s AND tstamp > %s AND tstamp < %s ORDER BY tstamp",
393 array(
'integer',
'integer',
'integer'),
403 if (!array_key_exists(
$row[
"tstamp"],
$log))
407 array_push(
$log[
$row[
"tstamp"]], $row);
411 $log_array = array();
412 foreach (
$log as $key => $value)
414 foreach ($value as $index =>
$row)
416 array_push($log_array,
$row);
430 function &
_getLog($ts_from, $ts_to, $test_id, $test_only = FALSE)
435 if ($test_only == TRUE)
437 $result = $ilDB->queryF(
"SELECT * FROM ass_log WHERE obj_fi = %s AND tstamp > %s AND tstamp < %s AND test_only = %s ORDER BY tstamp",
438 array(
'integer',
'integer',
'integer',
'text'),
439 array($test_id, $ts_from, $ts_to, 1)
444 $result = $ilDB->queryF(
"SELECT * FROM ass_log WHERE obj_fi = %s AND tstamp > %s AND tstamp < %s ORDER BY tstamp",
445 array(
'integer',
'integer',
'integer'),
446 array($test_id, $ts_from, $ts_to)
451 if (!array_key_exists(
$row[
"tstamp"],
$log))
456 if (array_key_exists(
"ref_id",
$row))
458 if (
$row[
"ref_id"] > 0)
464 $type_href = sprintf(
"goto.php?target=tst_%s&client_id=" . CLIENT_ID,
$row[
"ref_id"]);
467 $type_href = sprintf(
"goto.php?target=cat_%s&client_id=" . CLIENT_ID,
$row[
"ref_id"]);
472 $row[
"href"] = $type_href;
473 array_push(
$log[
$row[
"tstamp"]], $row);
477 $log_array = array();
478 foreach (
$log as $key => $value)
480 foreach ($value as $index =>
$row)
482 array_push($log_array,
$row);
497 $result = $ilDB->queryF(
"SELECT COUNT(obj_fi) logcount FROM ass_log WHERE obj_fi = %s",
504 return $row[
"logcount"];
522 $pathelements = array();
531 array_push($pathelements,
"<a href=\"./goto.php?target=" .
$data[
"type"] .
"_" .
$data[
"ref_id"] .
"&client=" . CLIENT_ID .
"\">" .
535 return implode(
" > ", $pathelements);
548 foreach ($a_array as $object_id)
550 $affectedRows = $ilDB->manipulateF(
"DELETE FROM ass_log WHERE obj_fi = %s",
554 $this->
_addLog($ilUser->getId(), $object_id, $this->lng->txt(
"assessment_log_deleted"));