Moodle APIs  3.8
Moodle 3.8.6 (Build: 20201109)
Static Public Member Functions | List of all members
tool_dataprivacy\data_registry Class Reference

Data registry business logic methods. More...

Static Public Member Functions

static defaults_set ()
 Are data registry defaults set? More...
 
static get_defaults ($contextlevel, $pluginname='')
 Returns the default purpose id and category id for the provided context level. More...
 
static get_effective_context_value (\context $context, $element, $forcedvalue=false)
 Returns the effective value given a context instance. More...
 
static get_effective_contextlevel_value ($contextlevel, $element)
 Returns the effective value for a context level. More...
 
static get_effective_default_contextlevel_purpose_and_category ($contextlevel, $forcedpurposevalue=false, $forcedcategoryvalue=false, $component='')
 Returns the effective default purpose and category for a context level. More...
 
static get_site_categories ()
 Returns all site categories that are visible to the current user. More...
 
static get_subject_scope (\context $context)
 Returns the roles assigned to the provided level. More...
 
static var_names_from_context ($classname, $pluginname='')
 Returns purpose and category var names from a context class name. More...
 

Detailed Description

Data registry business logic methods.

Mostly internal stuff.

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

Member Function Documentation

◆ defaults_set()

static tool_dataprivacy\data_registry::defaults_set ( )
static

Are data registry defaults set?

At least the system defaults need to be set.

Return values
bool

◆ get_defaults()

static tool_dataprivacy\data_registry::get_defaults (   $contextlevel,
  $pluginname = '' 
)
static

Returns the default purpose id and category id for the provided context level.

The caller code is responsible of checking that $contextlevel is an integer.

Parameters
int$contextlevelThe context level.
string$pluginnameThe name of the plugin associated with the context level.
Return values
int[]|false[]

◆ get_effective_context_value()

static tool_dataprivacy\data_registry::get_effective_context_value ( \context  $context,
  $element,
  $forcedvalue = false 
)
static

Returns the effective value given a context instance.

Parameters
context$context
string$element'category' or 'purpose'
int | false$forcedvalueUse this value as if this was this context instance value.
Return values
persistent|falseIt return a 'purpose' instance or a 'category' instance, depending on $element

◆ get_effective_contextlevel_value()

static tool_dataprivacy\data_registry::get_effective_contextlevel_value (   $contextlevel,
  $element 
)
static

Returns the effective value for a context level.

Note that this is different from the effective default context level (see get_effective_default_contextlevel_purpose_and_category) as this is returning the value set in the data registry, not in the defaults page.

Parameters
int$contextlevel
string$element'category' or 'purpose'
Return values
tool_dataprivacy

◆ get_effective_default_contextlevel_purpose_and_category()

static tool_dataprivacy\data_registry::get_effective_default_contextlevel_purpose_and_category (   $contextlevel,
  $forcedpurposevalue = false,
  $forcedcategoryvalue = false,
  $component = '' 
)
static

Returns the effective default purpose and category for a context level.

Parameters
int$contextlevel
int | bool$forcedpurposevalueUse this value as if this was this context level purpose.
int | bool$forcedcategoryvalueUse this value as if this was this context level category.
string$componentThe name of the component to check.
Return values
int[]

◆ get_site_categories()

static tool_dataprivacy\data_registry::get_site_categories ( )
static

Returns all site categories that are visible to the current user.

Return values
core_course_category[]

◆ get_subject_scope()

static tool_dataprivacy\data_registry::get_subject_scope ( \context  $context)
static

Returns the roles assigned to the provided level.

Important to note that it returns course-level assigned roles if the provided context level is below course.

Parameters
context$context
Return values
array

◆ var_names_from_context()

static tool_dataprivacy\data_registry::var_names_from_context (   $classname,
  $pluginname = '' 
)
static

Returns purpose and category var names from a context class name.

Parameters
string$classnameThe context level's class.
string$pluginnameThe name of the plugin associated with the context level.
Return values
string[]

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