Search moodle.org's
Developer Documentation

See Release Notes
Long Term Support Release

  • Bug fixes for general core bugs in 4.1.x will end 13 November 2023 (12 months).
  • Bug fixes for security issues in 4.1.x will end 10 November 2025 (36 months).
  • PHP version: minimum PHP 7.4.0 Note: minimum PHP version has increased since Moodle 4.0. PHP 8.0.x is supported too.

Users analyser (insights for users).

Copyright: 2019 David Monllao {@link http://www.davidmonllao.com}
License: http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
File Size: 192 lines (6 kb)
Included or required:0 times
Referenced: 0 times
Includes or requires: 0 files

Defines 1 class


Class: users  - X-Ref

Users analyser (insights for users).

get_analysables_iterator(?string $action = null, array $contexts = [])   X-Ref
The site users are the analysable elements returned by this analyser.

param: string|null $action 'prediction', 'training' or null if no specific action needed.
param: \context[] $contexts Only analysables that depend on the provided contexts. All analysables in the system if empty.
return: \Iterator

one_sample_per_analysable()   X-Ref
Just one sample per analysable.

return: bool

get_samples_origin()   X-Ref
Samples origin is user table.

return: string

get_sample_analysable($sampleid)   X-Ref
Returns the analysable of a sample

param: int $sampleid
return: \core_analytics\analysable

provided_sample_data()   X-Ref
This provides samples' user and context.

return: string[]

sample_access_context($sampleid)   X-Ref
Returns the context of a sample.

param: int $sampleid
return: \context

get_all_samples(\core_analytics\analysable $user)   X-Ref
This will return just one user as we analyse users separately.

param: \core_analytics\analysable $user
return: array

get_samples($sampleids)   X-Ref
Returns samples data from sample ids.

param: int[] $sampleids
return: array

sample_description($sampleid, $contextid, $sampledata)   X-Ref
Returns the description of a sample.

param: int $sampleid
param: int $contextid
param: array $sampledata
return: array array(string, \renderable)

processes_user_data()   X-Ref
We need to delete associated data if a user requests his data to be deleted.

return: bool

join_sample_user($sampletablealias)   X-Ref
Join the samples origin table with the user id table.

param: string $sampletablealias
return: string