SheaDawson\Rateable\Extensions\Rateable
- Author: Shea Dawson <shea@silverstripe.com.au>
- License: BSD http://silverstripe.org/BSD-license
Synopsis
class Rateable
extends DataExtension
{
- // members
- private static array $dependencies = ;
- private static array $rateable_templates = ;
- private static integer $rateable_rating_max = 5;
- private static boolean $rateable_config_enabled = false;
- private static boolean $rateable_can_change_rating = false;
- public RateableService $rateableService;
- private String $htmlIdPostfix;
- // methods
- public static array get_extra_config()
- public void updateSettingsFields()
- public void updateCMSFields()
- public Int getAverageScore()
- public ArrayList getRatingOptions()
- public int getNumberOfRatings()
- public int getMaxRating()
- public Boolean UserHasRated()
- public String RateableUI()
- public String getRatingHTMLID()
- public String getRatingCSSClass()
- public Boolean checkRatingsEnabled()
- public boolean canChangeRating()
- public String RatePath()
Hierarchy
Extends
- SilverStripe\ORM\DataExtension
Members
private
- $dependencies
- $htmlIdPostfix — SheaDawson\Rateable\Extensions\String
- $rateable_can_change_rating
—
boolean
If true, the user can change their rating at any time. - $rateable_config_enabled
—
boolean
If true, rateable will always be turned on regardless of 'EnableRatings'. - $rateable_rating_max
—
array
The maximum score a user can rate this item - $rateable_templates
—
array
Templates to render with.
public
- $rateableService — SheaDawson\Rateable\Services\RateableService
Methods
public
- RatePath() — return the url path for rating this object
- RateableUI() — returns the JS and HTML required for the star rating UI
- UserHasRated() — checks to see if the current user has rated this object by checking against the rating SessionID and MemberID
- canChangeRating() — Check whether the user can take back a rating or not.
- checkRatingsEnabled() — Checks whether ratings should be enabled on this object
- getAverageScore() — gets the average rating score
- getMaxRating() — Get the maximum rating
- getNumberOfRatings() — gets the number of ratings
- getRatingCSSClass() — returns a string to be used in the RatableUI's css class attribute
- getRatingHTMLID() — returns a unique HTML ID for each RateableUI div
- getRatingOptions() — Get the available ratings.
- get_extra_config() — Setting up DB / has_one / defaults with "get_extra_config" allows you to extend an extension class without breaking the $db configs.
- updateCMSFields()
- updateSettingsFields()