Exponential Basic 2.4.0.1 Exponential Basic CMS — PHP Class Reference

ezboxtype.php
Go to the documentation of this file.
1 <?php
3 //
4 // $Id: ezboxtype.php,v 1.8 2001/10/02 07:59:01 ce Exp $
5 //
6 // Definition of eZBoxType class
7 //
8 // Created on: <11-Jan-2004 rbs>
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
29
32
36 // include_once( "classes/ezdb.php" );
37 // include_once( "eztrade/classes/ezproducttype.php" );
38
39 class eZBoxType
40 {
44 function eZBoxType( $id=-1 )
45 {
46 $this->BoxValue = 0;
47 if ( $id != -1 )
48 {
49 $this->ID = $id;
50 $this->get( $this->ID );
51 }
52 }
53
57 function store()
58 {
59 $db =& eZDB::globalDatabase();
60 $db->begin();
61
62 $this->Name = $db->escapeString( $this->Name );
63
64 if ( !isset( $this->ID ) )
65 {
66 $db->lock( "eZTrade_BoxType" );
67 $nextID = $db->nextID( "eZTrade_BoxType", "ID" );
68 $ret[] = $db->query( "INSERT INTO eZTrade_BoxType
69 ( ID,
70 Name,
71 Length,
72 Height,
73 Width )
74 VALUES
75 ( '$nextID',
76 '$this->Name',
77 '$this->Length',
78 '$this->Height',
79 '$this->Width' )" );
80 $db->unlock();
81 $this->ID = $nextID;
82 }
83 else
84 {
85 $ret[] = $db->query( "UPDATE eZTrade_BoxType SET
86 Name='$this->Name',
87 Length='$this->Length',
88 Height='$this->Height',
89 Width='$this->Width'
90 WHERE ID='$this->ID'" );
91 }
92 eZDB::finish( $ret, $db );
93 return true;
94 }
95
99 function get( $id=-1 )
100 {
101 $db =& eZDB::globalDatabase();
102
103 if ( $id != -1 )
104 {
105 $db->array_query( $box_array, "SELECT * FROM eZTrade_BoxType WHERE ID='$id'" );
106
107 if ( count( $box_array ) > 1 )
108 {
109 die( "Error: Box Types with the same ID was found in the database. This should not happen." );
110 }
111 else if( count( $box_array ) == 1 )
112 {
113 $this->ID =& $box_array[0][$db->fieldName("ID")];
114 $this->Name =& $box_array[0][$db->fieldName("Name")];
115 $this->Length =& $box_array[0][$db->fieldName("Length")];
116 $this->Height =& $box_array[0][$db->fieldName("Height")];
117 $this->Width =& $box_array[0][$db->fieldName("Width")];
118 }
119 }
120 }
121
125 function &getAll()
126 {
127 $db =& eZDB::globalDatabase();
128
129 $return_array = array();
130 $box_array = array();
131
132 $db->array_query( $box_array, "SELECT ID FROM eZTrade_BoxType ORDER BY ID" );
133
134 for ( $i=0; $i<count($box_array); $i++ )
135 {
136 $return_array[$i] = new eZBoxType( $box_array[$i][$db->fieldName("ID")], 0 );
137 }
138
139 return $return_array;
140 }
141
145 function delete()
146 {
147 $db =& eZDB::globalDatabase();
148 $db->begin();
149 $ret[] = $db->query( "DELETE FROM eZTrade_BoxType WHERE ID='$this->ID'" );
150 eZDB::finish( $ret, $db );
151 }
152
156 function id()
157 {
158 return $this->ID;
159 }
160
164 function name()
165 {
166 return $this->Name;
167 }
168
172 function length()
173 {
174 return $this->Length;
175 }
176
180 function height()
181 {
182 return $this->Height;
183 }
184
188 function width()
189 {
190 return $this->Width;
191 }
192
196 function setName( $value )
197 {
198 $this->Name = $value;
199 }
200
204 function setLength( $value )
205 {
206 $this->Length = $value;
207 }
208
212 function setHeight( $value )
213 {
214 $this->Height = $value;
215 }
216
220 function setWidth( $value )
221 {
222 $this->Width = $value;
223 }
224
225 var $ID;
226 var $Name;
227 var $Length;
228 var $Height;
229 var $Width;
230 }
231 ?>
$i
$i
Definition: admin/adlist.php:91
eZBoxType
Definition: ezboxtype.php:40
eZBoxType\store
store()
Definition: ezboxtype.php:57
eZBoxType\$Width
$Width
Definition: ezboxtype.php:229
eZBoxType\$Length
$Length
Definition: ezboxtype.php:227
eZBoxType\height
height()
Definition: ezboxtype.php:180
eZBoxType\name
name()
Definition: ezboxtype.php:164
eZBoxType\setWidth
setWidth( $value)
Definition: ezboxtype.php:220
eZBoxType\setName
setName( $value)
Definition: ezboxtype.php:196
eZBoxType\$Name
$Name
Definition: ezboxtype.php:226
eZBoxType\$Height
$Height
Definition: ezboxtype.php:228
eZBoxType\eZBoxType
eZBoxType( $id=-1)
Definition: ezboxtype.php:44
eZBoxType\$ID
$ID
Definition: ezboxtype.php:225
eZBoxType\setLength
setLength( $value)
Definition: ezboxtype.php:204
eZBoxType\id
id()
Definition: ezboxtype.php:156
eZBoxType\width
width()
Definition: ezboxtype.php:188
eZBoxType\getAll
& getAll()
Definition: ezboxtype.php:125
eZBoxType\setHeight
setHeight( $value)
Definition: ezboxtype.php:212
eZBoxType\length
length()
Definition: ezboxtype.php:172
eZDB\finish
static finish(&$resultArray, &$db)
Definition: ezdb.php:204
eZDB\globalDatabase
static & globalDatabase()
Definition: ezdb.php:134
$id
$id
Definition: companytypelist.php:193
$db
$db
Definition: ezarticle/user/authorlist.php:53
$ret
$ret
Definition: ezsitemanager/admin/filelist.php:88
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+.