ILIAS  trunk Revision v12.0_alpha-1221-g4e438232683
ilLOTestQuestionAdapter Class Reference

Test question filter. More...

+ Collaboration diagram for ilLOTestQuestionAdapter:

Public Member Functions

 __construct (int $a_user_id, int $a_course_id)
 
 getTestRefId ()
 
 setTestRefId (int $testRefId)
 
 notifyTestStart (ilTestSession $a_test_session, int $a_test_obj_id)
 Called from learning objective test on actual test start. More...
 
 prepareTestPass (ilTestSession $a_test_session, ilTestSequence $a_test_sequence)
 Called from learning objective test. More...
 
 buildQuestionRelatedObjectiveList (ilTestQuestionSequence $a_test_sequence, ilTestQuestionRelatedObjectivesList $a_objectives_list)
 
 updateQuestionResult (ilTestSession $session, assQuestion $qst)
 update question result of run More...
 

Static Public Member Functions

static getInstance (ilTestSession $a_test_session)
 

Protected Member Functions

 lookupRelevantObjectiveIdsForTest (int $a_container_id, int $a_tst_ref_id, int $a_user_id)
 
 buildQuestionRelatedObjectiveListByTest (ilTestQuestionSequence $a_test_sequence, ilTestQuestionRelatedObjectivesList $a_objectives_list)
 
 buildQuestionRelatedObjectiveListByQuestions (ilTestQuestionSequence $a_test_sequence, ilTestQuestionRelatedObjectivesList $a_objectives_list)
 
 lookupObjectiveIdByRandomQuestionSelectionDefinitionId (int $a_id)
 
 lookupObjectiveIdByFixedQuestionId (int $a_question_id)
 
 getRelatedObjectivesForSeparatedTest (int $testRefId)
 
 getUserId ()
 
 getContainerId ()
 
 getSettings ()
 
 getAssignments ()
 
 initUserResult (ilTestSession $session)
 
 isQualifiedStartRun (ilTestSession $session)
 Check if current run is a start object run. More...
 
 setQuestionsOptional (ilTestSequence $seq)
 
 hideQuestions (ilTestSequence $seq)
 
 initTestRun (ilTestSession $session)
 
 storeTestRun ()
 
 updateQuestions (ilTestSession $session, ilTestSequence $seq)
 
 updateSeparateTestQuestions (ilTestSession $session, ilTestSequence $seq)
 
 updateFixedQuestions (ilTestSession $session, ilTestSequence $seq)
 
 updateRandomQuestions (ilTestSession $session, ilTestSequenceRandomQuestionSet $seq)
 
 isInRun (int $a_qid)
 

Protected Attributes

ilLOSettings $settings
 
ilLOTestAssignments $assignments
 
array $run = []
 
int $user_id = 0
 
int $container_id = 0
 
int $testRefId = null
 
ilLogger $logger
 

Detailed Description

Test question filter.

Author
Stefan Meyer smeye.nosp@m.r.il.nosp@m.ias@g.nosp@m.mx.d.nosp@m.e

Definition at line 25 of file class.ilLOTestQuestionAdapter.php.

Constructor & Destructor Documentation

◆ __construct()

ilLOTestQuestionAdapter::__construct ( int  $a_user_id,
int  $a_course_id 
)

Definition at line 40 of file class.ilLOTestQuestionAdapter.php.

41 {
42 global $DIC;
43
44 $this->logger = $DIC->logger()->crs();
45 $this->user_id = $a_user_id;
46 $this->container_id = $a_course_id;
47 $this->settings = ilLOSettings::getInstanceByObjId($this->container_id);
48 $this->assignments = ilLOTestAssignments::getInstance($this->container_id);
49 }
static getInstanceByObjId(int $a_obj_id)
static getInstance(int $a_container_id)
global $DIC
Definition: shib_login.php:26

References $DIC, ilLOTestAssignments\getInstance(), ilLOSettings\getInstanceByObjId(), ILIAS\Repository\logger(), and ILIAS\Repository\settings().

+ Here is the call graph for this function:

Member Function Documentation

◆ buildQuestionRelatedObjectiveList()

ilLOTestQuestionAdapter::buildQuestionRelatedObjectiveList ( ilTestQuestionSequence  $a_test_sequence,
ilTestQuestionRelatedObjectivesList  $a_objectives_list 
)

Definition at line 176 of file class.ilLOTestQuestionAdapter.php.

179 : void {
180 $testType = $this->assignments->getTypeByTest($this->getTestRefId());
181
182 if ($testType == ilLOSettings::TYPE_TEST_INITIAL && $this->getSettings()->hasSeparateInitialTests()) {
183 $this->buildQuestionRelatedObjectiveListByTest($a_test_sequence, $a_objectives_list);
184 } elseif ($testType == ilLOSettings::TYPE_TEST_QUALIFIED && $this->getSettings()->hasSeparateQualifiedTests()) {
185 $this->buildQuestionRelatedObjectiveListByTest($a_test_sequence, $a_objectives_list);
186 } else {
187 $this->buildQuestionRelatedObjectiveListByQuestions($a_test_sequence, $a_objectives_list);
188 }
189 }
buildQuestionRelatedObjectiveListByQuestions(ilTestQuestionSequence $a_test_sequence, ilTestQuestionRelatedObjectivesList $a_objectives_list)
buildQuestionRelatedObjectiveListByTest(ilTestQuestionSequence $a_test_sequence, ilTestQuestionRelatedObjectivesList $a_objectives_list)

References buildQuestionRelatedObjectiveListByTest().

+ Here is the call graph for this function:

◆ buildQuestionRelatedObjectiveListByQuestions()

ilLOTestQuestionAdapter::buildQuestionRelatedObjectiveListByQuestions ( ilTestQuestionSequence  $a_test_sequence,
ilTestQuestionRelatedObjectivesList  $a_objectives_list 
)
protected

Definition at line 202 of file class.ilLOTestQuestionAdapter.php.

205 : void {
206 foreach ($a_test_sequence->getQuestionIds() as $questionId) {
207 if ($a_test_sequence instanceof ilTestRandomQuestionSequence) {
208 $definitionId = $a_test_sequence->getResponsibleSourcePoolDefinitionId($questionId);
209 $objectiveIds = $this->lookupObjectiveIdByRandomQuestionSelectionDefinitionId($definitionId);
210 } else {
211 $objectiveIds = $this->lookupObjectiveIdByFixedQuestionId($questionId);
212 }
213
214 if ($objectiveIds !== []) {
215 $a_objectives_list->addQuestionRelatedObjectives($questionId, $objectiveIds);
216 }
217 }
218 }
lookupObjectiveIdByFixedQuestionId(int $a_question_id)
lookupObjectiveIdByRandomQuestionSelectionDefinitionId(int $a_id)

References ilTestQuestionRelatedObjectivesList\addQuestionRelatedObjectives().

+ Here is the call graph for this function:

◆ buildQuestionRelatedObjectiveListByTest()

ilLOTestQuestionAdapter::buildQuestionRelatedObjectiveListByTest ( ilTestQuestionSequence  $a_test_sequence,
ilTestQuestionRelatedObjectivesList  $a_objectives_list 
)
protected

Definition at line 191 of file class.ilLOTestQuestionAdapter.php.

194 : void {
195 $objectiveIds = array($this->getRelatedObjectivesForSeparatedTest($this->getTestRefId()));
196
197 foreach ($a_test_sequence->getQuestionIds() as $questionId) {
198 $a_objectives_list->addQuestionRelatedObjectives($questionId, $objectiveIds);
199 }
200 }

References ilTestQuestionRelatedObjectivesList\addQuestionRelatedObjectives().

Referenced by buildQuestionRelatedObjectiveList().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getAssignments()

ilLOTestQuestionAdapter::getAssignments ( )
protected

Definition at line 255 of file class.ilLOTestQuestionAdapter.php.

256 {
257 return $this->assignments;
258 }
Settings for LO courses.

◆ getContainerId()

ilLOTestQuestionAdapter::getContainerId ( )
protected

Definition at line 245 of file class.ilLOTestQuestionAdapter.php.

245 : int
246 {
247 return $this->container_id;
248 }

◆ getInstance()

static ilLOTestQuestionAdapter::getInstance ( ilTestSession  $a_test_session)
static

Definition at line 522 of file class.ilLOTestQuestionAdapter.php.

522 : self
523 {
524 $adapter = new self(
525 $a_test_session->getUserId(),
526 $a_test_session->getObjectiveOrientedContainerId()
527 );
528
529 $adapter->setTestRefId($a_test_session->getRefId());
530 $adapter->initTestRun($a_test_session);
531 return $adapter;
532 }

References ilTestSession\getObjectiveOrientedContainerId(), ilTestSession\getRefId(), and ilTestSession\getUserId().

Referenced by ilTestSubmissionReviewGUI\buildUserReviewOutput(), ilTestServiceGUI\getPassOverviewTableData(), ilTestServiceGUI\outCorrectSolution(), ilTestEvaluationGUI\outUserListOfAnswerPasses(), ilTestEvaluationGUI\outUserPassDetails(), ilTestPlayerAbstractGUI\save(), ilTestPlayerAbstractGUI\showQuestionCmd(), ilTestEvalObjectiveOrientedGUI\showVirtualPassCmd(), and ilTestPlayerAbstractGUI\startTestCmd().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getRelatedObjectivesForSeparatedTest()

ilLOTestQuestionAdapter::getRelatedObjectivesForSeparatedTest ( int  $testRefId)
protected

Definition at line 230 of file class.ilLOTestQuestionAdapter.php.

230 : ?int
231 {
232 foreach ($this->getAssignments()->getAssignments() as $assignment) {
233 if ($assignment->getTestRefId() === $testRefId) {
234 return $assignment->getObjectiveId();
235 }
236 }
237 return null;
238 }

◆ getSettings()

ilLOTestQuestionAdapter::getSettings ( )
protected

Definition at line 250 of file class.ilLOTestQuestionAdapter.php.

251 {
252 return $this->settings;
253 }
Settings for LO courses.

Referenced by lookupRelevantObjectiveIdsForTest(), and prepareTestPass().

+ Here is the caller graph for this function:

◆ getTestRefId()

ilLOTestQuestionAdapter::getTestRefId ( )

Definition at line 51 of file class.ilLOTestQuestionAdapter.php.

51 : ?int
52 {
53 return $this->testRefId;
54 }

References $testRefId.

◆ getUserId()

ilLOTestQuestionAdapter::getUserId ( )
protected

Definition at line 240 of file class.ilLOTestQuestionAdapter.php.

240 : int
241 {
242 return $this->user_id;
243 }

References $user_id.

◆ hideQuestions()

ilLOTestQuestionAdapter::hideQuestions ( ilTestSequence  $seq)
protected

Definition at line 412 of file class.ilLOTestQuestionAdapter.php.

412 : void
413 {
414 // first unhide all questions
415 $seq->clearHiddenQuestions();
416 foreach ($seq->getQuestionIds() as $qid) {
417 if (!$this->isInRun($qid)) {
418 $seq->hideQuestion($qid);
419 }
420 }
421 }
hideQuestion(int $question_id)

References ilTestSequence\clearHiddenQuestions(), ilTestSequence\getQuestionIds(), and ilTestSequence\hideQuestion().

Referenced by prepareTestPass().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ initTestRun()

ilLOTestQuestionAdapter::initTestRun ( ilTestSession  $session)
protected

Definition at line 423 of file class.ilLOTestQuestionAdapter.php.

423 : void
424 {
425 $this->run = ilLOTestRun::getRun(
426 $this->container_id,
427 $this->user_id,
429 );
430 }
static getRun(int $a_container_id, int $a_user_id, int $a_test_id)
static _lookupObjId(int $ref_id)

References ilObject\_lookupObjId(), ilTestSession\getRefId(), and ilLOTestRun\getRun().

Referenced by notifyTestStart().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ initUserResult()

ilLOTestQuestionAdapter::initUserResult ( ilTestSession  $session)
protected

Definition at line 260 of file class.ilLOTestQuestionAdapter.php.

260 : void
261 {
262 // check if current test is start object and fullfilled
263 // if yes => do not increase tries.
264 $is_qualified_run = false;
265 if ($this->isQualifiedStartRun($session)) {
266 $is_qualified_run = true;
267 }
268
269 foreach ($this->run as $run) {
270 $old_result = ilLOUserResults::lookupResult(
271 $this->container_id,
272 $this->user_id,
273 $run->getObjectiveId(),
274 $this->getAssignments()->getTypeByTest($session->getRefId())
275 );
276
278 $this->container_id,
279 $run->getObjectiveId(),
280 $session->getRefId(),
281 $run->getMaxPoints()
282 );
283
284 $max_attempts = ilLOUtils::lookupMaxAttempts(
285 $this->container_id,
286 $run->getObjectiveId(),
287 $session->getRefId()
288 );
289
290 $this->logger->debug('Max attempts = ' . $max_attempts);
291
292 if ($max_attempts) {
293 // check if current test is start object and fullfilled
294 // if yes => do not increase tries.
295 $this->logger->debug('Checking for qualified test...');
296 if (!$is_qualified_run) {
297 $this->logger->debug(' and increasing attempts.');
298 ++$old_result['tries'];
299 }
300 $old_result['is_final'] = ($old_result['tries'] >= $max_attempts);
301 }
302
303 $ur = new ilLOUserResults($this->container_id, $this->user_id);
304 $ur->saveObjectiveResult(
305 $run->getObjectiveId(),
306 $this->getAssignments()->getTypeByTest($session->getRefId()),
307 $old_result['status'],
308 $old_result['result_perc'],
309 $limit,
310 $old_result['tries'],
311 $old_result['is_final']
312 );
313 }
314 }
isQualifiedStartRun(ilTestSession $session)
Check if current run is a start object run.
static lookupResult(int $a_course_obj_id, int $a_user_id, int $a_objective_id, int $a_tst_type)
static lookupObjectiveRequiredPercentage(int $a_container_id, int $a_objective_id, int $a_test_ref_id, int $a_max_points)
static lookupMaxAttempts(int $a_container_id, int $a_objective_id, int $a_test_ref_id)

References ilTestSession\getRefId(), ILIAS\Repository\logger(), ilLOUtils\lookupMaxAttempts(), ilLOUtils\lookupObjectiveRequiredPercentage(), and ilLOUserResults\lookupResult().

Referenced by prepareTestPass().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ isInRun()

ilLOTestQuestionAdapter::isInRun ( int  $a_qid)
protected

Definition at line 512 of file class.ilLOTestQuestionAdapter.php.

512 : bool
513 {
514 foreach ($this->run as $run) {
515 if ($run->questionExists($a_qid)) {
516 return true;
517 }
518 }
519 return false;
520 }

◆ isQualifiedStartRun()

ilLOTestQuestionAdapter::isQualifiedStartRun ( ilTestSession  $session)
protected

Check if current run is a start object run.

Definition at line 319 of file class.ilLOTestQuestionAdapter.php.

319 : bool
320 {
321 if ($this->getAssignments()->getTypeByTest($session->getRefId()) == ilLOSettings::TYPE_TEST_INITIAL) {
322 $this->logger->debug('Initial test');
323 return false;
324 }
325
326 if ($session->getRefId() !== $this->getSettings()->getQualifiedTest()) {
327 $this->logger->debug('No qualified test run');
328 return false;
329 }
331 $this->logger->debug('No start object');
332 return false;
333 }
334 // Check if start object is fullfilled
335
336 $container_ref_ids = ilObject::_getAllReferences($this->getContainerId());
337 $container_ref_id = end($container_ref_ids);
338
339 $start = new ilContainerStartObjects(
340 $container_ref_id,
341 $this->getContainerId()
342 );
343 if ($start->isFullfilled($this->getUserId(), $session->getRefId())) {
344 $this->logger->debug('Is fullfilled');
345 return false;
346 }
347 $this->logger->debug('Is not fullfilled');
348 return true;
349 }
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
static isStartObject(int $a_container_id, int $a_item_ref_id)
static _getAllReferences(int $id)
get all reference ids for object ID

References ilObject\_getAllReferences(), ilTestSession\getRefId(), ilContainerStartObjects\isStartObject(), ILIAS\Repository\logger(), and ilLOSettings\TYPE_TEST_INITIAL.

+ Here is the call graph for this function:

◆ lookupObjectiveIdByFixedQuestionId()

ilLOTestQuestionAdapter::lookupObjectiveIdByFixedQuestionId ( int  $a_question_id)
protected

Definition at line 225 of file class.ilLOTestQuestionAdapter.php.

225 : array
226 {
228 }

References ilCourseObjectiveQuestion\lookupObjectivesOfQuestion().

+ Here is the call graph for this function:

◆ lookupObjectiveIdByRandomQuestionSelectionDefinitionId()

ilLOTestQuestionAdapter::lookupObjectiveIdByRandomQuestionSelectionDefinitionId ( int  $a_id)
protected

Definition at line 220 of file class.ilLOTestQuestionAdapter.php.

220 : array
221 {
223 }
static lookupObjectiveIdsBySequence(int $a_container_id, int $a_seq_id)

References ilLORandomTestQuestionPools\lookupObjectiveIdsBySequence().

+ Here is the call graph for this function:

◆ lookupRelevantObjectiveIdsForTest()

ilLOTestQuestionAdapter::lookupRelevantObjectiveIdsForTest ( int  $a_container_id,
int  $a_tst_ref_id,
int  $a_user_id 
)
protected

Definition at line 61 of file class.ilLOTestQuestionAdapter.php.

61 : array
62 {
64
65 $objective_ids = ilCourseObjective::_getObjectiveIds($a_container_id);
66
67 $relevant_objective_ids = array();
68 if (!$this->getSettings()->hasSeparateInitialTests()) {
69 if ($a_tst_ref_id === $this->getSettings()->getInitialTest()) {
70 $relevant_objective_ids = $objective_ids;
71 }
72 } elseif (!$this->getSettings()->hasSeparateQualifiedTests()) {
73 if ($a_tst_ref_id === $this->getSettings()->getQualifiedTest()) {
74 $relevant_objective_ids = $objective_ids;
75 }
76 }
77
78 foreach ($objective_ids as $objective_id) {
79 $assigned_itest = $assignments->getTestByObjective($objective_id, ilLOSettings::TYPE_TEST_INITIAL);
80 if ($assigned_itest === $a_tst_ref_id) {
81 $relevant_objective_ids[] = $objective_id;
82 }
83 $assigned_qtest = $assignments->getTestByObjective($objective_id, ilLOSettings::TYPE_TEST_QUALIFIED);
84 if ($assigned_qtest === $a_tst_ref_id) {
85 $relevant_objective_ids[] = $objective_id;
86 }
87 }
88
89 $relevant_objective_ids = array_unique($relevant_objective_ids);
90
91 if (count($relevant_objective_ids) <= 1) {
92 return $relevant_objective_ids;
93 }
94
95 // filter passed objectives
96 $test_type = $assignments->getTypeByTest($a_tst_ref_id);
97 $results = new ilLOUserResults($a_container_id, $a_user_id);
98
99 $passed = $results->getCompletedObjectiveIds();
100 $this->logger->debug('Passed objectives are ' . print_r($passed, true) . ' for test type: ' . $test_type);
101
102 // all completed => show all objectives
103 if (count($passed) >= count($relevant_objective_ids)) {
104 return $relevant_objective_ids;
105 }
106
107 $unpassed = array();
108 foreach ($relevant_objective_ids as $objective_id) {
109 if (!in_array($objective_id, $passed)) {
110 $unpassed[] = $objective_id;
111 }
112 }
113 return $unpassed;
114 }
static _getObjectiveIds(int $course_id, bool $a_activated_only=false)
getTestByObjective(int $a_objective_id, int $a_type)
getTypeByTest(int $a_test_ref_id)
$results

References $assignments, $results, ilCourseObjective\_getObjectiveIds(), ilLOTestAssignments\getInstance(), getSettings(), ilLOTestAssignments\getTestByObjective(), ilLOTestAssignments\getTypeByTest(), ILIAS\Repository\logger(), ilLOSettings\TYPE_TEST_INITIAL, and ilLOSettings\TYPE_TEST_QUALIFIED.

Referenced by notifyTestStart().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ notifyTestStart()

ilLOTestQuestionAdapter::notifyTestStart ( ilTestSession  $a_test_session,
int  $a_test_obj_id 
)

Called from learning objective test on actual test start.

Definition at line 119 of file class.ilLOTestQuestionAdapter.php.

119 : void
120 {
121 $relevant_objectives = $this->lookupRelevantObjectiveIdsForTest(
122 $a_test_session->getObjectiveOrientedContainerId(),
123 $a_test_session->getRefId(),
124 $a_test_session->getUserId()
125 );
126 $this->logger->debug('Notify test start: ' . print_r($relevant_objectives, true));
127
128 // delete test runs
130 $a_test_session->getObjectiveOrientedContainerId(),
131 $a_test_session->getUserId(),
132 $a_test_obj_id
133 );
134
135 foreach ($relevant_objectives as $oid) {
136 $this->logger->debug('Adding new run for objective with id: ' . $oid);
137 $run = new ilLOTestRun(
138 $a_test_session->getObjectiveOrientedContainerId(),
139 $a_test_session->getUserId(),
140 $a_test_obj_id,
141 $oid
142 );
143 $run->create();
144 }
145
146 // finally reinitialize test runs
147 $this->initTestRun($a_test_session);
148 }
lookupRelevantObjectiveIdsForTest(int $a_container_id, int $a_tst_ref_id, int $a_user_id)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
static deleteRun(int $a_container_id, int $a_user_id, int $a_test_id)

References $run, ilLOTestRun\deleteRun(), ilTestSession\getObjectiveOrientedContainerId(), ilTestSession\getRefId(), ilTestSession\getUserId(), initTestRun(), ILIAS\Repository\logger(), and lookupRelevantObjectiveIdsForTest().

+ Here is the call graph for this function:

◆ prepareTestPass()

ilLOTestQuestionAdapter::prepareTestPass ( ilTestSession  $a_test_session,
ilTestSequence  $a_test_sequence 
)

Called from learning objective test.

Definition at line 153 of file class.ilLOTestQuestionAdapter.php.

153 : bool
154 {
155 $this->logger->debug('Prepare test pass called');
156
157 $this->updateQuestions($a_test_session, $a_test_sequence);
158
159 if ($this->getSettings()->getQualifiedTest() === $a_test_session->getRefId()) {
160 if ($this->getSettings()->getPassedObjectiveMode() == ilLOSettings::MARK_PASSED_OBJECTIVE_QST) {
161 $this->setQuestionsOptional($a_test_sequence);
162 } elseif ($this->getSettings()->getPassedObjectiveMode() == ilLOSettings::HIDE_PASSED_OBJECTIVE_QST) {
163 $this->hideQuestions($a_test_sequence);
164 }
165 }
166
167 $this->storeTestRun();
168 $this->initUserResult($a_test_session);
169
170 // Save test sequence
171 $a_test_sequence->saveToDb();
172
173 return true;
174 }
const HIDE_PASSED_OBJECTIVE_QST
const MARK_PASSED_OBJECTIVE_QST
updateQuestions(ilTestSession $session, ilTestSequence $seq)
initUserResult(ilTestSession $session)
saveToDb()
Saves the sequence data for a given pass to the database.

References ilTestSession\getRefId(), getSettings(), ilLOSettings\HIDE_PASSED_OBJECTIVE_QST, hideQuestions(), initUserResult(), ILIAS\Repository\logger(), ilLOSettings\MARK_PASSED_OBJECTIVE_QST, ilTestSequence\saveToDb(), setQuestionsOptional(), storeTestRun(), and updateQuestions().

+ Here is the call graph for this function:

◆ setQuestionsOptional()

ilLOTestQuestionAdapter::setQuestionsOptional ( ilTestSequence  $seq)
protected

Definition at line 401 of file class.ilLOTestQuestionAdapter.php.

401 : void
402 {
403 // first unset optional on all questions
405 foreach ($seq->getQuestionIds() as $qid) {
406 if (!$this->isInRun($qid)) { // but is assigned to any LO
407 $seq->setQuestionOptional($qid);
408 }
409 }
410 }
setQuestionOptional(int $question_id)

References ilTestSequence\clearOptionalQuestions(), ilTestSequence\getQuestionIds(), and ilTestSequence\setQuestionOptional().

Referenced by prepareTestPass().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ setTestRefId()

ilLOTestQuestionAdapter::setTestRefId ( int  $testRefId)

Definition at line 56 of file class.ilLOTestQuestionAdapter.php.

56 : void
57 {
58 $this->testRefId = $testRefId;
59 }

References $testRefId.

◆ storeTestRun()

ilLOTestQuestionAdapter::storeTestRun ( )
protected

Definition at line 432 of file class.ilLOTestQuestionAdapter.php.

432 : void
433 {
434 foreach ($this->run as $tst_run) {
435 $tst_run->update();
436 }
437 }

Referenced by prepareTestPass().

+ Here is the caller graph for this function:

◆ updateFixedQuestions()

ilLOTestQuestionAdapter::updateFixedQuestions ( ilTestSession  $session,
ilTestSequence  $seq 
)
protected

Definition at line 467 of file class.ilLOTestQuestionAdapter.php.

467 : void
468 {
469 foreach ($this->run as $tst_run) {
470 $tst_run->clearQuestions();
472 ilObject::_lookupObjId($session->getRefId()),
473 $tst_run->getObjectiveId()
474 );
475 $points = 0;
476 foreach ($qst as $id) {
477 $tst_run->addQuestion($id);
479 }
480 $tst_run->setMaxPoints((int) $points);
481 }
482 }
$id
plugin.php for ilComponentBuildPluginInfoObjectiveTest::testAddPlugins
Definition: plugin.php:23
static lookupQuestionsByObjective(int $a_test_id, int $a_objective)
static _lookupMaximumPointsOfQuestion(int $a_question_id)

References $id, ilCourseObjectiveQuestion\_lookupMaximumPointsOfQuestion(), ilObject\_lookupObjId(), ilTestSession\getRefId(), and ilCourseObjectiveQuestion\lookupQuestionsByObjective().

+ Here is the call graph for this function:

◆ updateQuestionResult()

ilLOTestQuestionAdapter::updateQuestionResult ( ilTestSession  $session,
assQuestion  $qst 
)

update question result of run

Definition at line 354 of file class.ilLOTestQuestionAdapter.php.

354 : void
355 {
356 foreach ($this->run as $run) {
357 if ($run->questionExists($qst->getId())) {
358 $GLOBALS['DIC']['ilLog']->write(__METHOD__ . ': reached points are ' . $qst->getReachedPoints(
359 $session->getActiveId(),
360 $session->getPass()
361 ));
362 $run->setQuestionResult(
363 $qst->getId(),
364 $qst->getReachedPoints($session->getActiveId(), $session->getPass())
365 );
366 $run->update();
367
368 $res = $run->getResult();
369
370 $old_result = ilLOUserResults::lookupResult(
371 $this->container_id,
372 $this->user_id,
373 $run->getObjectiveId(),
374 $this->getAssignments()->getTypeByTest($session->getRefId())
375 );
376
377 $ur = new ilLOUserResults($this->container_id, $this->user_id);
378 $ur->saveObjectiveResult(
379 $run->getObjectiveId(),
380 $this->getAssignments()->getTypeByTest($session->getRefId()),
382 $this->container_id,
383 $session->getRefId(),
384 $run->getObjectiveId(),
385 $res['max'],
386 $res['reached'],
387 $old_result['limit_perc']
388 ) ?
391 (float) $res['percentage'],
392 $old_result['limit_perc'],
393 $old_result['tries'],
394 $old_result['is_final']
395 );
396 ilLPStatusWrapper::_updateStatus($this->container_id, $this->user_id);
397 }
398 }
399 }
getReachedPoints(int $active_id, int $pass)
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 _updateStatus(int $a_obj_id, int $a_usr_id, ?object $a_obj=null, bool $a_percentage=false, bool $a_force_raise=false)
$res
Definition: ltiservices.php:69
$GLOBALS["DIC"]
Definition: wac.php:54

References $GLOBALS, $res, ilLPStatusWrapper\_updateStatus(), ilTestSession\getActiveId(), assQuestion\getId(), ilTestSession\getPass(), assQuestion\getReachedPoints(), ilTestSession\getRefId(), ilLOUtils\isCompleted(), ilLOUserResults\lookupResult(), ilLOUserResults\STATUS_COMPLETED, and ilLOUserResults\STATUS_FAILED.

+ Here is the call graph for this function:

◆ updateQuestions()

ilLOTestQuestionAdapter::updateQuestions ( ilTestSession  $session,
ilTestSequence  $seq 
)
protected

Definition at line 439 of file class.ilLOTestQuestionAdapter.php.

439 : void
440 {
441 if ($this->getAssignments()->isSeparateTest($session->getRefId())) {
442 $this->updateSeparateTestQuestions($session, $seq);
443 return;
444 }
445 if ($seq instanceof ilTestSequenceFixedQuestionSet) {
446 $this->updateFixedQuestions($session, $seq);
447 return;
448 }
449 if ($seq instanceof ilTestSequenceRandomQuestionSet) {
450 $this->updateRandomQuestions($session, $seq);
451 }
452 }
updateSeparateTestQuestions(ilTestSession $session, ilTestSequence $seq)
updateRandomQuestions(ilTestSession $session, ilTestSequenceRandomQuestionSet $seq)
updateFixedQuestions(ilTestSession $session, ilTestSequence $seq)

References ilTestSession\getRefId().

Referenced by prepareTestPass().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ updateRandomQuestions()

ilLOTestQuestionAdapter::updateRandomQuestions ( ilTestSession  $session,
ilTestSequenceRandomQuestionSet  $seq 
)
protected

Definition at line 484 of file class.ilLOTestQuestionAdapter.php.

484 : void
485 {
486 foreach ($this->run as $tst_run) {
487 // Clear questions of previous run
488 $tst_run->clearQuestions();
489
491 $this->container_id,
492 $tst_run->getObjectiveId(),
493 ilObject::_lookupObjId($session->getRefId()),
494 (
495 ($this->getSettings()->getQualifiedTest() === $session->getRefId()) ?
498 )
499 );
500
501 $points = 0;
502 foreach ($seq->getQuestionIds() as $qst) {
503 if (in_array($seq->getResponsibleSourcePoolDefinitionId($qst), $sequences)) {
504 $tst_run->addQuestion($qst);
506 }
507 }
508 $tst_run->setMaxPoints((int) $points);
509 }
510 }
static lookupSequencesByType(int $a_container_id, int $a_objective_id, int $a_test_id, int $a_test_type)

References ilCourseObjectiveQuestion\_lookupMaximumPointsOfQuestion(), ilObject\_lookupObjId(), ilTestSequence\getQuestionIds(), ilTestSession\getRefId(), ilTestSequenceRandomQuestionSet\getResponsibleSourcePoolDefinitionId(), ilLORandomTestQuestionPools\lookupSequencesByType(), ilLOSettings\TYPE_TEST_INITIAL, and ilLOSettings\TYPE_TEST_QUALIFIED.

+ Here is the call graph for this function:

◆ updateSeparateTestQuestions()

ilLOTestQuestionAdapter::updateSeparateTestQuestions ( ilTestSession  $session,
ilTestSequence  $seq 
)
protected

Definition at line 454 of file class.ilLOTestQuestionAdapter.php.

454 : void
455 {
456 foreach ($this->run as $tst_run) {
457 $tst_run->clearQuestions();
458 $points = 0;
459 foreach ($seq->getQuestionIds() as $qst_id) {
460 $tst_run->addQuestion($qst_id);
462 }
463 $tst_run->setMaxPoints((int) $points);
464 }
465 }

References ilCourseObjectiveQuestion\_lookupMaximumPointsOfQuestion(), and ilTestSequence\getQuestionIds().

+ Here is the call graph for this function:

Field Documentation

◆ $assignments

ilLOTestAssignments ilLOTestQuestionAdapter::$assignments
protected

Definition at line 28 of file class.ilLOTestQuestionAdapter.php.

Referenced by lookupRelevantObjectiveIdsForTest().

◆ $container_id

int ilLOTestQuestionAdapter::$container_id = 0
protected

Definition at line 35 of file class.ilLOTestQuestionAdapter.php.

◆ $logger

ilLogger ilLOTestQuestionAdapter::$logger
protected

Definition at line 38 of file class.ilLOTestQuestionAdapter.php.

◆ $run

array ilLOTestQuestionAdapter::$run = []
protected

Definition at line 33 of file class.ilLOTestQuestionAdapter.php.

Referenced by notifyTestStart().

◆ $settings

ilLOSettings ilLOTestQuestionAdapter::$settings
protected

Definition at line 27 of file class.ilLOTestQuestionAdapter.php.

◆ $testRefId

int ilLOTestQuestionAdapter::$testRefId = null
protected

Definition at line 36 of file class.ilLOTestQuestionAdapter.php.

Referenced by getTestRefId(), and setTestRefId().

◆ $user_id

int ilLOTestQuestionAdapter::$user_id = 0
protected

Definition at line 34 of file class.ilLOTestQuestionAdapter.php.


The documentation for this class was generated from the following file: