ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
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 24 of file class.ilLOTestQuestionAdapter.php.

Constructor & Destructor Documentation

◆ __construct()

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

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

40 {
41 global $DIC;
42
43 $this->logger = $DIC->logger()->crs();
44 $this->user_id = $a_user_id;
45 $this->container_id = $a_course_id;
46 $this->settings = ilLOSettings::getInstanceByObjId($this->container_id);
47 $this->assignments = ilLOTestAssignments::getInstance($this->container_id);
48 }
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 173 of file class.ilLOTestQuestionAdapter.php.

176 : void {
177 $testType = $this->assignments->getTypeByTest($this->getTestRefId());
178
179 if ($testType == ilLOSettings::TYPE_TEST_INITIAL && $this->getSettings()->hasSeparateInitialTests()) {
180 $this->buildQuestionRelatedObjectiveListByTest($a_test_sequence, $a_objectives_list);
181 } elseif ($testType == ilLOSettings::TYPE_TEST_QUALIFIED && $this->getSettings()->hasSeparateQualifiedTests()) {
182 $this->buildQuestionRelatedObjectiveListByTest($a_test_sequence, $a_objectives_list);
183 } else {
184 $this->buildQuestionRelatedObjectiveListByQuestions($a_test_sequence, $a_objectives_list);
185 }
186 }
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 199 of file class.ilLOTestQuestionAdapter.php.

202 : void {
203 foreach ($a_test_sequence->getQuestionIds() as $questionId) {
204 if ($a_test_sequence instanceof ilTestRandomQuestionSequence) {
205 $definitionId = $a_test_sequence->getResponsibleSourcePoolDefinitionId($questionId);
206 $objectiveIds = $this->lookupObjectiveIdByRandomQuestionSelectionDefinitionId($definitionId);
207 } else {
208 $objectiveIds = $this->lookupObjectiveIdByFixedQuestionId($questionId);
209 }
210
211 if ($objectiveIds !== []) {
212 $a_objectives_list->addQuestionRelatedObjectives($questionId, $objectiveIds);
213 }
214 }
215 }
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 188 of file class.ilLOTestQuestionAdapter.php.

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

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 252 of file class.ilLOTestQuestionAdapter.php.

253 {
254 return $this->assignments;
255 }
Settings for LO courses.

◆ getContainerId()

ilLOTestQuestionAdapter::getContainerId ( )
protected

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

242 : int
243 {
244 return $this->container_id;
245 }

◆ getInstance()

static ilLOTestQuestionAdapter::getInstance ( ilTestSession  $a_test_session)
static

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

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

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 227 of file class.ilLOTestQuestionAdapter.php.

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

◆ getSettings()

ilLOTestQuestionAdapter::getSettings ( )
protected

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

248 {
249 return $this->settings;
250 }
Settings for LO courses.

Referenced by lookupRelevantObjectiveIdsForTest(), and prepareTestPass().

+ Here is the caller graph for this function:

◆ getTestRefId()

ilLOTestQuestionAdapter::getTestRefId ( )

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

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

References $testRefId.

◆ getUserId()

ilLOTestQuestionAdapter::getUserId ( )
protected

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

237 : int
238 {
239 return $this->user_id;
240 }

References $user_id.

◆ hideQuestions()

ilLOTestQuestionAdapter::hideQuestions ( ilTestSequence  $seq)
protected

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

409 : void
410 {
411 // first unhide all questions
412 $seq->clearHiddenQuestions();
413 foreach ($seq->getQuestionIds() as $qid) {
414 if (!$this->isInRun($qid)) {
415 $seq->hideQuestion($qid);
416 }
417 }
418 }
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 420 of file class.ilLOTestQuestionAdapter.php.

420 : void
421 {
422 $this->run = ilLOTestRun::getRun(
423 $this->container_id,
424 $this->user_id,
426 );
427 }
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 257 of file class.ilLOTestQuestionAdapter.php.

257 : void
258 {
259 // check if current test is start object and fullfilled
260 // if yes => do not increase tries.
261 $is_qualified_run = false;
262 if ($this->isQualifiedStartRun($session)) {
263 $is_qualified_run = true;
264 }
265
266 foreach ($this->run as $run) {
267 $old_result = ilLOUserResults::lookupResult(
268 $this->container_id,
269 $this->user_id,
270 $run->getObjectiveId(),
271 $this->getAssignments()->getTypeByTest($session->getRefId())
272 );
273
275 $this->container_id,
276 $run->getObjectiveId(),
277 $session->getRefId(),
278 $run->getMaxPoints()
279 );
280
281 $max_attempts = ilLOUtils::lookupMaxAttempts(
282 $this->container_id,
283 $run->getObjectiveId(),
284 $session->getRefId()
285 );
286
287 $this->logger->debug('Max attempts = ' . $max_attempts);
288
289 if ($max_attempts) {
290 // check if current test is start object and fullfilled
291 // if yes => do not increase tries.
292 $this->logger->debug('Checking for qualified test...');
293 if (!$is_qualified_run) {
294 $this->logger->debug(' and increasing attempts.');
295 ++$old_result['tries'];
296 }
297 $old_result['is_final'] = ($old_result['tries'] >= $max_attempts);
298 }
299
300 $ur = new ilLOUserResults($this->container_id, $this->user_id);
301 $ur->saveObjectiveResult(
302 $run->getObjectiveId(),
303 $this->getAssignments()->getTypeByTest($session->getRefId()),
304 $old_result['status'],
305 $old_result['result_perc'],
306 $limit,
307 $old_result['tries'],
308 $old_result['is_final']
309 );
310 }
311 }
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 509 of file class.ilLOTestQuestionAdapter.php.

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

◆ isQualifiedStartRun()

ilLOTestQuestionAdapter::isQualifiedStartRun ( ilTestSession  $session)
protected

Check if current run is a start object run.

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

316 : bool
317 {
318 if ($this->getAssignments()->getTypeByTest($session->getRefId()) == ilLOSettings::TYPE_TEST_INITIAL) {
319 $this->logger->debug('Initial test');
320 return false;
321 }
322
323 if ($session->getRefId() !== $this->getSettings()->getQualifiedTest()) {
324 $this->logger->debug('No qualified test run');
325 return false;
326 }
328 $this->logger->debug('No start object');
329 return false;
330 }
331 // Check if start object is fullfilled
332
333 $container_ref_ids = ilObject::_getAllReferences($this->getContainerId());
334 $container_ref_id = end($container_ref_ids);
335
336 $start = new ilContainerStartObjects(
337 $container_ref_id,
338 $this->getContainerId()
339 );
340 if ($start->isFullfilled($this->getUserId(), $session->getRefId())) {
341 $this->logger->debug('Is fullfilled');
342 return false;
343 }
344 $this->logger->debug('Is not fullfilled');
345 return true;
346 }
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 222 of file class.ilLOTestQuestionAdapter.php.

222 : array
223 {
225 }

References ilCourseObjectiveQuestion\lookupObjectivesOfQuestion().

+ Here is the call graph for this function:

◆ lookupObjectiveIdByRandomQuestionSelectionDefinitionId()

ilLOTestQuestionAdapter::lookupObjectiveIdByRandomQuestionSelectionDefinitionId ( int  $a_id)
protected

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

217 : array
218 {
220 }
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 60 of file class.ilLOTestQuestionAdapter.php.

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

118 : void
119 {
120 $relevant_objectives = $this->lookupRelevantObjectiveIdsForTest(
121 $a_test_session->getObjectiveOrientedContainerId(),
122 $a_test_session->getRefId(),
123 $a_test_session->getUserId()
124 );
125 $this->logger->debug('Notify test start: ' . print_r($relevant_objectives, true));
126
127 // delete test runs
129 $a_test_session->getObjectiveOrientedContainerId(),
130 $a_test_session->getUserId(),
131 $a_test_obj_id
132 );
133
134 foreach ($relevant_objectives as $oid) {
135 $this->logger->debug('Adding new run for objective with id: ' . $oid);
136 $run = new ilLOTestRun(
137 $a_test_session->getObjectiveOrientedContainerId(),
138 $a_test_session->getUserId(),
139 $a_test_obj_id,
140 $oid
141 );
142 $run->create();
143 }
144
145 // finally reinitialize test runs
146 $this->initTestRun($a_test_session);
147 }
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 152 of file class.ilLOTestQuestionAdapter.php.

152 : bool
153 {
154 $this->logger->debug('Prepare test pass called');
155
156 $this->updateQuestions($a_test_session, $a_test_sequence);
157
158 if ($this->getSettings()->getPassedObjectiveMode() == ilLOSettings::MARK_PASSED_OBJECTIVE_QST) {
159 $this->setQuestionsOptional($a_test_sequence);
160 } elseif ($this->getSettings()->getPassedObjectiveMode() == ilLOSettings::HIDE_PASSED_OBJECTIVE_QST) {
161 $this->hideQuestions($a_test_sequence);
162 }
163
164 $this->storeTestRun();
165 $this->initUserResult($a_test_session);
166
167 // Save test sequence
168 $a_test_sequence->saveToDb();
169
170 return true;
171 }
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 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 398 of file class.ilLOTestQuestionAdapter.php.

398 : void
399 {
400 // first unset optional on all questions
402 foreach ($seq->getQuestionIds() as $qid) {
403 if (!$this->isInRun($qid)) { // but is assigned to any LO
404 $seq->setQuestionOptional($qid);
405 }
406 }
407 }
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 55 of file class.ilLOTestQuestionAdapter.php.

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

References $testRefId.

◆ storeTestRun()

ilLOTestQuestionAdapter::storeTestRun ( )
protected

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

429 : void
430 {
431 foreach ($this->run as $tst_run) {
432 $tst_run->update();
433 }
434 }

Referenced by prepareTestPass().

+ Here is the caller graph for this function:

◆ updateFixedQuestions()

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

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

464 : void
465 {
466 foreach ($this->run as $tst_run) {
467 $tst_run->clearQuestions();
469 ilObject::_lookupObjId($session->getRefId()),
470 $tst_run->getObjectiveId()
471 );
472 $points = 0;
473 foreach ($qst as $id) {
474 $tst_run->addQuestion($id);
476 }
477 $tst_run->setMaxPoints((int) $points);
478 }
479 }
$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 351 of file class.ilLOTestQuestionAdapter.php.

351 : void
352 {
353 foreach ($this->run as $run) {
354 if ($run->questionExists($qst->getId())) {
355 $GLOBALS['DIC']['ilLog']->write(__METHOD__ . ': reached points are ' . $qst->getReachedPoints(
356 $session->getActiveId(),
357 $session->getPass()
358 ));
359 $run->setQuestionResult(
360 $qst->getId(),
361 $qst->getReachedPoints($session->getActiveId(), $session->getPass())
362 );
363 $run->update();
364
365 $res = $run->getResult();
366
367 $old_result = ilLOUserResults::lookupResult(
368 $this->container_id,
369 $this->user_id,
370 $run->getObjectiveId(),
371 $this->getAssignments()->getTypeByTest($session->getRefId())
372 );
373
374 $ur = new ilLOUserResults($this->container_id, $this->user_id);
375 $ur->saveObjectiveResult(
376 $run->getObjectiveId(),
377 $this->getAssignments()->getTypeByTest($session->getRefId()),
379 $this->container_id,
380 $session->getRefId(),
381 $run->getObjectiveId(),
382 $res['max'],
383 $res['reached'],
384 $old_result['limit_perc']
385 ) ?
388 (float) $res['percentage'],
389 $old_result['limit_perc'],
390 $old_result['tries'],
391 $old_result['is_final']
392 );
393 ilLPStatusWrapper::_updateStatus($this->container_id, $this->user_id);
394 }
395 }
396 }
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 436 of file class.ilLOTestQuestionAdapter.php.

436 : void
437 {
438 if ($this->getAssignments()->isSeparateTest($session->getRefId())) {
439 $this->updateSeparateTestQuestions($session, $seq);
440 return;
441 }
442 if ($seq instanceof ilTestSequenceFixedQuestionSet) {
443 $this->updateFixedQuestions($session, $seq);
444 return;
445 }
446 if ($seq instanceof ilTestSequenceRandomQuestionSet) {
447 $this->updateRandomQuestions($session, $seq);
448 }
449 }
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 481 of file class.ilLOTestQuestionAdapter.php.

481 : void
482 {
483 foreach ($this->run as $tst_run) {
484 // Clear questions of previous run
485 $tst_run->clearQuestions();
486
488 $this->container_id,
489 $tst_run->getObjectiveId(),
490 ilObject::_lookupObjId($session->getRefId()),
491 (
492 ($this->getSettings()->getQualifiedTest() === $session->getRefId()) ?
495 )
496 );
497
498 $points = 0;
499 foreach ($seq->getQuestionIds() as $qst) {
500 if (in_array($seq->getResponsibleSourcePoolDefinitionId($qst), $sequences)) {
501 $tst_run->addQuestion($qst);
503 }
504 }
505 $tst_run->setMaxPoints((int) $points);
506 }
507 }
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 451 of file class.ilLOTestQuestionAdapter.php.

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

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

+ Here is the call graph for this function:

Field Documentation

◆ $assignments

ilLOTestAssignments ilLOTestQuestionAdapter::$assignments
protected

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

Referenced by lookupRelevantObjectiveIdsForTest().

◆ $container_id

int ilLOTestQuestionAdapter::$container_id = 0
protected

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

◆ $logger

ilLogger ilLOTestQuestionAdapter::$logger
protected

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

◆ $run

array ilLOTestQuestionAdapter::$run = []
protected

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

Referenced by notifyTestStart().

◆ $settings

ilLOSettings ilLOTestQuestionAdapter::$settings
protected

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

◆ $testRefId

int ilLOTestQuestionAdapter::$testRefId = null
protected

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

Referenced by getTestRefId(), and setTestRefId().

◆ $user_id

int ilLOTestQuestionAdapter::$user_id = 0
protected

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


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