ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
class.ilTestVirtualSequenceRandomQuestionSet.php
Go to the documentation of this file.
1<?php
2
19declare(strict_types=1);
20
28{
30
31 public function __construct(ilDBInterface $db, ilObjTest $test_obj, ilTestSequenceFactory $test_sequence_facory)
32 {
33 parent::__construct($db, $test_obj, $test_sequence_facory);
34
35 $this->questions_source_pool_definition_map = [];
36 }
37
38 public function getResponsibleSourcePoolDefinitionId(int $question_id): ?int
39 {
40 return $this->questions_source_pool_definition_map[$question_id];
41 }
42
43 protected function fetchQuestionsFromPasses(int $active_id, array $passes): void
44 {
45 $this->questions_pass_map = [];
46
47 foreach ($passes as $pass) {
48 $handled_source_pool_definitions = array_flip($this->questions_source_pool_definition_map);
49
50 $test_sequence = $this->getTestSequence($active_id, $pass);
51
52 foreach ($test_sequence->getOrderedSequenceQuestions() as $question_id) {
53 $definition_id = $test_sequence->getResponsibleSourcePoolDefinitionId($question_id);
54
55 if (isset($handled_source_pool_definitions[$definition_id])) {
56 continue;
57 }
58
59 if ($this->wasAnsweredInThisPass($test_sequence, $question_id)) {
60 $this->questions_pass_map[$question_id] = $pass;
61
62 $this->questions_source_pool_definition_map[$question_id] = $definition_id;
63 }
64 }
65 }
66 }
67}
__construct(ilDBInterface $db, ilObjTest $test_obj, ilTestSequenceFactory $test_sequence_facory)
getTestSequence(int $active_id, int $pass)
wasAnsweredInThisPass(ilTestSequence $test_sequence, int $question_id)
Interface ilDBInterface.
__construct(Container $dic, ilPlugin $plugin)
@inheritDoc