Moodle PHP Documentation 4.5
Moodle 4.5dev (Build: 20240606) (d3ae1391abe)
core_rating\privacy\provider Class Reference

Privacy Subsystem implementation for core_ratings. More...

Inheritance diagram for core_rating\privacy\provider:
core_privacy\local\metadata\provider core_privacy\local\request\subsystem\plugin_provider core_privacy\local\request\shared_userlist_provider core_privacy\local\request\shared_data_provider core_privacy\local\request\userlist_provider core_privacy\local\request\data_provider

Static Public Member Functions

static delete_ratings (\context $context, string $component=null, string $ratingarea=null, int $itemid=null)
 Deletes all ratings for a specified context, component, ratingarea and itemid.
 
static delete_ratings_select (\context $context, string $component, string $ratingarea, $itemidstest, $params=[])
 Deletes all tag instances for given context, component, itemtype using subquery for itemids.
 
static export_area_ratings (int $userid, context $context, array $subcontext, string $component, string $ratingarea, int $itemid, bool $onlyuser=true)
 Export all ratings which match the specified component, areaid, and itemid.
 
static get_metadata (collection $collection)
 Returns metadata about the ratings subsystem.
 
static get_sql_join ($alias, $component, $ratingarea, $itemidjoin, $userid, $innerjoin=false)
 Get the SQL required to find all submission items where this user has had any involvements.
 
static get_users_in_context_from_sql (userlist $userlist, string $alias, string $component, string $area, string $insql, $params)
 Add the list of users who have rated in the specified constraints.
 

Detailed Description

Privacy Subsystem implementation for core_ratings.

License
http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later

Member Function Documentation

◆ delete_ratings()

static core_rating\privacy\provider::delete_ratings ( \context $context,
string $component = null,
string $ratingarea = null,
int $itemid = null )
static

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.

Parameters
context$contextDetails about which context to delete ratings for.
string$componentComponent to delete.
string$ratingareaRating area to delete.
int$itemidThe item ID for use with deletion.

◆ delete_ratings_select()

static core_rating\privacy\provider::delete_ratings_select ( \context $context,
string $component,
string $ratingarea,
$itemidstest,
$params = [] )
static

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.

Parameters
context$contextDetails about which context to delete ratings for.
string$componentComponent to delete.
string$ratingareaRating area to delete.
string$itemidstestan SQL fragment that the itemid must match. Used in the query like WHERE itemid $itemidstest. Must use named parameters, and may not use named parameters called contextid, component or ratingarea.
array$paramsany query params used by $itemidstest.

◆ export_area_ratings()

static core_rating\privacy\provider::export_area_ratings ( int $userid,
context $context,
array $subcontext,
string $component,
string $ratingarea,
int $itemid,
bool $onlyuser = true )
static

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.

Parameters
int$useridThe user whose information is to be exported
context$contextThe context being stored.
array$subcontextThe subcontext within the context to export this information
string$componentThe component to fetch data from
string$ratingareaThe ratingarea that the data was stored in within the component
int$itemidThe itemid within that ratingarea
bool$onlyuserWhether to only export ratings that the current user has made, or all ratings

◆ get_metadata()

static core_rating\privacy\provider::get_metadata ( collection $collection)
static

Returns metadata about the ratings subsystem.

Parameters
collection$collectionThe initialised collection to add items to.
Return values
collectionA listing of user data stored through the subsystem.

Implements core_privacy\local\metadata\provider.

◆ get_sql_join()

static core_rating\privacy\provider::get_sql_join ( $alias,
$component,
$ratingarea,
$itemidjoin,
$userid,
$innerjoin = false )
static

Get the SQL required to find all submission items where this user has had any involvements.

If possible an inner join should be used.

Parameters
string$aliasThe name of the table alias to use.
string$componentThe na eof the component to fetch ratings for.
string$ratingareaThe rating area to fetch results for.
string$itemidjoinThe right-hand-side of the JOIN ON clause.
int$useridThe ID of the user being stored.
bool$innerjoinWhether to use an inner join (preferred)
Return values
stdClass

◆ get_users_in_context_from_sql()

static core_rating\privacy\provider::get_users_in_context_from_sql ( userlist $userlist,
string $alias,
string $component,
string $area,
string $insql,
$params )
static

Add the list of users who have rated in the specified constraints.

Parameters
userlist$userlistThe userlist to add the users to.
string$aliasAn alias prefix to use for rating selects to avoid interference with your own sql.
string$componentThe component to check.
string$areaThe rating area to check.
string$insqlThe SQL to use in a sub-select for the itemid query.
array$paramsThe params required for the insql.

The documentation for this class was generated from the following file: