Exponential Basic 2.4.0.1 Exponential Basic CMS — PHP Class Reference

ezbulkmailtemplate.php
Go to the documentation of this file.
1 <?php
3 //
4 // $Id: ezbulkmailtemplate.php 8528 2001-11-19 14:01:43Z jhe $
5 //
6 // eZBulkMailTemplate class
7 //
8 // Created on: <17-Apr-2001 14:07:32 fh>
9 //
10 // This source file is part of Exponential Basic, publishing software.
11 //
12 // Copyright (C) 1999-2001 eZ Systems. All rights reserved.
13 //
14 // This program is free software; you can redistribute it and/or
15 // modify it under the terms of the GNU General Public License
16 // as published by the Free Software Foundation; either version 2
17 // of the License, or (at your option) any later version.
18 //
19 // This program is distributed in the hope that it will be useful,
20 // but WITHOUT ANY WARRANTY; without even the implied warranty of
21 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
22 // GNU General Public License for more details.
23 //
24 // You should have received a copy of the GNU General Public License
25 // along with this program; if not, write to the Free Software
26 // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, US
27 //
28
31
39 class eZBulkMailTemplate
40 {
43 function __construct( $id=-1 )
44 {
45 if ( $id != -1 )
46 {
47 $this->ID = $id;
48 $this->get( $this->ID );
49 }
50 }
51
55 function store()
56 {
57 $db =& eZDB::globalDatabase();
58 $db->begin();
59 $name = $db->escapeString( $this->Name );
60 $header = $db->escapeString( $this->Header );
61 $footer = $db->escapeString( $this->Footer );
62 $description = $db->escapeString( $this->Description );
63
64 if ( !isset( $this->ID ) )
65 {
66 $db->lock( "eZBulkMail_Template" );
67 $nextID = $db->nextID( "eZBulkMail_Template", "ID" );
68 $result = $db->query( "INSERT INTO eZBulkMail_Template
69 ( ID, Header, Name, Footer, Description )
70 VALUES
71 ( '$nextID',
72 '$header',
73 '$name',
74 '$footer',
75 '$description' )
76 " );
77 $this->ID = $nextID;
78 }
79 else
80 {
81 $result = $db->query( "UPDATE eZBulkMail_Template SET
82 Header='$header',
83 Name='$name',
84 Footer='$footer',
85 Description='$description'
86 WHERE ID='$this->ID'" );
87 }
88
89 $db->unlock();
90 if ( $result == false )
91 $db->rollback( );
92 else
93 $db->commit();
94 }
95
100 function delete( $id = -1)
101 {
102 $db =& eZDB::globalDatabase();
103
104 if ( $id == -1 )
105 $id = $this->ID;
106
107 $db->begin();
108 $result = $db->query( "DELETE FROM eZBulkMail_Template WHERE ID='$id'" );
109 if ( $result == false )
110 $db->rollback( );
111 else
112 $db->commit();
113 }
114
118 function get( $id=-1 )
119 {
120 $db =& eZDB::globalDatabase();
121
122 if ( $id != "" )
123 {
124 $db->array_query( $template_array, "SELECT * FROM eZBulkMail_Template WHERE ID='$id'" );
125 if ( count( $template_array ) > 1 )
126 {
127 die( "Error: Templates with the same ID was found in the database. This shouldent happen." );
128 }
129 else if ( count( $template_array ) == 1 )
130 {
131 $this->ID = $template_array[0][$db->fieldName( "ID" )];
132 $this->Name = $template_array[0][$db->fieldName( "Name" )];
133 $this->Header = $template_array[0][$db->fieldName( "Header" )];
134 $this->Footer = $template_array[0][$db->fieldName( "Footer" )];
135 $this->Description = $template_array[0][$db->fieldName( "Description")];
136 }
137 }
138 }
139
145 static public function getAll()
146 {
147 $db =& eZDB::globaldatabase();
148 $return_array = array();
149 $template_array = array();
150
151 $db->array_query( $template_array, "SELECT ID, Name FROM eZBulkMail_Template ORDER BY Name" );
152 for ( $i = 0; $i < count( $template_array ); $i++ )
153 {
154 $return_array[$i] = new eZBulkMailTemplate( $template_array[$i][$db->fieldName( "ID" )] );
155 }
156
157 return $return_array;
158 }
159
163 function id()
164 {
165 return $this->ID;
166 }
167
171 function header()
172 {
173 return $this->Header;
174 }
175
179 function footer()
180 {
181 return $this->Footer;
182 }
183
187 function name()
188 {
189 return $this->Name;
190 }
191
195 function description()
196 {
197 return $this->Description;
198 }
199
200
204 function setHeader( $value )
205 {
206 $this->Header = $value;
207 }
208
212 function setFooter( $value )
213 {
214 $this->Footer = $value;
215 }
216
220 function setName( $value )
221 {
222 $this->Name = $value;
223 }
224
228 function setDescription( $value )
229 {
230 $this->Description = $value;
231 }
232
233
237 function buildMessage( $message )
238 {
239 return $this->Header . $message . $this->Footer;
240 }
241
242 var $Header;
243 var $Footer;
244 var $Name;
245 var $Description;
246 var $ID;
247 }
248
249 ?>
$i
$i
Definition: admin/adlist.php:91
$message
$message
Definition: admin/message.php:51
eZBulkMailTemplate
Definition: ezbulkmailtemplate.php:40
eZBulkMailTemplate\footer
footer()
Definition: ezbulkmailtemplate.php:179
eZBulkMailTemplate\setDescription
setDescription( $value)
Definition: ezbulkmailtemplate.php:228
eZBulkMailTemplate\id
id()
Definition: ezbulkmailtemplate.php:163
eZBulkMailTemplate\$ID
$ID
Definition: ezbulkmailtemplate.php:246
eZBulkMailTemplate\header
header()
Definition: ezbulkmailtemplate.php:171
eZBulkMailTemplate\buildMessage
buildMessage( $message)
Definition: ezbulkmailtemplate.php:237
eZBulkMailTemplate\$Header
$Header
Definition: ezbulkmailtemplate.php:242
eZBulkMailTemplate\setName
setName( $value)
Definition: ezbulkmailtemplate.php:220
eZBulkMailTemplate\name
name()
Definition: ezbulkmailtemplate.php:187
eZBulkMailTemplate\getAll
static getAll()
Definition: ezbulkmailtemplate.php:145
eZBulkMailTemplate\description
description()
Definition: ezbulkmailtemplate.php:195
eZBulkMailTemplate\setHeader
setHeader( $value)
Definition: ezbulkmailtemplate.php:204
eZBulkMailTemplate\setFooter
setFooter( $value)
Definition: ezbulkmailtemplate.php:212
eZBulkMailTemplate\__construct
__construct( $id=-1)
Definition: ezbulkmailtemplate.php:43
eZBulkMailTemplate\$Name
$Name
Definition: ezbulkmailtemplate.php:244
eZBulkMailTemplate\store
store()
Definition: ezbulkmailtemplate.php:55
eZBulkMailTemplate\$Footer
$Footer
Definition: ezbulkmailtemplate.php:243
eZBulkMailTemplate\$Description
$Description
Definition: ezbulkmailtemplate.php:245
eZDB\globalDatabase
static & globalDatabase()
Definition: ezdb.php:134
$result
$result
Definition: companysearch.php:94
$name
$name
Definition: companytypelist.php:194
$id
$id
Definition: companytypelist.php:193
$template_array
$template_array
Definition: countryedit.php:43
$db
$db
Definition: ezarticle/user/authorlist.php:53
$header
$header
Definition: paypalnotify.php:141
Name
if($user) if(isset( $next) && $next)<?=isset($all_fields_error) &&$all_fields_error ?><?=isset($password_error) &&$password_error ?></p ><? endif;?>< form method="post">< table border="0" cellspacing="2" cellpadding="2" class="boxtext" style="font-size=13;">< tr >< td style="color:<?= isset( $error['first_name'] ) ?> First Name
Definition: step1.php:127
Copyright © 1998 – 2026 7x. All rights reserved. Licensed under the GNU GPLv2+.