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.

Privacy Subsystem implementation for core_ratings.

Copyright: 2018 Andrew Nicols <andrew@nicols.co.uk>
License: http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
File Size: 260 lines (11 kb)
Included or required:0 times
Referenced: 0 times
Includes or requires: 0 files

Defines 1 class


Class: provider  - X-Ref

Privacy Subsystem implementation for core_ratings.

get_metadata(collection $collection)   X-Ref
Returns metadata about the ratings subsystem.

param: collection     $collection The initialised collection to add items to.
return: collection     A listing of user data stored through the subsystem.

export_area_ratings(int $userid,\context $context,array $subcontext,string $component,string $ratingarea,int $itemid,bool $onlyuser = true)   X-Ref
Export all ratings which match the specified component, areaid, and itemid.

If requesting ratings for a users own content, and you wish to include all ratings of that content, specify
$onlyuser as false.

When requesting ratings for another users content, you should only export the ratings that the specified user
made themselves.

param: int         $userid The user whose information is to be exported
param: \context    $context The context being stored.
param: array       $subcontext The subcontext within the context to export this information
param: string      $component The component to fetch data from
param: string      $ratingarea The ratingarea that the data was stored in within the component
param: int         $itemid The itemid within that ratingarea
param: bool        $onlyuser Whether to only export ratings that the current user has made, or all ratings

get_sql_join($alias, $component, $ratingarea, $itemidjoin, $userid, $innerjoin = false)   X-Ref
Get the SQL required to find all submission items where this user has had any involvements.

If possible an inner join should be used.

param: string          $alias      The name of the table alias to use.
param: string          $component  The na eof the component to fetch ratings for.
param: string          $ratingarea The rating area to fetch results for.
param: string          $itemidjoin The right-hand-side of the JOIN ON clause.
param: int             $userid     The ID of the user being stored.
param: bool            $innerjoin  Whether to use an inner join (preferred)
return: \stdClass

delete_ratings(\context $context, string $component = null,string $ratingarea = null, int $itemid = null)   X-Ref
Deletes all ratings for a specified context, component, ratingarea and itemid.

Only delete ratings when the item itself was deleted.

We never delete ratings for one user but not others - this may affect grades, therefore ratings
made by particular user are not considered personal information.

param: \context $context Details about which context to delete ratings for.
param: string $component Component to delete.
param: string $ratingarea Rating area to delete.
param: int $itemid The item ID for use with deletion.

delete_ratings_select(\context $context, string $component,string $ratingarea, $itemidstest, $params = [])   X-Ref
Deletes all tag instances for given context, component, itemtype using subquery for itemids

In most situations you will want to specify $userid as null. Per-user tag instances
are possible in Tags API, however there are no components or standard plugins that actually use them.

param: \context $context Details about which context to delete ratings for.
param: string $component Component to delete.
param: string $ratingarea Rating area to delete.
param: string $itemidstest an SQL fragment that the itemid must match. Used
param: array $params any query params used by $itemidstest.

get_users_in_context_from_sql(userlist $userlist, string $alias, string $component, string $area, string $insql, $params)   X-Ref
Add the list of users who have rated in the specified constraints.

param: userlist    $userlist The userlist to add the users to.
param: string      $alias An alias prefix to use for rating selects to avoid interference with your own sql.
param: string      $component The component to check.
param: string      $area The rating area to check.
param: string      $insql The SQL to use in a sub-select for the itemid query.
param: array       $params The params required for the insql.