ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
ILIAS\Test\Participants\Participant Class Reference
+ Collaboration diagram for ILIAS\Test\Participants\Participant:

Public Member Functions

 __construct (private readonly int $user_id, private readonly ?int $active_id=null, private readonly ?int $test_id=null, private readonly ?string $anonymous_id=null, private readonly string $firstname='', private readonly string $lastname='', private readonly string $login='', private readonly string $matriculation='', private int $extra_time=0, private readonly int $attempts=0, private ?string $client_ip_from=null, private ?string $client_ip_to=null, private readonly ?int $invitation_date=null, private readonly ?bool $submitted=null, private readonly ?int $last_started_attempt=null, private readonly ?int $last_finished_attempt=null, private readonly bool $unfinished_attempts=false, private readonly ?\DateTimeImmutable $first_access=null, private readonly ?\DateTimeImmutable $last_access=null, private readonly bool $scoring_finalized=false)
 
 getUserId ()
 
 getActiveId ()
 
 getTestId ()
 
 getAnonymousId ()
 
 getFirstname ()
 
 getLastname ()
 
 getLogin ()
 
 getMatriculation ()
 
 getExtraTime ()
 
 withAddedExtraTime (int $extra_time)
 
 getAttempts ()
 
 getClientIpFrom ()
 
 withClientIpFrom (?string $ip)
 
 getClientIpTo ()
 
 withClientIpTo (?string $ip)
 
 isInvitedParticipant ()
 
 getSubmitted ()
 
 getTotalDuration (?int $processing_time)
 
 getLastStartedAttempt ()
 
 getLastFinishedAttempt ()
 
 hasUnfinishedAttempts ()
 
 getFirstAccess ()
 
 getLastAccess ()
 
 hasAnsweredQuestionsForScoredAttempt ()
 
 getRemainingDuration (int $processing_time, bool $reset_time_on_new_attempt)
 
 getAttemptOverviewInformation ()
 
 withAttemptOverviewInformation (?AttemptOverview $attempt_overview)
 
 withRunningAttemptStart (\DateTimeImmutable $start_date)
 
 isScoringFinalized ()
 

Private Attributes

AttemptOverview $attempt_overview = null
 
DateTimeImmutable $running_attempt_start = null
 

Detailed Description

Definition at line 25 of file Participant.php.

Constructor & Destructor Documentation

◆ __construct()

ILIAS\Test\Participants\Participant::__construct ( private readonly int  $user_id,
private readonly ?int  $active_id = null,
private readonly ?int  $test_id = null,
private readonly ?string  $anonymous_id = null,
private readonly string  $firstname = '',
private readonly string  $lastname = '',
private readonly string  $login = '',
private readonly string  $matriculation = '',
private int  $extra_time = 0,
private readonly int  $attempts = 0,
private ?string  $client_ip_from = null,
private ?string  $client_ip_to = null,
private readonly ?int  $invitation_date = null,
private readonly ?bool  $submitted = null,
private readonly ?int  $last_started_attempt = null,
private readonly ?int  $last_finished_attempt = null,
private readonly bool  $unfinished_attempts = false,
private readonly ?\DateTimeImmutable  $first_access = null,
private readonly ?\DateTimeImmutable  $last_access = null,
private readonly bool  $scoring_finalized = false 
)

Definition at line 30 of file Participant.php.

51 {
52 }

Member Function Documentation

◆ getActiveId()

ILIAS\Test\Participants\Participant::getActiveId ( )

◆ getAnonymousId()

ILIAS\Test\Participants\Participant::getAnonymousId ( )

Definition at line 69 of file Participant.php.

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

◆ getAttemptOverviewInformation()

ILIAS\Test\Participants\Participant::getAttemptOverviewInformation ( )

Definition at line 215 of file Participant.php.

Referenced by ILIAS\Test\Participants\ParticipantTable\getPostLoadFilters().

+ Here is the caller graph for this function:

◆ getAttempts()

ILIAS\Test\Participants\Participant::getAttempts ( )

Definition at line 106 of file Participant.php.

106 : int
107 {
108 return $this->attempts;
109 }

◆ getClientIpFrom()

ILIAS\Test\Participants\Participant::getClientIpFrom ( )

Definition at line 111 of file Participant.php.

111 : ?string
112 {
113 return $this->client_ip_from;
114 }

Referenced by ILIAS\Test\Participants\ParticipantTableIpRangeAction\isUniqueClientIp().

+ Here is the caller graph for this function:

◆ getClientIpTo()

ILIAS\Test\Participants\Participant::getClientIpTo ( )

Definition at line 126 of file Participant.php.

126 : ?string
127 {
128 return $this->client_ip_to;
129 }

Referenced by ILIAS\Test\Participants\ParticipantTableIpRangeAction\isUniqueClientIp().

+ Here is the caller graph for this function:

◆ getExtraTime()

ILIAS\Test\Participants\Participant::getExtraTime ( )

Definition at line 94 of file Participant.php.

94 : int
95 {
96 return $this->extra_time;
97 }

Referenced by ILIAS\Test\Participants\ParticipantTableExtraTimeAction\resolveHasDifferentExtraTime(), and ILIAS\Test\Participants\ParticipantRepository\updateExtraTime().

+ Here is the caller graph for this function:

◆ getFirstAccess()

ILIAS\Test\Participants\Participant::getFirstAccess ( )

Definition at line 175 of file Participant.php.

175 : ?\DateTimeImmutable
176 {
177 return $this->first_access;
178 }

◆ getFirstname()

ILIAS\Test\Participants\Participant::getFirstname ( )

Definition at line 74 of file Participant.php.

74 : string
75 {
76 return $this->firstname;
77 }

◆ getLastAccess()

ILIAS\Test\Participants\Participant::getLastAccess ( )

Definition at line 180 of file Participant.php.

180 : ?\DateTimeImmutable
181 {
182 return $this->last_access;
183 }

◆ getLastFinishedAttempt()

ILIAS\Test\Participants\Participant::getLastFinishedAttempt ( )

Definition at line 165 of file Participant.php.

165 : ?int
166 {
167 return $this->last_finished_attempt;
168 }

◆ getLastname()

ILIAS\Test\Participants\Participant::getLastname ( )

Definition at line 79 of file Participant.php.

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

◆ getLastStartedAttempt()

ILIAS\Test\Participants\Participant::getLastStartedAttempt ( )

Definition at line 160 of file Participant.php.

160 : ?int
161 {
162 return $this->last_started_attempt;
163 }

◆ getLogin()

ILIAS\Test\Participants\Participant::getLogin ( )

Definition at line 84 of file Participant.php.

84 : string
85 {
86 return $this->login;
87 }

◆ getMatriculation()

ILIAS\Test\Participants\Participant::getMatriculation ( )

Definition at line 89 of file Participant.php.

89 : string
90 {
91 return $this->matriculation;
92 }

◆ getRemainingDuration()

ILIAS\Test\Participants\Participant::getRemainingDuration ( int  $processing_time,
bool  $reset_time_on_new_attempt 
)

Definition at line 190 of file Participant.php.

193 : int {
194 $remaining = $this->getTotalDuration($processing_time);
195
196 $start = $this->getFirstAccess()?->getTimestamp();
197 if ($reset_time_on_new_attempt) {
198 $start = $this->running_attempt_start?->getTimestamp();
199 }
200
201 if ($start === null) {
202 return $remaining;
203 }
204
205 $remaining += $start;
206 if ($this->submitted) {
207 $remaining -= $this->getLastAccess()?->getTimestamp() ?? time();
208 } else {
209 $remaining -= time();
210 }
211
212 return max(0, $remaining);
213 }
getTotalDuration(?int $processing_time)

◆ getSubmitted()

ILIAS\Test\Participants\Participant::getSubmitted ( )

Definition at line 146 of file Participant.php.

146 : ?bool
147 {
148 return $this->submitted;
149 }

◆ getTestId()

ILIAS\Test\Participants\Participant::getTestId ( )

Definition at line 64 of file Participant.php.

64 : ?int
65 {
66 return $this->test_id;
67 }

Referenced by ILIAS\Test\Participants\ParticipantRepository\updateExtraTime().

+ Here is the caller graph for this function:

◆ getTotalDuration()

ILIAS\Test\Participants\Participant::getTotalDuration ( ?int  $processing_time)

Definition at line 151 of file Participant.php.

151 : int
152 {
153 if (!$processing_time) {
154 return 0;
155 }
156
157 return $processing_time + $this->extra_time * 60;
158 }

◆ getUserId()

◆ hasAnsweredQuestionsForScoredAttempt()

ILIAS\Test\Participants\Participant::hasAnsweredQuestionsForScoredAttempt ( )

Definition at line 185 of file Participant.php.

185 : bool
186 {
187 return $this->attempt_overview?->hasAnsweredQuestions() ?? false;
188 }

Referenced by ILIAS\Test\Participants\ParticipantTable\getPostLoadFilters().

+ Here is the caller graph for this function:

◆ hasUnfinishedAttempts()

ILIAS\Test\Participants\Participant::hasUnfinishedAttempts ( )

Definition at line 170 of file Participant.php.

170 : bool
171 {
172 return $this->unfinished_attempts;
173 }

Referenced by ILIAS\Test\Participants\ParticipantTableFinishTestAction\allowActionForRecord().

+ Here is the caller graph for this function:

◆ isInvitedParticipant()

ILIAS\Test\Participants\Participant::isInvitedParticipant ( )

Definition at line 141 of file Participant.php.

141 : bool
142 {
143 return $this->invitation_date > 0;
144 }

Referenced by ILIAS\Test\Participants\ParticipantTableIpRangeAction\allowActionForRecord().

+ Here is the caller graph for this function:

◆ isScoringFinalized()

ILIAS\Test\Participants\Participant::isScoringFinalized ( )

Definition at line 234 of file Participant.php.

234 : bool
235 {
236 return $this->scoring_finalized;
237 }

Referenced by ILIAS\Test\Participants\ParticipantTable\getPostLoadFilters().

+ Here is the caller graph for this function:

◆ withAddedExtraTime()

ILIAS\Test\Participants\Participant::withAddedExtraTime ( int  $extra_time)

Definition at line 99 of file Participant.php.

99 : self
100 {
101 $clone = clone $this;
102 $clone->extra_time += $extra_time;
103 return $clone;
104 }

◆ withAttemptOverviewInformation()

ILIAS\Test\Participants\Participant::withAttemptOverviewInformation ( ?AttemptOverview  $attempt_overview)

Definition at line 220 of file Participant.php.

220 : self
221 {
222 $clone = clone $this;
223 $clone->attempt_overview = $attempt_overview;
224 return $clone;
225 }

◆ withClientIpFrom()

ILIAS\Test\Participants\Participant::withClientIpFrom ( ?string  $ip)

Definition at line 116 of file Participant.php.

116 : self
117 {
118 if ($ip === '') {
119 $ip = null;
120 }
121 $clone = clone $this;
122 $clone->client_ip_from = $ip;
123 return $clone;
124 }

◆ withClientIpTo()

ILIAS\Test\Participants\Participant::withClientIpTo ( ?string  $ip)

Definition at line 131 of file Participant.php.

131 : self
132 {
133 if ($ip === '') {
134 $ip = null;
135 }
136 $clone = clone $this;
137 $clone->client_ip_to = $ip;
138 return $clone;
139 }

◆ withRunningAttemptStart()

ILIAS\Test\Participants\Participant::withRunningAttemptStart ( \DateTimeImmutable  $start_date)

Definition at line 227 of file Participant.php.

227 : self
228 {
229 $clone = clone $this;
230 $clone->running_attempt_start = $start_date;
231 return $clone;
232 }

Field Documentation

◆ $attempt_overview

AttemptOverview ILIAS\Test\Participants\Participant::$attempt_overview = null
private

Definition at line 27 of file Participant.php.

◆ $running_attempt_start

DateTimeImmutable ILIAS\Test\Participants\Participant::$running_attempt_start = null
private

Definition at line 28 of file Participant.php.


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