Commit ada10e7c authored by Andrew Nicols's avatar Andrew Nicols Committed by Eloy Lafuente
Browse files

Merge branch 'MDL-57583-master' of https://github.com/snake/moodle

parents 22485359 5a24e217
......@@ -84,13 +84,17 @@ class completion_criteria_activity extends completion_criteria {
$this->course = $data->id;
foreach (array_keys($data->criteria_activity) as $activity) {
$module = $DB->get_record('course_modules', array('id' => $activity));
$this->module = self::get_mod_name($module->module);
$this->moduleinstance = $activity;
$this->id = NULL;
$this->insert();
// Data comes from advcheckbox, so contains keys for all activities.
// A value of 0 is 'not checked' whereas 1 is 'checked'.
foreach ($data->criteria_activity as $activity => $val) {
// Only update those which are checked.
if (!empty($val)) {
$module = $DB->get_record('course_modules', array('id' => $activity));
$this->module = self::get_mod_name($module->module);
$this->moduleinstance = $activity;
$this->id = null;
$this->insert();
}
}
}
}
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment