[ Index ]
 

Code source de eZ Publish 3.9.0

Accédez au Source d'autres logiciels libresSoutenez Angelica Josefina !

title

Body

[fermer]

/kernel/classes/ -> eztipafriendcounter.php (source)

   1  <?php
   2  //
   3  // Definition of eZTipafriendCounter class
   4  //
   5  //
   6  // SOFTWARE NAME: eZ publish
   7  // SOFTWARE RELEASE: 3.9.0
   8  // BUILD VERSION: 17785
   9  // COPYRIGHT NOTICE: Copyright (C) 1999-2006 eZ systems AS
  10  // SOFTWARE LICENSE: GNU General Public License v2.0
  11  // NOTICE: >
  12  //   This program is free software; you can redistribute it and/or
  13  //   modify it under the terms of version 2.0  of the GNU General
  14  //   Public License as published by the Free Software Foundation.
  15  //
  16  //   This program is distributed in the hope that it will be useful,
  17  //   but WITHOUT ANY WARRANTY; without even the implied warranty of
  18  //   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  19  //   GNU General Public License for more details.
  20  //
  21  //   You should have received a copy of version 2.0 of the GNU General
  22  //   Public License along with this program; if not, write to the Free
  23  //   Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
  24  //   MA 02110-1301, USA.
  25  //
  26  //
  27  
  28  //!! eZKernel
  29  //! The class eZTipafriendCounter
  30  /*!
  31  
  32  */
  33  
  34  include_once ( "lib/ezdb/classes/ezdb.php" );
  35  include_once ( "kernel/classes/ezpersistentobject.php" );
  36  include_once ( "kernel/classes/ezcontentclassgroup.php" );
  37  
  38  class eZTipafriendCounter extends eZPersistentObject
  39  {
  40      function eZTipafriendCounter( $row )
  41      {
  42          $this->eZPersistentObject( $row );
  43      }
  44  
  45      function definition()
  46      {
  47          return array( 'fields' => array( 'node_id' => array( 'name' => 'NodeID',
  48                                                               'datatype' => 'integer',
  49                                                               'default' => 0,
  50                                                               'required' => true ),
  51                                           'count' => array( 'name' => 'Count', // deprecated column, must not be used
  52                                                             'datatype' => 'integer',
  53                                                             'default' => 0,
  54                                                             'required' => true ),
  55                                           'requested' => array( 'name' => 'Requested',
  56                                                                 'datatype' => 'integer',
  57                                                                 'default' => 0,
  58                                                                 'required' => true ) ),
  59                        'keys' => array( 'node_id', 'requested' ),
  60                        'relations' => array( 'node_id' => array( 'class' => 'ezcontentobjecttreenode',
  61                                                                  'field' => 'node_id' ) ),
  62                        'class_name' => 'eZTipafriendCounter',
  63                        'sort' => array( 'count' => 'desc' ),
  64                        'name' => 'eztipafriend_counter' );
  65      }
  66  
  67      function create( $node_id )
  68      {
  69          $row = array( 'node_id' => $node_id,
  70                        'count' => 0,
  71                        'requested' => time() );
  72          return new eZTipafriendCounter( $row );
  73      }
  74  
  75      /*!
  76       \note Transaction unsafe. If you call several transaction unsafe methods you must enclose
  77       the calls within a db transaction; thus within db->begin and db->commit.
  78       */
  79      function removeForNode( $node_id )
  80      {
  81          eZPersistentObject::removeObject( eZTipafriendCounter::definition(),
  82                                            array( 'node_id' => $node_id ) );
  83      }
  84  
  85      /*!
  86       \depricated
  87       Use removeForNode instead
  88       \note Transaction unsafe. If you call several transaction unsafe methods you must enclose
  89       the calls within a db transaction; thus within db->begin and db->commit.
  90       */
  91      function clear( $node_id )
  92      {
  93          eZTipafriendCounter::removeForNode( $node_id );
  94      }
  95  
  96      /*!
  97       \depricated, will be removed in future versions of eZP
  98       \note Transaction unsafe. If you call several transaction unsafe methods you must enclose
  99       the calls within a db transaction; thus within db->begin and db->commit.
 100       */
 101      function increase()
 102      {
 103      }
 104  
 105      function fetch( $node_id, $asObject = true )
 106      {
 107          return eZPersistentObject::fetchObject( eZTipafriendCounter::definition(),
 108                                                  null,
 109                                                  array( 'node_id' => $node_id ),
 110                                                  $asObject );
 111      }
 112  
 113      /*!
 114       \static
 115       Removes all counters for tipafriend functionality.
 116       \note Transaction unsafe. If you call several transaction unsafe methods you must enclose
 117       the calls within a db transaction; thus within db->begin and db->commit.
 118      */
 119      function cleanup()
 120      {
 121          $db =& eZDB::instance();
 122          $db->query( "DELETE FROM eztipafriend_counter" );
 123      }
 124  
 125      /// \privatesection
 126      var $NodeID;
 127      var $Count;
 128  }
 129  
 130  ?>


Généré le : Sat Feb 24 10:30:04 2007 par Balluche grâce à PHPXref 0.7