ILIAS  release_8 Revision v8.24
class.ilMailTemplateContextDefinitionProcessor.php
Go to the documentation of this file.
1<?php
2
19declare(strict_types=1);
20
22{
23 protected ilDBInterface $db;
24 protected ?string $component;
25 protected bool $in_mailtemplates = false;
26
30 protected array $mail_templates = [];
31
32 public function __construct(ilDBInterface $db)
33 {
34 $this->db = $db;
35 }
36
37 public function purge(): void
38 {
39 }
40
41 public function beginComponent(string $component, string $type): void
42 {
43 $this->component = $type . '/' . $component;
44 $this->in_mailtemplates = false;
45 $this->mail_templates = [];
46 }
47
48 public function endComponent(string $component, string $type): void
49 {
50 $this->component = null;
51 $this->in_mailtemplates = false;
52 $this->mail_templates = [];
53 }
54
55 public function beginTag(string $name, array $attributes): void
56 {
57 if ($name === 'mailtemplates') {
58 $this->in_mailtemplates = true;
59 return;
60 }
61 if ($name !== 'context' || !$this->in_mailtemplates) {
62 return;
63 }
64
65 $component = $attributes['component'] ?? null;
66 if (!$component) {
68 }
69
72 $attributes['id'],
73 $attributes['class'],
74 $attributes['path'] ?? null
75 );
76 $this->mail_templates[] = $attributes['id'];
77 }
78
79 public function endTag(string $name): void
80 {
81 if ($name === 'mailtemplates') {
82 $this->in_mailtemplates = false;
83 return;
84 }
85
86 if ($name !== 'module' && $name !== 'service') {
87 return;
88 }
89
90 ilMailTemplateContextService::clearFromXml($this->component, $this->mail_templates);
91 }
92}
beginTag(string $name, array $attributes)
This is called when a tag starts in the context of the given component.
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.
purge()
This methods is supposed to purge existing data in the provider of the component, so new components c...
beginComponent(string $component, string $type)
This method is called when parsing of component.xml for the given component starts.
static clearFromXml(string $a_component, array $a_new_templates)
static insertFromXML(string $a_component, string $a_id, string $a_class, ?string $a_path)
An ilComponentDefinitionProcessor processes some attributes from a component.xml (i....
Interface ilDBInterface.
if($format !==null) $name
Definition: metadata.php:247
$attributes
Definition: metadata.php:248
$type