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