Moodle  2.2.1
http://www.collinsharper.com
C:/xampp/htdocs/moodle/lib/completion/cron.php File Reference

Go to the source code of this file.

Namespaces

namespace  moodlecore

Functions

 completion_cron ()
 completion_cron_mark_started ()
 completion_cron_criteria ()
 completion_cron_completions ()
 completion_cron_aggregate ($method, $data, &$state)

Function Documentation

Update user's course completion statuses

First update all criteria completions, then aggregate all criteria completions and update overall course completions

Returns:
void

Definition at line 39 of file cron.php.

Here is the call graph for this function:

Here is the caller graph for this function:

completion_cron_aggregate ( method,
data,
&$  state 
)

Aggregate criteria status's as per configured aggregation method

Parameters:
int$methodCOMPLETION_AGGREGATION_* constant
bool$dataCriteria completion status
bool | null$stateAggregation state
Returns:
void

Definition at line 399 of file cron.php.

Here is the caller graph for this function:

Aggregate each user's criteria completions

Returns:
void

Definition at line 233 of file cron.php.

Here is the call graph for this function:

Here is the caller graph for this function:

Run installed criteria's data aggregation methods

Loop through each installed criteria and run the cron() method if it exists

Returns:
void

Definition at line 205 of file cron.php.

Here is the call graph for this function:

Here is the caller graph for this function:

Mark users as started if the config option is set

Returns:
void

A quick explaination of this horrible looking query

It's purpose is to locate all the active participants of a course with course completion enabled.

We also only want the users with no course_completions record as this functions job is to create the missing ones :)

We want to record the user's enrolment start time for the course. This gets tricky because there can be multiple enrolment plugins active in a course, hence the possibility of multiple records for each couse/user in the results

An explaination of the following loop

We are essentially doing a group by in the code here (as I can't find a decent way of doing it in the sql).

Since there can be multiple enrolment plugins for each course, we can have multiple rows for each particpant in the query result. This isn't really a problem until you combine it with the fact that the enrolment plugins can save the enrol start time in either timestart or timeenrolled.

The purpose of this loop is to find the earliest enrolment start time for each participant in each course.

Definition at line 53 of file cron.php.

Here is the call graph for this function:

Here is the caller graph for this function:

 All Data Structures Namespaces Files Functions Variables Enumerations