Moodle APIs 4.3
Moodle 4.3.6 (Build: 20240812)
|
Activity base class. More...
Public Member Functions | |
add_sample_data ($data) | |
add_sample_data | |
calculate ($sampleids, $samplesorigin, $starttime=false, $endtime=false, $existingcalculations=array()) | |
Calculates the indicator. | |
clear_sample_data () | |
clear_sample_data | |
fetch_student_grades (\core_analytics\course $course) | |
No need to fetch grades for resources. | |
fill_per_analysable_caches (\core_analytics\analysable $analysable) | |
Fetch the course grades of this activity type instances. | |
string | get_activity_type () |
Returns the activity type. | |
get_calculation_outcome ($value, $subtype=false) | |
get_calculation_outcome | |
get_cognitive_depth_level (\cm_info $cm) | |
Returns the potential level of cognitive depth. | |
get_display_value ($value, $subtype=false) | |
get_display_value | |
get_id () | |
The class id is the calculable class full qualified class name. | |
get_indicator_type () | |
Defines indicator type. | |
get_social_breadth_level (\cm_info $cm) | |
Returns the potential level of social breadth. | |
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. | |
should_be_displayed ($value, $subtype) | |
Show only the main feature. | |
Static Public Member Functions | |
static | get_feature_headers () |
get_feature_headers | |
static | get_max_value () |
Returns the maximum value an indicator calculation can return. | |
static | get_min_value () |
Returns the minimum value an indicator calculation can return. | |
static | get_name () |
Returns a lang_string object representing the name for the indicator or target. | |
static | instance () |
Returns an instance of the indicator. | |
static | required_sample_data () |
required_sample_data | |
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?. | |
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. | |
add_shared_calculation_info (int $sampleid, array $info) | |
Adds info related to the current calculation for later use when generating insights. | |
any_feedback ($action, cm_info $cm, $contextid, $user) | |
Is there any feedback activity log for this user in this context? | |
any_log ($contextid, $user) | |
Do activity logs contain any log of user in this context? | |
any_write_log ($contextid, $user) | |
Do activity logs contain any write log of user in this context? | |
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. | |
calculate_sample ($sampleid, $tablename, $starttime=false, $endtime=false) | |
calculate_sample | |
classify_value ($value, $ranges) | |
Classifies the provided value into the provided range according to the ranges predicates. | |
cognitive_calculate_sample ($sampleid, $tablename, $starttime=false, $endtime=false) | |
Calculates the cognitive depth of a sample. | |
feedback_check_grades () | |
Whether grades should be checked or not when looking for feedback. | |
feedback_post_action (\cm_info $cm, $contextid, $userid, $eventnames, $after=null) | |
Whether this user in this context did any of the provided actions (events) | |
feedback_replied (\cm_info $cm, $contextid, $userid, $after=null) | |
$cm is used for this method overrides. | |
feedback_replied_events () | |
Returns the list of events that involve replying to feedback from other users. | |
feedback_submitted (\cm_info $cm, $contextid, $userid, $after=null) | |
$cm is used for this method overrides. | |
feedback_submitted_events () | |
Returns the list of events that involve submitting something after receiving feedback from other users. | |
feedback_viewed (\cm_info $cm, $contextid, $userid, $after=null) | |
$cm is used for this method overrides. | |
feedback_viewed_events () | |
Returns the list of events that involve viewing feedback from other users. | |
fetch_activity_logs ($activities, $starttime=false, $endtime=false) | |
Fetch acitivity logs from database. | |
fetch_student_grades (\core_analytics\course $course) | |
Gets the course student grades. | |
fill_instance_data (\cm_info $cm) | |
Fills in activity instance data. | |
get_activities ($starttime, $endtime, $student=false) | |
Guesses all activities that were available during a period of time. | |
get_graded_date ($contextid, $userid, $checkfeedback=false) | |
Returns the date a user was graded. | |
get_student_activities ($sampleid, $tablename, $starttime, $endtime) | |
Returns the activities the user had access to between a time period. | |
get_time_range_weeks_number ($starttime, $endtime) | |
Returns the number of weeks a time range contains. | |
get_timeclose_field () | |
Returns the name of the field that controls activity availability. | |
limit_value ($calculatedvalue) | |
Limits the calculated value to the minimum and maximum values. | |
retrieve ($elementname, $sampleid) | |
Retrieve the specified element associated to $sampleid. | |
social_calculate_sample ($sampleid, $tablename, $starttime=false, $endtime=false) | |
Calculates the social breadth of a sample. | |
to_features ($calculatedvalues) | |
Converts the calculated values to a list of features for the dataset. | |
validate_calculated_value ($calculatedvalue) | |
Validates the calculated value. | |
Static Protected Member Functions | |
static | include_averages () |
Set to false to avoid context features to be added as dataset features. | |
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_bigbluebuttonbn\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_resource\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_bigbluebuttonbn\analytics\indicator\cognitive_depth, mod_bigbluebuttonbn\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\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, 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_user\analytics\indicator\user_profile_set, core_user\analytics\indicator\user_track_forums, core_user\analytics\target\upcoming_activities_due, mod_assign\analytics\indicator\cognitive_depth, mod_assign\analytics\indicator\social_breadth, mod_bigbluebuttonbn\analytics\indicator\cognitive_depth, mod_bigbluebuttonbn\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.
|
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.