ILIAS  release_8 Revision v8.23
class.ilTestEvaluationPassData.php
Go to the documentation of this file.
1 <?php
2 
33 {
40 
46  private $workingtime;
47 
53  private $questioncount;
54 
60  private $maxpoints;
61 
67  private float $reachedpoints = 0.0;
68 
75 
81  public $pass;
82 
88  private $requestedHintsCount = null;
89 
95  private $deductedHintPoints = null;
96 
102  private $obligationsAnswered = null;
103 
105  private $examId = '';
106 
107  public function __sleep()
108  {
109  return array('answeredQuestions', 'pass', 'nrOfAnsweredQuestions', 'reachedpoints',
110  'maxpoints', 'questioncount', 'workingtime', 'examId');
111  }
112 
118  public function __construct()
119  {
120  $this->answeredQuestions = array();
121  }
122 
123  public function getNrOfAnsweredQuestions(): int
124  {
126  }
127 
129  {
130  $this->nrOfAnsweredQuestions = $nrOfAnsweredQuestions;
131  }
132 
133  public function getReachedPoints(): float
134  {
135  return $this->reachedpoints;
136  }
137 
138  public function setReachedPoints(float $reachedpoints): void
139  {
140  $this->reachedpoints = $reachedpoints;
141  }
142 
143  public function getMaxPoints(): float
144  {
145  return $this->maxpoints;
146  }
147 
148  public function setMaxPoints($maxpoints)
149  {
150  $this->maxpoints = $maxpoints;
151  }
152 
153  public function getQuestionCount(): int
154  {
155  return $this->questioncount;
156  }
157 
159  {
160  $this->questioncount = $questioncount;
161  }
162 
163  public function getWorkingTime(): int
164  {
165  return $this->workingtime;
166  }
167 
168  public function setWorkingTime($workingtime)
169  {
170  $this->workingtime = $workingtime;
171  }
172 
173  public function getPass(): int
174  {
175  return $this->pass;
176  }
177 
178  public function setPass($a_pass)
179  {
180  $this->pass = $a_pass;
181  }
182 
183  public function getAnsweredQuestions(): array
184  {
186  }
187 
188  public function addAnsweredQuestion($question_id, $max_points, $reached_points, $isAnswered, $sequence = null, $manual = 0)
189  {
190  $this->answeredQuestions[] = array(
191  "id" => $question_id,
192  "points" => round($max_points, 2),
193  "reached" => round($reached_points, 2),
194  'isAnswered' => $isAnswered,
195  "sequence" => $sequence,
196  'manual' => $manual
197  );
198  }
199 
200  public function getAnsweredQuestion($index)
201  {
202  if (array_key_exists($index, $this->answeredQuestions)) {
203  return $this->answeredQuestions[$index];
204  } else {
205  return null;
206  }
207  }
208 
209  public function getAnsweredQuestionByQuestionId($question_id)
210  {
211  foreach ($this->answeredQuestions as $question) {
212  if ($question["id"] == $question_id) {
213  return $question;
214  }
215  }
216  return null;
217  }
218 
219  public function getAnsweredQuestionCount(): int
220  {
221  return count($this->answeredQuestions);
222  }
223 
229  public function getRequestedHintsCount(): ?int
230  {
232  }
233 
240  {
241  $this->requestedHintsCount = $requestedHintsCount;
242  }
243 
249  public function getDeductedHintPoints(): ?int
250  {
252  }
253 
260  {
261  $this->deductedHintPoints = $deductedHintPoints;
262  }
263 
270  {
271  $this->obligationsAnswered = (bool) $obligationsAnswered;
272  }
273 
277  public function getExamId(): string
278  {
279  return $this->examId;
280  }
281 
285  public function setExamId(string $examId): void
286  {
287  $this->examId = $examId;
288  }
289 
300  public function areObligationsAnswered(): ?bool
301  {
302  if (!is_null($this->obligationsAnswered)) {
304  }
305 
306  if (is_array($this->answeredQuestions) && count($this->answeredQuestions)) {
307  foreach ($this->answeredQuestions as $question) {
308  if (!$question['isAnswered']) {
309  return false;
310  }
311  }
312 
313  return true;
314  }
315 
316  throw new ilTestEvaluationException(
317  'Neither the boolean property ilTestEvaluationPassData::obligationsAnswered was set, ' .
318  'nor the property array property ilTestEvaluationPassData::answeredQuestions contains elements!'
319  );
320  }
321 } // END ilTestEvaluationPassData
setRequestedHintsCount($requestedHintsCount)
Setter for $requestedHintsCount.
setNrOfAnsweredQuestions($nrOfAnsweredQuestions)
$index
Definition: metadata.php:145
getRequestedHintsCount()
Getter for $requestedHintsCount.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
setDeductedHintPoints($deductedHintPoints)
Setter for $deductedHintPoints.
setObligationsAnswered($obligationsAnswered)
setter for property obligationsAnswered
areObligationsAnswered()
getter for property obligationsAnswered.
getDeductedHintPoints()
Getter for $deductedHintPoints.
addAnsweredQuestion($question_id, $max_points, $reached_points, $isAnswered, $sequence=null, $manual=0)