CMS
Version 3.9
email_template.inc
Go to the documentation of this file.
1
<?php
7
/**************************************************************
8
9
Copyright (c) 2010 Sonjara, Inc
10
11
Permission is hereby granted, free of charge, to any person
12
obtaining a copy of this software and associated documentation
13
files (the "Software"), to deal in the Software without
14
restriction, including without limitation the rights to use,
15
copy, modify, merge, publish, distribute, sublicense, and/or sell
16
copies of the Software, and to permit persons to whom the
17
Software is furnished to do so, subject to the following
18
conditions:
19
20
The above copyright notice and this permission notice shall be
21
included in all copies or substantial portions of the Software.
22
23
Except as contained in this notice, the name(s) of the above
24
copyright holders shall not be used in advertising or otherwise
25
to promote the sale, use or other dealings in this Software
26
without prior written authorization.
27
28
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
29
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
30
OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
31
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
32
HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
33
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
34
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
35
OTHER DEALINGS IN THE SOFTWARE.
36
37
*****************************************************************/
38
39
40
class
EmailTemplate
extends
DataItem
41
{
42
var
$fields
= array(
43
"email_template_id"
=> Number,
44
"class_name"
=> String,
45
"name"
=> String,
46
"sender_email"
=> String,
47
"recipients"
=> Text,
48
"subject"
=> String,
49
"message"
=> HTML
50
);
51
57
static
function
getEmailTemplate
(
$name
)
58
{
59
$emailTemplates
= Query::create(
EmailTemplate
,
"WHERE name=:n"
)
60
->bind(
":n"
,
$name
)
61
->execute();
62
63
return
(count(
$emailTemplates
) > 0) ?
$emailTemplates
[0] :
null
;
64
}
65
71
static
function
templateExists
(
$name
)
72
{
73
return
Query::create(
'EmailTemplate'
,
"WHERE name=:n"
)
74
->bind(
":n"
,
$name
)
75
->count() > 0;
76
}
77
89
static
function
setDefaultTemplate
(
$name
,
$recipients
,
$subject
,
$message
,
$class_name
, $sender_email =
""
)
90
{
91
$emailTemplates
= Query::create(
EmailTemplate
,
"WHERE name=:name"
)
92
->bind(
":name"
,
$name
)
93
->execute();
94
95
if
(count(
$emailTemplates
))
96
{
97
return
;
98
}
99
100
$emailTemplate
=
new
EmailTemplate
();
101
$emailTemplate
->name =
$name
;
102
$emailTemplate
->class_name =
$class_name
;
103
$emailTemplate
->recipients =
$recipients
;
104
$emailTemplate
->subject =
$subject
;
105
$emailTemplate
->message =
$message
;
106
$emailTemplate
->save();
107
}
108
109
function
EmailTemplate
()
110
{
111
$this->table =
"email_template"
;
112
$this->primary_key =
"email_template_id"
;
113
114
$this->DataItem(func_get_args());
115
}
116
}
117
118
119
?>
$emailTemplate
$emailTemplate
Definition:
email_template_form.inc:47
$emailTemplates
$emailTemplates
Definition:
email_template_list.inc:48
$class_name
$class_name
Definition:
advanced_email_features.inc:47
$name
$name
Definition:
upload.inc:54
EmailTemplate
Definition:
email_template.inc:41
EmailTemplate\$fields
$fields
Definition:
email_template.inc:42
EmailTemplate\getEmailTemplate
static getEmailTemplate($name)
Retrieves the named email templated.
Definition:
email_template.inc:57
EmailTemplate\EmailTemplate
EmailTemplate()
Definition:
email_template.inc:109
EmailTemplate\setDefaultTemplate
static setDefaultTemplate($name, $recipients, $subject, $message, $class_name, $sender_email="")
Create a default template for emails that are sent through Fakoli components (e.g....
Definition:
email_template.inc:89
EmailTemplate\templateExists
static templateExists($name)
Checks whether the named EmailTemplate exists.
Definition:
email_template.inc:71
$message
$message
Definition:
mail_to.inc:49
$subject
$subject
Definition:
permissions_checker.inc:25
$recipients
$recipients
Definition:
recipients_dialog.inc:56
code
cms.sonjara.com
cms
components
email
datamodel
email_template.inc
Generated on Tue Mar 23 2021 15:36:12 for CMS by
1.9.1