Moodle course analysable.
More...
|
static | instance ($course, ?\context $context=null) |
| Returns an analytics course instance.
|
|
|
const | MAX_TIME = PHP_INT_MAX < 9999999999 ? PHP_MAX_INT : 9999999999 |
| Max timestamp.
|
|
|
stdClass | $course = null |
| Course object.
|
|
array | $courseactivities = array() |
| The course activities organized by activity type.
|
|
context_course | $coursecontext = null |
| The course context.
|
|
int | $endtime = null |
| Course end time.
|
|
bool | $finished = null |
| Is the course finished?
|
|
bool | $loaded = false |
| Has this course data been already loaded.
|
|
int int | $now = 0 |
| Store current Unix timestamp.
|
|
int | $ntotallogs = null |
| Cached copy of the total number of logs in the course.
|
|
bool | $started = null |
| Has the course already started?
|
|
int | $starttime = null |
| Course start time.
|
|
int[] | $studentids = [] |
| Course students ids.
|
|
int[] | $teacherids = [] |
| Course teachers ids.
|
|
|
static int | $cachedid = 0 |
| $cachedid self\$cachedinstance analysable id.
|
|
static core_analytics course | $cachedinstance = null |
| $cachedinstance
|
|
Moodle course analysable.
- Copyright
- 2016 David Monllao
- License
- http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
◆ __construct()
core_analytics\course::__construct |
( |
| $course, |
|
|
?\context | $context = null ) |
Course manager constructor.
Use self\instance() instead to get cached copies of the course. Instances obtained through this constructor will not be cached.
- Parameters
-
int | stdClass | $course | Course id or mdl_course record |
context | null | $context | |
- Return values
-
◆ course_students_query_filter()
core_analytics\course::course_students_query_filter |
( |
| $prefix = false | ) |
|
|
protected |
Returns the query and params used to filter the logstore by this course students.
- Parameters
-
- Return values
-
◆ filter_user_id()
core_analytics\course::filter_user_id |
( |
| $record | ) |
|
|
protected |
Used by get_user_ids to extract the user id.
- Parameters
-
- Return values
-
◆ get_all_activities()
core_analytics\course::get_all_activities |
( |
| $activitytype | ) |
|
Returns all the activities of the provided type the course has.
- Parameters
-
- Return values
-
◆ get_context()
core_analytics\course::get_context |
( |
| ) |
|
◆ get_course_data()
core_analytics\course::get_course_data |
( |
| ) |
|
Returns a course plain object.
- Return values
-
◆ get_end()
core_analytics\course::get_end |
( |
| ) |
|
◆ get_id()
core_analytics\course::get_id |
( |
| ) |
|
◆ get_name()
core_analytics\course::get_name |
( |
| ) |
|
◆ get_start()
core_analytics\course::get_start |
( |
| ) |
|
Get the course start timestamp.
- Return values
-
int | Timestamp or 0 if has not started yet. |
Implements core_analytics\analysable.
◆ get_student_grades()
core_analytics\course::get_student_grades |
( |
| $courseactivities | ) |
|
Returns the course students grades.
- Parameters
-
- Return values
-
◆ get_students()
core_analytics\course::get_students |
( |
| ) |
|
Returns the course students.
- Return values
-
◆ get_total_logs()
core_analytics\course::get_total_logs |
( |
| ) |
|
Returns the total number of student logs in the course.
- Return values
-
◆ get_user_ids()
core_analytics\course::get_user_ids |
( |
| $roleids | ) |
|
Returns a list of user ids matching the specified roles in this course.
- Parameters
-
- Return values
-
◆ guess_end()
core_analytics\course::guess_end |
( |
| ) |
|
Get the course end timestamp.
- Return values
-
◆ guess_start()
core_analytics\course::guess_start |
( |
| ) |
|
Guesses the start of the course based on students' activity and enrolment start dates.
- Return values
-
◆ instance()
static core_analytics\course::instance |
( |
| $course, |
|
|
?\context | $context = null ) |
|
static |
Returns an analytics course instance.
Lazy load of course data, students and teachers.
- Parameters
-
int | stdClass | $course | Course object or course id |
context | null | $context | |
- Return values
-
◆ is_finished()
core_analytics\course::is_finished |
( |
| ) |
|
Has the course finished?
- Return values
-
◆ load()
core_analytics\course::load |
( |
| ) |
|
|
protected |
Loads the analytics course object.
- Return values
-
◆ median()
core_analytics\course::median |
( |
| $values | ) |
|
|
protected |
Calculate median.
Keys are ignored.
- Parameters
-
int[] | float[] | $values | Sorted array of values |
- Return values
-
◆ update_loop_times()
core_analytics\course::update_loop_times |
( |
| $start, |
|
|
| $end ) |
|
protected |
Returns the average time between 2 timestamps.
- Parameters
-
- Return values
-
array | [starttime, averagetime, endtime] |
◆ was_started()
core_analytics\course::was_started |
( |
| ) |
|
Has the course started?
- Return values
-
◆ MAX_TIME
const core_analytics\analysable::MAX_TIME = PHP_INT_MAX < 9999999999 ? PHP_MAX_INT : 9999999999 |
|
inherited |
Max timestamp.
We are limited by both PHP's max int value and DB (cross-db) max int allowed. Use the smallest one.
The documentation for this class was generated from the following file:
- analytics/classes/course.php