Moodle  2.2.1
http://www.collinsharper.com
rating Class Reference
Inheritance diagram for rating:
Collaboration diagram for rating:

Public Member Functions

 __construct ($options)
 update_rating ($rating)
 get_rating ()
 get_aggregate_string ()
 user_can_rate ($userid=null)
 user_can_view_aggregate ($userid=null)
 get_view_ratings_url ($popup=false)
 get_rate_url ($rating=null, $returnurl=null)

Data Fields

 $context
 $component
 $ratingarea = null
 $itemid
 $scaleid
 $userid
 $settings
 $id = null
 $aggregate = null
 $count = 0
 $rating = null
 $itemtimecreated = null
 $itemuserid = null

Detailed Description

The rating class represents a single rating by a single user

Since:
Moodle 2.0

Definition at line 45 of file lib.php.


Constructor & Destructor Documentation

__construct ( options)

Constructor.

Parameters:
object$options{ context => context context to use for the rating [required] component => component using ratings ie mod_forum [required] ratingarea => ratingarea to associate this rating with [required] itemid => int the id of the associated item (forum post, glossary item etc) [required] scaleid => int The scale in use when the rating was submitted [required] userid => int The id of the user who submitted the rating [required] settings => Settings for the rating object [optional] id => The id of this rating (if the rating is from the db) [optional] aggregate => The aggregate for the rating [optional] count => The number of ratings [optional] rating => The rating given by the user [optional] }

Definition at line 151 of file lib.php.


Member Function Documentation

Returns this ratings aggregate value as a string.

Returns:
string

Definition at line 239 of file lib.php.

Here is the caller graph for this function:

get_rate_url ( rating = null,
returnurl = null 
)

Returns a URL that can be used to rate the associated item.

Parameters:
int | null$ratingThe rating to give the item, if null then no rating param is added.
moodle_url | string$returnurlThe URL to return to.
Returns:
moodle_url

Definition at line 348 of file lib.php.

Here is the call graph for this function:

Here is the caller graph for this function:

Retreive the integer value of this rating

Returns:
int the integer value of this rating object

Definition at line 230 of file lib.php.

get_view_ratings_url ( popup = false)

Returns a URL to view all of the ratings for the item this rating is for.

If this is a rating of a post then this URL will take the user to a page that shows all of the ratings for the post (this one included).

Parameters:
bool$popup
Returns:
moodle_url

Definition at line 326 of file lib.php.

Here is the caller graph for this function:

update_rating ( rating)

Update this rating in the database

Parameters:
int$ratingthe integer value of this rating
Returns:
void

Definition at line 181 of file lib.php.

user_can_rate ( userid = null)

Returns true if the user is able to rate this rating object

Parameters:
int$useridCurrent user assumed if left empty
Returns:
bool

Definition at line 263 of file lib.php.

Here is the caller graph for this function:

user_can_view_aggregate ( userid = null)

Returns true if the user is able to view the aggregate for this rating object.

Parameters:
int | null$useridIf left empty the current user is assumed.
Returns:
bool

Definition at line 297 of file lib.php.

Here is the caller graph for this function:


Field Documentation

$aggregate = null

Definition at line 103 of file lib.php.

Definition at line 57 of file lib.php.

Definition at line 51 of file lib.php.

$count = 0

Definition at line 111 of file lib.php.

$id = null

Definition at line 95 of file lib.php.

Definition at line 70 of file lib.php.

$itemtimecreated = null

Definition at line 126 of file lib.php.

$itemuserid = null

Definition at line 133 of file lib.php.

$rating = null

Definition at line 119 of file lib.php.

$ratingarea = null

Definition at line 64 of file lib.php.

Definition at line 76 of file lib.php.

$settings

Definition at line 88 of file lib.php.

Definition at line 82 of file lib.php.


The documentation for this class was generated from the following file:
 All Data Structures Namespaces Files Functions Variables Enumerations