30 $this->
init(
'oxratings' );
47 if ( $iRatingLogsTimeout =
$myConfig->getConfigParam(
'iRatingLogsTimeout' ) ) {
48 $sExpDate = date(
'Y-m-d H:i:s',
oxRegistry::get(
"oxUtilsDate")->getTime() - $iRatingLogsTimeout*24*60*60);
49 $oDb->execute(
"delete from oxratings where oxtimestamp < '$sExpDate'" );
51 $sSelect =
"select oxid from oxratings where oxuserid = ".$oDb->quote( $sUserId ).
" and oxtype=".$oDb->quote( $sType ).
" and oxobjectid = ".$oDb->quote( $sObjectId );
52 if ( $oDb->getOne( $sSelect ) ) {
74 if ( is_array( $aIncludedObjectsIds ) && count( $aIncludedObjectsIds ) > 0 ) {
75 $sQuerySnipet =
" AND ( `oxobjectid` = ".$oDb->quote( $sObjectId ) .
" OR `oxobjectid` in ('" .implode(
"', '", $aIncludedObjectsIds).
"') )";
77 $sQuerySnipet =
" AND `oxobjectid` = ".$oDb->quote( $sObjectId );
85 AND `oxtype` = " . $oDb->quote( $sType )
90 if ( $fRating = $oDb->getOne( $sSelect,
false,
false ) ) {
91 $fRating = round( $fRating, 1 );
106 public function getRatingCount( $sObjectId, $sType, $aIncludedObjectsIds = null )
111 if ( is_array( $aIncludedObjectsIds ) && count( $aIncludedObjectsIds ) > 0 ) {
112 $sQuerySnipet =
" AND ( `oxobjectid` = ".$oDb->quote( $sObjectId ) .
" OR `oxobjectid` in ('" .implode(
"', '", $aIncludedObjectsIds).
"') )";
114 $sQuerySnipet =
" AND `oxobjectid` = ".$oDb->quote( $sObjectId );
122 AND `oxtype` = " . $oDb->quote( $sType )
127 $iCount = $oDb->getOne( $sSelect,
false,
false );
139 return $this->oxratings__oxtype->value;
149 return $this->oxratings__oxobjectid->value;