mirror of
https://github.com/moodle/moodle.git
synced 2025-08-04 16:36:37 +02:00
MDL-57583 completion: fix bug with advcheckbox in course completion form
Added the appropriate checks to handle the advcheckbox post data.
This commit is contained in:
parent
1034421264
commit
5a24e2177e
1 changed files with 11 additions and 7 deletions
|
@ -84,16 +84,20 @@ class completion_criteria_activity extends completion_criteria {
|
||||||
|
|
||||||
$this->course = $data->id;
|
$this->course = $data->id;
|
||||||
|
|
||||||
foreach (array_keys($data->criteria_activity) as $activity) {
|
// 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));
|
$module = $DB->get_record('course_modules', array('id' => $activity));
|
||||||
$this->module = self::get_mod_name($module->module);
|
$this->module = self::get_mod_name($module->module);
|
||||||
$this->moduleinstance = $activity;
|
$this->moduleinstance = $activity;
|
||||||
$this->id = NULL;
|
$this->id = null;
|
||||||
$this->insert();
|
$this->insert();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get module instance module type
|
* Get module instance module type
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue