ILIAS  trunk Revision v12.0_alpha-1221-g4e438232683
ILIAS\Test\Results\Data Namespace Reference

Data Structures

class  AttemptOverview
 
class  AttemptResult
 
class  AttemptSolutions
 
class  Factory
 
class  ParticipantResult
 Class ParticipantResult is a model representation of an entry in the test_result_cache table. More...
 
class  QuestionResult
 
class  Repository
 
class  TestOverview
 

Enumerations

enum  StatusOfAttempt : string { isFinished }
 

Enumeration Type Documentation

◆ StatusOfAttempt

Enumerator
isFinished 

Definition at line 25 of file StatusOfAttempt.php.

26{
27 case NOT_YET_STARTED = 'not_started';
28 case RUNNING = 'running';
29 case FINISHED_BY_UNKNOWN = 'finished_by_unknown';
30 case FINISHED_BY_ADMINISTRATOR = 'finished_by_administrator';
31 case FINISHED_BY_DURATION = 'finished_by_duration';
32 case FINISHED_BY_PARTICIPANT = 'finished_by_participant';
33 case FINISHED_BY_CRONJOB = 'finished_by_cronjob';
34
35 public function isFinished(): bool
36 {
37 return in_array($this, [
38 self::FINISHED_BY_UNKNOWN,
39 self::FINISHED_BY_ADMINISTRATOR,
40 self::FINISHED_BY_CRONJOB,
41 self::FINISHED_BY_DURATION,
42 self::FINISHED_BY_PARTICIPANT,
43 ]);
44 }
45
46 public static function build(int $current_attempt, ?int $last_finished_attempt, ?string $finalized_by): StatusOfAttempt
47 {
48 if ($last_finished_attempt === null || $current_attempt > $last_finished_attempt) {
49 return StatusOfAttempt::RUNNING;
50 }
51
52 if ($finalized_by === null || $finalized_by === '') {
53 return StatusOfAttempt::FINISHED_BY_UNKNOWN;
54 }
55
56 return StatusOfAttempt::tryFrom($finalized_by);
57 }
58
59 public function getTranslation(Language $lng): string
60 {
61 return $lng->txt($this->value);
62 }
63}
global $lng
Definition: privfeed.php:31