Exponential Basic 2.4.0.1 Exponential Basic CMS — PHP Class Reference

ezorderoptionvalue.php
Go to the documentation of this file.
1 <?php
3 //
4 // $Id: ezorderoptionvalue.php 6773 2001-08-30 11:38:31Z ce $
5 //
6 // Definition of eZOrderOptionValue class
7 //
8 // Created on: <28-Sep-2000 16:40:01 bf>
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 //
30
39 // include_once( "classes/ezdb.php" );
40
41 class eZOrderOptionValue
42 {
49 function __construct( $id="" )
50 {
51 if ( $id != "" )
52 {
53 $this->ID = $id;
54 $this->get( $this->ID );
55 }
56 }
57
61 function store()
62 {
63 $db =& eZDB::globalDatabase();
64 $db->begin();
65
66 $this->OptionName = $db->escapeString( $this->OptionName );
67 $this->ValueName = $db->escapeString( $this->ValueName );
68 $this->RemoteID = $db->escapeString( $this->RemoteID );
69
70 if ( !isset( $this->ID ) )
71 {
72 $db->lock( "eZTrade_OrderOptionValue" );
73 $nextID = $db->nextID( "eZTrade_OrderOptionValue", "ID");
74 $ret[] = $db->query( "INSERT INTO eZTrade_OrderOptionValue
75 ( ID,
76 OrderItemID,
77 OptionName,
78 RemoteID,
79 ValueName )
80 VALUES
81 ( '$nextID',
82 '$this->OrderItemID',
83 '$this->OptionName',
84 '$this->RemoteID',
85 '$this->ValueName' )" );
86
87 $db->unlock();
88 $this->ID = $nextID;
89 }
90 else
91 {
92 $ret[] = $db->query( "UPDATE eZTrade_OrderOptionValue SET
93 OrderItemID='$this->OrderItemID',
94 OptionName='$this->OptionName',
95 RemoteID='$this->RemoteID',
96 ValueName='$this->ValueName'
97 WHERE ID='$this->ID'
98 " );
99 }
100 eZDB::finish( $ret, $db );
101 return true;
102 }
103
107 function get( $id="" )
108 {
109 $db =& eZDB::globalDatabase();
110 $ret = false;
111
112 if ( $id != "" )
113 {
114 $db->array_query( $option_value_array, "SELECT * FROM eZTrade_OrderOptionValue WHERE ID='$id'" );
115 if ( count( $option_value_array ) > 1 )
116 {
117 die( "Error: Option_value's with the same ID was found in the database. This shouldent happen." );
118 }
119 else if( count( $option_value_array ) == 1 )
120 {
121 $this->ID =& $option_value_array[0][$db->fieldName("ID")];
122 $this->OrderItemID =& $option_value_array[0][$db->fieldName("OrderItemID")];
123 $this->OptionName =& $option_value_array[0][$db->fieldName("OptionName")];
124 $this->ValueName =& $option_value_array[0][$db->fieldName("ValueName")];
125 $this->RemoteID =& $option_value_array[0][$db->fieldName("RemoteID")];
126
127 $ret = true;
128 }
129 }
130 return $ret;
131 }
132
136 function id()
137 {
138 return $this->ID;
139 }
140
144 function optionName( )
145 {
146 return $this->OptionName;
147 }
148
152 function valueName( )
153 {
154 return $this->ValueName;
155 }
156
160 function remoteID( )
161 {
162 return $this->RemoteID;
163 }
164
168 function setOrderItem( $orderItem )
169 {
170 if ( is_a( $orderItem, "eZOrderItem" ) )
171 {
172 $this->OrderItemID = $orderItem->id();
173 }
174 }
175
179 function setOptionName( $value )
180 {
181 $this->OptionName = $value;
182 }
183
187 function setValueName( $value )
188 {
189 $this->ValueName = $value;
190 }
191
195 function setRemoteID( $value )
196 {
197 $this->RemoteID = $value;
198 }
199
200
201 var $ID;
202 var $OrderItemID;
203 var $OptionName;
204 var $ValueName;
205 var $RemoteID;
206
207 }
208
209 ?>
eZDB\finish
static finish(&$resultArray, &$db)
Definition: ezdb.php:204
eZDB\globalDatabase
static & globalDatabase()
Definition: ezdb.php:134
eZOrderOptionValue
Definition: ezorderoptionvalue.php:42
eZOrderOptionValue\$ValueName
$ValueName
Definition: ezorderoptionvalue.php:204
eZOrderOptionValue\$ID
$ID
Definition: ezorderoptionvalue.php:201
eZOrderOptionValue\setOptionName
setOptionName( $value)
Definition: ezorderoptionvalue.php:179
eZOrderOptionValue\__construct
__construct( $id="")
Definition: ezorderoptionvalue.php:49
eZOrderOptionValue\setOrderItem
setOrderItem( $orderItem)
Definition: ezorderoptionvalue.php:168
eZOrderOptionValue\valueName
valueName()
Definition: ezorderoptionvalue.php:152
eZOrderOptionValue\store
store()
Definition: ezorderoptionvalue.php:61
eZOrderOptionValue\id
id()
Definition: ezorderoptionvalue.php:136
eZOrderOptionValue\setValueName
setValueName( $value)
Definition: ezorderoptionvalue.php:187
eZOrderOptionValue\setRemoteID
setRemoteID( $value)
Definition: ezorderoptionvalue.php:195
eZOrderOptionValue\$RemoteID
$RemoteID
Definition: ezorderoptionvalue.php:205
eZOrderOptionValue\$OrderItemID
$OrderItemID
Definition: ezorderoptionvalue.php:202
eZOrderOptionValue\optionName
optionName()
Definition: ezorderoptionvalue.php:144
eZOrderOptionValue\$OptionName
$OptionName
Definition: ezorderoptionvalue.php:203
eZOrderOptionValue\remoteID
remoteID()
Definition: ezorderoptionvalue.php:160
$id
$id
Definition: companytypelist.php:193
$db
$db
Definition: ezarticle/user/authorlist.php:53
$ret
$ret
Definition: ezsitemanager/admin/filelist.php:88
Copyright © 1998 – 2026 7x. All rights reserved. Licensed under the GNU GPLv2+.