19 declare(strict_types=1);
49 return [
'questions',
'passes',
'passed',
'lastVisit',
'firstVisit',
'timeOfWork',
'numberOfQuestions',
50 'questionsWorkedThrough',
'mark_official',
'mark',
'maxpoints',
'reached',
'user_id',
'login',
51 'name',
'passScoring'];
55 private int $pass_scoring
61 return $this->pass_scoring;
66 $this->pass_scoring = $passScoring;
111 return $this->getMaxPoints() ? $this->
getReached() / $this->getMaxPoints() * 100.0 : 0.0;
127 if (!isset($this->passes[$questionpass])) {
131 if (isset($this->passes[$questionpass])) {
132 return $this->passes[$questionpass]->getNrOfAnsweredQuestions();
141 if (!isset($this->passes[$questionpass])) {
145 if (isset($this->passes[$questionpass])) {
146 return $this->passes[$questionpass]->getQuestionCount();
160 foreach ($this->passes as $pass) {
161 $time += $pass->getWorkingTime();
173 $this->first_visit = $time;
183 $this->last_visit = $time;
196 $this->passes[$pass_nr] = $pass;
201 return $this->passes[$pass_nr] ??
null;
206 return count($this->passes);
226 foreach ($this->passes as $pass) {
229 if ($reached > $bestpoints || !isset($bestpass)) {
230 $bestpoints = $reached;
231 $bestpass = $pass->getPass();
235 return (
int) $bestpass;
241 foreach (array_keys($this->passes) as $pass) {
242 if ($pass > $lastpass) {
261 $this->last_finished_pass = $pass;
265 $this->question_titles[$question_id] = $question_title;
282 return $this->questions[$pass] ??
null;
285 public function addQuestion(
int $original_id,
int $question_id,
float $max_points, ?
int $sequence =
null,
int $pass = 0): void
287 if (!isset($this->questions[$pass])) {
288 $this->questions[$pass] = [];
291 $this->questions[$pass][] = [
292 'id' => $question_id,
293 'o_id' => $original_id,
294 'points' => $max_points,
295 'sequence' => $sequence
304 return $this->questions[$pass][$index] ??
null;
309 if (!isset($this->questions[$attempt])) {
313 $question = array_filter(
314 $this->questions[$attempt],
315 fn(array $v):
bool => $v[
'id'] === $question_id
318 if ($question === []) {
322 return array_shift($question);
328 if (array_key_exists($pass, $this->passes)) {
329 $count = $this->passes[$pass]->getQuestionCount();
337 if (array_key_exists($pass, $this->passes)) {
338 $reached = $this->passes[$pass]->getReachedPoints();
340 $reached = ($reached < 0) ? 0 : $reached;
341 $reached = round($reached, 2);
347 if (!isset($this->passes[$pass]) || !is_object($this->passes[$pass])) {
350 if (!isset($this->passes[$pass]) || !is_object($this->passes[$pass])) {
354 $available = $this->passes[$pass]->getMaxPoints();
355 $available = round($available, 2);
364 $percent = ($available > 0) ? $reached / $available : 0;
397 $exam_id = $this->passes[$scored_pass]->getExamId();
412 foreach ($this->passes as $pass) {
415 if ($reached >= $bestpoints) {
416 $bestpoints = $reached;
417 $bestpass_bject = $pass;
421 return $bestpass_bject;
432 foreach (array_keys($this->passes) as $passIndex) {
433 if ($passIndex > $lastpassIndex) {
434 $lastpassIndex = $passIndex;
438 $lastpassObject = $this->passes[$lastpassIndex];
440 return $lastpassObject;
getQuestionsWorkedThroughInPercent()
getReachedPointsInPercent()
DateTimeImmutable $last_visit
getBestPass()
This is used in the export of test results Aligned with ilObjTest::_getBestPass: from passes with equ...
A class defining marks for assessment test objects.
setFirstVisit(?\DateTimeImmutable $time)
getQuestions(int $pass=0)
setPassScoring(int $passScoring)
addPass(int $pass_nr, ilTestEvaluationPassData $pass)
login()
description: > Example for rendring a login glyph.
addQuestionTitle(int $question_id, string $question_title)
setLastFinishedPass(?int $pass=null)
getScoredPassObject()
returns the object of class ilTestEvaluationPassData that relates to the the scored test pass (best p...
setSubmitted(bool $submitted)
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
DateTimeImmutable $first_visit
getQuestionByAttemptAndId(int $attempt, int $question_id)
getQuestionsWorkedThrough()
getBestPassObject()
returns the object of class ilTestEvaluationPassData that relates to the the best test pass ...
getLastPassObject()
returns the object of class ilTestEvaluationPassData that relates to the the last test pass ...
__construct(private int $pass_scoring)
setLastVisit(?\DateTimeImmutable $time)
getQuestion(int $index, int $pass=0)
getAvailablePoints(int $pass=0)
getReachedPointsInPercentForPass(int $pass=0)
getReachedPoints(int $pass=0)
getQuestionCount(int $pass=0)
addQuestion(int $original_id, int $question_id, float $max_points, ?int $sequence=null, int $pass=0)
getExamIdFromScoredPass()