ILIAS  release_8 Revision v8.24
class.ilTestSequenceFactory.php
Go to the documentation of this file.
1<?php
2
19use ILIAS\Refinery\Factory as Refinery;
20
27{
29 private array $testSequences = [];
32 private Refinery $refinery;
35
36 public function __construct(
39 Refinery $refinery,
42 ) {
43 $this->db = $db;
44 $this->lng = $lng;
45 $this->refinery = $refinery;
46 $this->component_repository = $component_repository;
47 $this->testOBJ = $testOBJ;
48 }
49
57 public function getSequenceByTestSession($testSession)
58 {
59 return $this->getSequenceByActiveIdAndPass($testSession->getActiveId(), $testSession->getPass());
60 }
61
70 public function getSequenceByActiveIdAndPass($activeId, $pass)
71 {
72 if (!isset($this->testSequences[$activeId][$pass])) {
73 if ($this->testOBJ->isFixedTest()) {
74 $this->testSequences[$activeId][$pass] = new ilTestSequenceFixedQuestionSet(
75 $activeId,
76 $pass,
77 $this->testOBJ->isRandomTest()
78 );
79 }
80
81 if ($this->testOBJ->isRandomTest()) {
82 $this->testSequences[$activeId][$pass] = new ilTestSequenceRandomQuestionSet(
83 $activeId,
84 $pass,
85 $this->testOBJ->isRandomTest()
86 );
87 }
88
89 if ($this->testOBJ->isDynamicTest()) {
90 $questionSet = new ilTestDynamicQuestionSet(
91 $this->db,
92 $this->lng,
93 $this->refinery,
94 $this->component_repository,
95 $this->testOBJ
96 );
97 $this->testSequences[$activeId][$pass] = new ilTestSequenceDynamicQuestionSet(
98 $this->db,
99 $questionSet,
100 $activeId
101 );
102 }
103 }
104
105 return $this->testSequences[$activeId][$pass];
106 }
107}
Builds data types.
Definition: Factory.php:21
language handling
getSequenceByActiveIdAndPass($activeId, $pass)
creates and returns an instance of a test sequence that corresponds to the current test mode and give...
getSequenceByTestSession($testSession)
creates and returns an instance of a test sequence that corresponds to the current test mode and the ...
ilComponentRepository $component_repository
__construct(ilDBInterface $db, ilLanguage $lng, Refinery $refinery, ilComponentRepository $component_repository, ilObjTest $testOBJ)
Readable part of repository interface to ilComponentDataDB.
Interface ilDBInterface.