18 declare(strict_types=0);
39 $this->
logger = $DIC->logger()->crs();
40 $this->user_id = $a_user_id;
41 $this->container_id = $a_course_id;
62 $relevant_objective_ids = array();
63 if (!$this->
getSettings()->hasSeparateInitialTests()) {
64 if ($a_tst_ref_id === $this->
getSettings()->getInitialTest()) {
65 $relevant_objective_ids = $objective_ids;
67 } elseif (!$this->
getSettings()->hasSeparateQualifiedTests()) {
68 if ($a_tst_ref_id === $this->
getSettings()->getQualifiedTest()) {
69 $relevant_objective_ids = $objective_ids;
73 foreach ($objective_ids as $objective_id) {
75 if ($assigned_itest === $a_tst_ref_id) {
76 $relevant_objective_ids[] = $objective_id;
79 if ($assigned_qtest === $a_tst_ref_id) {
80 $relevant_objective_ids[] = $objective_id;
84 $relevant_objective_ids = array_unique($relevant_objective_ids);
86 if (count($relevant_objective_ids) <= 1) {
87 return $relevant_objective_ids;
94 $passed =
$results->getCompletedObjectiveIds();
95 $this->
logger->debug(
'Passed objectives are ' . print_r($passed,
true) .
' for test type: ' . $test_type);
98 if (count($passed) >= count($relevant_objective_ids)) {
99 return $relevant_objective_ids;
103 foreach ($relevant_objective_ids as $objective_id) {
104 if (!in_array($objective_id, $passed)) {
105 $unpassed[] = $objective_id;
121 $this->
logger->debug(
'Notify test start: ' . print_r($relevant_objectives,
true));
130 foreach ($relevant_objectives as $oid) {
131 $this->
logger->debug(
'Adding new run for objective with id: ' . $oid);
150 $this->
logger->debug(
'Prepare test pass called');
173 $testType = $this->assignments->getTypeByTest($this->
getTestRefId());
201 $definitionId = $a_test_sequence->getResponsibleSourcePoolDefinitionId($questionId);
207 if ($objectiveIds !== []) {
226 if ($assignment->getTestRefId() ===
$testRefId) {
227 return $assignment->getObjectiveId();
257 $is_qualified_run =
false;
259 $is_qualified_run =
true;
262 foreach ($this->run as $run) {
266 $run->getObjectiveId(),
272 $run->getObjectiveId(),
279 $run->getObjectiveId(),
283 $this->
logger->debug(
'Max attempts = ' . $max_attempts);
288 $this->
logger->debug(
'Checking for qualified test...');
289 if (!$is_qualified_run) {
290 $this->
logger->debug(
' and increasing attempts.');
291 ++$old_result[
'tries'];
293 $old_result[
'is_final'] = ($old_result[
'tries'] >= $max_attempts);
297 $ur->saveObjectiveResult(
298 $run->getObjectiveId(),
300 $old_result[
'status'],
301 $old_result[
'result_perc'],
303 $old_result[
'tries'],
304 $old_result[
'is_final']
315 $this->
logger->debug(
'Initial test');
320 $this->
logger->debug(
'No qualified test run');
324 $this->
logger->debug(
'No start object');
330 $container_ref_id = end($container_ref_ids);
336 if ($start->isFullfilled($this->getUserId(), $session->
getRefId())) {
337 $this->
logger->debug(
'Is fullfilled');
340 $this->
logger->debug(
'Is not fullfilled');
349 foreach ($this->run as $run) {
350 if ($run->questionExists($qst->
getId())) {
355 $run->setQuestionResult(
361 $res = $run->getResult();
366 $run->getObjectiveId(),
371 $ur->saveObjectiveResult(
372 $run->getObjectiveId(),
377 $run->getObjectiveId(),
380 $old_result[
'limit_perc']
384 (
float) $res[
'percentage'],
385 $old_result[
'limit_perc'],
386 $old_result[
'tries'],
387 $old_result[
'is_final']
427 foreach ($this->run as $tst_run) {
449 foreach ($this->run as $tst_run) {
450 $tst_run->clearQuestions();
453 $tst_run->addQuestion($qst_id);
456 $tst_run->setMaxPoints($points);
462 foreach ($this->run as $tst_run) {
463 $tst_run->clearQuestions();
466 $tst_run->getObjectiveId()
469 foreach ($qst as
$id) {
470 $tst_run->addQuestion($id);
473 $tst_run->setMaxPoints($points);
479 foreach ($this->run as $tst_run) {
481 $tst_run->clearQuestions();
485 $tst_run->getObjectiveId(),
497 $tst_run->addQuestion($qst);
501 $tst_run->setMaxPoints($points);
507 foreach ($this->run as $run) {
508 if ($run->questionExists($a_qid)) {
522 $adapter->setTestRefId($a_test_session->
getRefId());
523 $adapter->initTestRun($a_test_session);
updateRandomQuestions(ilTestSession $session, ilTestSequenceRandomQuestionSet $seq)
getResponsibleSourcePoolDefinitionId($questionId)
static lookupObjectiveIdsBySequence(int $a_container_id, int $a_seq_id)
static _lookupMaximumPointsOfQuestion(int $a_question_id)
static lookupQuestionsByObjective(int $a_test_id, int $a_objective)
Abstract basic class which is to be extended by the concrete assessment question type classes...
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
lookupObjectiveIdByFixedQuestionId(int $a_question_id)
static _getAllReferences(int $id)
get all reference ids for object ID
static deleteRun(int $a_container_id, int $a_user_id, int $a_test_id)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
static lookupResult(int $a_course_obj_id, int $a_user_id, int $a_objective_id, int $a_tst_type)
static _getObjectiveIds(int $course_id, bool $a_activated_only=false)
getObjectiveOrientedContainerId()
setQuestionsOptional(ilTestSequence $seq)
const HIDE_PASSED_OBJECTIVE_QST
hideQuestion($question_id)
static lookupObjectiveRequiredPercentage(int $a_container_id, int $a_objective_id, int $a_test_ref_id, int $a_max_points)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
static _lookupObjId(int $ref_id)
updateSeparateTestQuestions(ilTestSession $session, ilTestSequence $seq)
hideQuestions(ilTestSequence $seq)
saveToDb()
Saves the sequence data for a given pass to the database.
static getInstance(ilTestSession $a_test_session)
getTypeByTest(int $a_test_ref_id)
updateQuestions(ilTestSession $session, ilTestSequence $seq)
initTestRun(ilTestSession $session)
buildQuestionRelatedObjectiveListByQuestions(ilTestQuestionSequence $a_test_sequence, ilTestQuestionRelatedObjectivesList $a_objectives_list)
buildQuestionRelatedObjectiveList(ilTestQuestionSequence $a_test_sequence, ilTestQuestionRelatedObjectivesList $a_objectives_list)
updateFixedQuestions(ilTestSession $session, ilTestSequence $seq)
const MARK_PASSED_OBJECTIVE_QST
if(!defined('PATH_SEPARATOR')) $GLOBALS['_PEAR_default_error_mode']
ilLOTestAssignments $assignments
getRelatedObjectivesForSeparatedTest(int $testRefId)
static isStartObject(int $a_container_id, int $a_item_ref_id)
static isCompleted(int $a_cont_oid, int $a_test_rid, int $a_objective_id, int $max_points, int $reached, int $limit_perc)
Check if objective is completed.
static getInstanceByObjId(int $a_obj_id)
setTestRefId(int $testRefId)
updateQuestionResult(ilTestSession $session, assQuestion $qst)
update question result of run
static getRun(int $a_container_id, int $a_user_id, int $a_test_id)
isQualifiedStartRun(ilTestSession $session)
Check if current run is a start object run.
setQuestionOptional($questionId)
static lookupSequencesByType(int $a_container_id, int $a_objective_id, int $a_test_id, int $a_test_type)
buildQuestionRelatedObjectiveListByTest(ilTestQuestionSequence $a_test_sequence, ilTestQuestionRelatedObjectivesList $a_objectives_list)
$id
plugin.php for ilComponentBuildPluginInfoObjectiveTest::testAddPlugins
__construct(int $a_user_id, int $a_course_id)
static getInstance(int $a_container_id)
notifyTestStart(ilTestSession $a_test_session, int $a_test_obj_id)
Called from learning objective test on actual test start.
const TYPE_TEST_QUALIFIED
getReachedPoints(int $active_id, int $pass)
static lookupObjectivesOfQuestion(int $a_qid)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
prepareTestPass(ilTestSession $a_test_session, ilTestSequence $a_test_sequence)
Called from learning objective test.
getTestByObjective(int $a_objective_id, int $a_type)
lookupRelevantObjectiveIdsForTest(int $a_container_id, int $a_tst_ref_id, int $a_user_id)
lookupObjectiveIdByRandomQuestionSelectionDefinitionId(int $a_id)
static lookupMaxAttempts(int $a_container_id, int $a_objective_id, int $a_test_ref_id)
static _updateStatus(int $a_obj_id, int $a_usr_id, ?object $a_obj=null, bool $a_percentage=false, bool $a_force_raise=false)
initUserResult(ilTestSession $session)