Wednesday 31 January 2007 12:14:40 pm
Hi .. I had downloaded the rating extension, I just would like to add a list function for the top rated .. so in ratingoperatorresult.php i had added this :
function ratingOperatorResult( $args )
{
include_once( 'lib/ezdb/classes/ezdb.php' );
$db =& eZDB::instance();
switch ( $args['function'] )
{
case 'total_votes':
{
$row = $db->arrayQuery( "SELECT count(*) as votes FROM ezarticle_rating WHERE node_id='".$args['key']."'" );
return $row[0]['votes'];
} break;
// Start: Top Rated List //
case 'top_votes':
{
$row = $db->arrayQuery( "SELECT * FROM ezarticle_rating as top_votes order by top_votes.rate DESC " );
return $row['top_votes'];
} break;
// End: Top Rated List //
case 'average_value':
{
$row = $db->arrayQuery( "SELECT round( sum( rate ) / count( * ) ) AS estimate
FROM ezarticle_rating
WHERE node_id = '".$args['key']."'" );
return $row[0]['estimate'];
} break;
}
}
I called from temapltes by : {ratingoperatorresult(hash( 'function', 'top_votes' ) )} but its return nothing ... the query its right ,,, why its not working ? Thanks in advanced.
|