3 declare(strict_types=1);
41 public function __construct(
int $a_id = 0,
bool $a_call_by_reference =
true)
43 $this->setting =
new ilSetting(
'assessment');
50 $assSettings =
new ilSetting(
'assessment');
52 return (
int) $assSettings->get(
53 self::SETTINGS_KEY_SKL_TRIG_NUM_ANSWERS_BARRIER,
54 (
string) self::DEFAULT_SKL_TRIG_NUM_ANSWERS_BARRIER
62 $setting->
set(
'assessment_logging', (
string) ((
int) $a_enable));
69 $setting->
set(
'assessment_log_language', $a_language);
76 return (
bool) $setting->
get(
'assessment_logging',
'0');
86 $types = $setting->
get(
'forbidden_questiontypes',
'');
92 $result = unserialize($types, [
'allowed_classes' =>
false]);
95 return array_filter(array_map(
'intval', $result));
107 if ($typeIds !== []) {
108 $types = serialize(array_map(
'intval', $typeIds));
111 $setting->
set(
'forbidden_questiontypes', $types);
118 $lang = $setting->
get(
'assessment_log_language',
'');
132 return count(self::_getManualScoring()) > 0;
143 $types = $setting->
get(
'assessment_manual_scoring',
'');
144 return array_filter(array_map(
'intval', explode(
',', $types)));
154 $ilDB = $DIC[
'ilDB'];
157 $typeIds = array_filter(array_map(
'intval', explode(
',', $setting->
get(
'assessment_manual_scoring',
''))));
158 $manualScoringTypes = [];
160 $result =
$ilDB->query(
'SELECT question_type_id, type_tag FROM qpl_qst_type');
161 while ($row =
$ilDB->fetchAssoc($result)) {
162 if (in_array((
int) $row[
'question_type_id'], $typeIds,
true)) {
163 $manualScoringTypes[] = $row[
'type_tag'];
166 return array_filter($manualScoringTypes);
176 if ($type_ids === []) {
177 $setting->
delete(
'assessment_manual_scoring');
179 $setting->
set(
'assessment_manual_scoring', implode(
',', $type_ids));
190 $types = $setting->
get(
'assessment_scoring_adjustment',
'');
191 return array_filter(array_map(
'intval', explode(
',', $types)));
201 if ($type_ids === []) {
202 $setting->
delete(
'assessment_scoring_adjustment');
204 $setting->
set(
'assessment_scoring_adjustment', implode(
',', $type_ids));
211 return (
bool) $setting->
get(
'assessment_adjustments_enabled',
'0');
217 $setting->
set(
'assessment_adjustments_enabled', (
string) ((
int) $active));
241 $ilDB = $DIC[
'ilDB'];
244 if (is_numeric($question_id)) {
245 $db_question_id = (
int) $question_id;
249 if (is_numeric($original_id)) {
250 $db_original_id = (
int) $original_id;
254 if (is_numeric($test_ref_id)) {
255 $db_test_ref_id = (
int) $test_ref_id;
258 $only = ($test_only ===
true) ? 1 : 0;
259 $next_id =
$ilDB->nextId(
'ass_log');
260 $affectedRows =
$ilDB->manipulateF(
261 "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)",
262 [
'integer',
'integer',
'integer',
'text',
'integer',
'integer',
'text',
'integer',
'integer'],
284 public static function getLog(
int $ts_from,
int $ts_to,
int $test_id,
bool $test_only =
false): array
287 $ilDB = $DIC[
'ilDB'];
290 if ($test_only ===
true) {
291 $result =
$ilDB->queryF(
292 "SELECT * FROM ass_log WHERE obj_fi = %s AND tstamp > %s AND tstamp < %s AND test_only = %s ORDER BY tstamp",
293 [
'integer',
'integer',
'integer',
'text'],
302 $result =
$ilDB->queryF(
303 "SELECT * FROM ass_log WHERE obj_fi = %s AND tstamp > %s AND tstamp < %s ORDER BY tstamp",
304 [
'integer',
'integer',
'integer'],
312 while ($row =
$ilDB->fetchAssoc($result)) {
313 if (!array_key_exists($row[
"tstamp"],
$log)) {
314 $log[$row[
"tstamp"]] = [];
316 $log[$row[
"tstamp"]][] = $row;
322 foreach ($value as
$index => $row) {
336 public static function _getLog(
int $ts_from,
int $ts_to,
int $test_id,
bool $test_only =
false): array
339 $ilDB = $DIC[
'ilDB'];
342 if ($test_only ===
true) {
343 $result =
$ilDB->queryF(
344 "SELECT * FROM ass_log WHERE obj_fi = %s AND tstamp > %s AND tstamp < %s AND test_only = %s ORDER BY tstamp",
345 [
'integer',
'integer',
'integer',
'text'],
346 [$test_id, $ts_from, $ts_to, 1]
349 $result =
$ilDB->queryF(
350 "SELECT * FROM ass_log WHERE obj_fi = %s AND tstamp > %s AND tstamp < %s ORDER BY tstamp",
351 [
'integer',
'integer',
'integer'],
352 [$test_id, $ts_from, $ts_to]
355 while ($row =
$ilDB->fetchAssoc($result)) {
356 if (!array_key_exists($row[
"tstamp"],
$log)) {
357 $log[$row[
"tstamp"]] = [];
360 if (array_key_exists(
"ref_id", $row) && $row[
"ref_id"] > 0) {
364 $type_href = sprintf(
"goto.php?target=tst_%s&client_id=" .
CLIENT_ID, $row[
"ref_id"]);
367 $type_href = sprintf(
"goto.php?target=cat_%s&client_id=" .
CLIENT_ID, $row[
"ref_id"]);
371 $row[
"href"] = $type_href;
372 $log[$row[
"tstamp"]][] = $row;
378 foreach ($value as
$index => $row) {
393 $ilDB = $DIC->database();
395 $result =
$ilDB->queryF(
396 "SELECT COUNT(obj_fi) logcount FROM ass_log WHERE obj_fi = %s",
400 if ($result->numRows()) {
401 $row =
$ilDB->fetchAssoc($result);
402 return (
int) $row[
"logcount"];
415 $ilDB = $DIC->database();
418 foreach ($a_array as $object_id) {
419 $affectedRows =
$ilDB->manipulateF(
420 "DELETE FROM ass_log WHERE obj_fi = %s",
424 self::_addLog(
$ilUser->getId(), $object_id, $this->
lng->txt(
"assessment_log_deleted"));
437 'enable_tst_page_edit',
438 (
string) self::ADDITIONAL_QUESTION_CONTENT_EDITING_MODE_PAGE_OBJECT_DISABLED
441 return (
bool) $isPageEditorEnabled;
446 return $this->setting->get(
'ass_process_lock_mode', self::ASS_PROC_LOCK_MODE_NONE);
451 $this->setting->set(
'ass_process_lock_mode', $lockMode);
460 self::ASS_PROC_LOCK_MODE_NONE,
461 self::ASS_PROC_LOCK_MODE_FILE,
462 self::ASS_PROC_LOCK_MODE_DB
468 return $this->setting->get(
469 'ass_skl_trig_num_answ_barrier',
470 (
string) self::DEFAULT_SKL_TRIG_NUM_ANSWERS_BARRIER
476 $this->setting->set(
'ass_skl_trig_num_answ_barrier', (
string) $skillTriggeringNumAnswersBarrier);
481 $this->setting->set(
'export_essay_qst_with_html', (
string) ((
int) $value));
486 return (
bool) $this->setting->get(
'export_essay_qst_with_html',
'0');
496 $scoringAdjustableQuestionTypes = [];
498 foreach ($allQuestionTypes as
$type => $typeData) {
502 $scoringAdjustableQuestionTypes[
$type] = $typeData;
506 return $scoringAdjustableQuestionTypes;
delete(string $a_keyword)
static getScoringAdjustmentEnabled()
static _getManualScoringTypes()
Retrieve the manual scoring settings as type strings.
setSkillTriggeringNumAnswersBarrier(int $skillTriggeringNumAnswersBarrier)
static _addLog( $user_id, $object_id, $logtext, $question_id=0, $original_id=0, $test_only=false, $test_ref_id=0)
Add an assessment log entry.
get(string $a_keyword, ?string $a_default_value=null)
get setting
deleteLogEntries(array $a_array)
Deletes the log entries for a given array of test object IDs.
static _getLog(int $ts_from, int $ts_to, int $test_id, bool $test_only=false)
Retrieve assessment log datasets from the database.
questionSupportsScoringAdjustment(assQuestionGUI $question_object)
static getLog(int $ts_from, int $ts_to, int $test_id, bool $test_only=false)
Retrieve assessment log datasets from the database.
set(string $a_key, string $a_val)
const ASS_PROC_LOCK_MODE_DB
getAssessmentProcessLockMode()
_setManualScoring(array $type_ids)
Set the manual scoring settings.
setExportEssayQuestionsWithHtml(bool $value)
static getValidAssessmentProcessLockModes()
static getScoringAdjustableQuestions()
const DEFAULT_SKL_TRIG_NUM_ANSWERS_BARRIER
_enableAssessmentLogging(bool $a_enable)
static _getQuestionGUI(string $question_type='', int $question_id=-1)
Creates a question gui representation and returns the alias to the question gui.
const ASS_PROC_LOCK_MODE_NONE
const ASS_PROC_LOCK_MODE_FILE
static _enabledAssessmentLogging()
getNrOfLogEntries(int $test_obj_id)
Returns the number of log entries for a given test id.
getSkillTriggeringNumAnswersBarrier()
const ADDITIONAL_QUESTION_CONTENT_EDITING_MODE_PAGE_OBJECT_DISABLED
_setLogLanguage(string $a_language)
static _mananuallyScoreableQuestionTypesExists()
Returns the fact wether manually scoreable question types exist or not.
const SETTINGS_KEY_SKL_TRIG_NUM_ANSWERS_BARRIER
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
static _getForbiddenQuestionTypes()
Returns the forbidden questiontypes for ILIAS.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
static setScoringAdjustableQuestions(array $type_ids)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
static getSkillTriggerAnswerNumberBarrier()
_setForbiddenQuestionTypes(array $typeIds)
Sets the forbidden questiontypes for ILIAS.
fetchScoringAdjustableTypes(array $allQuestionTypes)
setAssessmentProcessLockMode(string $lockMode)
static _getManualScoring()
Retrieve the manual scoring settings.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
getExportEssayQuestionsWithHtml()
__construct(Container $dic, ilPlugin $plugin)
static isAdditionalQuestionContentEditingModePageObjectEnabled()
Returns the fact wether content editing with ilias page editor is enabled for questions or not...
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
static setScoringAdjustmentEnabled(bool $active)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
static _lookupType(int $id, bool $reference=false)
__construct(int $a_id=0, bool $a_call_by_reference=true)
const ADDITIONAL_QUESTION_CONTENT_EDITING_MODE_PAGE_OBJECT_ENABLED