Search moodle.org's
Developer Documentation

See Release Notes

  • Bug fixes for general core bugs in 4.0.x will end 8 May 2023 (12 months).
  • Bug fixes for security issues in 4.0.x will end 13 November 2023 (18 months).
  • PHP version: minimum PHP 7.3.0 Note: the minimum PHP version has increased since Moodle 3.10. PHP 7.4.x is also supported.

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.

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

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

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

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

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

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.

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

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.

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

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

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

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

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

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.

return: bool
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