00001 <?php
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036 include_once( "lib/ezdb/classes/ezdb.php" );
00037 include_once( "kernel/classes/ezpersistentobject.php" );
00038 include_once( "kernel/classes/ezcontentclassgroup.php" );
00039
00040 class eZTipafriendCounter extends eZPersistentObject
00041 {
00042 function eZTipafriendCounter( $row )
00043 {
00044 $this->eZPersistentObject( $row );
00045 }
00046
00047 function definition()
00048 {
00049 return array( 'fields' => array( 'node_id' => array( 'name' => 'NodeID',
00050 'datatype' => 'integer',
00051 'default' => 0,
00052 'required' => true ),
00053 'count' => array( 'name' => 'Count',
00054 'datatype' => 'integer',
00055 'default' => 0,
00056 'required' => true ),
00057 'requested' => array( 'name' => 'Requested',
00058 'datatype' => 'integer',
00059 'default' => 0,
00060 'required' => true ) ),
00061 'keys' => array( 'node_id', 'requested' ),
00062 'relations' => array( 'node_id' => array( 'class' => 'ezcontentobjecttreenode',
00063 'field' => 'node_id' ) ),
00064 'class_name' => 'eZTipafriendCounter',
00065 'sort' => array( 'count' => 'desc' ),
00066 'name' => 'eztipafriend_counter' );
00067 }
00068
00069 function create( $node_id )
00070 {
00071 $row = array( 'node_id' => $node_id,
00072 'count' => 0,
00073 'requested' => time() );
00074 return new eZTipafriendCounter( $row );
00075 }
00076
00077
00078
00079
00080
00081 function removeForNode( $node_id )
00082 {
00083 eZPersistentObject::removeObject( eZTipafriendCounter::definition(),
00084 array( 'node_id' => $node_id ) );
00085 }
00086
00087
00088
00089
00090
00091
00092
00093 function clear( $node_id )
00094 {
00095 eZTipafriendCounter::removeForNode( $node_id );
00096 }
00097
00098
00099
00100
00101
00102
00103 function increase()
00104 {
00105 }
00106
00107 function fetch( $node_id, $asObject = true )
00108 {
00109 return eZPersistentObject::fetchObject( eZTipafriendCounter::definition(),
00110 null,
00111 array( 'node_id' => $node_id ),
00112 $asObject );
00113 }
00114
00115
00116
00117
00118
00119
00120
00121 function cleanup()
00122 {
00123 $db =& eZDB::instance();
00124 $db->query( "DELETE FROM eztipafriend_counter" );
00125 }
00126
00127
00128 var $NodeID;
00129 var $Count;
00130 }
00131
00132 ?>