Class ilMailTemplateService.
More...
◆ clearFromXml()
static ilMailTemplateService::clearFromXml |
( |
|
$a_component, |
|
|
array |
$a_new_templates |
|
) |
| |
|
static |
- Parameters
-
string | $a_component | |
array | $a_new_templates | |
Definition at line 17 of file class.ilMailTemplateService.php.
References $GLOBALS, $query, $row, and array.
Referenced by ilObjDefReader\handlerEndTag().
19 if(!
$GLOBALS[
'ilDB']->tableExists(
'mail_tpl_ctx'))
24 $persisted_templates =
array();
25 $query =
'SELECT id FROM mail_tpl_ctx WHERE component = ' .
$GLOBALS[
'ilDB']->quote($a_component,
'text');
29 $persisted_templates[] =
$row[
'id'];
32 if(count($persisted_templates))
34 if(count($a_new_templates))
36 foreach($persisted_templates as $id)
38 if(!in_array($id, $a_new_templates))
41 'DELETE FROM mail_tpl_ctx WHERE component = ' .
$GLOBALS[
'ilDB']->quote($a_component,
'text') .
' AND id = ' .
$GLOBALS[
'ilDB']->quote($id,
'text')
43 $GLOBALS[
'ilLog']->write(
"Mail Template XML - Context " . $id .
" in class " . $a_component .
" deleted.");
49 $GLOBALS[
'ilDB']->manipulate(
'DELETE FROM mail_tpl_ctx WHERE component = ' .
$GLOBALS[
'ilDB']->quote($a_component,
'text'));
50 $GLOBALS[
'ilLog']->write(
"Mail Template XML - All contexts deleted for " . $a_component .
" as component is inactive.");
$GLOBALS['loaded']
Global hash that tracks already loaded includes.
Create styles array
The data for the language used.
◆ createEntry()
static ilMailTemplateService::createEntry |
( |
ilMailTemplateContext |
$a_context, |
|
|
|
$a_component, |
|
|
|
$a_class, |
|
|
|
$a_path |
|
) |
| |
|
staticprotected |
- Parameters
-
Definition at line 188 of file class.ilMailTemplateService.php.
References $GLOBALS, $query, $res, $row, array, and ilMailTemplateContext\getId().
190 $query =
"SELECT id FROM mail_tpl_ctx WHERE id = %s";
193 $context_exists = (
$row[
'id'] == $a_context->
getId());
199 'component' =>
array(
'text', $a_component),
200 'class' =>
array(
'text', $a_class),
201 'path' =>
array(
'text', $a_path)
204 $GLOBALS[
'ilLog']->write(
"Mail Template XML - Context " . $a_context->
getId() .
" in class " . $a_class .
" added.");
209 'component' =>
array(
'text', $a_component),
210 'class' =>
array(
'text', $a_class),
211 'path' =>
array(
'text', $a_path)
216 $GLOBALS[
'ilLog']->write(
"Mail Template XML - Context " . $a_context->
getId() .
" in class " . $a_class .
" updated.");
$GLOBALS['loaded']
Global hash that tracks already loaded includes.
getId()
Returns a unique (in the context of mail template contexts) id.
Create styles array
The data for the language used.
◆ getContextInstance()
static ilMailTemplateService::getContextInstance |
( |
|
$a_component, |
|
|
|
$a_id, |
|
|
|
$a_class, |
|
|
|
$a_path |
|
) |
| |
|
staticprotected |
- Parameters
-
string | $a_component | |
string | $a_id | |
string | $a_class | |
string | $a_path | |
Definition at line 137 of file class.ilMailTemplateService.php.
References $GLOBALS.
143 $a_path = $a_component .
'/classes/';
145 $class_file = $a_path .
'class.' . $a_class .
'.php';
147 if(file_exists($class_file))
149 require_once $class_file;
150 if(class_exists($a_class))
152 $context =
new $a_class();
155 if($context->getId() == $a_id)
161 $mess .=
" - context id mismatch";
166 $mess .=
" - does not extend ilMailTemplateContext";
171 $mess =
"- class not found in file";
176 $mess =
" - class file not found";
179 $GLOBALS[
'ilLog']->write(
"Mail Template XML - Context " . $a_id .
" in class " . $a_class .
" (" . $class_file .
") is invalid." . $mess);
$GLOBALS['loaded']
Global hash that tracks already loaded includes.
Class ilMailTemplateContext.
◆ getTemplateContextById()
static ilMailTemplateService::getTemplateContextById |
( |
|
$a_id | ) |
|
|
static |
◆ getTemplateContexts()
static ilMailTemplateService::getTemplateContexts |
( |
|
$a_id = null | ) |
|
|
static |
Returns an array of mail template contexts, the key of each entry matches its id.
- Parameters
-
null | string | array | $a_id | |
- Returns
- ilMailTemplateContext[]
Definition at line 97 of file class.ilMailTemplateService.php.
References $GLOBALS, $query, $row, and array.
Referenced by ilMailTemplateGUI\getTemplateForm(), and ilMailTemplateGUI\showTemplates().
101 if($a_id && !is_array($a_id))
103 $a_id =
array($a_id);
106 $query =
'SELECT * FROM mail_tpl_ctx';
110 $where[] =
$GLOBALS[
'ilDB']->in(
'id', $a_id,
false,
'text');
114 $query .=
' WHERE '. implode(
' AND ', $where);
120 $context = self::getContextInstance(
$row[
'component'],
$row[
'id'],
$row[
'class'],
$row[
'path']);
123 $templates[$context->getId()] = $context;
$GLOBALS['loaded']
Global hash that tracks already loaded includes.
Class ilMailTemplateContext.
Create styles array
The data for the language used.
◆ insertFromXML()
static ilMailTemplateService::insertFromXML |
( |
|
$a_component, |
|
|
|
$a_id, |
|
|
|
$a_class, |
|
|
|
$a_path |
|
) |
| |
|
static |
- Parameters
-
string | $a_component | |
string | $a_id | |
string | $a_class | |
string | $a_path | |
Definition at line 61 of file class.ilMailTemplateService.php.
References $GLOBALS.
Referenced by ilObjDefReader\handlerBeginTag().
63 if(!
$GLOBALS[
'ilDB']->tableExists(
'mail_tpl_ctx'))
68 $context = self::getContextInstance($a_component, $a_id, $a_class, $a_path);
71 self::createEntry($context, $a_component, $a_class, $a_path);
$GLOBALS['loaded']
Global hash that tracks already loaded includes.
Class ilMailTemplateContext.
The documentation for this class was generated from the following file: