19 declare(strict_types=1);
31 require_once
'./Modules/Test/classes/inc.AssessmentConstants.php';
68 return array(
'questions',
'passes',
'passed',
'lastVisit',
'firstVisit',
'timeOfWork',
'numberOfQuestions',
69 'questionsWorkedThrough',
'mark_official',
'mark',
'maxpoints',
'reached',
'user_id',
'login',
70 'name',
'passScoring');
76 $this->questions = [];
77 $this->passed =
false;
148 $this->maxpoints = $max_points;
153 return $this->getMaxPoints() ? $this->
getReached() / $this->getMaxPoints() * 100.0 : 0;
163 $this->mark = $a_mark;
169 if (!isset($this->passes[$questionpass])) {
173 if (isset($this->passes[$questionpass])) {
174 return $this->passes[$questionpass]->getNrOfAnsweredQuestions();
182 $this->questionsWorkedThrough = $nr;
188 if (!isset($this->passes[$questionpass])) {
192 if (isset($this->passes[$questionpass])) {
193 return $this->passes[$questionpass]->getQuestionCount();
201 $this->numberOfQuestions = $nr;
212 foreach ($this->passes as $pass) {
213 $time += $pass->getWorkingTime();
220 $this->timeOfWork = $time_of_work;
230 $this->firstVisit = $time;
240 $this->lastVisit = $time;
253 $this->passes[$pass_nr] = $pass;
258 return $this->passes[$pass_nr] ?? null;
263 return count($this->passes);
285 foreach ($this->passes as $pass) {
288 if (($reached > $bestpoints
289 && ($pass->areObligationsAnswered() || !$obligationsAnsweredPassExists))
290 || !isset($bestpass)) {
292 $bestpass = $pass->getPass();
296 return (
int) $bestpass;
302 foreach (array_keys($this->passes) as $pass) {
303 if ($pass > $lastpass) {
322 $this->lastFinishedPass = $pass;
326 $this->questionTitles[$question_id] = $question_title;
343 return $this->questions[$pass] ?? null;
346 public function addQuestion(
int $original_id,
int $question_id,
float $max_points,
int $sequence = null,
int $pass = 0): void
348 if (!isset($this->questions[$pass])) {
349 $this->questions[$pass] = [];
352 $this->questions[$pass][] = [
353 'id' => $question_id,
354 'o_id' => $original_id,
355 'points' => $max_points,
356 'sequence' => $sequence
365 return $this->questions[$pass][$index] ?? null;
371 if (array_key_exists($pass, $this->passes)) {
372 $count = $this->passes[$pass]->getQuestionCount();
380 if (array_key_exists($pass, $this->passes)) {
381 $reached = $this->passes[$pass]->getReachedPoints();
383 $reached = ($reached < 0) ? 0 : $reached;
384 $reached = round($reached, 2);
390 if (!isset($this->passes[$pass])) {
394 if (!isset($this->passes[$pass])) {
398 $available = $this->passes[$pass]->getMaxPoints();
399 $available = round($available, 2);
408 $percent = ($available > 0) ? $reached / $available : 0;
424 $this->mark_official = $a_mark_official;
459 $examId = $this->passes[$scoredPass]->getExamId();
476 $requestedHintsCount = $this->passes[$pass]->getRequestedHintsCount();
478 return $requestedHintsCount;
492 foreach ($this->passes as $pass) {
495 if ($reached >= $bestpoints && ($pass->areObligationsAnswered() || !$obligationsAnsweredPassExists)) {
497 $bestpassObject = $pass;
501 return $bestpassObject;
512 foreach (array_keys($this->passes) as $passIndex) {
513 if ($passIndex > $lastpassIndex) {
514 $lastpassIndex = $passIndex;
518 $lastpassObject = $this->passes[$lastpassIndex];
520 return $lastpassObject;
529 foreach ($this->passes as $pass) {
530 if ($pass->areObligationsAnswered()) {
__construct(int $passScoring)
setMarkOfficial(string $a_mark_official)
getQuestionsWorkedThroughInPercent()
getReachedPointsInPercent()
getBestPass()
This is used in the export of test results Aligned with ilObjTest::_getBestPass: from passes with equ...
int $passScoring
Pass Scoring (Last pass = 0, Best pass = 1)
setMaxpoints(float $max_points)
getQuestions(int $pass=0)
setPassScoring(int $passScoring)
addPass(int $pass_nr, ilTestEvaluationPassData $pass)
addQuestionTitle(int $question_id, string $question_title)
setLastFinishedPass(?int $pass=null)
Base Exception for all Exceptions relating to Modules/Test.
getScoredPassObject()
returns the object of class ilTestEvaluationPassData that relates to the the scored test pass (best p...
setSubmitted(bool $submitted)
getRequestedHintsCount(int $pass)
returns the count of hints requested by participant for given testpass
setReached(float $reached)
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 ...
setTimeOfWork(string $time_of_work)
doesObligationsAnsweredPassExist()
returns the fact wether a test pass with all obligations answered exists or not
setNumberOfQuestions(int $nr)
getQuestion(int $index, int $pass=0)
getAvailablePoints(int $pass=0)
getRequestedHintsCountFromScoredPass()
returns the count of hints requested by participant for scored testpass
int $questionsWorkedThrough
getReachedPointsInPercentForPass(int $pass=0)
addQuestion(int $original_id, int $question_id, float $max_points, int $sequence=null, int $pass=0)
getReachedPoints(int $pass=0)
areObligationsAnswered()
returns the fact wether all obligations in the scored test pass are answered or not ...
getQuestionCount(int $pass=0)
getExamIdFromScoredPass()
setQuestionsWorkedThrough(int $nr)