ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
ilTestEvaluationUserData Class Reference
+ Collaboration diagram for ilTestEvaluationUserData:

Public Member Functions

 __sleep ()
 
 __construct (private int $pass_scoring)
 
 getPassScoring ()
 
 setPassScoring (int $passScoring)
 
 getName ()
 
 setName ($name)
 
 getLogin ()
 
 setLogin (string $login)
 
 isSubmitted ()
 
 setSubmitted (bool $submitted)
 
 getReached ()
 
 getMaxpoints ()
 
 getReachedPointsInPercent ()
 
 getMark ()
 
 setMark (Mark $mark)
 
 getQuestionsWorkedThrough ()
 
 getNumberOfQuestions ()
 
 getQuestionsWorkedThroughInPercent ()
 
 getTimeOnTask ()
 
 getFirstVisit ()
 
 setFirstVisit (?\DateTimeImmutable $time)
 
 getLastVisit ()
 
 setLastVisit (?\DateTimeImmutable $time)
 
 getPasses ()
 
 addPass (int $pass_nr, ilTestEvaluationPassData $pass)
 
 getPass (int $pass_nr)
 
 getPassCount ()
 
 getScoredPass ()
 
 getBestPass ()
 This is used in the export of test results Aligned with ilObjTest::_getBestPass: from passes with equal points the first one wins. More...
 
 getLastPass ()
 
 getFinishedPasses ()
 
 getLastFinishedPass ()
 
 setLastFinishedPass (?int $pass=null)
 
 addQuestionTitle (int $question_id, string $question_title)
 
 getQuestionTitles ()
 
 getQuestions (int $pass=0)
 
 addQuestion (int $original_id, int $question_id, float $max_points, ?int $sequence=null, int $pass=0)
 
 getQuestion (int $index, int $pass=0)
 
 getQuestionByAttemptAndId (int $attempt, int $question_id)
 
 getQuestionCount (int $pass=0)
 
 getReachedPoints (int $pass=0)
 
 getAvailablePoints (int $pass=0)
 
 getReachedPointsInPercentForPass (int $pass=0)
 
 setUserID (int $user_id)
 
 getUserID ()
 
 getScoredPassObject ()
 returns the object of class ilTestEvaluationPassData that relates to the the scored test pass (best pass / last pass) More...
 
 getExamIdFromScoredPass ()
 
 getBestPassObject ()
 returns the object of class ilTestEvaluationPassData that relates to the the best test pass More...
 
 getLastPassObject ()
 returns the object of class ilTestEvaluationPassData that relates to the the last test pass More...
 

Private Attributes

array $question_titles
 
string $name
 
string $login = ''
 
int $user_id = null
 
bool $submitted
 
Mark $mark
 
DateTimeImmutable $first_visit = null
 
DateTimeImmutable $last_visit = null
 
array $passes = []
 
int $last_finished_pass = null
 
array $questions
 

Detailed Description

Deprecated:
11; Result/EvaluationData will be refined.

Definition at line 26 of file class.ilTestEvaluationUserData.php.

Constructor & Destructor Documentation

◆ __construct()

ilTestEvaluationUserData::__construct ( private int  $pass_scoring)

Definition at line 54 of file class.ilTestEvaluationUserData.php.

56 {
57 }

Member Function Documentation

◆ __sleep()

ilTestEvaluationUserData::__sleep ( )

Definition at line 47 of file class.ilTestEvaluationUserData.php.

48 {
49 return ['questions', 'passes', 'passed', 'lastVisit', 'firstVisit', 'timeOfWork', 'numberOfQuestions',
50 'questionsWorkedThrough', 'mark_official', 'mark', 'maxpoints', 'reached', 'user_id', 'login',
51 'name', 'passScoring'];
52 }

◆ addPass()

ilTestEvaluationUserData::addPass ( int  $pass_nr,
ilTestEvaluationPassData  $pass 
)

Definition at line 194 of file class.ilTestEvaluationUserData.php.

194 : void
195 {
196 $this->passes[$pass_nr] = $pass;
197 }

◆ addQuestion()

ilTestEvaluationUserData::addQuestion ( int  $original_id,
int  $question_id,
float  $max_points,
?int  $sequence = null,
int  $pass = 0 
)

Definition at line 285 of file class.ilTestEvaluationUserData.php.

285 : void
286 {
287 if (!isset($this->questions[$pass])) {
288 $this->questions[$pass] = [];
289 }
290
291 $this->questions[$pass][] = [
292 'id' => $question_id,
293 'o_id' => $original_id,
294 'points' => $max_points,
295 'sequence' => $sequence
296 ];
297 }

◆ addQuestionTitle()

ilTestEvaluationUserData::addQuestionTitle ( int  $question_id,
string  $question_title 
)

Definition at line 263 of file class.ilTestEvaluationUserData.php.

263 : void
264 {
265 $this->question_titles[$question_id] = $question_title;
266 }

◆ getAvailablePoints()

ilTestEvaluationUserData::getAvailablePoints ( int  $pass = 0)

Definition at line 345 of file class.ilTestEvaluationUserData.php.

345 : float
346 {
347 if (!isset($this->passes[$pass]) || !is_object($this->passes[$pass])) {
348 $pass = 0;
349 }
350 if (!isset($this->passes[$pass]) || !is_object($this->passes[$pass])) {
351 return 0.0;
352 }
353
354 $available = $this->passes[$pass]->getMaxPoints();
355 $available = round($available, 2);
356
357 return $available;
358 }

Referenced by getMaxpoints(), and getReachedPointsInPercentForPass().

+ Here is the caller graph for this function:

◆ getBestPass()

ilTestEvaluationUserData::getBestPass ( )

This is used in the export of test results Aligned with ilObjTest::_getBestPass: from passes with equal points the first one wins.

Definition at line 221 of file class.ilTestEvaluationUserData.php.

221 : int
222 {
223 $bestpoints = 0;
224 $bestpass = null;
225
226 foreach ($this->passes as $pass) {
227 $reached = $this->getReachedPointsInPercentForPass($pass->getPass());
228
229 if ($reached > $bestpoints || !isset($bestpass)) {
230 $bestpoints = $reached;
231 $bestpass = $pass->getPass();
232 }
233 }
234
235 return (int) $bestpass;
236 }

References getReachedPointsInPercentForPass().

Referenced by getScoredPass().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getBestPassObject()

ilTestEvaluationUserData::getBestPassObject ( )

returns the object of class ilTestEvaluationPassData that relates to the the best test pass

Definition at line 407 of file class.ilTestEvaluationUserData.php.

408 {
409 $bestpoints = 0;
410 $bestpass_bject = 0;
411
412 foreach ($this->passes as $pass) {
413 $reached = $this->getReachedPointsInPercentForPass($pass->getPass());
414
415 if ($reached >= $bestpoints) {
416 $bestpoints = $reached;
417 $bestpass_bject = $pass;
418 }
419 }
420
421 return $bestpass_bject;
422 }

References getReachedPointsInPercentForPass().

Referenced by getScoredPassObject().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getExamIdFromScoredPass()

ilTestEvaluationUserData::getExamIdFromScoredPass ( )

Definition at line 391 of file class.ilTestEvaluationUserData.php.

391 : string
392 {
393 $exam_id = '';
394 $scored_pass = $this->getScoredPass();
395
396 if (isset($this->passes[$scored_pass]) && $this->passes[$scored_pass] instanceof ilTestEvaluationPassData) {
397 $exam_id = $this->passes[$scored_pass]->getExamId();
398 }
399
400 return $exam_id;
401 }

References getScoredPass().

+ Here is the call graph for this function:

◆ getFinishedPasses()

ilTestEvaluationUserData::getFinishedPasses ( )

Definition at line 249 of file class.ilTestEvaluationUserData.php.

249 : int
250 {
251 return $this->getLastFinishedPass() === null ? 0 : $this->getLastFinishedPass() + 1;
252 }

References getLastFinishedPass().

+ Here is the call graph for this function:

◆ getFirstVisit()

ilTestEvaluationUserData::getFirstVisit ( )

Definition at line 166 of file class.ilTestEvaluationUserData.php.

166 : ?\DateTimeImmutable
167 {
168 return $this->first_visit;
169 }

References $first_visit.

◆ getLastFinishedPass()

ilTestEvaluationUserData::getLastFinishedPass ( )

Definition at line 254 of file class.ilTestEvaluationUserData.php.

254 : ?int
255 {
257 }

References $last_finished_pass.

Referenced by getFinishedPasses().

+ Here is the caller graph for this function:

◆ getLastPass()

ilTestEvaluationUserData::getLastPass ( )

Definition at line 238 of file class.ilTestEvaluationUserData.php.

238 : int
239 {
240 $lastpass = 0;
241 foreach (array_keys($this->passes) as $pass) {
242 if ($pass > $lastpass) {
243 $lastpass = $pass;
244 }
245 }
246 return $lastpass;
247 }

Referenced by getScoredPass().

+ Here is the caller graph for this function:

◆ getLastPassObject()

ilTestEvaluationUserData::getLastPassObject ( )

returns the object of class ilTestEvaluationPassData that relates to the the last test pass

Definition at line 428 of file class.ilTestEvaluationUserData.php.

429 {
430 $lastpassIndex = 0;
431
432 foreach (array_keys($this->passes) as $passIndex) {
433 if ($passIndex > $lastpassIndex) {
434 $lastpassIndex = $passIndex;
435 }
436 }
437
438 $lastpassObject = $this->passes[$lastpassIndex];
439
440 return $lastpassObject;
441 }

Referenced by getScoredPassObject().

+ Here is the caller graph for this function:

◆ getLastVisit()

ilTestEvaluationUserData::getLastVisit ( )

Definition at line 176 of file class.ilTestEvaluationUserData.php.

176 : ?\DateTimeImmutable
177 {
178 return $this->last_visit;
179 }

References $last_visit.

◆ getLogin()

ilTestEvaluationUserData::getLogin ( )

Definition at line 79 of file class.ilTestEvaluationUserData.php.

79 : string
80 {
81 return $this->login;
82 }

References $login.

◆ getMark()

ilTestEvaluationUserData::getMark ( )

Definition at line 114 of file class.ilTestEvaluationUserData.php.

114 : Mark
115 {
116 return $this->mark;
117 }
A class defining marks for assessment test objects.
Definition: Mark.php:36

References $mark.

◆ getMaxpoints()

ilTestEvaluationUserData::getMaxpoints ( )

Definition at line 104 of file class.ilTestEvaluationUserData.php.

104 : float
105 {
106 return $this->getAvailablePoints($this->getScoredPass());
107 }

References getAvailablePoints(), and getScoredPass().

+ Here is the call graph for this function:

◆ getName()

ilTestEvaluationUserData::getName ( )

Definition at line 69 of file class.ilTestEvaluationUserData.php.

69 : string
70 {
71 return $this->name;
72 }

References $name.

◆ getNumberOfQuestions()

ilTestEvaluationUserData::getNumberOfQuestions ( )

Definition at line 138 of file class.ilTestEvaluationUserData.php.

138 : int
139 {
140 $questionpass = $this->getScoredPass();
141 if (!isset($this->passes[$questionpass])) {
142 $questionpass = 0;
143 }
144
145 if (isset($this->passes[$questionpass])) {
146 return $this->passes[$questionpass]->getQuestionCount();
147 }
148
149 return 0;
150 }

References getScoredPass().

Referenced by getQuestionsWorkedThroughInPercent().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getPass()

ilTestEvaluationUserData::getPass ( int  $pass_nr)

Definition at line 199 of file class.ilTestEvaluationUserData.php.

200 {
201 return $this->passes[$pass_nr] ?? null;
202 }

Referenced by ilTestEvaluationFactory\addMarksToParticipants().

+ Here is the caller graph for this function:

◆ getPassCount()

ilTestEvaluationUserData::getPassCount ( )

Definition at line 204 of file class.ilTestEvaluationUserData.php.

204 : int
205 {
206 return count($this->passes);
207 }

Referenced by ilTestEvaluationFactory\addMarksToParticipants().

+ Here is the caller graph for this function:

◆ getPasses()

ilTestEvaluationUserData::getPasses ( )
Returns
array<int, ilTestEvaluationPassData>

Definition at line 189 of file class.ilTestEvaluationUserData.php.

189 : array
190 {
191 return $this->passes;
192 }

References $passes.

Referenced by ILIAS\Test\ExportImport\ResultsExportExcel\getPassesDataFromUserData(), and ILIAS\Test\Scoring\Manual\TestScoring\recalculatePasses().

+ Here is the caller graph for this function:

◆ getPassScoring()

ilTestEvaluationUserData::getPassScoring ( )

Definition at line 59 of file class.ilTestEvaluationUserData.php.

59 : int
60 {
61 return $this->pass_scoring;
62 }

Referenced by getScoredPass(), and getScoredPassObject().

+ Here is the caller graph for this function:

◆ getQuestion()

ilTestEvaluationUserData::getQuestion ( int  $index,
int  $pass = 0 
)
Returns
array{id: int, o_id: int, points: float, sequenence: ?int}|null

Definition at line 302 of file class.ilTestEvaluationUserData.php.

302 : ?array
303 {
304 return $this->questions[$pass][$index] ?? null;
305 }

◆ getQuestionByAttemptAndId()

ilTestEvaluationUserData::getQuestionByAttemptAndId ( int  $attempt,
int  $question_id 
)

Definition at line 307 of file class.ilTestEvaluationUserData.php.

307 : ?array
308 {
309 if (!isset($this->questions[$attempt])) {
310 return null;
311 }
312
313 $question = array_filter(
314 $this->questions[$attempt],
315 fn(array $v): bool => $v['id'] === $question_id
316 );
317
318 if ($question === []) {
319 return null;
320 }
321
322 return array_shift($question);
323 }

◆ getQuestionCount()

ilTestEvaluationUserData::getQuestionCount ( int  $pass = 0)

Definition at line 325 of file class.ilTestEvaluationUserData.php.

325 : int
326 {
327 $count = 0;
328 if (array_key_exists($pass, $this->passes)) {
329 $count = $this->passes[$pass]->getQuestionCount();
330 }
331 return $count;
332 }

◆ getQuestions()

ilTestEvaluationUserData::getQuestions ( int  $pass = 0)
Returns
null|list<array{id: int, o_id: int, points: float, sequenence: ?int}>

Definition at line 280 of file class.ilTestEvaluationUserData.php.

280 : ?array
281 {
282 return $this->questions[$pass] ?? null;
283 }

◆ getQuestionsWorkedThrough()

ilTestEvaluationUserData::getQuestionsWorkedThrough ( )

Definition at line 124 of file class.ilTestEvaluationUserData.php.

124 : int
125 {
126 $questionpass = $this->getScoredPass();
127 if (!isset($this->passes[$questionpass])) {
128 $questionpass = 0;
129 }
130
131 if (isset($this->passes[$questionpass])) {
132 return $this->passes[$questionpass]->getNrOfAnsweredQuestions();
133 }
134
135 return 0;
136 }

References getScoredPass().

Referenced by getQuestionsWorkedThroughInPercent().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getQuestionsWorkedThroughInPercent()

ilTestEvaluationUserData::getQuestionsWorkedThroughInPercent ( )

Definition at line 152 of file class.ilTestEvaluationUserData.php.

152 : float
153 {
154 return $this->getNumberOfQuestions() ? $this->getQuestionsWorkedThrough() / $this->getNumberOfQuestions() * 100.0 : 0;
155 }

References getNumberOfQuestions(), and getQuestionsWorkedThrough().

+ Here is the call graph for this function:

◆ getQuestionTitles()

ilTestEvaluationUserData::getQuestionTitles ( )
Returns
array<string>

Definition at line 272 of file class.ilTestEvaluationUserData.php.

272 : array
273 {
275 }

References $question_titles.

◆ getReached()

ilTestEvaluationUserData::getReached ( )

Definition at line 99 of file class.ilTestEvaluationUserData.php.

99 : float
100 {
101 return $this->getReachedPoints($this->getScoredPass());
102 }

References getReachedPoints(), and getScoredPass().

Referenced by ILIAS\Test\Statistics\Statistics\__construct(), and getReachedPointsInPercent().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getReachedPoints()

ilTestEvaluationUserData::getReachedPoints ( int  $pass = 0)

Definition at line 334 of file class.ilTestEvaluationUserData.php.

334 : float
335 {
336 $reached = 0;
337 if (array_key_exists($pass, $this->passes)) {
338 $reached = $this->passes[$pass]->getReachedPoints();
339 }
340 $reached = ($reached < 0) ? 0 : $reached;
341 $reached = round($reached, 2);
342 return $reached;
343 }

Referenced by getReached(), and getReachedPointsInPercentForPass().

+ Here is the caller graph for this function:

◆ getReachedPointsInPercent()

ilTestEvaluationUserData::getReachedPointsInPercent ( )

Definition at line 109 of file class.ilTestEvaluationUserData.php.

109 : float
110 {
111 return $this->getMaxPoints() ? $this->getReached() / $this->getMaxPoints() * 100.0 : 0.0;
112 }

References getReached().

Referenced by ilTestEvaluationFactory\addMarksToParticipants().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getReachedPointsInPercentForPass()

ilTestEvaluationUserData::getReachedPointsInPercentForPass ( int  $pass = 0)

Definition at line 360 of file class.ilTestEvaluationUserData.php.

360 : float
361 {
362 $reached = $this->getReachedPoints($pass);
363 $available = $this->getAvailablePoints($pass);
364 $percent = ($available > 0) ? $reached / $available : 0;
365 return $percent;
366 }

References getAvailablePoints(), and getReachedPoints().

Referenced by getBestPass(), and getBestPassObject().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getScoredPass()

ilTestEvaluationUserData::getScoredPass ( )

Definition at line 209 of file class.ilTestEvaluationUserData.php.

209 : int
210 {
211 if ($this->getPassScoring() === 1) {
212 return $this->getBestPass();
213 }
214
215 return $this->getLastPass();
216 }
getBestPass()
This is used in the export of test results Aligned with ilObjTest::_getBestPass: from passes with equ...

References getBestPass(), getLastPass(), and getPassScoring().

Referenced by getExamIdFromScoredPass(), getMaxpoints(), getNumberOfQuestions(), getQuestionsWorkedThrough(), and getReached().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getScoredPassObject()

ilTestEvaluationUserData::getScoredPassObject ( )

returns the object of class ilTestEvaluationPassData that relates to the the scored test pass (best pass / last pass)

Definition at line 382 of file class.ilTestEvaluationUserData.php.

383 {
384 if ($this->getPassScoring() === 1) {
385 return $this->getBestPassObject();
386 }
387
388 return $this->getLastPassObject();
389 }
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

References getBestPassObject(), getLastPassObject(), and getPassScoring().

Referenced by ILIAS\Test\ExportImport\ResultsExportExcel\getPassesDataFromUserData().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getTimeOnTask()

ilTestEvaluationUserData::getTimeOnTask ( )

Definition at line 157 of file class.ilTestEvaluationUserData.php.

157 : int
158 {
159 $time = 0;
160 foreach ($this->passes as $pass) {
161 $time += $pass->getWorkingTime();
162 }
163 return $time;
164 }

◆ getUserID()

◆ isSubmitted()

ilTestEvaluationUserData::isSubmitted ( )

Definition at line 89 of file class.ilTestEvaluationUserData.php.

89 : bool
90 {
91 return $this->submitted;
92 }

References $submitted.

◆ setFirstVisit()

ilTestEvaluationUserData::setFirstVisit ( ?\DateTimeImmutable  $time)

Definition at line 171 of file class.ilTestEvaluationUserData.php.

171 : void
172 {
173 $this->first_visit = $time;
174 }

◆ setLastFinishedPass()

ilTestEvaluationUserData::setLastFinishedPass ( ?int  $pass = null)

Definition at line 259 of file class.ilTestEvaluationUserData.php.

259 : void
260 {
261 $this->last_finished_pass = $pass;
262 }

◆ setLastVisit()

ilTestEvaluationUserData::setLastVisit ( ?\DateTimeImmutable  $time)

Definition at line 181 of file class.ilTestEvaluationUserData.php.

181 : void
182 {
183 $this->last_visit = $time;
184 }

◆ setLogin()

ilTestEvaluationUserData::setLogin ( string  $login)

Definition at line 84 of file class.ilTestEvaluationUserData.php.

84 : void
85 {
86 $this->login = $login;
87 }

References $login, and ILIAS\UI\examples\Symbol\Glyph\Login\login().

+ Here is the call graph for this function:

◆ setMark()

ilTestEvaluationUserData::setMark ( Mark  $mark)

Definition at line 119 of file class.ilTestEvaluationUserData.php.

119 : void
120 {
121 $this->mark = $mark;
122 }

References $mark.

Referenced by ilTestEvaluationFactory\addMarksToParticipants().

+ Here is the caller graph for this function:

◆ setName()

ilTestEvaluationUserData::setName (   $name)

Definition at line 74 of file class.ilTestEvaluationUserData.php.

74 : void
75 {
76 $this->name = $name;
77 }

References $name.

◆ setPassScoring()

ilTestEvaluationUserData::setPassScoring ( int  $passScoring)

Definition at line 64 of file class.ilTestEvaluationUserData.php.

64 : void
65 {
66 $this->pass_scoring = $passScoring;
67 }

◆ setSubmitted()

ilTestEvaluationUserData::setSubmitted ( bool  $submitted)

Definition at line 94 of file class.ilTestEvaluationUserData.php.

94 : void
95 {
96 $this->submitted = $submitted;
97 }

References $submitted.

◆ setUserID()

ilTestEvaluationUserData::setUserID ( int  $user_id)

Definition at line 368 of file class.ilTestEvaluationUserData.php.

368 : void
369 {
370 $this->user_id = $user_id;
371 }

References $user_id.

Field Documentation

◆ $first_visit

DateTimeImmutable ilTestEvaluationUserData::$first_visit = null
private

Definition at line 34 of file class.ilTestEvaluationUserData.php.

Referenced by getFirstVisit().

◆ $last_finished_pass

int ilTestEvaluationUserData::$last_finished_pass = null
private

Definition at line 41 of file class.ilTestEvaluationUserData.php.

Referenced by getLastFinishedPass().

◆ $last_visit

DateTimeImmutable ilTestEvaluationUserData::$last_visit = null
private

Definition at line 35 of file class.ilTestEvaluationUserData.php.

Referenced by getLastVisit().

◆ $login

string ilTestEvaluationUserData::$login = ''
private

Definition at line 30 of file class.ilTestEvaluationUserData.php.

Referenced by getLogin(), and setLogin().

◆ $mark

Mark ilTestEvaluationUserData::$mark
private

Definition at line 33 of file class.ilTestEvaluationUserData.php.

Referenced by getMark(), and setMark().

◆ $name

string ilTestEvaluationUserData::$name
private

Definition at line 29 of file class.ilTestEvaluationUserData.php.

Referenced by getName(), and setName().

◆ $passes

array ilTestEvaluationUserData::$passes = []
private

Definition at line 40 of file class.ilTestEvaluationUserData.php.

Referenced by getPasses().

◆ $question_titles

array ilTestEvaluationUserData::$question_titles
private

Definition at line 28 of file class.ilTestEvaluationUserData.php.

Referenced by getQuestionTitles().

◆ $questions

array ilTestEvaluationUserData::$questions
private

Definition at line 45 of file class.ilTestEvaluationUserData.php.

◆ $submitted

bool ilTestEvaluationUserData::$submitted
private

Definition at line 32 of file class.ilTestEvaluationUserData.php.

Referenced by isSubmitted(), and setSubmitted().

◆ $user_id

int ilTestEvaluationUserData::$user_id = null
private

Definition at line 31 of file class.ilTestEvaluationUserData.php.

Referenced by getUserID(), and setUserID().


The documentation for this class was generated from the following file: