24 require_once
'./Services/WorkflowEngine/classes/class.ilWorkflowEngine.php';
79 $this->db = $DIC->database();
87 require_once(
'./Services/GlobalCache/classes/class.ilGlobalCache.php');
89 $cached_listeners = $ilGlobalCache->get(
'listeners');
90 if (is_array($cached_listeners)) {
91 $this->listener = $cached_listeners;
98 $this->listener = array();
100 $sql =
"SELECT * FROM il_event_handling" .
101 " WHERE type = " .
$ilDB->quote(
"listen",
"text");
104 $this->listener[
$row[
"id"]][] = $row[
"component"];
107 $ilGlobalCache->set(
'listeners', $this->listener);
119 public function raise($a_component, $a_event, $a_parameter =
"")
121 $this->logger->debug(sprintf(
122 "Received event '%s' from component '%s'.",
128 $this->logger->debug(
new class($a_parameter) {
132 protected $parameter;
139 $this->parameter = $parameter;
145 public function __toString()
147 if (is_object($this->parameter)) {
148 return 'Event data class: ' . get_class($this->parameter);
151 return 'Event data size: ' .
sizeof($this->parameter);
156 $this->logger->debug(
"Started event propagation for event listeners ...");
158 if (is_array($this->listener[$a_component])) {
159 foreach ($this->listener[$a_component] as
$listener) {
161 $last_slash = strripos($listener,
'/');
162 $comp = substr($listener, 0, $last_slash);
165 if ($comp ==
'Plugins') {
166 $name = substr($listener, $last_slash + 1);
169 if ($pdata[
'name'] ==
$name) {
171 $pdata[
'component_type'],
172 $pdata[
'component_name'],
177 $plugin->handleEvent($a_component, $a_event, $a_parameter);
181 $class =
'il' . substr($listener, $last_slash + 1) .
'AppEventListener';
182 $file =
"./" . $listener .
"/classes/class." . $class .
".php";
185 if (is_file($file)) {
187 call_user_func(array($class,
'handleEvent'), $a_component, $a_event, $a_parameter);
193 $this->logger->debug(
"Finished event listener handling, started event propagation for event hook plugins ...");
196 include_once(
"./Services/Component/classes/class.ilPluginAdmin.php");
198 foreach ($plugins as $pl) {
205 $plugin->handleEvent($a_component, $a_event, $a_parameter);
208 $this->logger->debug(
"Finished event hook plugin handling, started event propagation for workflow engine ...");
211 $workflow_engine->handleEvent($a_component, $a_event, $a_parameter);
213 $this->logger->debug(
"Finished workflow engine handling.");
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.
ilWorkflowEngine is part of the petri net based workflow engine.
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.