ILIAS  trunk Revision v11.0_alpha-2638-g80c1d007f79
ilStudyProgrammeUserTableRow.php
Go to the documentation of this file.
1 <?php
2 
19 declare(strict_types=1);
20 
25 {
26  protected PRGProgressId $id;
27  protected int $status_raw;
28  protected bool $active_raw;
29 
31 
32  protected string $active;
33  protected string $firstname;
34  protected string $lastname;
35  protected string $login;
36  protected string $orgus;
37  protected string $gender;
38  protected string $status;
39  protected string $completion_date;
43  protected ?array $completion_by_obj_ids;
44  protected string $completion_by;
45  protected string $points_reachable;
46  protected string $points_required;
47  protected string $points_current;
48  protected string $custom_plan;
49  protected string $belongs_to;
50  protected string $assign_date;
51  protected string $assigned_by;
52  protected string $deadline;
53  protected string $expiry_date;
54  protected string $validity;
55  protected string $restart_date;
56  protected int $lifecycle_status;
57  protected bool $cert_relevance;
58 
59  public function __construct(
60  protected int $ass_id,
61  protected int $usr_id,
62  protected int $node_obj_id,
63  protected bool $is_root_progress,
64  protected ilPRGUserInformation $user_information
65  ) {
66  $this->id = new PRGProgressId($ass_id, $usr_id, $node_obj_id);
67  }
68 
69  public function getId(): PRGProgressId
70  {
71  return $this->id;
72  }
73  public function getAssignmentId(): int
74  {
75  return $this->ass_id;
76  }
77  public function getUsrId(): int
78  {
79  return $this->usr_id;
80  }
81  public function getNodeId(): int
82  {
83  return $this->node_obj_id;
84  }
85  public function isRootProgress(): bool
86  {
87  return $this->is_root_progress;
88  }
89 
91  {
92  return $this->user_information;
93  }
94  public function getUserData(string $field_id)
95  {
96  return $this->user_information->getUserData($field_id);
97  }
98 
99  public function withUserActiveRaw(bool $active_raw): self
100  {
101  $clone = clone $this;
102  $clone->active_raw = $active_raw;
103  return $clone;
104  }
105  public function isUserActiveRaw(): bool
106  {
107  return $this->active_raw;
108  }
109  public function withUserActive(string $active): self
110  {
111  $clone = clone $this;
112  $clone->active = $active;
113  return $clone;
114  }
115  public function getUserActive(): string
116  {
117  return $this->active;
118  }
119 
120  public function withFirstname(string $firstname): self
121  {
122  $clone = clone $this;
123  $clone->firstname = $firstname;
124  return $clone;
125  }
126  public function getFirstname(): string
127  {
128  return $this->firstname;
129  }
130 
131  public function withLastname(string $lastname): self
132  {
133  $clone = clone $this;
134  $clone->lastname = $lastname;
135  return $clone;
136  }
137  public function getLastname(): string
138  {
139  return $this->lastname;
140  }
141 
142  public function getName(): string
143  {
144  return $this->lastname . ', ' . $this->firstname;
145  }
146 
147  public function withLogin(string $login): self
148  {
149  $clone = clone $this;
150  $clone->login = $login;
151  return $clone;
152  }
153  public function getLogin(): string
154  {
155  return $this->login;
156  }
157 
158  public function withOrgUs(string $orgus): self
159  {
160  $clone = clone $this;
161  $clone->orgus = $orgus;
162  return $clone;
163  }
164  public function getOrgUs(): string
165  {
166  return $this->orgus;
167  }
168 
169  public function withGender(string $gender): self
170  {
171  $clone = clone $this;
172  $clone->gender = $gender;
173  return $clone;
174  }
175  public function getGender(): string
176  {
177  return $this->gender;
178  }
179 
180  public function withStatus(string $status): self
181  {
182  $clone = clone $this;
183  $clone->status = $status;
184  return $clone;
185  }
186  public function getStatus(): string
187  {
188  return $this->status;
189  }
190  public function withStatusRaw(int $status_raw): self
191  {
192  $clone = clone $this;
193  $clone->status_raw = $status_raw;
194  return $clone;
195  }
196  public function getStatusRaw(): int
197  {
198  return $this->status_raw;
199  }
200 
201  public function withCompletionDate(string $completion_date): self
202  {
203  $clone = clone $this;
204  $clone->completion_date = $completion_date;
205  return $clone;
206  }
207  public function getCompletionDate(): string
208  {
209  return $this->completion_date;
210  }
211 
212  public function withCompletionBy(string $completion_by): self
213  {
214  $clone = clone $this;
215  $clone->completion_by = $completion_by;
216  return $clone;
217  }
218  public function getCompletionBy(): string
219  {
220  return $this->completion_by;
221  }
222 
226  public function withCompletionByObjIds(?array $obj_ids): self
227  {
228  $clone = clone $this;
229  $clone->completion_by_obj_ids = $obj_ids;
230  return $clone;
231  }
232 
236  public function getCompletionByObjIds(): ?array
237  {
239  }
240 
241  public function withPointsReachable(string $points_reachable): self
242  {
243  $clone = clone $this;
244  $clone->points_reachable = $points_reachable;
245  return $clone;
246  }
247  public function getPointsReachable(): string
248  {
250  }
251  public function withPointsRequired(string $points_required): self
252  {
253  $clone = clone $this;
254  $clone->points_required = $points_required;
255  return $clone;
256  }
257  public function getPointsRequired(): string
258  {
259  return $this->points_required;
260  }
261  public function withPointsCurrent(string $points_current): self
262  {
263  $clone = clone $this;
264  $clone->points_current = $points_current;
265  return $clone;
266  }
267  public function getPointsCurrent(): string
268  {
269  return $this->points_current;
270  }
271  public function withCustomPlan(string $custom_plan): self
272  {
273  $clone = clone $this;
274  $clone->custom_plan = $custom_plan;
275  return $clone;
276  }
277  public function getCustomPlan(): string
278  {
279  return $this->custom_plan;
280  }
281 
282  public function withBelongsTo(string $belongs_to): self
283  {
284  $clone = clone $this;
285  $clone->belongs_to = $belongs_to;
286  return $clone;
287  }
288  public function getBelongsTo(): string
289  {
290  return $this->belongs_to;
291  }
292 
293  public function withAssignmentDate(string $assign_date): self
294  {
295  $clone = clone $this;
296  $clone->assign_date = $assign_date;
297  return $clone;
298  }
299  public function getAssignmentDate(): string
300  {
301  return $this->assign_date;
302  }
303 
304  public function withAssignmentBy(string $assigned_by): self
305  {
306  $clone = clone $this;
307  $clone->assigned_by = $assigned_by;
308  return $clone;
309  }
310  public function getAssignmentBy(): string
311  {
312  return $this->assigned_by;
313  }
314 
315  public function withDeadline(string $deadline): self
316  {
317  $clone = clone $this;
318  $clone->deadline = $deadline;
319  return $clone;
320  }
321  public function getDeadline(): string
322  {
323  return $this->deadline;
324  }
325 
326  public function withExpiryDate(string $expiry_date): self
327  {
328  $clone = clone $this;
329  $clone->expiry_date = $expiry_date;
330  return $clone;
331  }
332  public function getExpiryDate(): string
333  {
334  return $this->expiry_date;
335  }
336 
337  public function withValidity(string $validity): self
338  {
339  $clone = clone $this;
340  $clone->validity = $validity;
341  return $clone;
342  }
343  public function getValidity(): string
344  {
345  return $this->validity;
346  }
347 
348  public function withRestartDate(string $restart_date): self
349  {
350  $clone = clone $this;
351  $clone->restart_date = $restart_date;
352  return $clone;
353  }
354  public function getRestartDate(): string
355  {
356  return $this->restart_date;
357  }
358 
359  public function withNodeLifecycleStatus(int $lifecycle_status): self
360  {
361  if (! in_array($lifecycle_status, \ilStudyProgrammeAssessmentSettings::$STATUS)) {
362  throw new \LogicException('Invalid status: ' . $lifecycle_status);
363  }
364  $clone = clone $this;
365  $clone->lifecycle_status = $lifecycle_status;
366  return $clone;
367  }
368 
369  public function getNodeLifecycleStatus(): int
370  {
372  }
373 
374  public function withCertificateRelevance(bool $cert_relevance): self
375  {
376  $clone = clone $this;
377  $clone->cert_relevance = $cert_relevance;
378  return $clone;
379  }
380  public function getCertificateRelevance(): bool
381  {
382  return $this->cert_relevance;
383  }
384 
385 
386  public function toArray(): array
387  {
388  $ret = [
389  'prgrs_id' => (string) $this->getId(),
390  'name' => $this->getName(),
391  'active_raw' => $this->isUserActiveRaw(),
392  'active' => $this->getUserActive(),
393  'firstname' => $this->getFirstname(),
394  'lastname' => $this->getLastname(),
395  'login' => $this->getLogin(),
396  'orgus' => $this->getOrgUs(),
397  'gender' => $this->getGender(),
398  'status' => $this->getStatus(),
399  'completion_date' => $this->getCompletionDate(),
400  'completion_by' => $this->getCompletionBy(),
401  'points_reachable' => $this->getPointsReachable(),
402  'points_required' => $this->getPointsRequired(),
403  'points_current' => $this->getPointsCurrent(),
404  'custom_plan' => $this->getCustomPlan(),
405  'belongs_to' => $this->getBelongsTo(),
406  'assign_date' => $this->getAssignmentDate(),
407  'assigned_by' => $this->getAssignmentBy(),
408  'deadline' => $this->getDeadline(),
409  'expiry_date' => $this->getExpiryDate(),
410  'validity' => $this->getValidity(),
411  'cert_relevance' => $this->getCertificateRelevance(),
412  ];
413 
414  foreach ($this->user_information->getAvailableUserFields() as $user_field) {
415  if (! array_key_exists($user_field, $ret)) {
416  $ret[$user_field] = $this->getUserData($user_field);
417  }
418  }
419 
420  return $ret;
421  }
422 }
ilStudyProgrammeUserTable provides a flattened list of progresses at a programme-node.
__construct(protected int $ass_id, protected int $usr_id, protected int $node_obj_id, protected bool $is_root_progress, protected ilPRGUserInformation $user_information)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
Additional information about a user, used in context of assignments.
withPointsReachable(string $points_reachable)