ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
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
91 public function __sleep()
92 {
93 return array('answeredQuestions', 'pass', 'nrOfAnsweredQuestions', 'reachedpoints',
94 'maxpoints', 'questioncount', 'workingtime');
95 }
96
102 public function __construct()
103 {
104 $this->answeredQuestions = array();
105 }
106
107 public function getNrOfAnsweredQuestions()
108 {
110 }
111
113 {
114 $this->nrOfAnsweredQuestions = $nrOfAnsweredQuestions;
115 }
116
117 public function getReachedPoints()
118 {
120 }
121
123 {
124 $this->reachedpoints = $reachedpoints;
125 }
126
127 public function getMaxPoints()
128 {
129 return $this->maxpoints;
130 }
131
132 public function setMaxPoints($maxpoints)
133 {
134 $this->maxpoints = $maxpoints;
135 }
136
137 public function getQuestionCount()
138 {
140 }
141
143 {
144 $this->questioncount = $questioncount;
145 }
146
147 public function getWorkingTime()
148 {
149 return $this->workingtime;
150 }
151
153 {
154 $this->workingtime = $workingtime;
155 }
156
157 public function getPass()
158 {
159 return $this->pass;
160 }
161
162 public function setPass($a_pass)
163 {
164 $this->pass = $a_pass;
165 }
166
167 public function getAnsweredQuestions()
168 {
170 }
171
172 public function addAnsweredQuestion($question_id, $max_points, $reached_points, $isAnswered, $sequence = null, $manual = 0)
173 {
174 $this->answeredQuestions[] = array(
175 "id" => $question_id,
176 "points" => round($max_points, 2),
177 "reached" => round($reached_points, 2),
178 'isAnswered' => $isAnswered,
179 "sequence" => $sequence,
180 'manual' => $manual
181 );
182 }
183
184 public function &getAnsweredQuestion($index)
185 {
186 if (array_key_exists($index, $this->answeredQuestions)) {
187 return $this->answeredQuestions[$index];
188 } else {
189 return null;
190 }
191 }
192
193 public function &getAnsweredQuestionByQuestionId($question_id)
194 {
195 foreach ($this->answeredQuestions as $question) {
196 if ($question["id"] == $question_id) {
197 return $question;
198 }
199 }
200 return null;
201 }
202
203 public function getAnsweredQuestionCount()
204 {
205 return count($this->answeredQuestions);
206 }
207
213 public function getRequestedHintsCount()
214 {
216 }
217
224 {
225 $this->requestedHintsCount = $requestedHintsCount;
226 }
227
233 public function getDeductedHintPoints()
234 {
236 }
237
244 {
245 $this->deductedHintPoints = $deductedHintPoints;
246 }
247
254 {
255 $this->obligationsAnswered = (bool) $obligationsAnswered;
256 }
257
268 public function areObligationsAnswered()
269 {
270 if (!is_null($this->obligationsAnswered)) {
272 }
273
274 if (is_array($this->answeredQuestions) && count($this->answeredQuestions)) {
275 foreach ($this->answeredQuestions as $question) {
276 if (!$question['isAnswered']) {
277 return false;
278 }
279 }
280
281 return true;
282 }
283
285 'Neither the boolean property ilTestEvaluationPassData::obligationsAnswered was set, ' .
286 'nor the property array property ilTestEvaluationPassData::answeredQuestions contains elements!'
287 );
288 }
289} // 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:60