Moodle APIs 3.9
Moodle 3.9.13+ (Build: 20220325)
|
Activity base class. More...
Public Member Functions | |
add_sample_data ($data) | |
add_sample_data More... | |
calculate ($sampleids, $samplesorigin, $starttime=false, $endtime=false, $existingcalculations=array()) | |
Calculates the indicator. More... | |
clear_sample_data () | |
clear_sample_data More... | |
fetch_student_grades (\core_analytics\course $course) | |
No need to fetch grades. More... | |
fill_per_analysable_caches (\core_analytics\analysable $analysable) | |
Fetch the course grades of this activity type instances. More... | |
string | get_activity_type () |
Returns the activity type. More... | |
get_calculation_outcome ($value, $subtype=false) | |
get_calculation_outcome More... | |
get_cognitive_depth_level (\cm_info $cm) | |
Returns the potential level of cognitive depth. More... | |
get_display_value ($value, $subtype=false) | |
get_display_value More... | |
get_id () | |
The class id is the calculable class full qualified class name. More... | |
get_indicator_type () | |
Defines indicator type. More... | |
get_social_breadth_level (\cm_info $cm) | |
Returns the potential level of social breadth. More... | |
save_calculation_info (\core_analytics\local\time_splitting\base $timesplitting, int $rangeindex) | |
Stores in MUC the previously added data and it associates it to the provided $calculable. More... | |
should_be_displayed ($value, $subtype) | |
Show only the main feature. More... | |
Static Public Member Functions | |
static | get_feature_headers () |
get_feature_headers More... | |
static | get_max_value () |
Returns the maximum value an indicator calculation can return. More... | |
static | get_min_value () |
Returns the minimum value an indicator calculation can return. More... | |
static | get_name () |
Returns a lang_string object representing the name for the indicator or target. More... | |
static | instance () |
Returns an instance of the indicator. More... | |
static | required_sample_data () |
required_sample_data More... | |
Protected Member Functions | |
activity_completed_by (\cm_info $activity, $starttime, $endtime, $student=false) | |
Was the activity supposed to be completed during the provided time range?. More... | |
activity_type_completed_by (\cm_info $activity, $starttime, $endtime, $student=false) | |
True if the activity is due or it has been closed during this period, false if during another period, null if no due time. More... | |
add_shared_calculation_info (int $sampleid, array $info) | |
Adds info related to the current calculation for later use when generating insights. More... | |
any_feedback ($action, cm_info $cm, $contextid, $user) | |
Is there any feedback activity log for this user in this context? More... | |
any_log ($contextid, $user) | |
Do activity logs contain any log of user in this context? More... | |
any_write_log ($contextid, $user) | |
Do activity logs contain any write log of user in this context? More... | |
availability_completed_by (\core_availability\info $info, $starttime, $endtime) | |
Check if the activity/section should have been completed during the provided period according to its availability rules. More... | |
calculate_sample ($sampleid, $tablename, $starttime=false, $endtime=false) | |
calculate_sample More... | |
classify_value ($value, $ranges) | |
Classifies the provided value into the provided range according to the ranges predicates. More... | |
cognitive_calculate_sample ($sampleid, $tablename, $starttime=false, $endtime=false) | |
Calculates the cognitive depth of a sample. More... | |
feedback_check_grades () | |
Whether grades should be checked or not when looking for feedback. More... | |
feedback_post_action (\cm_info $cm, $contextid, $userid, $eventnames, $after=null) | |
Whether this user in this context did any of the provided actions (events) More... | |
feedback_replied (\cm_info $cm, $contextid, $userid, $after=null) | |
$cm is used for this method overrides. More... | |
feedback_replied_events () | |
Returns the list of events that involve replying to feedback from other users. More... | |
feedback_submitted (\cm_info $cm, $contextid, $userid, $after=null) | |
$cm is used for this method overrides. More... | |
feedback_submitted_events () | |
Returns the list of events that involve submitting something after receiving feedback from other users. More... | |
feedback_viewed (\cm_info $cm, $contextid, $userid, $after=null) | |
$cm is used for this method overrides. More... | |
feedback_viewed_events () | |
Returns the list of events that involve viewing feedback from other users. More... | |
fetch_activity_logs ($activities, $starttime=false, $endtime=false) | |
Fetch acitivity logs from database. More... | |
fetch_student_grades (\core_analytics\course $course) | |
Gets the course student grades. More... | |
fill_instance_data (\cm_info $cm) | |
Fills in activity instance data. More... | |
get_activities ($starttime, $endtime, $student=false) | |
Guesses all activities that were available during a period of time. More... | |
get_graded_date ($contextid, $userid, $checkfeedback=false) | |
Returns the date a user was graded. More... | |
get_student_activities ($sampleid, $tablename, $starttime, $endtime) | |
Returns the activities the user had access to between a time period. More... | |
get_time_range_weeks_number ($starttime, $endtime) | |
Returns the number of weeks a time range contains. More... | |
get_timeclose_field () | |
Returns the name of the field that controls activity availability. More... | |
limit_value ($calculatedvalue) | |
Limits the calculated value to the minimum and maximum values. More... | |
retrieve ($elementname, $sampleid) | |
Retrieve the specified element associated to $sampleid. More... | |
social_calculate_sample ($sampleid, $tablename, $starttime=false, $endtime=false) | |
Calculates the social breadth of a sample. More... | |
to_features ($calculatedvalues) | |
Converts the calculated values to a list of features for the dataset. More... | |
validate_calculated_value ($calculatedvalue) | |
Validates the calculated value. More... | |
Static Protected Member Functions | |
static | include_averages () |
Set to false to avoid context features to be added as dataset features. More... | |
Activity base class.
|
protectedinherited |
Was the activity supposed to be completed during the provided time range?.
cm_info | $activity | |
int | $starttime | |
int | $endtime | |
stdClass | false | $student |
bool |
|
protectedinherited |
True if the activity is due or it has been closed during this period, false if during another period, null if no due time.
It can be overwritten by activities that allow teachers to set a due date or a time close separately from Moodle availability system. Note that in most of the cases overwriting get_timeclose_field should be enough.
Returns true or false if the time close date falls into the provided time range. Null otherwise.
cm_info | $activity | |
int | $starttime | |
int | $endtime | |
stdClass | false | $student |
null |
|
inherited |
add_sample_data
array | $data |
void |
|
finalprotectedinherited |
Adds info related to the current calculation for later use when generating insights.
Note that the data in $info array is reused across multiple samples, if you want to add data just for this sample you can use the sample id as key.
Please, note that you should be careful with how much data you add here as it can kill the server memory.
int | $sampleid | The sample id this data is associated with |
array | $info | The data. Indexed by an id unique across the site. E.g. an activity id. |
null |
|
protectedinherited |
Is there any feedback activity log for this user in this context?
This method returns true if $user is empty and there is any feedback activity logs.
string | $action | |
cm_info | $cm | |
int | $contextid | |
stdClass | false | $user |
bool |
|
finalprotectedinherited |
Do activity logs contain any log of user in this context?
If user is empty we look for any log in this context.
int | $contextid | |
stdClass | false | $user |
bool |
|
finalprotectedinherited |
Do activity logs contain any write log of user in this context?
If user is empty we look for any write log in this context.
int | $contextid | |
stdClass | false | $user |
bool |
|
protectedinherited |
Check if the activity/section should have been completed during the provided period according to its availability rules.
core_availability::info | $info | |
int | $starttime | |
int | $endtime |
bool|null |
|
inherited |
Calculates the indicator.
Returns an array of values which size matches $sampleids size.
int[] | $sampleids | |
string | $samplesorigin | |
integer | $starttime | Limit the calculation to this timestart |
integer | $endtime | Limit the calculation to this timeend |
array | $existingcalculations | Existing calculations of this indicator, indexed by sampleid. |
array | [0] = [$sampleid => int[]|float[]], [1] = [$sampleid => int|float], [2] = [$sampleid => $sampleid] |
|
protectedinherited |
calculate_sample
coding_exception |
int | $sampleid | |
string | $tablename | |
int | $starttime | |
int | $endtime |
float|int|null |
Reimplemented from core_analytics\local\indicator\base.
|
protectedinherited |
Classifies the provided value into the provided range according to the ranges predicates.
Use:
coding_exception |
int | float | $value | |
array | $ranges | e.g. [ ['lt', 20], ['ge', 20] ] |
float |
|
inherited |
clear_sample_data
void |
|
protectedinherited |
Calculates the cognitive depth of a sample.
int | $sampleid | |
string | $tablename | |
int | $starttime | |
int | $endtime |
float|int|null |
coding_exception |
|
protectedinherited |
Whether grades should be checked or not when looking for feedback.
bool |
Reimplemented in mod_assign\analytics\indicator\activity_base, mod_chat\analytics\indicator\activity_base, mod_forum\analytics\indicator\cognitive_depth, mod_lesson\analytics\indicator\activity_base, mod_quiz\analytics\indicator\activity_base, and mod_workshop\analytics\indicator\activity_base.
|
protectedinherited |
Whether this user in this context did any of the provided actions (events)
cm_info | $cm | |
int | $contextid | |
int | $userid | |
string[] | $eventnames | |
int | false | $after |
bool |
Reimplemented in mod_chat\analytics\indicator\activity_base, and mod_forum\analytics\indicator\activity_base.
|
protectedinherited |
$cm is used for this method overrides.
This function must be fast.
cm_info | $cm | |
mixed | $contextid | |
mixed | $userid | |
int | $after | Timestamp, defaults to the graded date or false if we don't check the date. |
bool |
Reimplemented in mod_assign\analytics\indicator\cognitive_depth, mod_lesson\analytics\indicator\cognitive_depth, and mod_quiz\analytics\indicator\cognitive_depth.
|
protectedinherited |
Returns the list of events that involve replying to feedback from other users.
string[] |
Reimplemented in mod_chat\analytics\indicator\activity_base, mod_forum\analytics\indicator\cognitive_depth, and mod_workshop\analytics\indicator\cognitive_depth.
|
protectedinherited |
$cm is used for this method overrides.
This function must be fast.
cm_info | $cm | |
mixed | $contextid | |
mixed | $userid | |
int | $after | Timestamp, defaults to the graded date or false if we don't check the date. |
bool |
Reimplemented in mod_lesson\analytics\indicator\cognitive_depth.
|
protectedinherited |
Returns the list of events that involve submitting something after receiving feedback from other users.
string[] |
Reimplemented in mod_assign\analytics\indicator\cognitive_depth, mod_quiz\analytics\indicator\cognitive_depth, and mod_workshop\analytics\indicator\cognitive_depth.
|
protectedinherited |
$cm is used for this method overrides.
This function must be fast.
cm_info | $cm | |
mixed | $contextid | |
mixed | $userid | |
int | $after | Timestamp, defaults to the graded date or false if we don't check the date. |
bool |
Reimplemented in mod_choice\analytics\indicator\activity_base, and mod_feedback\analytics\indicator\activity_base.
|
protectedinherited |
Returns the list of events that involve viewing feedback from other users.
string[] |
Reimplemented in mod_assign\analytics\indicator\activity_base, mod_chat\analytics\indicator\activity_base, mod_choice\analytics\indicator\activity_base, mod_forum\analytics\indicator\activity_base, mod_lesson\analytics\indicator\activity_base, mod_lti\analytics\indicator\activity_base, mod_quiz\analytics\indicator\activity_base, mod_scorm\analytics\indicator\activity_base, and mod_workshop\analytics\indicator\activity_base.
|
protectedinherited |
Fetch acitivity logs from database.
array | $activities | |
int | $starttime | |
int | $endtime |
array |
|
protectedinherited |
mod_survey\analytics\indicator\activity_base::fetch_student_grades | ( | \core_analytics\course | $course | ) |
|
protectedinherited |
|
inherited |
Fetch the course grades of this activity type instances.
core_analytics::analysable | $analysable |
void |
Reimplemented from core_analytics\local\indicator\base.
|
protectedinherited |
Guesses all activities that were available during a period of time.
int | $starttime | |
int | $endtime | |
stdClass | false | $student |
array |
|
finalinherited |
Returns the activity type.
No point in changing this class in children classes.
The activity name (e.g. assign or quiz)
|
inherited |
get_calculation_outcome
float | $value | |
string | $subtype |
int |
Reimplemented from core_analytics\calculable.
|
inherited |
Returns the potential level of cognitive depth.
cm_info | $cm |
int |
Reimplemented in mod_assign\analytics\indicator\cognitive_depth, mod_book\analytics\indicator\cognitive_depth, mod_chat\analytics\indicator\cognitive_depth, mod_choice\analytics\indicator\cognitive_depth, mod_data\analytics\indicator\cognitive_depth, mod_feedback\analytics\indicator\cognitive_depth, mod_folder\analytics\indicator\cognitive_depth, mod_forum\analytics\indicator\cognitive_depth, mod_glossary\analytics\indicator\cognitive_depth, mod_imscp\analytics\indicator\cognitive_depth, mod_label\analytics\indicator\cognitive_depth, mod_lesson\analytics\indicator\cognitive_depth, mod_lti\analytics\indicator\cognitive_depth, mod_page\analytics\indicator\cognitive_depth, mod_quiz\analytics\indicator\cognitive_depth, mod_resource\analytics\indicator\cognitive_depth, mod_scorm\analytics\indicator\cognitive_depth, mod_survey\analytics\indicator\cognitive_depth, mod_url\analytics\indicator\cognitive_depth, mod_wiki\analytics\indicator\cognitive_depth, and mod_workshop\analytics\indicator\cognitive_depth.
|
inherited |
get_display_value
float | $value | |
string | $subtype |
string |
Reimplemented from core_analytics\calculable.
|
staticinherited |
get_feature_headers
array |
|
protectedinherited |
Returns the date a user was graded.
int | $contextid | |
int | $userid | |
bool | $checkfeedback | Check that the student was graded or check that feedback was given |
int|false |
|
inherited |
The class id is the calculable class full qualified class name.
string |
|
abstractinherited |
Defines indicator type.
string |
Reimplemented in mod_assign\analytics\indicator\cognitive_depth, mod_assign\analytics\indicator\social_breadth, mod_book\analytics\indicator\cognitive_depth, mod_book\analytics\indicator\social_breadth, mod_chat\analytics\indicator\cognitive_depth, mod_chat\analytics\indicator\social_breadth, mod_choice\analytics\indicator\cognitive_depth, mod_choice\analytics\indicator\social_breadth, mod_data\analytics\indicator\cognitive_depth, mod_data\analytics\indicator\social_breadth, mod_feedback\analytics\indicator\cognitive_depth, mod_feedback\analytics\indicator\social_breadth, mod_folder\analytics\indicator\cognitive_depth, mod_folder\analytics\indicator\social_breadth, mod_forum\analytics\indicator\cognitive_depth, mod_forum\analytics\indicator\social_breadth, mod_glossary\analytics\indicator\cognitive_depth, mod_glossary\analytics\indicator\social_breadth, mod_imscp\analytics\indicator\cognitive_depth, mod_imscp\analytics\indicator\social_breadth, mod_label\analytics\indicator\cognitive_depth, mod_label\analytics\indicator\social_breadth, mod_lesson\analytics\indicator\cognitive_depth, mod_lesson\analytics\indicator\social_breadth, mod_lti\analytics\indicator\cognitive_depth, mod_lti\analytics\indicator\social_breadth, mod_page\analytics\indicator\cognitive_depth, mod_page\analytics\indicator\social_breadth, mod_quiz\analytics\indicator\cognitive_depth, mod_quiz\analytics\indicator\social_breadth, mod_resource\analytics\indicator\cognitive_depth, mod_resource\analytics\indicator\social_breadth, mod_scorm\analytics\indicator\cognitive_depth, mod_scorm\analytics\indicator\social_breadth, mod_survey\analytics\indicator\cognitive_depth, mod_survey\analytics\indicator\social_breadth, mod_url\analytics\indicator\cognitive_depth, mod_url\analytics\indicator\social_breadth, mod_wiki\analytics\indicator\cognitive_depth, mod_wiki\analytics\indicator\social_breadth, mod_workshop\analytics\indicator\cognitive_depth, and mod_workshop\analytics\indicator\social_breadth.
|
staticinherited |
Returns the maximum value an indicator calculation can return.
float |
|
staticinherited |
Returns the minimum value an indicator calculation can return.
float |
|
staticabstractinherited |
Returns a lang_string object representing the name for the indicator or target.
Used as column identificator.
If there is a corresponding '_help' string this will be shown as well.
lang_string |
Reimplemented in core_course\analytics\indicator\activities_due, core_course\analytics\indicator\completion_enabled, core_course\analytics\indicator\no_student, core_course\analytics\indicator\no_teacher, core_course\analytics\indicator\potential_cognitive_depth, core_course\analytics\indicator\potential_social_breadth, core_course\analytics\target\course_competencies, core_course\analytics\target\course_completion, core_course\analytics\target\course_dropout, core_course\analytics\target\course_gradetopass, core_course\analytics\target\no_access_since_course_start, core_course\analytics\target\no_recent_accesses, core_course\analytics\target\no_teaching, core\analytics\indicator\any_access_after_end, core\analytics\indicator\any_access_before_start, core\analytics\indicator\any_course_access, core\analytics\indicator\any_write_action, core\analytics\indicator\any_write_action_in_course, core\analytics\indicator\read_actions, mod_assign\analytics\indicator\cognitive_depth, mod_assign\analytics\indicator\social_breadth, mod_book\analytics\indicator\cognitive_depth, mod_book\analytics\indicator\social_breadth, mod_chat\analytics\indicator\cognitive_depth, mod_chat\analytics\indicator\social_breadth, mod_choice\analytics\indicator\cognitive_depth, mod_choice\analytics\indicator\social_breadth, mod_data\analytics\indicator\cognitive_depth, mod_data\analytics\indicator\social_breadth, mod_feedback\analytics\indicator\cognitive_depth, mod_feedback\analytics\indicator\social_breadth, mod_folder\analytics\indicator\cognitive_depth, mod_folder\analytics\indicator\social_breadth, mod_forum\analytics\indicator\cognitive_depth, mod_forum\analytics\indicator\social_breadth, mod_glossary\analytics\indicator\cognitive_depth, mod_glossary\analytics\indicator\social_breadth, mod_imscp\analytics\indicator\cognitive_depth, mod_imscp\analytics\indicator\social_breadth, mod_label\analytics\indicator\cognitive_depth, mod_label\analytics\indicator\social_breadth, mod_lesson\analytics\indicator\cognitive_depth, mod_lesson\analytics\indicator\social_breadth, mod_lti\analytics\indicator\cognitive_depth, mod_lti\analytics\indicator\social_breadth, mod_page\analytics\indicator\cognitive_depth, mod_page\analytics\indicator\social_breadth, mod_quiz\analytics\indicator\cognitive_depth, mod_quiz\analytics\indicator\social_breadth, mod_resource\analytics\indicator\cognitive_depth, mod_resource\analytics\indicator\social_breadth, mod_scorm\analytics\indicator\cognitive_depth, mod_scorm\analytics\indicator\social_breadth, mod_survey\analytics\indicator\cognitive_depth, mod_survey\analytics\indicator\social_breadth, mod_url\analytics\indicator\cognitive_depth, mod_url\analytics\indicator\social_breadth, mod_wiki\analytics\indicator\cognitive_depth, mod_wiki\analytics\indicator\social_breadth, mod_workshop\analytics\indicator\cognitive_depth, mod_workshop\analytics\indicator\social_breadth, core_user\analytics\indicator\user_profile_set, core_user\analytics\indicator\user_track_forums, and core_user\analytics\target\upcoming_activities_due.
|
inherited |
Returns the potential level of social breadth.
cm_info | $cm |
int |
Reimplemented in mod_assign\analytics\indicator\social_breadth, mod_book\analytics\indicator\social_breadth, mod_chat\analytics\indicator\social_breadth, mod_choice\analytics\indicator\social_breadth, mod_data\analytics\indicator\social_breadth, mod_feedback\analytics\indicator\social_breadth, mod_folder\analytics\indicator\social_breadth, mod_forum\analytics\indicator\social_breadth, mod_glossary\analytics\indicator\social_breadth, mod_imscp\analytics\indicator\social_breadth, mod_label\analytics\indicator\social_breadth, mod_lesson\analytics\indicator\social_breadth, mod_lti\analytics\indicator\social_breadth, mod_page\analytics\indicator\social_breadth, mod_quiz\analytics\indicator\social_breadth, mod_resource\analytics\indicator\social_breadth, mod_scorm\analytics\indicator\social_breadth, mod_survey\analytics\indicator\social_breadth, mod_url\analytics\indicator\social_breadth, mod_wiki\analytics\indicator\social_breadth, and mod_workshop\analytics\indicator\social_breadth.
|
protectedinherited |
Returns the activities the user had access to between a time period.
int | $sampleid | |
string | $tablename | |
int | $starttime | |
int | $endtime |
array |
|
protectedinherited |
Returns the number of weeks a time range contains.
Useful for calculations that depend on the time range duration. Note that it returns a float, rounding the float may lead to inaccurate results.
int | $starttime | |
int | $endtime |
float |
|
protectedinherited |
Returns the name of the field that controls activity availability.
Should be overwritten by activities that allow teachers to set a due date or a time close separately from Moodle availability system.
Just 1 field will not be enough for all cases, but for the most simple ones without overrides and stuff like that.
null|string |
Reimplemented in mod_assign\analytics\indicator\activity_base, mod_choice\analytics\indicator\activity_base, mod_data\analytics\indicator\activity_base, mod_feedback\analytics\indicator\activity_base, mod_lesson\analytics\indicator\activity_base, mod_quiz\analytics\indicator\activity_base, mod_scorm\analytics\indicator\activity_base, and mod_workshop\analytics\indicator\activity_base.
|
staticprotectedinherited |
Set to false to avoid context features to be added as dataset features.
bool |
|
staticinherited |
Returns an instance of the indicator.
Useful to reset cached data.
core_analytics::local::indicator::base |
|
protectedinherited |
Limits the calculated value to the minimum and maximum values.
float | $calculatedvalue |
float|null |
|
staticinherited |
|
protectedinherited |
Retrieve the specified element associated to $sampleid.
string | $elementname | |
int | $sampleid |
stdClass|false | An stdClass object or false if it can not be found. |
|
finalinherited |
Stores in MUC the previously added data and it associates it to the provided $calculable.
Flagged as final as we don't want people to extend this, it is likely to be moved to core_analytics::calculable
core_analytics::local::time_splitting::base | $timesplitting | |
int | $rangeindex |
null |
|
inherited |
Show only the main feature.
float | $value | |
string | $subtype |
bool |
Reimplemented from core_analytics\local\indicator\base.
|
protectedinherited |
Calculates the social breadth of a sample.
int | $sampleid | |
string | $tablename | |
int | $starttime | |
int | $endtime |
float|int|null |
|
protectedinherited |
Converts the calculated values to a list of features for the dataset.
array | $calculatedvalues |
array |
Reimplemented from core_analytics\local\indicator\base.
|
protectedinherited |
Validates the calculated value.
coding_exception |
float | $calculatedvalue |
true |
Reimplemented in core_analytics\local\indicator\discrete.