ZenMagick 0.9.1


org.zenmagick.service.ZMReviews

Class ZMReviews

ZMObject
|
+--ZMReviews

public class ZMReviews
extends ZMObject

Reviews.

Author:
mano
Version:
$Id: ZMReviews.php 1056 2008-04-17 00:14:49Z DerManoMann $

Constructor Summary

ZMReviews()

Create new instance.

Method Summary
ZMReview

createReview(ZMReview review, mixed account, int languageId, ZMAccount author)

Create a new review.

array

getAllReviews(int languageId)

Get all published reviews.

float

getAverageRatingForProductId(int productId, int languageId)

Get the average rating for the given product id.

array

getRandomReviews(int productId, int max, int languageId)

Get a random review.

int

getReviewCount(int productId, int languageId)

Get the number of reviews for the given product (id).

ZMReview

getReviewForId(int reviewId, int languageId)

Get the review for the given review id.

array

getReviewsForProductId(int productId, int languageId)

Get all reviews for the given product id.

static void

instance()

Get instance.

void

updateViewCount(int reviewId)

Update the view count for the given review id.

Methods inherited from org.zenmagick.ZMObject
backtrace, create, log, singleton

Constructor Detail

ZMReviews

public ZMReviews()

Create new instance. /


Method Detail

createReview

public ZMReview createReview(ZMReview review, mixed account, int languageId, ZMAccount author)

Create a new review.

Parameters:
review - The new review.
author - The review author.
languageId - The language for this review; default is null.
Returns:
The inserted review (incl. the new id).

getAllReviews

public array getAllReviews(int languageId)

Get all published reviews.

Parameters:
languageId - Optional language id; default is null
Returns:
List of ZMReview instances.

getAverageRatingForProductId

public float getAverageRatingForProductId(int productId, int languageId)

Get the average rating for the given product id.

Parameters:
productId - The product id.
languageId - Optional language id; default is null
Returns:
The average rating or null if no ratnig exists.

getRandomReviews

public array getRandomReviews(int productId, int max, int languageId)

Get a random review.

Parameters:
productId - Optional productId to limit reviews to one product; default is null.
max - Optional result limit; default is null to use the setting .
languageId - Optional language id; default is null
Returns:
List of ZMReview instances.

getReviewCount

public int getReviewCount(int productId, int languageId)

Get the number of reviews for the given product (id).

Parameters:
productId - The product id.
languageId - Optional language id; default is null
Returns:
The number of published reviews for the product.

getReviewForId

public ZMReview getReviewForId(int reviewId, int languageId)

Get the review for the given review id.

Parameters:
reviewId - The id of the review to load.
languageId - Optional language id; default is null
Returns:
A ZMReview instance or null.

getReviewsForProductId

public array getReviewsForProductId(int productId, int languageId)

Get all reviews for the given product id.

Parameters:
productId - The product id.
languageId - Optional language id; default is null
Returns:
List of ZMReview instances.

instance

public static void instance()

Get instance. /


updateViewCount

public void updateViewCount(int reviewId)

Update the view count for the given review id.

Parameters:
reviewId - The id of the review.

ZenMagick 0.9.1