MDL-37554 activities select all option
authoreWallah <info@ewallah.net>
Sun, 27 Mar 2016 00:50:01 +0000 (18:50 -0600)
committerCameron Ball <cameron@moodle.com>
Mon, 13 Jun 2016 02:22:16 +0000 (10:22 +0800)
completion/criteria/completion_criteria_activity.php
course/completion_form.php

index 05eda15..28437de 100644 (file)
@@ -61,10 +61,11 @@ class completion_criteria_activity extends completion_criteria {
      */
     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);
index ce4880a..53d4b47 100644 (file)
@@ -88,6 +88,9 @@ class course_completion_form extends moodleform {
         $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));