ILIAS  trunk Revision v11.0_alpha-1723-g8e69f309bab
All Data Structures Namespaces Files Functions Variables Enumerations Enumerator Modules Pages
class.ilEventHandlingDefinitionProcessor.php
Go to the documentation of this file.
1 <?php
2 
19 declare(strict_types=1);
20 
25 {
26  protected array $data = [];
27  protected ?string $component;
28 
29  public function getData(): array
30  {
31  return $this->data;
32  }
33 
34  public function purge(): void
35  {
36  $this->data = [];
37  }
38 
39  public function beginComponent(string $component, string $type): void
40  {
41  $this->component = $type . "/" . $component;
42  }
43 
44  public function endComponent(string $component, string $type): void
45  {
46  $this->component = null;
47  }
48 
49  public function beginTag(string $name, array $attributes): void
50  {
51  if ($name !== "event") {
52  return;
53  }
54 
55  $component = $attributes["component"] ?? null;
56  if (!$component) {
57  $component = $this->component;
58  }
59 
60  $event = [
61  "component" => $component,
62  "type" => $attributes["type"],
63  "type_specification" => $attributes["id"]
64  ];
65 
66  // only add event to data if no such entry exists
67  if (!$this->hasDataEntryForEvent($event)) {
68  $this->data[] = $event;
69  }
70  }
71 
72  public function endTag(string $name): void
73  {
74  }
75 
76  public function hasDataEntryForEvent($event): bool
77  {
78  return in_array($event, $this->data, true);
79  }
80 }
An ilComponentDefinitionProcessor processes some attributes from a component.xml (i.e.
purge()
This methods is supposed to purge existing data in the provider of the component, so new components c...
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
beginComponent(string $component, string $type)
This method is called when parsing of component.xml for the given component starts.
endComponent(string $component, string $type)
This method is called when parsing of component.xml for the given component ends. ...
endTag(string $name)
This is called when a tag ends in the context of the given component.
beginTag(string $name, array $attributes)
This is called when a tag starts in the context of the given component.