33 require_once
"./classes/class.ilObject.php";
47 include_once
"./Services/Administration/classes/class.ilSetting.php";
48 $this->setting =
new ilSetting(
"assessment");
50 $this->
ilObject($a_id,$a_call_by_reference);
61 if (!parent::update())
81 if (!parent::delete())
119 function notify($a_event,$a_ref_id,$a_parent_non_rbac_id,$a_node_id,$a_params = 0)
159 if ($a_node_id==
$_GET[
"ref_id"])
161 $parent_obj =& $this->ilias->obj_factory->getInstanceByRefId($a_node_id);
162 $parent_type = $parent_obj->getType();
163 if($parent_type == $this->
getType())
165 $a_node_id = (int) $tree->getParentId($a_node_id);
169 parent::notify($a_event,$a_ref_id,$a_parent_non_rbac_id,$a_node_id,$a_params);
181 $setting->set(
"assessment_logging", 1);
185 $setting->set(
"assessment_logging", 0);
196 $setting->set(
"assessment_log_language", $a_language);
206 return (
boolean)
$setting->get(
"assessment_logging");
215 $types =
$setting->get(
"forbidden_questiontypes");
217 if (strlen(trim($types)) == 0)
237 if (is_array($a_types) && (count($a_types) > 0))
239 $types = serialize($a_types);
241 $setting->set(
"forbidden_questiontypes", $types);
252 if (strlen(
$lang) == 0)
266 $types =
$setting->get(
"assessment_manual_scoring");
267 return explode(
",", $types);
277 $result = $ilDB->query(
"SELECT * FROM qpl_qst_type");
281 $dbtypes[
$row[
"question_type_id"]] = $row[
"type_tag"];
284 $types =
$setting->get(
"assessment_manual_scoring");
285 $ids = explode(
",", $types);
286 foreach ($ids as $key => $value)
288 $ids[$key] = $dbtypes[$value];
301 if ((!is_array($type_ids)) || (count($type_ids) == 0))
303 $setting->delete(
"assessment_manual_scoring");
307 $setting->set(
"assessment_manual_scoring", implode($type_ids,
","));
321 function _addLog($user_id, $object_id, $logtext, $question_id =
"", $original_id =
"", $test_only = FALSE, $test_ref_id = NULL)
323 global $ilUser,
$ilDB;
324 if (strlen($question_id) == 0) $question_id = NULL;
325 if (strlen($original_id) == 0) $original_id = NULL;
326 if (strlen($test_ref_id) == 0) $test_ref_id = NULL;
327 $only = ($test_only == TRUE) ? 1 : 0;
328 $next_id = $ilDB->nextId(
'ass_log');
329 $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)",
330 array(
'integer',
'integer',
'integer',
'text',
'integer',
'integer',
'text',
'integer',
'integer'),
353 function &
getLog($ts_from, $ts_to, $test_id, $test_only = FALSE)
358 if ($test_only == TRUE)
360 $result = $ilDB->queryF(
"SELECT * FROM ass_log WHERE obj_fi = %s AND tstamp > %s AND tstamp < %s AND test_only = %s ORDER BY tstamp",
361 array(
'integer',
'integer',
'integer',
'text'),
372 $result = $ilDB->queryF(
"SELECT * FROM ass_log WHERE obj_fi = %s AND tstamp > %s AND tstamp < %s ORDER BY tstamp",
373 array(
'integer',
'integer',
'integer'),
383 if (!array_key_exists(
$row[
"tstamp"],
$log))
387 array_push(
$log[
$row[
"tstamp"]], $row);
391 $log_array = array();
392 foreach (
$log as $key => $value)
394 foreach ($value as $index =>
$row)
396 array_push($log_array,
$row);
410 function &
_getLog($ts_from, $ts_to, $test_id, $test_only = FALSE)
415 if ($test_only == TRUE)
417 $result = $ilDB->queryF(
"SELECT * FROM ass_log WHERE obj_fi = %s AND tstamp > %s AND tstamp < %s AND test_only = %s ORDER BY tstamp",
418 array(
'integer',
'integer',
'integer',
'text'),
419 array($test_id, $ts_from, $ts_to, 1)
424 $result = $ilDB->queryF(
"SELECT * FROM ass_log WHERE obj_fi = %s AND tstamp > %s AND tstamp < %s ORDER BY tstamp",
425 array(
'integer',
'integer',
'integer'),
426 array($test_id, $ts_from, $ts_to)
431 if (!array_key_exists(
$row[
"tstamp"],
$log))
436 if (array_key_exists(
"ref_id",
$row))
438 if (
$row[
"ref_id"] > 0)
440 include_once
"./classes/class.ilObject.php";
445 $type_href = sprintf(
"goto.php?target=tst_%s&client_id=" . CLIENT_ID,
$row[
"ref_id"]);
448 $type_href = sprintf(
"goto.php?target=cat_%s&client_id=" . CLIENT_ID,
$row[
"ref_id"]);
453 $row[
"href"] = $type_href;
454 array_push(
$log[
$row[
"tstamp"]], $row);
458 $log_array = array();
459 foreach (
$log as $key => $value)
461 foreach ($value as $index =>
$row)
463 array_push($log_array,
$row);
478 $result = $ilDB->queryF(
"SELECT COUNT(obj_fi) logcount FROM ass_log WHERE obj_fi = %s",
485 return $row[
"logcount"];
503 $pathelements = array();
512 array_push($pathelements,
"<a href=\"./goto.php?target=" .
$data[
"type"] .
"_" .
$data[
"ref_id"] .
"&client=" . CLIENT_ID .
"\">" .
516 return implode(
" > ", $pathelements);
529 foreach ($a_array as $object_id)
531 $affectedRows = $ilDB->manipulateF(
"DELETE FROM ass_log WHERE obj_fi = %s",
535 $this->
_addLog($ilUser->getId(), $object_id, $this->lng->txt(
"assessment_log_deleted"));