This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Learning e.V.
More...
|
static | handleEvent (string $a_component, string $a_event, array $a_parameter) |
| Handle an event in a listener. More...
|
|
static | handleEvent (string $a_component, string $a_event, array $a_parameter) |
| Handle an event in a listener. More...
|
|
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Learning e.V.
ILIAS is licensed with the GPL-3.0, see https://www.gnu.org/licenses/gpl-3.0.en.html You should have received a copy of said license along with the source code, too.
If this is not the case or you just want to try ILIAS, you'll find us at: https://www.ilias.de https://github.com/ILIAS-eLearning Class ilCourseReferencePathInfo
Definition at line 22 of file class.ilCourseReferenceAppEventListener.php.
◆ __construct()
ilCourseReferenceAppEventListener::__construct |
( |
| ) |
|
|
private |
◆ handleEvent()
static ilCourseReferenceAppEventListener::handleEvent |
( |
string |
$a_component, |
|
|
string |
$a_event, |
|
|
array |
$a_parameter |
|
) |
| |
|
static |
Handle an event in a listener.
- Parameters
-
string | $a_component | component, e.g. "components/ILIAS/Forum" or "components/ILIAS/User" |
string | $a_event | event e.g. "createUser", "updateUser", "deleteUser", ... |
array | $a_parameter | parameter array (assoc), array("name" => ..., "phone_office" => ...) |
Implements ilAppEventListener.
Definition at line 120 of file class.ilCourseReferenceAppEventListener.php.
120 : void
121 {
123 switch ($a_component) {
124 case 'components/ILIAS/AccessControl':
125 $self = new self();
126 $self->handleUserAssignments($a_event, $a_parameter);
127 break;
128 }
129 }
static getLogger(string $a_component_id)
Get component logger.
References ilLoggerFactory\getLogger().
◆ handleReferences()
ilCourseReferenceAppEventListener::handleReferences |
( |
|
$a_course_obj_id, |
|
|
|
$a_usr_id, |
|
|
|
$a_role_id |
|
) |
| |
|
protected |
- Parameters
-
$a_course_obj_id | |
$a_usr_id | |
$a_role_id | |
Definition at line 72 of file class.ilCourseReferenceAppEventListener.php.
73 {
75 if (substr($role_title, 0, 10) !== 'il_crs_mem') {
76 $this->
logger->debug(
'Ignoring non member role: ' . $role_title);
77 return;
78 }
79
80
81
83 $course_ref_id = end($course_ref_ids);
84
85 $childs = $this->tree->getChildsByType($course_ref_id, 'crsr');
87
88 foreach ($childs as $tree_node) {
89 $this->
logger->debug(
'Handling course reference: ' . $tree_node[
'title']);
91
92
93 if (!$path_info->hasParentCourse()) {
94 $this->
logger->debug(
'No reference member update: no direct parent course');
95 continue;
96 }
97
98 if (!$path_info->isMemberUpdateEnabled()) {
99 $this->
logger->debug(
'No reference member update: update disabled.');
100 continue;
101 }
102
103 $this->
logger->debug(
'Reference member update: adding user to course.');
104 $target_course_ref_id = $path_info->getTargetId();
107 }
108 }
static getInstanceByRefId(int $ref_id, int $target_ref_id=0)
static _getAllReferences(int $id)
get all reference ids for object ID
static _lookupTitle(int $obj_id)
static getInstance(int $a_ref_id)
References ilObject\_getAllReferences(), ilObject\_lookupTitle(), ilLogLevel\DEBUG, ilParticipants\getInstance(), ilCourseReferencePathInfo\getInstanceByRefId(), ilParticipants\IL_CRS_MEMBER, and ILIAS\Repository\logger().
Referenced by handleUserAssignments().
◆ handleUserAssignments()
ilCourseReferenceAppEventListener::handleUserAssignments |
( |
|
$a_event, |
|
|
|
$a_parameter |
|
) |
| |
|
protected |
- Parameters
-
Definition at line 49 of file class.ilCourseReferenceAppEventListener.php.
50 {
51 if ($a_parameter['type'] != 'crs') {
52 $this->
logger->debug(
'Ignoring event for type ' . $a_parameter[
'type']);
53 return true;
54 }
55
56 $this->
logger->info(
'Current event is: ' . $a_event);
57 if ($a_event == 'assignUser') {
58 $this->
logger->debug(
'Handling assign user event for type crs.');
59 $this->
handleReferences($a_parameter[
'obj_id'], $a_parameter[
'usr_id'], $a_parameter[
'role_id']);
60 } else {
61 $this->
logger->debug(
'Ignoring event: ' . $a_event);
62 }
63 }
handleReferences($a_course_obj_id, $a_usr_id, $a_role_id)
References handleReferences(), and ILIAS\Repository\logger().
◆ $instance
ilCourseReferenceAppEventListener::$instance = null |
|
staticprivate |
◆ $logger
ilCourseReferenceAppEventListener::$logger = null |
|
private |
◆ $tree
ilCourseReferenceAppEventListener::$tree = null |
|
private |
The documentation for this class was generated from the following file: