33 $res = $this->db->query(
'SELECT * FROM mail_man_tpl');
34 while ($row = $this->db->fetchAssoc(
$res)) {
35 $template = new \ilMailTemplate($row);
36 $templates[] = $template;
49 $res = $this->db->queryF(
50 'SELECT * FROM mail_man_tpl WHERE tpl_id = %s',
55 if (1 === (
int) $this->db->numRows(
$res)) {
56 $row = $this->db->fetchAssoc(
$res);
57 return new \ilMailTemplate($row);
60 throw new \OutOfBoundsException(sprintf(
"Could not find template by id: %s", $templateId));
79 if (count($templateIds) > 0) {
80 $this->db->manipulate(
82 DELETE FROM mail_man_tpl WHERE ' .
83 $this->db->in(
'tpl_id', $templateIds,
false,
'integer')
97 'title' => [
'text', $template->
getTitle()],
98 'context' => [
'text', $template->
getContext()],
99 'lang' => [
'text', $template->
getLang()],
100 'm_subject' => [
'text', $template->
getSubject()],
101 'm_message' => [
'text', $template->
getMessage()],
102 'is_default' => [
'text', $template->
isDefault()],
105 'tpl_id' => [
'integer', $template->
getTplId()],
109 $nextId = $this->db->nextId(
'mail_man_tpl');
110 $this->db->insert(
'mail_man_tpl', [
111 'tpl_id' => [
'integer', $nextId],
112 'title' => [
'text', $template->
getTitle()],
113 'context' => [
'text', $template->
getContext()],
114 'lang' => [
'text', $template->
getLang()],
115 'm_subject' => [
'text', $template->
getSubject()],
116 'm_message' => [
'text', $template->
getMessage()],
117 'is_default' => [
'integer', $template->
isDefault()],
An exception for terminatinating execution or to throw for unit testing.
Class ilMailTemplateRepository.
findById(int $templateId)
findByContextId(string $contextId)
deleteByIds(array $templateIds)
store(\ilMailTemplate $template)
__construct(\ilDBInterface $db=null)
ilMailTemplateRepository constructor.
setTplId(int $templateId)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
foreach($_POST as $key=> $value) $res