The rating class represents a single rating by a single user.  
 More...
|  | 
| int | $aggregate = null | 
|  | The aggregate of the combined ratings for the associated item. 
 | 
|  | 
| string | $component | 
|  | The component using ratings. 
 | 
|  | 
| context | $context | 
|  | The context in which this rating exists. 
 | 
|  | 
| int | $count = 0 | 
|  | The total number of ratings for the associated item. 
 | 
|  | 
| int | $id = null | 
|  | The Id of this rating within the rating table. 
 | 
|  | 
| int | $itemid | 
|  | The id of the item (forum post, glossary item etc) being rated. 
 | 
|  | 
| int | $itemtimecreated = null | 
|  | The time the associated item was created. 
 | 
|  | 
| int | $itemuserid = null | 
|  | The id of the user who submitted the rating. 
 | 
|  | 
| int | $rating = null | 
|  | The rating the associated user gave the associated item. 
 | 
|  | 
| string | $ratingarea = null | 
|  | The rating area to associate this rating with This allows a plugin to rate more than one thing by specifying different rating areas. 
 | 
|  | 
| int | $scaleid | 
|  | The id scale (1-5, 0-100) that was in use when the rating was submitted. 
 | 
|  | 
| stdclass | $settings | 
|  | settings for this rating. 
 | 
|  | 
| int | $userid | 
|  | The id of the user who submitted the rating. 
 | 
|  | 
The rating class represents a single rating by a single user. 
- Copyright
- 2010 Andrew Davis 
- License
- http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later 
- Since
- Moodle 2.0 
◆ __construct()
      
        
          | rating::__construct | ( |  | $options | ) |  | 
      
 
Constructor. 
- Parameters
- 
  
    | stdClass | $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] } |  
 
 
 
◆ get_aggregate_string()
      
        
          | rating::get_aggregate_string | ( |  | ) |  | 
      
 
Returns this ratings aggregate value as a string. 
- Return values
- 
  
    | string | ratings aggregate value |  
 
 
 
◆ get_rate_url()
      
        
          | rating::get_rate_url | ( |  | $rating = null, | 
        
          |  |  |  | $returnurl = null ) | 
      
 
Returns a URL that can be used to rate the associated item. 
- Parameters
- 
  
    | int | null | $rating | The rating to give the item, if null then no rating param is added. |  | moodle_url | string | $returnurl | The URL to return to. |  
 
- Return values
- 
  
    | moodle_url | can be used to rate the associated item. |  
 
 
 
◆ get_rating()
Retreive the integer value of this rating. 
- Return values
- 
  
    | int | the integer value of this rating object |  
 
 
 
◆ get_view_ratings_url()
      
        
          | rating::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 | whether of not the URL should be loaded in a popup |  
 
- Return values
- 
  
    | moodle_url | URL to view all of the ratings for the item this rating is for. |  
 
 
 
◆ update_rating()
      
        
          | rating::update_rating | ( |  | $rating | ) |  | 
      
 
Update this rating in the database. 
- Parameters
- 
  
    | int | $rating | the integer value of this rating |  
 
 
 
◆ user_can_rate()
      
        
          | rating::user_can_rate | ( |  | $userid = null | ) |  | 
      
 
Returns true if the user is able to rate this rating object. 
- Parameters
- 
  
    | int | $userid | Current user assumed if left empty |  
 
- Return values
- 
  
    | bool | true if the user is able to rate this rating object |  
 
 
 
◆ user_can_view_aggregate()
      
        
          | rating::user_can_view_aggregate | ( |  | $userid = null | ) |  | 
      
 
Returns true if the user is able to view the aggregate for this rating object. 
- Parameters
- 
  
    | int | null | $userid | If left empty the current user is assumed. |  
 
- Return values
- 
  
    | bool | true if the user is able to view the aggregate for this rating object |  
 
 
 
◆ $aggregate
      
        
          | int rating::$aggregate = null | 
      
 
The aggregate of the combined ratings for the associated item. 
This is only set if the rating already exists 
 
 
◆ $component
      
        
          | string rating::$component | 
      
 
The component using ratings. 
For example "mod_forum" 
 
 
◆ $count
The total number of ratings for the associated item. 
This is only set if the rating already exists 
 
 
◆ $id
The Id of this rating within the rating table. 
This is only set if the rating already exists 
 
 
◆ $rating
      
        
          | int rating::$rating = null | 
      
 
The rating the associated user gave the associated item. 
This is only set if the rating already exists 
 
 
◆ $settings
      
        
          | stdclass rating::$settings | 
      
 
settings for this rating. 
Necessary to render the rating. 
 
 
The documentation for this class was generated from the following file: