ILIAS  release_8 Revision v8.19
All Data Structures Namespaces Files Functions Variables Modules Pages
class.PRGEventsDelayed.php
Go to the documentation of this file.
1 <?php
18 declare(strict_types=1);
19 
21 {
22  protected array $events = [];
24 
25  public function __construct(
26  ilStudyProgrammeEvents $prg_events
27  ) {
28  $this->prg_events = $prg_events;
29  }
30 
31  public function collect(string $event, array $parameter): void
32  {
33  $this->events[] = [$event, $parameter];
34  }
35 
36  public function raiseCollected(): void
37  {
38  $accounted_for = [];
39  foreach (array_filter($this->events) as $entry) {
40  list($event, $parameter) = $entry;
41  $k = $event . print_r($parameter, true);
42  if (!array_key_exists($k, $accounted_for)) {
43  $accounted_for[$k] = true;
44  $this->prg_events->raise($event, $parameter);
45  }
46  }
47  $this->events[] = [];
48  }
49 
50  public function userAssigned(ilPRGAssignment $assignment): void
51  {
52  $this->collect(self::EVENT_USER_ASSIGNED, [
53  "root_prg_id" => $assignment->getRootId(),
54  "usr_id" => $assignment->getUserId(),
55  "ass_id" => $assignment->getId()
56  ]);
57  }
58 
59  public function userReAssigned(ilPRGAssignment $assignment): void
60  {
61  $this->collect(self::EVENT_USER_REASSIGNED, [
62  "ass_id" => $assignment->getId(),
63  "root_prg_id" => (int) $assignment->getRootId()
64  ]);
65  }
66 
67  public function userDeassigned(ilPRGAssignment $a_assignment): void
68  {
69  $this->collect(self::EVENT_USER_DEASSIGNED, [
70  "root_prg_id" => $a_assignment->getRootId(),
71  "usr_id" => $a_assignment->getUserId(),
72  "ass_id" => $a_assignment->getId()
73  ]);
74  }
75 
76 
77  public function informUserByMailToRestart(ilPRGAssignment $assignment): void
78  {
79  $this->collect(self::EVENT_USER_TO_RESTART, [
80  "ass_id" => (int) $assignment->getId(),
81  "root_prg_id" => (int) $assignment->getRootId()
82  ]);
83  }
84 
85  public function userRiskyToFail(ilPRGAssignment $assignment): void
86  {
87  $this->collect(self::EVENT_USER_ABOUT_TO_FAIL, [
88  "ass_id" => (int) $assignment->getId(),
89  "root_prg_id" => (int) $assignment->getRootId()
90  ]);
91  }
92 
93  public function userSuccessful(ilPRGAssignment $assignment, int $pgs_node_id): void
94  {
95  $this->collect(self::EVENT_USER_SUCCESSFUL, [
96  "root_prg_id" => $assignment->getRootId(),
97  "prg_id" => $pgs_node_id,
98  "usr_id" => $assignment->getUserId(),
99  "ass_id" => $assignment->getId()
100  ]);
101  }
102 
103  public function validityChange(ilPRGAssignment $assignment, int $pgs_node_id): void
104  {
105  $this->collect(self::EVENT_VALIDITY_CHANGE, [
106  "ass_id" => $assignment->getId(),
107  "root_prg_id" => $assignment->getRootId(),
108  "prg_id" => $pgs_node_id,
109  "usr_id" => $assignment->getUserId()
110  ]);
111  }
112 
113  public function deadlineChange(ilPRGAssignment $assignment, int $pgs_node_id): void
114  {
115  $this->collect(self::EVENT_DEADLINE_CHANGE, [
116  "ass_id" => $assignment->getId(),
117  "root_prg_id" => $assignment->getRootId(),
118  "prg_id" => $pgs_node_id,
119  "usr_id" => $assignment->getUserId()
120  ]);
121  }
122 
123  public function scoreChange(ilPRGAssignment $assignment, int $pgs_node_id): void
124  {
125  $this->collect(self::EVENT_SCORE_CHANGE, [
126  "ass_id" => $assignment->getId(),
127  "root_prg_id" => $assignment->getRootId(),
128  "prg_id" => $pgs_node_id,
129  "usr_id" => $assignment->getUserId()
130  ]);
131  }
132 
133  public function userRevertSuccessful(ilPRGAssignment $assignment, int $pgs_node_id): void
134  {
135  $this->collect(self::EVENT_USER_NOT_SUCCESSFUL, [
136  "ass_id" => $assignment->getId(),
137  "root_prg_id" => $assignment->getRootId(),
138  "prg_id" => $pgs_node_id,
139  "usr_id" => $assignment->getUserId()
140  ]);
141  }
142 }
userReAssigned(ilPRGAssignment $assignment)
userSuccessful(ilPRGAssignment $assignment, int $pgs_node_id)
validityChange(ilPRGAssignment $assignment, int $pgs_node_id)
informUserByMailToRestart(ilPRGAssignment $assignment)
collect(string $event, array $parameter)
__construct(ilStudyProgrammeEvents $prg_events)
ilStudyProgrammeEvents $prg_events
userAssigned(ilPRGAssignment $assignment)
userDeassigned(ilPRGAssignment $a_assignment)
deadlineChange(ilPRGAssignment $assignment, int $pgs_node_id)
userRiskyToFail(ilPRGAssignment $assignment)
Assignments are relations of users to a PRG; They hold progress-information for (sub-)nodes of the PR...
scoreChange(ilPRGAssignment $assignment, int $pgs_node_id)
userRevertSuccessful(ilPRGAssignment $assignment, int $pgs_node_id)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...