VuFind API Documentation

RatingsService
in package

Ratings service

Tags
category

VuFind

author

Demian Katz demian.katz@villanova.edu

license

http://opensource.org/licenses/gpl-2.0.php GNU General Public License

link

Main Page

Table of Contents

$dbService  : RatingsServiceInterface
$ratingCache  : array<string|int, mixed>
Cache for rating data
$resourcePopulator  : ResourcePopulator
__construct()  : mixed
Constructor
getRatingBreakdown()  : array<string|int, mixed>
Get rating breakdown for the provided record.
getRatingData()  : array<string|int, mixed>
Get rating information for the provided record.
saveRating()  : void
Add or update user's rating for the record.

Properties

$ratingCache

Cache for rating data

protected array<string|int, mixed> $ratingCache = []

Methods

getRatingBreakdown()

Get rating breakdown for the provided record.

public getRatingBreakdown(AbstractBase $driver, array<string|int, mixed> $groups) : array<string|int, mixed>

Returns an array with the following keys:

rating - average rating (0-100) count - count of ratings groups - grouped counts

Parameters
$driver : AbstractBase

Record to look up

$groups : array<string|int, mixed>

Group definition (key => [min, max])

Return values
array<string|int, mixed>

getRatingData()

Get rating information for the provided record.

public getRatingData(AbstractBase $driver[, int|null $userId = null ]) : array<string|int, mixed>

Returns an array with the following keys:

rating - average rating (0-100) count - count of ratings

Parameters
$driver : AbstractBase

Record to look up

$userId : int|null = null

User ID, or null for all users

Return values
array<string|int, mixed>

saveRating()

Add or update user's rating for the record.

public saveRating(AbstractBase $driver, int $userId, int|null $rating) : void
Parameters
$driver : AbstractBase

Record associated with rating

$userId : int

ID of the user posting the rating

$rating : int|null

The user-provided rating, or null to clear any existing rating

Return values
void

Search results