oxrating.php

Go to the documentation of this file.
00001 <?php
00002 
00007 class oxRating extends oxBase
00008 {
00014     protected $_blDisableShopCheck = true;
00015 
00021     protected $_sClassName = 'oxrating';
00022 
00026     public function __construct()
00027     {
00028         parent::__construct();
00029         $this->init( 'oxratings' );
00030     }
00031 
00037     protected function _insert()
00038     {
00039         // set oxcreate
00040         $this->oxratings__oxtimestamp= new oxField(date( 'Y-m-d H:i:s', oxUtilsDate::getInstance()->getTime() ));
00041 
00042         return parent::_insert();
00043     }
00044 
00054     public function allowRating( $sUserId, $sType, $sObjectId)
00055     {
00056         $oDB = oxDb::getDb();
00057         $myConfig = $this->getConfig();
00058         if ( $iRatingLogsTimeout = $myConfig->getConfigParam( 'iRatingLogsTimeout' ) ) {
00059             $sExpDate = date( 'Y-m-d H:i:s', oxUtilsDate::getInstance()->getTime() - $iRatingLogsTimeout*24*60*60);
00060             $oDB->execute( "delete from oxratings where oxtimestamp < '$sExpDate'" );
00061         }
00062         $sSelect = "select oxid from oxratings where oxuserid = ".$oDB->quote( $sUserId )." and oxtype=".$oDB->quote( $sType )." and oxobjectid = ".$oDB->quote( $sObjectId );
00063         if ( $oDB->getOne( $sSelect ) ) {
00064             return false;
00065         }
00066 
00067         return true;
00068     }
00069 
00070 }

Generated by  doxygen 1.6.2