Search moodle.org's
Developer Documentation

See Release Notes

  • Bug fixes for general core bugs in 4.2.x will end 22 April 2024 (12 months).
  • Bug fixes for security issues in 4.2.x will end 7 October 2024 (18 months).
  • PHP version: minimum PHP 8.0.0 Note: minimum PHP version has increased since Moodle 4.1. PHP 8.1.x is supported too.

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

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: 309 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