Class ilMailTemplateContextService.
More...
◆ clearFromXml()
static ilMailTemplateContextService::clearFromXml |
( |
|
$a_component, |
|
|
array |
$a_new_templates |
|
) |
| |
|
static |
- Parameters
-
string | $a_component | |
array | $a_new_templates | |
Definition at line 13 of file class.ilMailTemplateContextService.php.
References $DIC, $id, $query, and $row.
Referenced by ilObjDefReader\handlerEndTag().
17 if (!$DIC->database()->tableExists(
'mail_tpl_ctx')) {
21 $persisted_templates = array();
22 $query =
'SELECT id FROM mail_tpl_ctx WHERE component = ' . $DIC->database()->quote($a_component,
'text');
23 $set = $DIC->database()->query(
$query);
24 while (
$row = $DIC->database()->fetchAssoc($set)) {
25 $persisted_templates[] =
$row[
'id'];
28 if (count($persisted_templates)) {
29 if (count($a_new_templates)) {
30 foreach ($persisted_templates as
$id) {
31 if (!in_array($id, $a_new_templates)) {
32 $DIC->database()->manipulate(
33 'DELETE FROM mail_tpl_ctx WHERE component = ' . $DIC->database()->quote(
36 ) .
' AND id = ' . $DIC->database()->quote($id,
'text')
38 $DIC[
'ilLog']->debug(
"Mail Template XML - Context " . $id .
" in class " . $a_component .
" deleted.");
42 $DIC->database()->manipulate(
'DELETE FROM mail_tpl_ctx WHERE component = ' . $DIC->database()->quote(
46 $DIC[
'ilLog']->debug(
"Mail Template XML - All contexts deleted for " . $a_component .
" as component is inactive.");
if(!array_key_exists('StateId', $_REQUEST)) $id
◆ createEntry()
static ilMailTemplateContextService::createEntry |
( |
ilMailTemplateContext |
$a_context, |
|
|
|
$a_component, |
|
|
|
$a_class, |
|
|
|
$a_path |
|
) |
| |
|
staticprotected |
- Parameters
-
Definition at line 170 of file class.ilMailTemplateContextService.php.
References $DIC, $query, $res, $row, and ilMailTemplateContext\getId().
174 $query =
"SELECT id FROM mail_tpl_ctx WHERE id = %s";
175 $res = $DIC->database()->queryF(
$query, array(
'text'), array($a_context->
getId()));
176 $row = $DIC->database()->fetchAssoc(
$res);
177 $context_exists = (
$row[
'id'] == $a_context->
getId());
179 if (!$context_exists) {
180 $DIC->database()->insert(
'mail_tpl_ctx', array(
181 'id' => array(
'text', $a_context->
getId()),
182 'component' => array(
'text', $a_component),
183 'class' => array(
'text', $a_class),
184 'path' => array(
'text', $a_path)
187 $DIC[
'ilLog']->debug(
"Mail Template XML - Context " . $a_context->
getId() .
" in class " . $a_class .
" added.");
189 $DIC->database()->update(
'mail_tpl_ctx', array(
190 'component' => array(
'text', $a_component),
191 'class' => array(
'text', $a_class),
192 'path' => array(
'text', $a_path)
194 'id' => array(
'text', $a_context->
getId())
197 $DIC[
'ilLog']->debug(
"Mail Template XML - Context " . $a_context->
getId() .
" in class " . $a_class .
" updated.");
getId()
Returns a unique (in the context of mail template contexts) id.
foreach($_POST as $key=> $value) $res
◆ getContextInstance()
static ilMailTemplateContextService::getContextInstance |
( |
|
$a_component, |
|
|
|
$a_id, |
|
|
|
$a_class, |
|
|
|
$a_path |
|
) |
| |
|
staticprotected |
- Parameters
-
string | $a_component | |
string | $a_id | |
string | $a_class | |
string | $a_path | |
- Returns
- null|ilMailTemplateContext
Definition at line 130 of file class.ilMailTemplateContextService.php.
References $context, and $DIC.
137 $a_path = $a_component .
'/classes/';
139 $class_file = $a_path .
'class.' . $a_class .
'.php';
141 if (file_exists($class_file)) {
142 require_once $class_file;
143 if (class_exists($a_class)) {
149 $mess .=
" - context id mismatch";
152 $mess .=
" - does not extend ilMailTemplateContext";
155 $mess =
"- class not found in file";
158 $mess =
" - class file not found";
161 $DIC[
'ilLog']->debug(
"Mail Template XML - Context " . $a_id .
" in class " . $a_class .
" (" . $class_file .
") is invalid." . $mess);
Class ilMailTemplateContext.
◆ getTemplateContextById()
static ilMailTemplateContextService::getTemplateContextById |
( |
|
$a_id | ) |
|
|
static |
◆ getTemplateContexts()
static ilMailTemplateContextService::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 92 of file class.ilMailTemplateContextService.php.
References $context, $DIC, $query, and $row.
Referenced by ilMailTemplateTableGUI\__construct(), ilMailTemplateGUI\getTemplateForm(), and ilMailTemplateGUI\showTemplates().
98 if ($a_id && !is_array($a_id)) {
102 $query =
'SELECT * FROM mail_tpl_ctx';
105 $where[] = $DIC->database()->in(
'id', $a_id,
false,
'text');
108 $query .=
' WHERE ' . implode(
' AND ', $where);
111 $set = $DIC->database()->query(
$query);
112 while (
$row = $DIC->database()->fetchAssoc($set)) {
Class ilMailTemplateContext.
◆ insertFromXML()
static ilMailTemplateContextService::insertFromXML |
( |
|
$a_component, |
|
|
|
$a_id, |
|
|
|
$a_class, |
|
|
|
$a_path |
|
) |
| |
|
static |
The documentation for this class was generated from the following file: