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.

Base class for targets whose analysable is a course using user enrolments as samples.

Copyright: 2019 Victor Deniz <victor@moodle.com>
License: http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
File Size: 393 lines (15 kb)
Included or required:0 times
Referenced: 0 times
Includes or requires: 0 files

Defines 1 class


Class: course_enrolments  - X-Ref

Base class for targets whose analysable is a course using user enrolments as samples.

get_analyser_class()   X-Ref
Returns the analyser class that should be used along with this target.

return: string The full class name as a string

can_use_timesplitting(\core_analytics\local\time_splitting\base $timesplitting)   X-Ref
Only past stuff.

param: \core_analytics\local\time_splitting\base $timesplitting
return: bool

get_insight_subject(int $modelid, \context $context)   X-Ref
Overwritten to show a simpler language string.

param: int $modelid
param: \context $context
return: string

get_insight_body(\context $context, string $contextname, \stdClass $user, \moodle_url $insighturl)   X-Ref
Returns the body message for the insight.

param: \context     $context
param: string       $contextname
param: \stdClass    $user
param: \moodle_url  $insighturl
return: string[]                     The plain text message and the HTML message

is_valid_analysable(\core_analytics\analysable $course, $fortraining = true)   X-Ref
Discards courses that are not yet ready to be used for training or prediction.

param: \core_analytics\analysable $course
param: bool $fortraining
return: true|string

is_valid_sample($sampleid, \core_analytics\analysable $course, $fortraining = true)   X-Ref
Discard student enrolments that are invalid.

Note that this method assumes that the target is only interested in enrolments that are/were active
between the current course start and end times. Targets interested in predicting students at risk before
their enrolment start and targets interested in getting predictions for students whose enrolment already
finished should overwrite this method as these students are discarded by this method.

param: int $sampleid
param: \core_analytics\analysable $course
param: bool $fortraining
return: bool

prediction_actions(\core_analytics\prediction $prediction, $includedetailsaction = false,$isinsightuser = false)   X-Ref
prediction_actions

param: \core_analytics\prediction $prediction
param: bool $includedetailsaction
param: bool $isinsightuser
return: \core_analytics\prediction_action[]

bulk_actions(array $predictions)   X-Ref
Suggested bulk actions for a user.

param: \core_analytics\prediction[]     $predictions List of predictions suitable for the bulk actions to use.
return: \core_analytics\bulk_action[]                 The list of bulk actions.

add_bulk_actions_js()   X-Ref
Adds the JS required to run the bulk actions.


enrolment_active_during_analysis_time(int $sampleid, int $starttime, int $endtime)   X-Ref
Is/was this user enrolment active during most of the analysis interval?

This method discards enrolments that were not active during most of the analysis interval. It is
important to discard these enrolments because the indicator calculations can lead to misleading
results.

Note that this method assumes that the target is interested in enrolments that are/were active
during the analysis interval. Targets interested in predicting students at risk before
their enrolment start should not call this method. Similarly, targets interested in getting
predictions for students whose enrolment already finished should not call this method either.

param: int    $sampleid     The id of the sample that is being calculated
param: int    $starttime    The analysis interval start time
param: int    $endtime      The analysis interval end time
return: bool