19 declare(strict_types=1);
64 $this->component_repository = $DIC[
"component.repository"];
65 $this->component_factory = $DIC[
"component.factory"];
73 $listener_events = $this->event_handling_data->getEventsByType(
"listen");
74 foreach ($listener_events as $event_key => $event_value) {
75 $this->listener[$event_value[
"type_specification"]][] = $event_value[
"component"];
86 public function raise(
89 array $a_parameter = []
91 $this->
logger->debug(sprintf(
92 "Received event '%s' from component '%s'.",
97 $parameter_formatter =
static function ($value) use (&$parameter_formatter) {
98 if (is_object($value)) {
99 return get_class($value);
102 if (is_array($value)) {
104 $parameter_formatter,
113 $parameter_formatter,
117 $this->
logger->debug(
"Started event propagation for event listeners ...");
119 if (is_array($this->listener[$a_component] ??
null)) {
120 foreach ($this->listener[$a_component] as $listener) {
122 $last_slash = strripos($listener,
'/');
123 $comp = substr($listener, 0, $last_slash);
125 if ($comp ==
'Plugins') {
126 $name = substr($listener, $last_slash + 1);
129 foreach ($this->component_repository->getPlugins() as $pl) {
130 if ($pl->getName() !== $name || !$pl->isActive()) {
133 $plugin = $this->component_factory->getPlugin($pl->getId());
134 $plugin->handleEvent($a_component, $a_event, $a_parameter);
137 $class =
'il' . substr($listener, $last_slash + 1) .
'AppEventListener';
139 if (class_exists($class)) {
140 call_user_func(array($class,
'handleEvent'), $a_component, $a_event, $a_parameter);
146 $this->
logger->debug(
"Finished event listener handling, started event propagation for event hook plugins ...");
149 foreach ($this->component_factory->getActivePluginsInSlot(
"evhk") as
$plugin) {
150 $plugin->handleEvent($a_component, $a_event, $a_parameter);
__construct(?ilLogger $logger=null)
Readable part of repository interface to ilComponentDataDB.
ilArtifactEventHandlingData $event_handling_data
static getLogger(string $a_component_id)
Get component logger.
ilComponentRepository $component_repository
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
ilComponentFactory $component_factory
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...