ILIAS  trunk Revision v11.0_alpha-1715-g7fc467680fb
All Data Structures Namespaces Files Functions Variables Enumerations Enumerator Modules Pages
ilLearningSequenceAppEventListener Class Reference

EventListener for LSO. More...

+ Collaboration diagram for ilLearningSequenceAppEventListener:

Static Public Member Functions

static handleEvent (string $component, string $event, array $parameter)
 

Static Protected Member Functions

static getLSEventHandler ()
 
static getIlTree ()
 
static getIlLanguage ()
 
static getIlLPStatusWrapper ()
 

Static Private Member Functions

static onServiceTrackingUpdateStatus (array $parameter)
 
static onObjectDeletion (array $parameter)
 
static onObjectToTrash (array $parameter)
 
static onObjectCloned (ilObject $new_obj, ilObject $origin_obj)
 
static onParticipantDeletion (array $parameter)
 

Static Private Attributes

static ilLSLPEventHandler $lp_event_handler = null
 

Detailed Description

EventListener for LSO.

Definition at line 26 of file class.ilLearningSequenceAppEventListener.php.

Member Function Documentation

◆ getIlLanguage()

static ilLearningSequenceAppEventListener::getIlLanguage ( )
staticprotected

Definition at line 137 of file class.ilLearningSequenceAppEventListener.php.

References $DIC.

137  : illanguage
138  {
139  global $DIC;
140  return $DIC['lng'];
141  }
global $DIC
Definition: shib_login.php:22

◆ getIlLPStatusWrapper()

static ilLearningSequenceAppEventListener::getIlLPStatusWrapper ( )
staticprotected

Definition at line 143 of file class.ilLearningSequenceAppEventListener.php.

144  {
145  return new ilLPStatusWrapper();
146  }

◆ getIlTree()

static ilLearningSequenceAppEventListener::getIlTree ( )
staticprotected

Definition at line 131 of file class.ilLearningSequenceAppEventListener.php.

References $DIC.

131  : ilTree
132  {
133  global $DIC;
134  return $DIC['tree'];
135  }
global $DIC
Definition: shib_login.php:22

◆ getLSEventHandler()

static ilLearningSequenceAppEventListener::getLSEventHandler ( )
staticprotected

Definition at line 126 of file class.ilLearningSequenceAppEventListener.php.

127  {
128  return new ilLSEventHandler(self::getIlTree());
129  }

◆ handleEvent()

static ilLearningSequenceAppEventListener::handleEvent ( string  $component,
string  $event,
array  $parameter 
)
static

Definition at line 30 of file class.ilLearningSequenceAppEventListener.php.

30  : void
31  {
32  switch ($component) {
33  case "components/ILIAS/Tracking":
34  switch ($event) {
35  case "updateStatus":
36  self::onServiceTrackingUpdateStatus($parameter);
37  break;
38  }
39  break;
40  case "components/ILIAS/ILIASObject":
41  switch ($event) {
42  case "beforeDeletion":
43  self::onObjectDeletion($parameter);
44  break;
45  case "toTrash":
46  self::onObjectToTrash($parameter);
47  break;
48  case 'cloneObject':
49  $new_obj = $parameter['object'];
50  $origin_obj = $parameter['cloned_from_object'];
51  self::onObjectCloned($new_obj, $origin_obj);
52  break;
53  }
54  break;
55 
56  case "components/ILIAS/LearningSequence":
57  switch ($event) {
58  case "deleteParticipant":
59  self::onParticipantDeletion($parameter);
60  break;
61  case "addParticipant":
62  default:
63  break;
64  }
65  break;
66 
67  default:
68  throw new ilException(
69  "ilLearningSequenceAppEventListener::handleEvent: " .
70  "Won't handle events of '$component'."
71  );
72  }
73  }

◆ onObjectCloned()

static ilLearningSequenceAppEventListener::onObjectCloned ( ilObject  $new_obj,
ilObject  $origin_obj 
)
staticprivate

Definition at line 111 of file class.ilLearningSequenceAppEventListener.php.

References $handler.

111  : void
112  {
113  $handler = self::getLSEventHandler();
114  $handler->handleClonedObject($new_obj, $origin_obj);
115  }
$handler
Definition: oai.php:30

◆ onObjectDeletion()

static ilLearningSequenceAppEventListener::onObjectDeletion ( array  $parameter)
staticprivate

Definition at line 99 of file class.ilLearningSequenceAppEventListener.php.

References $handler.

99  : void
100  {
101  $handler = self::getLSEventHandler();
102  $handler->handleObjectDeletion($parameter);
103  }
$handler
Definition: oai.php:30

◆ onObjectToTrash()

static ilLearningSequenceAppEventListener::onObjectToTrash ( array  $parameter)
staticprivate

Definition at line 105 of file class.ilLearningSequenceAppEventListener.php.

References $handler.

105  : void
106  {
107  $handler = self::getLSEventHandler();
108  $handler->handleObjectToTrash($parameter);
109  }
$handler
Definition: oai.php:30

◆ onParticipantDeletion()

static ilLearningSequenceAppEventListener::onParticipantDeletion ( array  $parameter)
staticprivate

Definition at line 117 of file class.ilLearningSequenceAppEventListener.php.

References $handler, and ILIAS\Repository\int().

117  : void
118  {
119  $handler = self::getLSEventHandler();
120  $obj_id = (int) $parameter['obj_id'];
121  $usr_id = (int) $parameter['usr_id'];
122 
123  $handler->handleParticipantDeletion($obj_id, $usr_id);
124  }
$handler
Definition: oai.php:30
+ Here is the call graph for this function:

◆ onServiceTrackingUpdateStatus()

static ilLearningSequenceAppEventListener::onServiceTrackingUpdateStatus ( array  $parameter)
staticprivate

Definition at line 75 of file class.ilLearningSequenceAppEventListener.php.

References $lng, ilObject\_lookupTitle(), ilObject\_lookupType(), ilLPStatus\LP_STATUS_COMPLETED_NUM, ilLSCompletionNotificationProvider\NOTIFICATION_TYPE, and null.

75  : void
76  {
77  if (self::$lp_event_handler === null) {
78  self::$lp_event_handler = new ilLSLPEventHandler(self::getIlTree(), self::getIlLPStatusWrapper());
79  }
80  self::$lp_event_handler->updateLPForChildEvent($parameter);
81 
82  if ($parameter['status'] === ilLPStatus::LP_STATUS_COMPLETED_NUM
83  && $parameter['old_status'] !== $parameter['status']
84  && ilObject::_lookupType($parameter['obj_id']) === 'lso'
85  ) {
86  $lng = self::getIlLanguage();
87  $lso_title = ilObject::_lookupTitle($parameter['obj_id']);
89  $notification->setValidForSeconds(ilNotificationConfig::TTL_LONG);
90  $notification->setVisibleForSeconds(ilNotificationConfig::DEFAULT_TTS);
91  $notification->setTitleVar($lng->txt('lso_toast_completed_title'));
92  $notification->setShortDescriptionVar($lng->txt('lso_toast_completed_desc'));
93  $notification->setLongDescriptionVar($lng->txt('lso_toast_completed_desc'));
94  $notification->setIconPath('assets/images/standard/icon_lso.svg');
95  $notification->notifyByUsers([$parameter['usr_id']]);
96  }
97  }
const LP_STATUS_COMPLETED_NUM
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
static _lookupTitle(int $obj_id)
global $lng
Definition: privfeed.php:31
static _lookupType(int $id, bool $reference=false)
+ Here is the call graph for this function:

Field Documentation

◆ $lp_event_handler

ilLSLPEventHandler ilLearningSequenceAppEventListener::$lp_event_handler = null
staticprivate

Definition at line 28 of file class.ilLearningSequenceAppEventListener.php.


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