From 6ae9dbc2aa8fb370d1bc0fbed9ed220f72482d0d Mon Sep 17 00:00:00 2001 From: eWallah Date: Sat, 26 Mar 2016 18:50:01 -0600 Subject: [PATCH] MDL-37554 activities select all option --- completion/criteria/completion_criteria_activity.php | 9 +++++---- course/completion_form.php | 3 +++ 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/completion/criteria/completion_criteria_activity.php b/completion/criteria/completion_criteria_activity.php index 05eda152b104e..28437dea59852 100644 --- a/completion/criteria/completion_criteria_activity.php +++ b/completion/criteria/completion_criteria_activity.php @@ -61,10 +61,11 @@ public static function fetch($params) { */ public function config_form_display(&$mform, $data = null) { $modnames = get_module_types_names(); - $mform->addElement('checkbox', 'criteria_activity['.$data->id.']', - $modnames[self::get_mod_name($data->module)]. - ' - '. - format_string($data->name)); + $mform->addElement('advcheckbox', + 'criteria_activity['.$data->id.']', + $modnames[self::get_mod_name($data->module)] . ' - ' . format_string($data->name), + null, + array('group' => 1)); if ($this->id) { $mform->setDefault('criteria_activity['.$data->id.']', 1); diff --git a/course/completion_form.php b/course/completion_form.php index ce4880a7e533f..53d4b4785c342 100644 --- a/course/completion_form.php +++ b/course/completion_form.php @@ -88,6 +88,9 @@ public function definition() { $activities = $completion->get_activities(); if (!empty($activities)) { + if (!$completion->is_course_locked()) { + $this->add_checkbox_controller(1, null, null, 0); + } foreach ($activities as $activity) { $params_a = array('moduleinstance' => $activity->id); $criteria = new completion_criteria_activity(array_merge($params, $params_a));