Class ilMailTemplateContextService.
More...
◆ clearFromXml()
| static ilMailTemplateContextService::clearFromXml |
( |
string |
$a_component, |
|
|
array |
$a_new_templates |
|
) |
| |
|
static |
- Parameters
-
Definition at line 29 of file class.ilMailTemplateContextService.php.
References $DIC, and $id.
Referenced by ilMailTemplateContextDefinitionProcessor\endTag().
32 if (!$DIC->database()->tableExists(
'mail_tpl_ctx')) {
35 $persisted_templates = [];
36 $query =
'SELECT id FROM mail_tpl_ctx WHERE component = ' . $DIC->database()->quote($a_component,
'text');
37 $set = $DIC->database()->query($query);
38 while ($row = $DIC->database()->fetchAssoc($set)) {
39 $persisted_templates[] = $row[
'id'];
42 if ($persisted_templates !== []) {
43 if ($a_new_templates !== []) {
44 foreach ($persisted_templates as
$id) {
45 if (!in_array($id, $a_new_templates,
true)) {
46 $DIC->database()->manipulate(
47 'DELETE FROM mail_tpl_ctx WHERE component = ' . $DIC->database()->quote(
50 ) .
' AND id = ' . $DIC->database()->quote($id,
'text')
55 $DIC->database()->manipulate(
56 'DELETE FROM mail_tpl_ctx WHERE component = ' . $DIC->database()->quote(
$id
plugin.php for ilComponentBuildPluginInfoObjectiveTest::testAddPlugins
◆ createEntry()
| static ilMailTemplateContextService::createEntry |
( |
ilMailTemplateContext |
$a_context, |
|
|
string |
$a_component, |
|
|
string |
$a_class, |
|
|
?string |
$a_path |
|
) |
| |
|
staticprotected |
Definition at line 150 of file class.ilMailTemplateContextService.php.
References $DIC, $res, and ilMailTemplateContext\getId().
158 $query =
"SELECT id FROM mail_tpl_ctx WHERE id = %s";
159 $res = $DIC->database()->queryF($query, [
'text'], [$a_context->
getId()]);
160 $row = $DIC->database()->fetchAssoc(
$res);
161 $row_id = $row[
'id'] ?? null;
162 $context_exists = ($row_id === $a_context->
getId());
164 if (!$context_exists) {
165 $DIC->database()->insert(
'mail_tpl_ctx', [
166 'id' => [
'text', $a_context->
getId()],
167 'component' => [
'text', $a_component],
168 'class' => [
'text', $a_class],
169 'path' => [
'text', $a_path]
172 $DIC->database()->update(
'mail_tpl_ctx', [
173 'component' => [
'text', $a_component],
174 'class' => [
'text', $a_class],
175 'path' => [
'text', $a_path]
177 'id' => [
'text', $a_context->
getId()]
◆ getContextInstance()
| static ilMailTemplateContextService::getContextInstance |
( |
string |
$a_component, |
|
|
string |
$a_id, |
|
|
string |
$a_class, |
|
|
?string |
$a_path, |
|
|
bool |
$isCreationContext = false |
|
) |
| |
|
staticprotected |
Definition at line 123 of file class.ilMailTemplateContextService.php.
References $context.
131 $a_path = $a_component .
'/classes/';
133 $class_file = $a_path .
'class.' . $a_class .
'.php';
135 if (class_exists($a_class) && file_exists($class_file)) {
136 if ($isCreationContext) {
138 $context = $reflClass->newInstanceWithoutConstructor();
Class ilMailTemplateContext.
◆ getTemplateContextById()
| static ilMailTemplateContextService::getTemplateContextById |
( |
string |
$a_id | ) |
|
|
static |
◆ getTemplateContexts()
| static ilMailTemplateContextService::getTemplateContexts |
( |
?array |
$a_id = null | ) |
|
|
static |
Returns an array of mail template contexts, the key of each entry matches its id.
- Parameters
-
- Returns
- ilMailTemplateContext[]
Definition at line 98 of file class.ilMailTemplateContextService.php.
References $context, and $DIC.
Referenced by ilMailTemplateTableGUI\__construct(), ilMailTemplateGUI\getTemplateForm(), and ilMailTemplateGUI\showTemplates().
103 $query =
'SELECT * FROM mail_tpl_ctx';
105 if (is_array($a_id) && count($a_id)) {
106 $where[] = $DIC->database()->in(
'id', $a_id,
false,
'text');
109 $query .=
' WHERE ' . implode(
' AND ', $where);
112 $set = $DIC->database()->query($query);
113 while ($row = $DIC->database()->fetchAssoc($set)) {
114 $context = self::getContextInstance($row[
'component'], $row[
'id'], $row[
'class'], $row[
'path']);
Class ilMailTemplateContext.
◆ insertFromXML()
| static ilMailTemplateContextService::insertFromXML |
( |
string |
$a_component, |
|
|
string |
$a_id, |
|
|
string |
$a_class, |
|
|
?string |
$a_path |
|
) |
| |
|
static |
The documentation for this class was generated from the following file: