Exponential Basic 2.4.0.1 Exponential Basic CMS — PHP Class Reference

ezbulkmailusercategorysettings.php
Go to the documentation of this file.
1 <?php
3 //
4 // $Id: ezbulkmailusercategorysettings.php 7122 2001-09-10 11:38:19Z ce $
5 //
6 // Definition of eZBulkMailCategorySettings class
7 //
8 // Created on: <17-Apr-2001 11:17:57 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 // include_once( "classes/ezdb.php" );
40 // include_once( "ezbulkmail/classes/ezbulkmail.php" );
41 // include_once( "ezbulkmail/classes/ezbulkmailcategory.php" );
42
43 class eZBulkMailUserCategorySettings
44 {
47 function __construct( $id=-1 )
48 {
49 if ( $id != -1 )
50 {
51 $this->ID = $id;
52 $this->get( $this->ID );
53 }
54 }
55
59 function store()
60 {
61 $db =& eZDB::globalDatabase();
62 $db->begin();
63 $name = $db->escapeString( $this->Name );
64 $description = $db->escapeString( $this->Description );
65 if ( !isset( $this->ID ) )
66 {
67 $db->lock( "eZBulkMail_UserCategorySettings" );
68 $nextID = $db->nextID( "eZBulkMail_UserCategorySettings", "ID" );
69
70 $result = $db->query( "INSERT INTO eZBulkMail_UserCategorySettings
71 ( ID, CategoryID, UserID, Delay )
72 VALUES
73 ( '$nextID',
74 '$this->CategoryID',
75 '$this->UserID',
76 '$this->Delay'
77 ) " );
78 $this->ID = $nextID;
79 }
80 else
81 {
82 $result = $db->query( "UPDATE eZBulkMail_UserCategorySettings SET
83 CategoryID='$this->CategoryID',
84 UserID='$this->UserID',
85 Delay='$this->Delay'
86 WHERE ID='$this->ID'" );
87 }
88
89 $db->unlock();
90 if ( $result == false )
91 $db->rollback( );
92 else
93 $db->commit();
94 }
95
99 function delete( $id = -1 )
100 {
101 $db =& eZDB::globalDatabase();
102 $db->begin();
103
104 if( $id == -1 )
105 $id = $this->ID;
106
107 $result = $db->query( "DELETE FROM eZBulkMail_UserCategorySettings WHERE ID='$id'" );
108
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( $category_array, "SELECT * FROM eZBulkMail_UserCategorySettings WHERE ID='$id'" );
125 if ( count( $category_array ) > 1 )
126 {
127 die( "Error: Category's with the same ID was found in the database. This shouldent happen." );
128 }
129 else if( count( $category_array ) == 1 )
130 {
131 $this->ID = $category_array[0][$db->fieldName( "ID" )];
132 $this->CategoryID = $category_array[0][$db->fieldName( "CategoryID" )];
133 $this->UserID = $category_array[0][$db->fieldName( "UserID" )];
134 $this->Delay = $category_array[0][$db->fieldName( "Delay" )];
135 }
136 }
137 }
138
142 function id()
143 {
144 return $this->ID;
145 }
146
150 function category()
151 {
152 return new eZBulkMailCategorySettings( $this->CategoryID );
153 }
154
158 function subscriptionAddress()
159 {
160 return new eZBulkMailUserSubscripter( $this->UserID );
161 }
162
169 function delay()
170 {
171 return $this->Delay;
172 }
173
177 function setCategory( $value )
178 {
179 if ( is_a ( $value, "eZBulkMailCategory" ) )
180 $this->CategoryID = $value->id();
181 elseif ( is_numeric( $value ) )
182 $this->CategoryID = $value;
183 }
184
188 function setAddress( $value )
189 {
190 if ( is_a( $value, "eZBulkMailUserSubscripter" ) )
191 $this->UserID = $value->id();
192 elseif ( is_numeric( $value ) )
193 $this->UserID = $value;
194 }
195
204 function setDelay( $value )
205 {
206 $this->Delay = $value;
207 }
208
209 var $ID;
210 var $CategoryID;
211 var $UserID;
212 var $Delay;
213 }
214
215 ?>
$CategoryID
$CategoryID
Definition: admin/articleedit.php:53
eZBulkMailUserSubscripter
Definition: ezbulkmailusersubscripter.php:42
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
$db
$db
Definition: ezarticle/user/authorlist.php:53
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
$UserID
$UserID
Definition: todoedit.php:122
$category_array
$category_array
Definition: todoedit.php:604
Copyright © 1998 – 2026 7x. All rights reserved. Licensed under the GNU GPLv2+.