ILIAS  release_8 Revision v8.24
class.ilTestSequenceFixedQuestionSet.php
Go to the documentation of this file.
1<?php
25{
30 public function removeQuestion($questionId, ilTestReindexedSequencePositionMap $reindexedSequencePositionMap): void
31 {
32 foreach ($this->sequencedata['sequence'] as $key => $oldSequenceElement) {
33 $newSequenceElement = $reindexedSequencePositionMap->getNewSequencePosition($oldSequenceElement);
34
35 if ($newSequenceElement) {
36 $this->sequencedata['sequence'][$key] = $newSequenceElement;
37 } else {
38 unset($this->sequencedata['sequence'][$key]);
39 }
40 }
41
42 $this->sequencedata['sequence'] = array_values($this->sequencedata['sequence']);
43
44 $this->sequencedata['postponed'] = $this->removeArrayValue($this->sequencedata['postponed'], $questionId);
45 $this->sequencedata['hidden'] = $this->removeArrayValue($this->sequencedata['hidden'], $questionId);
46
47 $this->optionalQuestions = $this->removeArrayValue($this->optionalQuestions, $questionId);
48
49 $this->alreadyPresentedQuestions = $this->removeArrayValue($this->alreadyPresentedQuestions, $questionId);
50
51 $this->alreadyCheckedQuestions = $this->removeArrayValue($this->alreadyCheckedQuestions, $questionId);
52 }
53
54 private function removeArrayValue($array, $value)
55 {
56 foreach ($array as $key => $val) {
57 if ($val == $value) {
58 unset($array[$key]);
59 }
60 }
61
62 return $array;
63 }
64}
removeQuestion($questionId, ilTestReindexedSequencePositionMap $reindexedSequencePositionMap)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
string $key
Consumer key/client ID value.
Definition: System.php:193