Differences Between: [Versions 310 and 403] [Versions 311 and 403] [Versions 39 and 403] [Versions 400 and 403] [Versions 401 and 403]
Moodle course analysable
Copyright: | 2016 David Monllao {@link http://www.davidmonllao.com} |
License: | http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later |
File Size: | 628 lines (18 kb) |
Included or required: | 0 times |
Referenced: | 0 times |
Includes or requires: | 0 files |
course:: (22 methods):
__construct()
instance()
get_id()
load()
get_name()
get_context()
get_start()
guess_start()
get_end()
guess_end()
get_course_data()
was_started()
is_finished()
get_user_ids()
get_students()
get_total_logs()
get_all_activities()
get_student_grades()
filter_user_id()
update_loop_times()
course_students_query_filter()
median()
__construct($course, ?\context $context = null) X-Ref |
Course manager constructor. Use self::instance() instead to get cached copies of the course. Instances obtained through this constructor will not be cached. param: int|\stdClass $course Course id or mdl_course record param: \context|null $context return: void |
instance($course, ?\context $context = null) X-Ref |
Returns an analytics course instance. Lazy load of course data, students and teachers. param: int|\stdClass $course Course object or course id param: \context|null $context return: \core_analytics\course |
get_id() X-Ref |
get_id return: int |
load() X-Ref |
Loads the analytics course object. return: void |
get_name() X-Ref |
The course short name return: string |
get_context() X-Ref |
get_context return: \context |
get_start() X-Ref |
Get the course start timestamp. return: int Timestamp or 0 if has not started yet. |
guess_start() X-Ref |
Guesses the start of the course based on students' activity and enrolment start dates. return: int |
get_end() X-Ref |
Get the course end timestamp. return: int Timestamp or 0 if time end was not set. |
guess_end() X-Ref |
Get the course end timestamp. return: int Timestamp, \core_analytics\analysable::MAX_TIME if we don't know but ongoing and 0 if we can not work it out. |
get_course_data() X-Ref |
Returns a course plain object. return: \stdClass |
was_started() X-Ref |
Has the course started? return: bool |
is_finished() X-Ref |
Has the course finished? return: bool |
get_user_ids($roleids) X-Ref |
Returns a list of user ids matching the specified roles in this course. param: array $roleids return: array |
get_students() X-Ref |
Returns the course students. return: int[] |
get_total_logs() X-Ref |
Returns the total number of student logs in the course return: int |
get_all_activities($activitytype) X-Ref |
Returns all the activities of the provided type the course has. param: string $activitytype return: array |
get_student_grades($courseactivities) X-Ref |
Returns the course students grades. param: array $courseactivities return: array |
filter_user_id($record) X-Ref |
Used by get_user_ids to extract the user id. param: \stdClass $record return: int The user id. |
update_loop_times($start, $end) X-Ref |
Returns the average time between 2 timestamps. param: int $start param: int $end return: array [starttime, averagetime, endtime] |
course_students_query_filter($prefix = false) X-Ref |
Returns the query and params used to filter the logstore by this course students. param: string $prefix return: array |
median($values) X-Ref |
Calculate median Keys are ignored. param: int[]|float[] $values Sorted array of values return: int |