Exponential Basic 2.4.0.1 Exponential Basic CMS — PHP Class Reference

ezadclick.php
Go to the documentation of this file.
1 <?php
3 //
4 // $Id: ezadclick.php 6555 2001-08-22 18:02:03Z br $
5 //
6 // Definition of eZAdClick class
7 //
8 // Created on: <25-Nov-2000 16:30:05 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 //
28
31
40 // include_once( "classes/ezdb.php" );
41
42
43 class eZAdClick
44 {
51 function __construct( $id="" )
52 {
53 if ( $id != "" )
54 {
55 $this->ID = $id;
56 $this->get( $this->ID );
57 }
58 }
59
63 function store()
64 {
65 $db =& eZDB::globalDatabase();
66 $db->begin();
67 if ( !isset( $this->ID ) )
68 {
69 $db->lock( "eZAd_Click" );
70 $nextID = $db->nextID( "eZAd_Click", "ID" );
71 $res[] = $db->query( "INSERT INTO eZAd_Click
72 ( ID,
73 PageViewID,
74 AdID,
75 ClickPrice )
76 VALUES
77 ( '$nextID',
78 '$this->PageViewID',
79 '$this->AdID',
80 '$this->ClickPrice' )" );
81
82 $this->ID = $nextID;
83 }
84 else
85 {
86 $res[] = $db->query( "UPDATE eZAd_Click SET
87 PageViewID='$this->PageViewID',
88 AdID='$this->AdID',
89 ClickPrice='$this->ClickPrice'
90 WHERE ID='$this->ID'
91 " );
92 }
93
94 eZDB::finish( $res, $db );
95 return true;
96 }
97
101 function get( $id="" )
102 {
103 $ret = false;
104 $db =& eZDB::globalDatabase();
105
106 if ( $id != "" )
107 {
108 $db->array_query( $ad_array, "SELECT * FROM eZAd_Ad WHERE ID='$id'" );
109 if ( count( $ad_array ) > 1 )
110 {
111 die( "Error: Ad's with the same ID was found in the database. This shouldent happen." );
112 }
113 else if( count( $ad_array ) == 1 )
114 {
115 $this->ID =& $ad_array[0][$db->fieldName( "ID" )];
116 $this->PageViewID =& $ad_array[0][$db->fieldName( "PageViewID" )];
117 $this->ClickPrice =& $ad_array[0][$db->fieldName( "ClickPrice" )];
118
119 $ret = true;
120 }
121 }
122 return $ret;
123 }
124
128 function delete()
129 {
130 $db =& eZDB::globalDatabase();
131 $db->begin();
132
133 if ( isset( $this->ID ) )
134 {
135 $res[] = $db->query( "DELETE FROM eZAd_Click WHERE ID='$this->ID'" );
136 }
137
138 eZDB::finish( $res, $db );
139
140 return true;
141 }
142
146 function id()
147 {
148 return $this->ID;
149 }
150
154 function &price()
155 {
156 return $this->Price;
157 }
158
162 function &clickTime()
163 {
164 $dateTime = new eZDateTime();
165 $dateTime->setTimeStamp( $this->ClickTime );
166
167 return $dateTime;
168 }
169
173 function setPageViewID( $value )
174 {
175 $this->PageViewID = $value;
176 }
177
181 function setPrice( $value )
182 {
183 $this->ClickPrice = $value;
184 }
185
189 function setAd( $ad )
190 {
191 if ( is_a( $ad, "eZAd" ) )
192 {
193 $this->AdID = $ad->id();
194 }
195 }
196
197 var $ID;
198 var $AdID;
199 var $PageViewID;
200 var $ClickTime;
201 var $ViewPrice;
202
203 }
204
205 ?>
$ad
$ad
Definition: adstatistics.php:56
$dateTime
$dateTime
Definition: authorview.php:77
eZAdClick
Definition: ezadclick.php:44
eZAdClick\id
id()
Definition: ezadclick.php:146
eZAdClick\price
& price()
Definition: ezadclick.php:154
eZAdClick\clickTime
& clickTime()
Definition: ezadclick.php:162
eZAdClick\$ViewPrice
$ViewPrice
Definition: ezadclick.php:201
eZAdClick\setPrice
setPrice( $value)
Definition: ezadclick.php:181
eZAdClick\$PageViewID
$PageViewID
Definition: ezadclick.php:199
eZAdClick\$ID
$ID
Definition: ezadclick.php:197
eZAdClick\setAd
setAd( $ad)
Definition: ezadclick.php:189
eZAdClick\store
store()
Definition: ezadclick.php:63
eZAdClick\$AdID
$AdID
Definition: ezadclick.php:198
eZAdClick\__construct
__construct( $id="")
Definition: ezadclick.php:51
eZAdClick\setPageViewID
setPageViewID( $value)
Definition: ezadclick.php:173
eZAdClick\$ClickTime
$ClickTime
Definition: ezadclick.php:200
eZDB\finish
static finish(&$resultArray, &$db)
Definition: ezdb.php:204
eZDB\globalDatabase
static & globalDatabase()
Definition: ezdb.php:134
eZDateTime
Definition: ezdatetime.php:55
$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+.