Exponential Basic 2.4.0.1 Exponential Basic CMS — PHP Class Reference

ezimagevariationgroup.php
Go to the documentation of this file.
1 <?php
3 //
4 // $Id: ezimagevariationgroup.php 9854 2003-06-12 14:33:53Z br $
5 //
6 // Definition of eZImageVariationGroup class
7 //
8 // Created on: <21-Sep-2000 17:28:47 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 class eZImageVariationGroup
38 {
42 function __construct( $id="" )
43 {
44 $this->ImageVariationGroup = 0;
45 $this ->ID = 0;
46
47 if ( $id != "" )
48 {
49 $this->ID = $id;
50 $this->get( $this->ID );
51 }
52 }
53
57 function store()
58 {
59 $db =& eZDB::globalDatabase();
60
61 $db->begin( );
62
63 $db->lock( "eZImageCatalogue_ImageVariationGroup" );
64
65 $this->ID = $db->nextID( "eZImageCatalogue_ImageVariationGroup", "ID" );
66
67 $res = $db->query( "INSERT INTO eZImageCatalogue_ImageVariationGroup
68 ( ID, Width, Height ) VALUES ( '$this->ID', '$this->Width', '$this->Height' )" );
69
70 $db->unlock();
71
72 if ( $res == false )
73 $db->rollback( );
74 else
75 $db->commit();
76 }
77
81 function get( $id="" )
82 {
83 $db =& eZDB::globalDatabase();
84
85 if ( $id != "" )
86 {
87 $db->array_query( $image_variation_array, "SELECT * FROM eZImageCatalogue_ImageVariationGroup WHERE ID='$id'" );
88 if ( count( $image_variation_array ) > 1 )
89 {
90 die( "Error: ImageVariations's with the same ID was found in the database. This should not happen." );
91 }
92 else if( count( $image_variation_array ) == 1 )
93 {
94 $this->ID = $image_variation_array[0][$db->fieldName("ID")];
95 $this->Width = $image_variation_array[0][$db->fieldName("Width")];
96 $this->Height = $image_variation_array[0][$db->fieldName("Height")];
97 }
98 }
99 }
100
104 function groupExists( $width, $height )
105 {
106 $db =& eZDB::globalDatabase();
107
108 $ret = false;
109
110 $query = ( "SELECT * FROM eZImageCatalogue_ImageVariationGroup WHERE Width='$width' AND Height='$height'" );
111
112 $db->array_query( $group_array, $query, array( "Limit" => 1, "Offset" => 0 ) );
113
114 if ( count( $group_array ) == 1 )
115 {
116 $ret = $group_array[0][$db->fieldName("ID")];
117 }
118
119 return $ret;
120 }
121
125 function id()
126 {
127 return $this->ID;
128 }
129
133 function width()
134 {
135 return $this->Width;
136 }
137
141 function height()
142 {
143 return $this->Height;
144 }
145
149 function setWidth( $value )
150 {
151 $this->Width = $value;
152 }
153
157 function setHeight( $value )
158 {
159 $this->Height = $value;
160 }
161
162 var $ID;
163 var $Width;
164 var $Height;
165 }
166
167 ?>
eZDB\globalDatabase
static & globalDatabase()
Definition: ezdb.php:134
eZImageVariationGroup
Definition: ezimagevariationgroup.php:38
eZImageVariationGroup\__construct
__construct( $id="")
Definition: ezimagevariationgroup.php:42
eZImageVariationGroup\width
width()
Definition: ezimagevariationgroup.php:133
eZImageVariationGroup\groupExists
groupExists( $width, $height)
Definition: ezimagevariationgroup.php:104
eZImageVariationGroup\store
store()
Definition: ezimagevariationgroup.php:57
eZImageVariationGroup\height
height()
Definition: ezimagevariationgroup.php:141
eZImageVariationGroup\$ID
$ID
Definition: ezimagevariationgroup.php:162
eZImageVariationGroup\$Height
$Height
Definition: ezimagevariationgroup.php:164
eZImageVariationGroup\$Width
$Width
Definition: ezimagevariationgroup.php:163
eZImageVariationGroup\setWidth
setWidth( $value)
Definition: ezimagevariationgroup.php:149
eZImageVariationGroup\id
id()
Definition: ezimagevariationgroup.php:125
eZImageVariationGroup\setHeight
setHeight( $value)
Definition: ezimagevariationgroup.php:157
$id
$id
Definition: companytypelist.php:193
$query
if(isset( $Year) &&!is_numeric( $Year)||isset( $Month) &&!is_numeric( $Month)) $query
Definition: entryexitpages.php:65
$db
$db
Definition: ezarticle/user/authorlist.php:53
$group_array
$group_array
Definition: ezgroupeventcalendar/user/dayview.php:836
$ret
$ret
Definition: ezsitemanager/admin/filelist.php:88
$res
$res
Definition: ezstats/admin/cron.php:45
$height
$height
Definition: user/imageview.php:171
$width
$width
Definition: user/imageview.php:170
Copyright © 1998 – 2026 7x. All rights reserved. Licensed under the GNU GPLv2+.