Exponential Basic 2.4.0.1 Exponential Basic CMS — PHP Class Reference

eztipclick.php
Go to the documentation of this file.
1 <?php
3 //
4 // $Id: eztipclick.php,v 1.9 2001/08/22 18:02:03 br Exp $
5 //
6 // Definition of eZTipClick 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 eZTipClick
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( "eZTip_Click" );
70 $nextID = $db->nextID( "eZTip_Click", "ID" );
71 $res[] = $db->query( "INSERT INTO eZTip_Click
72 ( ID,
73 PageViewID,
74 TipID )
75 VALUES
76 ( '$nextID',
77 '$this->PageViewID',
78 '$this->TipID' )" );
79
80 $this->ID = $nextID;
81 }
82 else
83 {
84 $res[] = $db->query( "UPDATE eZTip_Click SET
85 PageViewID='$this->PageViewID',
86 TipID='$this->TipID'
87 WHERE ID='$this->ID'
88 " );
89 }
90
91 eZDB::finish( $res, $db );
92 return true;
93 }
94
98 function get( $id="" )
99 {
100 $ret = false;
101 $db =& eZDB::globalDatabase();
102
103 if ( $id != "" )
104 {
105 $db->array_query( $tip_array, "SELECT * FROM eZTip_Tip WHERE ID='$id'" );
106 if ( count( $tip_array ) > 1 )
107 {
108 die( "Error: Tip's with the same ID was found in the database. This shouldent happen." );
109 }
110 else if( count( $tip_array ) == 1 )
111 {
112 $this->ID =& $tip_array[0][$db->fieldName( "ID" )];
113 $this->PageViewID =& $tip_array[0][$db->fieldName( "PageViewID" )];
114 $this->ClickPrice =& $tip_array[0][$db->fieldName( "ClickPrice" )];
115
116 $ret = true;
117 }
118 }
119 return $ret;
120 }
121
125 function delete()
126 {
127 $db =& eZDB::globalDatabase();
128 $db->begin();
129
130 if ( isset( $this->ID ) )
131 {
132 $res[] = $db->query( "DELETE FROM eZTip_Click WHERE ID='$this->ID'" );
133 }
134
135 eZDB::finish( $res, $db );
136
137 return true;
138 }
139
143 function id()
144 {
145 return $this->ID;
146 }
147
151 function &clickTime()
152 {
153 $dateTime = new eZDateTime();
154 $dateTime->setTimeStamp( $this->ClickTime );
155
156 return $dateTime;
157 }
158
162 function setPageViewID( $value )
163 {
164 $this->PageViewID = $value;
165 }
166
170 function setTip( $tip )
171 {
172 if ( get_class( $tip ) == "eztip" )
173 {
174 $this->TipID = $tip->id();
175 }
176 }
177
178 var $ID;
179 var $TipID;
180 var $PageViewID;
181 var $ClickTime;
182
183 }
184
185 ?>
$dateTime
$dateTime
Definition: authorview.php:77
eZDB\finish
static finish(&$resultArray, &$db)
Definition: ezdb.php:204
eZDB\globalDatabase
static & globalDatabase()
Definition: ezdb.php:134
eZDateTime
Definition: ezdatetime.php:55
eZTipClick
Definition: eztipclick.php:44
eZTipClick\clickTime
& clickTime()
Definition: eztipclick.php:151
eZTipClick\setTip
setTip( $tip)
Definition: eztipclick.php:170
eZTipClick\$ClickTime
$ClickTime
Definition: eztipclick.php:181
eZTipClick\$TipID
$TipID
Definition: eztipclick.php:179
eZTipClick\$ID
$ID
Definition: eztipclick.php:178
eZTipClick\id
id()
Definition: eztipclick.php:143
eZTipClick\store
store()
Definition: eztipclick.php:63
eZTipClick\__construct
__construct( $id="")
Definition: eztipclick.php:51
eZTipClick\setPageViewID
setPageViewID( $value)
Definition: eztipclick.php:162
eZTipClick\$PageViewID
$PageViewID
Definition: eztipclick.php:180
$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
$tip
$tip
Definition: tipstatistics.php:57
Copyright © 1998 – 2026 7x. All rights reserved. Licensed under the GNU GPLv2+.