Moodle APIs  3.8
Moodle 3.8.6 (Build: 20201109)
Public Member Functions | Static Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
core\analytics\analyser\student_enrolments Class Reference

Student enrolments analyser. More...

Inheritance diagram for core\analytics\analyser\student_enrolments:
core_analytics\local\analyser\by_course core_analytics\local\analyser\base

Public Member Functions

 add_log ($string)
 Adds a register to the analysis log. More...
 
 check_indicator_requirements (\core_analytics\local\indicator\base $indicator)
 Checks that this analyser satisfies the provided indicator requirements. More...
 
 get_all_samples (\core_analytics\analysable $analysable)
 This function returns this analysable list of samples. More...
 
 get_all_samples (\core_analytics\analysable $course)
 All course student enrolments. More...
 
 get_analysables ()
 Returns the list of analysable elements available on the site. More...
 
 get_analysables_iterator (?string $action=null, array $contexts=[])
 Return the list of courses to analyse. More...
 
 get_indicators ()
 Getter for indicators. More...
 
 get_labelled_data (array $contexts=[])
 Returns labelled data (training and evaluation). More...
 
 get_logs ()
 Returns the analysis logs. More...
 
 get_modelid ()
 Model id getter. More...
 
 get_options ()
 Options getter. More...
 
 get_sample_analysable ($sampleid)
 Returns the student enrolment course. More...
 
 get_samples ($sampleids)
 Returns all samples from the samples ids. More...
 
 get_samples_origin ()
 Defines the origin of the samples in the database. More...
 
 get_static_data (array $contexts=[])
 Returns indicator calculations as an array. More...
 
 get_target ()
 Returns the analysed target. More...
 
 get_timesplittings ()
 Getter for time splittings. More...
 
 get_unlabelled_data (array $contexts=[])
 Returns unlabelled data (prediction). More...
 
 instantiate_indicators ()
 Instantiate the indicators. More...
 
 join_sample_user ($sampletablealias)
 Join the samples origin table with the user id table. More...
 
 processes_user_data ()
 We need to delete associated data if a user requests his data to be deleted. More...
 
 sample_access_context ($sampleid)
 Returns the student enrolment course context. More...
 
 sample_description ($sampleid, $contextid, $sampledata)
 Returns the visible name of a sample + a renderable to display as sample picture. More...
 

Static Public Member Functions

static context_restriction_support ()
 Can be limited to course categories or specific courses. More...
 
static one_sample_per_analysable ()
 Do this analyser's analysables have 1 single sample each? More...
 
static potential_context_restrictions (string $query=null)
 Returns the possible contexts used by the analyser. More...
 

Protected Member Functions

 check_indicators_requirements ()
 Checks if the analyser satisfies all the model indicators requirements. More...
 
 get_iterator_sql (string $tablename, int $contextlevel, ?string $action=null, ?string $tablealias=null, array $contexts=[])
 Get the sql of a default implementation of the iterator. More...
 
 get_sample_courseid ($sampleid)
 Returns the student enrolment course id. More...
 
 order_sql (?string $fieldname=null, string $order='ASC', ?string $tablealias=null)
 Returns the order by clause. More...
 
 provided_sample_data ()
 Data provided by get_all_samples & get_samples. More...
 

Protected Attributes

core_analytics local indicator base[] $indicators
 The model indicators.
 
string[] $log
 Simple log array.
 
int $modelid
 
array $options
 Execution options.
 
array $samplecourses = array()
 Cache for user_enrolment id - course id relation.
 
core_analytics local target base $target
 The model target.
 
core_analytics local time_splitting base[] $timesplittings
 Time splitting methods to use. More...
 

Detailed Description

Student enrolments analyser.

It does return all student enrolments including the suspended ones.

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

Member Function Documentation

◆ add_log()

core_analytics\local\analyser\base::add_log (   $string)
inherited

Adds a register to the analysis log.

Parameters
string$string
Return values
void

◆ check_indicator_requirements()

core_analytics\local\analyser\base::check_indicator_requirements ( \core_analytics\local\indicator\base  $indicator)
inherited

Checks that this analyser satisfies the provided indicator requirements.

Parameters
core_analytics\local\indicator\base$indicator
Return values
true|string[]True if all good, missing requirements list otherwise

◆ check_indicators_requirements()

core_analytics\local\analyser\base::check_indicators_requirements ( )
protectedinherited

Checks if the analyser satisfies all the model indicators requirements.

Exceptions
core_analytics

◆ context_restriction_support()

static core_analytics\local\analyser\by_course::context_restriction_support ( )
staticinherited

Can be limited to course categories or specific courses.

Return values
array

Reimplemented from core_analytics\local\analyser\base.

◆ get_all_samples() [1/2]

core_analytics\local\analyser\base::get_all_samples ( \core_analytics\analysable  $analysable)
abstractinherited

This function returns this analysable list of samples.

Parameters
core_analytics\analysable$analysable
Return values
arrayarray[0] = int[] (sampleids) and array[1] = array (samplesdata)

◆ get_all_samples() [2/2]

core\analytics\analyser\student_enrolments::get_all_samples ( \core_analytics\analysable  $course)

All course student enrolments.

It does return all student enrolments including the suspended ones.

Parameters
core_analytics\analysable$course
Return values
array

◆ get_analysables()

core_analytics\local\analyser\base::get_analysables ( )
inherited

Returns the list of analysable elements available on the site.

core_analytics\local\analyser\by_course and core_analytics\local\analyser\sitewide are implementing this method returning site courses (by_course) and the whole system (sitewide) as analysables.

Todo:
MDL-65284 This will be removed in Moodle 4.1
Deprecated:
See also
get_analysables_iterator
Exceptions
coding_exception
Return values
core_analytics

◆ get_analysables_iterator()

core_analytics\local\analyser\by_course::get_analysables_iterator ( ?string  $action = null,
array  $contexts = [] 
)
inherited

Return the list of courses to analyse.

Parameters
string | null$action'prediction', 'training' or null if no specific action needed.
context[]$contextsOnly analysables that depend on the provided contexts. All analysables in the system if empty.
Return values
Iterator

Reimplemented from core_analytics\local\analyser\base.

◆ get_indicators()

core_analytics\local\analyser\base::get_indicators ( )
inherited

Getter for indicators.

Return values
core_analytics

◆ get_iterator_sql()

core_analytics\local\analyser\base::get_iterator_sql ( string  $tablename,
int  $contextlevel,
?string  $action = null,
?string  $tablealias = null,
array  $contexts = [] 
)
protectedinherited

Get the sql of a default implementation of the iterator.

This method only works for analysers that return analysable elements which ids map to a context instance ids.

Parameters
string$tablenameThe name of the table
int$contextlevelThe context level of the analysable
string | null$action
string | null$tablealiasThe table alias
context[]$contextsOnly analysables that depend on the provided contexts. All analysables if empty.
Return values
array[0] => sql and [1] => params array

◆ get_labelled_data()

core_analytics\local\analyser\base::get_labelled_data ( array  $contexts = [])
inherited

Returns labelled data (training and evaluation).

Parameters
context[]$contextsRestrict the analysis to these contexts. No context restrictions if null.
Return values
stored_file[]

◆ get_logs()

core_analytics\local\analyser\base::get_logs ( )
inherited

Returns the analysis logs.

Return values
string[]

◆ get_modelid()

core_analytics\local\analyser\base::get_modelid ( )
inherited

Model id getter.

Return values
int

◆ get_options()

core_analytics\local\analyser\base::get_options ( )
inherited

Options getter.

Return values
array

◆ get_sample_analysable()

core\analytics\analyser\student_enrolments::get_sample_analysable (   $sampleid)

Returns the student enrolment course.

Parameters
int$sampleid
Return values
core_analytics

Reimplemented from core_analytics\local\analyser\base.

◆ get_sample_courseid()

core\analytics\analyser\student_enrolments::get_sample_courseid (   $sampleid)
protected

Returns the student enrolment course id.

Parameters
int$sampleid
Return values
int

◆ get_samples()

core\analytics\analyser\student_enrolments::get_samples (   $sampleids)

Returns all samples from the samples ids.

Parameters
int[]$sampleids
Return values
array

Reimplemented from core_analytics\local\analyser\base.

◆ get_samples_origin()

core\analytics\analyser\student_enrolments::get_samples_origin ( )

Defines the origin of the samples in the database.

Return values
string

Reimplemented from core_analytics\local\analyser\base.

◆ get_static_data()

core_analytics\local\analyser\base::get_static_data ( array  $contexts = [])
inherited

Returns indicator calculations as an array.

Parameters
context[]$contextsRestrict the analysis to these contexts. No context restrictions if null.
Return values
array

◆ get_target()

core_analytics\local\analyser\base::get_target ( )
inherited

Returns the analysed target.

Return values
core_analytics

◆ get_timesplittings()

core_analytics\local\analyser\base::get_timesplittings ( )
inherited

Getter for time splittings.

Return values
core_analytics

◆ get_unlabelled_data()

core_analytics\local\analyser\base::get_unlabelled_data ( array  $contexts = [])
inherited

Returns unlabelled data (prediction).

Parameters
context[]$contextsRestrict the analysis to these contexts. No context restrictions if null.
Return values
stored_file[]

◆ instantiate_indicators()

core_analytics\local\analyser\base::instantiate_indicators ( )
inherited

Instantiate the indicators.

Return values
core_analytics

◆ join_sample_user()

core\analytics\analyser\student_enrolments::join_sample_user (   $sampletablealias)

Join the samples origin table with the user id table.

Parameters
string$sampletablealias
Return values
string

Reimplemented from core_analytics\local\analyser\base.

◆ one_sample_per_analysable()

static core_analytics\local\analyser\base::one_sample_per_analysable ( )
staticinherited

Do this analyser's analysables have 1 single sample each?

Overwrite and return true if your analysables only have one sample. The insights generated by models using this analyser will then include the suggested actions in the notification.

Return values
bool

Reimplemented in core\analytics\analyser\users, and core\analytics\analyser\courses.

◆ order_sql()

core_analytics\local\analyser\base::order_sql ( ?string  $fieldname = null,
string  $order = 'ASC',
?string  $tablealias = null 
)
protectedinherited

Returns the order by clause.

Parameters
string | null$fieldnameThe field name
string$order'ASC' or 'DESC'
string | null$tablealiasThe table alias of the field
Return values
string

◆ potential_context_restrictions()

static core_analytics\local\analyser\base::potential_context_restrictions ( string  $query = null)
staticinherited

Returns the possible contexts used by the analyser.

This method uses separate logic for each context level because to iterate through the list of contexts calling get_context_name for each of them would be expensive in performance terms.

This generic implementation returns all the contexts in the site for the provided context level. Overwrite it for specific restrictions in your analyser.

Parameters
string | null$queryContext name filter.
Return values
int[]

◆ processes_user_data()

core\analytics\analyser\student_enrolments::processes_user_data ( )

We need to delete associated data if a user requests his data to be deleted.

Return values
bool

Reimplemented from core_analytics\local\analyser\base.

◆ provided_sample_data()

core\analytics\analyser\student_enrolments::provided_sample_data ( )
protected

Data provided by get_all_samples & get_samples.

Return values
string[]

Reimplemented from core_analytics\local\analyser\base.

◆ sample_access_context()

core\analytics\analyser\student_enrolments::sample_access_context (   $sampleid)

Returns the student enrolment course context.

Parameters
int$sampleid
Return values
context

Reimplemented from core_analytics\local\analyser\base.

◆ sample_description()

core\analytics\analyser\student_enrolments::sample_description (   $sampleid,
  $contextid,
  $sampledata 
)

Returns the visible name of a sample + a renderable to display as sample picture.

Parameters
int$sampleid
int$contextid
array$sampledata
Return values
arrayarray(string, renderable)

Reimplemented from core_analytics\local\analyser\base.

Member Data Documentation

◆ $timesplittings

core_analytics local time_splitting base [] core_analytics\local\analyser\base::$timesplittings
protectedinherited

Time splitting methods to use.

Multiple time splitting methods during evaluation and 1 single time splitting method once the model is enabled.


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