◆ clearFromXml()
static ilMailTemplateContextService::clearFromXml |
( |
string |
$a_component, |
|
|
array |
$a_new_templates |
|
) |
| |
|
static |
- Parameters
-
Definition at line 26 of file class.ilMailTemplateContextService.php.
References $DIC, and $id.
Referenced by ilMailTemplateContextDefinitionProcessor\endTag().
29 if (!$DIC->database()->tableExists(
'mail_tpl_ctx')) {
32 $persisted_templates = [];
33 $query =
'SELECT id FROM mail_tpl_ctx WHERE component = ' . $DIC->database()->quote($a_component,
'text');
34 $set = $DIC->database()->query($query);
35 while ($row = $DIC->database()->fetchAssoc($set)) {
36 $persisted_templates[] = $row[
'id'];
39 if ($persisted_templates !== []) {
40 if ($a_new_templates !== []) {
41 foreach ($persisted_templates as
$id) {
42 if (!in_array($id, $a_new_templates,
true)) {
43 $DIC->database()->manipulate(
44 'DELETE FROM mail_tpl_ctx WHERE component = ' . $DIC->database()->quote(
47 ) .
' AND id = ' . $DIC->database()->quote($id,
'text')
52 $DIC->database()->manipulate(
53 '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 |
|
) |
| |
|
staticprivate |
- Parameters
-
Definition at line 149 of file class.ilMailTemplateContextService.php.
References $DIC, $res, ilMailTemplateContext\getId(), and null.
157 $query =
'SELECT id FROM mail_tpl_ctx WHERE id = %s';
158 $res = $DIC->database()->queryF($query, [
'text'], [$a_context->
getId()]);
159 $row = $DIC->database()->fetchAssoc(
$res);
160 $row_id = $row[
'id'] ??
null;
161 $context_exists = ($row_id === $a_context->
getId());
163 if ($context_exists) {
164 $DIC->database()->update(
'mail_tpl_ctx', [
165 'component' => [
'text', $a_component],
166 'class' => [
'text', $a_class],
167 'path' => [
'text', $a_path]
169 'id' => [
'text', $a_context->
getId()]
172 $DIC->database()->insert(
'mail_tpl_ctx', [
173 'id' => [
'text', $a_context->
getId()],
174 'component' => [
'text', $a_component],
175 'class' => [
'text', $a_class],
176 'path' => [
'text', $a_path]
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
◆ getContextInstance()
static ilMailTemplateContextService::getContextInstance |
( |
string |
$a_component, |
|
|
string |
$a_id, |
|
|
string |
$a_class, |
|
|
?string |
$a_path, |
|
|
bool |
$isCreationContext = false |
|
) |
| |
|
staticprivate |
- Parameters
-
Definition at line 123 of file class.ilMailTemplateContextService.php.
References $context, and null.
130 if (class_exists($a_class)) {
131 if ($isCreationContext) {
133 $context = $reflClass->newInstanceWithoutConstructor();
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
◆ 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
- array<string, ilMailTemplateContext>
Definition at line 95 of file class.ilMailTemplateContextService.php.
References $context, and $DIC.
Referenced by ilMailTemplateTableGUI\__construct(), ilMailTemplateGUI\getTemplateForm(), and ilMailTemplateGUI\showTemplates().
100 $query =
'SELECT * FROM mail_tpl_ctx';
102 if (is_array($a_id) && count($a_id)) {
103 $where[] = $DIC->database()->in(
'id', $a_id,
false,
'text');
106 $query .=
' WHERE ' . implode(
' AND ', $where);
109 $set = $DIC->database()->query($query);
110 while ($row = $DIC->database()->fetchAssoc($set)) {
111 $context = self::getContextInstance($row[
'component'], $row[
'id'], $row[
'class'], $row[
'path']);
◆ 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: