Search moodle.org's
Developer Documentation

See Release Notes

  • Bug fixes for general core bugs in 3.10.x will end 8 November 2021 (12 months).
  • Bug fixes for security issues in 3.10.x will end 9 May 2022 (18 months).
  • PHP version: minimum PHP 7.2.0 Note: minimum PHP version has increased since Moodle 3.8. PHP 7.3.x and 7.4.x are supported too.

Differences Between: [Versions 310 and 311] [Versions 310 and 400] [Versions 310 and 401] [Versions 310 and 402] [Versions 310 and 403]

Rating external API

Copyright: 2015 Costantino Cito <ccito@cvaconsulting.com>
License: http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
File Size: 303 lines (12 kb)
Included or required:0 times
Referenced: 0 times
Includes or requires: 0 files

Defines 1 class

core_rating_external:: (6 methods):
  get_item_ratings_parameters()
  get_item_ratings()
  get_item_ratings_returns()
  add_rating_parameters()
  add_rating()
  add_rating_returns()


Class: core_rating_external  - X-Ref

Rating external functions

get_item_ratings_parameters()   X-Ref
Returns description of get_item_ratings parameters.

return: external_function_parameters

get_item_ratings($contextlevel, $instanceid, $component, $ratingarea, $itemid, $scaleid, $sort)   X-Ref
Retrieve a list of ratings for a given item (forum post etc)

param: string $contextlevel course, module, user...
param: int $instanceid the instance if for the context element
param: string $component the name of the component
param: string $ratingarea rating area
param: int $itemid the item id
param: int $scaleid the scale id
param: string $sort sql order (firstname, rating or timemodified)
return: array Result and possible warnings

get_item_ratings_returns()   X-Ref
Returns description of get_item_ratings result values.

return: external_single_structure

add_rating_parameters()   X-Ref
Returns description of add_rating parameters.

return: external_function_parameters

add_rating($contextlevel, $instanceid, $component, $ratingarea, $itemid, $scaleid, $rating, $rateduserid,$aggregation = RATING_AGGREGATE_NONE)   X-Ref
Adds a rating to an item

param: string $contextlevel course, module, user...
param: int $instanceid the instance if for the context element
param: string $component the name of the component
param: string $ratingarea rating area
param: int $itemid the item id
param: int $scaleid the scale id
param: int $rating the user rating
param: int $rateduserid the rated user id
param: int $aggregation the aggregation method
return: array result and possible warnings

add_rating_returns()   X-Ref
Returns description of add_rating result values.

return: external_single_structure