Exponential Basic 2.4.0.1 Exponential Basic CMS — PHP Class Reference

ezwishlistoptionvalue.php
Go to the documentation of this file.
1 <?php
3 //
4 // $Id: ezwishlistoptionvalue.php 6318 2001-07-31 11:33:12Z jhe $
5 //
6 // Definition of eZWishListOptionValue class
7 //
8 // Created on: <21-Oct-2000 18:08:22 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
35 // include_once( "classes/ezdb.php" );
36
37 // include_once( "eztrade/classes/ezwishlistitem.php" );
38 // include_once( "eztrade/classes/ezoption.php" );
39 // include_once( "eztrade/classes/ezoptionvalue.php" );
40
41 class eZWishListOptionValue
42 {
49 function __construct( $id="" )
50 {
51 if ( $id != "" )
52 {
53 $this->ID = $id;
54 $this->get( $this->ID );
55 }
56 else
57 {
58 $this->Count = 1;
59 }
60 }
61
65 function store()
66 {
67 $db =& eZDB::globalDatabase();
68 $db->begin();
69
70 if ( !isset( $this->ID ) )
71 {
72 $db->lock( "eZTrade_WishListOptionValue" );
73 $nextID = $db->nextID( "eZTrade_WishListOptionValue", "ID" );
74
75 $res[] = $db->query( "INSERT INTO eZTrade_WishListOptionValue
76 ( ID, WishListItemID, OptionID, OptionValueID )
77 VALUES
78 ( '$nextID',
79 '$this->WishListItemID',
80 '$this->OptionID',
81 '$this->OptionValueID' )
82 " );
83 $db->unlock();
84 $this->ID = $nextID;
85 }
86 else
87 {
88 $res[] = $db->query( "UPDATE eZTrade_WishListOptionValue SET
89 WishListItemID='$this->WishListItemID',
90 OptionID='$this->OptionID',
91 OptionValueID='$this->OptionValueID'
92 WHERE ID='$this->ID'
93 " );
94 }
95 eZDB::finish( $res, $db );
96 return true;
97 }
98
102 function get( $id="" )
103 {
104 $db =& eZDB::globalDatabase();
105 $ret = false;
106
107 if ( $id != "" )
108 {
109 $db->array_query( $wishlist_array, "SELECT * FROM eZTrade_WishListOptionValue WHERE ID='$id'" );
110 if ( count( $wishlist_array ) > 1 )
111 {
112 die( "Error: Wishlist's with the same ID was found in the database. This shouldent happen." );
113 }
114 else if( count( $wishlist_array ) == 1 )
115 {
116 $this->ID =& $wishlist_array[0][$db->fieldName( "ID" )];
117 $this->WishListItemID =& $wishlist_array[0][$db->fieldName( "WishListItemID" )];
118 $this->OptionID =& $wishlist_array[0][$db->fieldName( "OptionID" )];
119 $this->OptionValueID =& $wishlist_array[0][$db->fieldName( "OptionValueID" )];
120
121 $ret = true;
122 }
123 }
124 return $ret;
125 }
126
130 function id( )
131 {
132 return $this->ID;
133 }
134
138 function &wishlistItem()
139 {
140 return new eZWishListItem( $this->WishListItemID );
141 }
142
146 function &option()
147 {
148 return new eZOption( $this->OptionID );
149 }
150
154 function &optionValue()
155 {
156 return new eZOptionValue( $this->OptionValueID );
157 }
158
162 function setWishListItem( &$wishlistItem )
163 {
164 if ( is_a( $wishlistItem, "eZWishListItem" ) )
165 {
166 $this->WishListItemID = $wishlistItem->id();
167 }
168 }
169
173 function setOption( &$option )
174 {
175 if ( is_a( $option, "eZOption" ) )
176 {
177 $this->OptionID = $option->id();
178 }
179 }
180
184 function setOptionValue( &$optionValue )
185 {
186 if ( is_a( $optionValue, "eZOptionValue" ) )
187 {
188 $this->OptionValueID = $optionValue->id();
189 }
190 }
191
192 var $ID;
193 var $WishListItemID;
194 var $OptionID;
195 var $OptionValueID;
196 }
197
198 ?>
eZDB\finish
static finish(&$resultArray, &$db)
Definition: ezdb.php:204
eZDB\globalDatabase
static & globalDatabase()
Definition: ezdb.php:134
eZOptionValue
Definition: ezoptionvalue.php:54
eZOption
Definition: ezoption.php:82
eZWishListItem
Definition: ezwishlistitem.php:55
eZWishListOptionValue
Definition: ezwishlistoptionvalue.php:42
eZWishListOptionValue\$OptionID
$OptionID
Definition: ezwishlistoptionvalue.php:194
eZWishListOptionValue\$WishListItemID
$WishListItemID
Definition: ezwishlistoptionvalue.php:193
eZWishListOptionValue\store
store()
Definition: ezwishlistoptionvalue.php:65
eZWishListOptionValue\$OptionValueID
$OptionValueID
Definition: ezwishlistoptionvalue.php:195
eZWishListOptionValue\id
id()
Definition: ezwishlistoptionvalue.php:130
eZWishListOptionValue\$ID
$ID
Definition: ezwishlistoptionvalue.php:192
eZWishListOptionValue\setOptionValue
setOptionValue(&$optionValue)
Definition: ezwishlistoptionvalue.php:184
eZWishListOptionValue\optionValue
& optionValue()
Definition: ezwishlistoptionvalue.php:154
eZWishListOptionValue\wishlistItem
& wishlistItem()
Definition: ezwishlistoptionvalue.php:138
eZWishListOptionValue\option
& option()
Definition: ezwishlistoptionvalue.php:146
eZWishListOptionValue\setWishListItem
setWishListItem(&$wishlistItem)
Definition: ezwishlistoptionvalue.php:162
eZWishListOptionValue\setOption
setOption(&$option)
Definition: ezwishlistoptionvalue.php:173
eZWishListOptionValue\__construct
__construct( $id="")
Definition: ezwishlistoptionvalue.php:49
$id
$id
Definition: companytypelist.php:193
$db
$db
Definition: ezarticle/user/authorlist.php:53
$ret
$ret
Definition: ezsitemanager/admin/filelist.php:88
$res
$res
Definition: ezstats/admin/cron.php:45
Copyright © 1998 – 2026 7x. All rights reserved. Licensed under the GNU GPLv2+.