ILIAS  trunk Revision v12.0_alpha-1221-g4e438232683
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 $importname=null, 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 ()
 
 getImportname ()
 
 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 ()
 
 getDisplayName (Language $language, bool $anonymous_test=false)
 

Private Attributes

AttemptOverview $attempt_overview = null
 
DateTimeImmutable $running_attempt_start = null
 

Detailed Description

Definition at line 26 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  $importname = null,
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 31 of file Participant.php.

53 {
54 }

Member Function Documentation

◆ getActiveId()

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

◆ getAnonymousId()

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

Definition at line 71 of file Participant.php.

71 : ?string
72 {
73 return $this->anonymous_id;
74 }

◆ getAttemptOverviewInformation()

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

Definition at line 222 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 113 of file Participant.php.

113 : int
114 {
115 return $this->attempts;
116 }

◆ getClientIpFrom()

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

Definition at line 118 of file Participant.php.

118 : ?string
119 {
120 return $this->client_ip_from;
121 }

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

+ Here is the caller graph for this function:

◆ getClientIpTo()

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

Definition at line 133 of file Participant.php.

133 : ?string
134 {
135 return $this->client_ip_to;
136 }

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

+ Here is the caller graph for this function:

◆ getDisplayName()

ILIAS\Test\Participants\Participant::getDisplayName ( Language  $language,
bool  $anonymous_test = false 
)

Definition at line 246 of file Participant.php.

246 : string
247 {
248 if ($this->user_id === ANONYMOUS_USER_ID && $this->importname !== null && $this->importname !== '') {
249 return "{$this->importname} ({$language->txt('imported')})";
250 }
251
252 if ($anonymous_test) {
253 return $language->txt('anonymous');
254 }
255
256 $display_name = '';
257
258 if ($this->firstname) {
259 $display_name .= $this->firstname . ' ';
260 }
261 if ($this->lastname) {
262 $display_name .= $this->lastname;
263 }
264
265 return $display_name;
266 }
const ANONYMOUS_USER_ID
Definition: constants.php:27
txt(string $a_topic, string $a_default_lang_fallback_mod="")

References ANONYMOUS_USER_ID, and ILIAS\Language\Language\txt().

+ Here is the call graph for this function:

◆ getExtraTime()

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

Definition at line 101 of file Participant.php.

101 : int
102 {
103 return $this->extra_time;
104 }

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 182 of file Participant.php.

182 : ?\DateTimeImmutable
183 {
184 return $this->first_access;
185 }

◆ getFirstname()

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

Definition at line 76 of file Participant.php.

76 : string
77 {
78 return $this->firstname;
79 }

◆ getImportname()

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

Definition at line 91 of file Participant.php.

91 : ?string
92 {
93 return $this->importname;
94 }

◆ getLastAccess()

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

Definition at line 187 of file Participant.php.

187 : ?\DateTimeImmutable
188 {
189 return $this->last_access;
190 }

◆ getLastFinishedAttempt()

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

Definition at line 172 of file Participant.php.

172 : ?int
173 {
174 return $this->last_finished_attempt;
175 }

◆ getLastname()

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

Definition at line 81 of file Participant.php.

81 : string
82 {
83 return $this->lastname;
84 }

◆ getLastStartedAttempt()

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

Definition at line 167 of file Participant.php.

167 : ?int
168 {
169 return $this->last_started_attempt;
170 }

◆ getLogin()

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

Definition at line 86 of file Participant.php.

86 : string
87 {
88 return $this->login;
89 }

◆ getMatriculation()

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

Definition at line 96 of file Participant.php.

96 : string
97 {
98 return $this->matriculation;
99 }

◆ getRemainingDuration()

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

Definition at line 197 of file Participant.php.

200 : int {
201 $remaining = $this->getTotalDuration($processing_time);
202
203 $start = $this->getFirstAccess()?->getTimestamp();
204 if ($reset_time_on_new_attempt) {
205 $start = $this->running_attempt_start?->getTimestamp();
206 }
207
208 if ($start === null) {
209 return $remaining;
210 }
211
212 $remaining += $start;
213 if ($this->submitted) {
214 $remaining -= $this->getLastAccess()?->getTimestamp() ?? time();
215 } else {
216 $remaining -= time();
217 }
218
219 return max(0, $remaining);
220 }
getTotalDuration(?int $processing_time)

◆ getSubmitted()

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

Definition at line 153 of file Participant.php.

153 : ?bool
154 {
155 return $this->submitted;
156 }

◆ getTestId()

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

Definition at line 66 of file Participant.php.

66 : ?int
67 {
68 return $this->test_id;
69 }

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 158 of file Participant.php.

158 : int
159 {
160 if (!$processing_time) {
161 return 0;
162 }
163
164 return $processing_time + $this->extra_time * 60;
165 }

◆ getUserId()

◆ hasAnsweredQuestionsForScoredAttempt()

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

Definition at line 192 of file Participant.php.

192 : bool
193 {
194 return $this->attempt_overview?->hasAnsweredQuestions() ?? false;
195 }

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

+ Here is the caller graph for this function:

◆ hasUnfinishedAttempts()

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

Definition at line 177 of file Participant.php.

177 : bool
178 {
179 return $this->unfinished_attempts;
180 }

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

+ Here is the caller graph for this function:

◆ isInvitedParticipant()

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

Definition at line 148 of file Participant.php.

148 : bool
149 {
150 return $this->invitation_date > 0;
151 }

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

+ Here is the caller graph for this function:

◆ isScoringFinalized()

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

Definition at line 241 of file Participant.php.

241 : bool
242 {
243 return $this->scoring_finalized;
244 }

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 106 of file Participant.php.

106 : self
107 {
108 $clone = clone $this;
109 $clone->extra_time += $extra_time;
110 return $clone;
111 }

◆ withAttemptOverviewInformation()

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

Definition at line 227 of file Participant.php.

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

◆ withClientIpFrom()

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

Definition at line 123 of file Participant.php.

123 : self
124 {
125 if ($ip === '') {
126 $ip = null;
127 }
128 $clone = clone $this;
129 $clone->client_ip_from = $ip;
130 return $clone;
131 }

◆ withClientIpTo()

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

Definition at line 138 of file Participant.php.

138 : self
139 {
140 if ($ip === '') {
141 $ip = null;
142 }
143 $clone = clone $this;
144 $clone->client_ip_to = $ip;
145 return $clone;
146 }

◆ withRunningAttemptStart()

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

Definition at line 234 of file Participant.php.

234 : self
235 {
236 $clone = clone $this;
237 $clone->running_attempt_start = $start_date;
238 return $clone;
239 }

Field Documentation

◆ $attempt_overview

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

Definition at line 28 of file Participant.php.

◆ $running_attempt_start

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

Definition at line 29 of file Participant.php.


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