ILIAS  release_6 Revision v6.24-5-g0c8bfefb3b8
class.ilTestEvaluationPassData.php
Go to the documentation of this file.
1<?php
2/* Copyright (c) 1998-2013 ILIAS open source, Extended GPL, see docs/LICENSE */
3
4require_once('Modules/Test/exceptions/class.ilTestEvaluationException.php');
5
20{
27
33 private $workingtime;
34
41
47 private $maxpoints;
48
55
62
68 public $pass;
69
75 private $requestedHintsCount = null;
76
82 private $deductedHintPoints = null;
83
89 private $obligationsAnswered = null;
90
92 private $examId = '';
93
94 public function __sleep()
95 {
96 return array('answeredQuestions', 'pass', 'nrOfAnsweredQuestions', 'reachedpoints',
97 'maxpoints', 'questioncount', 'workingtime', 'examId');
98 }
99
105 public function __construct()
106 {
107 $this->answeredQuestions = array();
108 }
109
110 public function getNrOfAnsweredQuestions()
111 {
113 }
114
116 {
117 $this->nrOfAnsweredQuestions = $nrOfAnsweredQuestions;
118 }
119
120 public function getReachedPoints()
121 {
123 }
124
126 {
127 $this->reachedpoints = $reachedpoints;
128 }
129
130 public function getMaxPoints()
131 {
132 return $this->maxpoints;
133 }
134
135 public function setMaxPoints($maxpoints)
136 {
137 $this->maxpoints = $maxpoints;
138 }
139
140 public function getQuestionCount()
141 {
143 }
144
146 {
147 $this->questioncount = $questioncount;
148 }
149
150 public function getWorkingTime()
151 {
152 return $this->workingtime;
153 }
154
156 {
157 $this->workingtime = $workingtime;
158 }
159
160 public function getPass()
161 {
162 return $this->pass;
163 }
164
165 public function setPass($a_pass)
166 {
167 $this->pass = $a_pass;
168 }
169
170 public function getAnsweredQuestions()
171 {
173 }
174
175 public function addAnsweredQuestion($question_id, $max_points, $reached_points, $isAnswered, $sequence = null, $manual = 0)
176 {
177 $this->answeredQuestions[] = array(
178 "id" => $question_id,
179 "points" => round($max_points, 2),
180 "reached" => round($reached_points, 2),
181 'isAnswered' => $isAnswered,
182 "sequence" => $sequence,
183 'manual' => $manual
184 );
185 }
186
188 {
189 if (array_key_exists($index, $this->answeredQuestions)) {
190 return $this->answeredQuestions[$index];
191 } else {
192 return null;
193 }
194 }
195
196 public function getAnsweredQuestionByQuestionId($question_id)
197 {
198 foreach ($this->answeredQuestions as $question) {
199 if ($question["id"] == $question_id) {
200 return $question;
201 }
202 }
203 return null;
204 }
205
206 public function getAnsweredQuestionCount()
207 {
208 return count($this->answeredQuestions);
209 }
210
216 public function getRequestedHintsCount()
217 {
219 }
220
227 {
228 $this->requestedHintsCount = $requestedHintsCount;
229 }
230
236 public function getDeductedHintPoints()
237 {
239 }
240
247 {
248 $this->deductedHintPoints = $deductedHintPoints;
249 }
250
257 {
258 $this->obligationsAnswered = (bool) $obligationsAnswered;
259 }
260
264 public function getExamId() : string
265 {
266 return $this->examId;
267 }
268
272 public function setExamId(string $examId) : void
273 {
274 $this->examId = $examId;
275 }
276
287 public function areObligationsAnswered()
288 {
289 if (!is_null($this->obligationsAnswered)) {
291 }
292
293 if (is_array($this->answeredQuestions) && count($this->answeredQuestions)) {
294 foreach ($this->answeredQuestions as $question) {
295 if (!$question['isAnswered']) {
296 return false;
297 }
298 }
299
300 return true;
301 }
302
304 'Neither the boolean property ilTestEvaluationPassData::obligationsAnswered was set, ' .
305 'nor the property array property ilTestEvaluationPassData::answeredQuestions contains elements!'
306 );
307 }
308} // END ilTestEvaluationPassData
An exception for terminatinating execution or to throw for unit testing.
setRequestedHintsCount($requestedHintsCount)
Setter for $requestedHintsCount.
addAnsweredQuestion($question_id, $max_points, $reached_points, $isAnswered, $sequence=null, $manual=0)
setObligationsAnswered($obligationsAnswered)
setter for property obligationsAnswered
setDeductedHintPoints($deductedHintPoints)
Setter for $deductedHintPoints.
setNrOfAnsweredQuestions($nrOfAnsweredQuestions)
getRequestedHintsCount()
Getter for $requestedHintsCount.
areObligationsAnswered()
getter for property obligationsAnswered.
getDeductedHintPoints()
Getter for $deductedHintPoints.
$index
Definition: metadata.php:128