77 $this->db = $DIC->database();
85 require_once(
'./Services/GlobalCache/classes/class.ilGlobalCache.php');
87 $cached_listeners = $ilGlobalCache->get(
'listeners');
88 if (is_array($cached_listeners)) {
89 $this->listener = $cached_listeners;
96 $this->listener = array();
98 $sql =
"SELECT * FROM il_event_handling" .
99 " WHERE type = " .
$ilDB->quote(
"listen",
"text");
102 $this->listener[$row[
"id"]][] = $row[
"component"];
105 $ilGlobalCache->set(
'listeners', $this->listener);
117 public function raise($a_component, $a_event, $a_parameter =
"")
119 $this->logger->debug(sprintf(
120 "Received event '%s' from component '%s'.",
126 $this->logger->debug(
new class($a_parameter) {
130 protected $parameter;
137 $this->parameter = $parameter;
143 public function __toString()
145 if (is_object($this->parameter)) {
146 return 'Event data class: ' . get_class($this->parameter);
149 return 'Event data size: ' .
sizeof($this->parameter);
154 $this->logger->debug(
"Started event propagation for event listeners ...");
156 if (is_array($this->listener[$a_component])) {
157 foreach ($this->listener[$a_component] as
$listener) {
159 $last_slash = strripos($listener,
'/');
160 $comp = substr($listener, 0, $last_slash);
163 if ($comp ==
'Plugins') {
164 $name = substr($listener, $last_slash + 1);
167 if ($pdata[
'name'] ==
$name) {
169 $pdata[
'component_type'],
170 $pdata[
'component_name'],
175 $plugin->handleEvent($a_component, $a_event, $a_parameter);
179 $class =
'il' . substr($listener, $last_slash + 1) .
'AppEventListener';
180 $file =
"./" . $listener .
"/classes/class." . $class .
".php";
183 if (is_file($file)) {
185 call_user_func(array($class,
'handleEvent'), $a_component, $a_event, $a_parameter);
191 $this->logger->debug(
"Finished event listener handling, started event propagation for event hook plugins ...");
194 include_once(
"./Services/Component/classes/class.ilPluginAdmin.php");
196 foreach ($plugins as $pl) {
203 $plugin->handleEvent($a_component, $a_event, $a_parameter);
206 $this->logger->debug(
"Finished event hook plugin handling, started event propagation for workflow engine ...");
static getActivePluginsForSlot($a_ctype, $a_cname, $a_slot_id)
Get all active plugins for a slot.
static getInstance($component)
static getActivePlugins()
Get info for all active plugins.
foreach($_POST as $key=> $value) $res
static getPluginObject($a_ctype, $a_cname, $a_slot_id, $a_pname)
Get Plugin Object.
__construct()
Constructor.
static getLogger($a_component_id)
Get component logger.