diff --git a/enrol/cohort/edit_form.php b/enrol/cohort/edit_form.php index 21ec3d625e72c..c7d0e2a74f4a3 100644 --- a/enrol/cohort/edit_form.php +++ b/enrol/cohort/edit_form.php @@ -65,7 +65,7 @@ function definition() { } else { $cohorts = array('' => get_string('choosedots')); - $allcohorts = cohort_get_available_cohorts($coursecontext); + $allcohorts = cohort_get_available_cohorts($coursecontext, 0, 0, 0); foreach ($allcohorts as $c) { $cohorts[$c->id] = format_string($c->name); } diff --git a/enrol/cohort/lib.php b/enrol/cohort/lib.php index 0f338fbeafe9f..1f5a22180d762 100644 --- a/enrol/cohort/lib.php +++ b/enrol/cohort/lib.php @@ -101,7 +101,7 @@ protected function can_add_new_instances($courseid) { if (!has_capability('moodle/course:enrolconfig', $coursecontext) or !has_capability('enrol/cohort:config', $coursecontext)) { return false; } - return cohort_get_available_cohorts($coursecontext) ? true : false; + return cohort_get_available_cohorts($coursecontext, 0, 0, 1) ? true : false; } /** diff --git a/enrol/manual/lib.php b/enrol/manual/lib.php index 34d4d30533e1e..4b035f3ada1c3 100644 --- a/enrol/manual/lib.php +++ b/enrol/manual/lib.php @@ -247,7 +247,7 @@ public function get_manual_enrol_button(course_enrolment_manager $manager) { 'defaultDuration' => $defaultduration, 'disableGradeHistory' => $CFG->disablegradehistory, 'recoverGradesDefault'=> '', - 'cohortsAvailable' => cohort_get_available_cohorts($manager->get_context(), COHORT_COUNT_MEMBERS, 0, 1) ? true : false + 'cohortsAvailable' => cohort_get_available_cohorts($manager->get_context(), COHORT_WITH_NOTENROLLED_MEMBERS_ONLY, 0, 1) ? true : false ); if ($CFG->recovergradesdefault) { diff --git a/enrol/self/edit_form.php b/enrol/self/edit_form.php index e33da18120807..a1e3a8069b321 100644 --- a/enrol/self/edit_form.php +++ b/enrol/self/edit_form.php @@ -106,7 +106,7 @@ function definition() { $mform->setType('customint3', PARAM_INT); $cohorts = array(0 => get_string('no')); - $allcohorts = cohort_get_available_cohorts($context); + $allcohorts = cohort_get_available_cohorts($context, 0, 0, 0); if ($instance->customint5 && !isset($allcohorts[$instance->customint5]) && ($c = $DB->get_record('cohort', array('id' => $instance->customint5), 'id, name, idnumber, contextid, visible', IGNORE_MISSING))) { // Current cohort was not found because current user can not see it. Still keep it. diff --git a/group/autogroup_form.php b/group/autogroup_form.php index df43b4fa652ec..a04da015a47b6 100644 --- a/group/autogroup_form.php +++ b/group/autogroup_form.php @@ -82,7 +82,7 @@ function definition() { $mform->setDefault('roleid', $student->id); } - if ($cohorts = cohort_get_available_cohorts(context_course::instance($COURSE->id), COHORT_WITH_ENROLLED_MEMBERS_ONLY)) { + if ($cohorts = cohort_get_available_cohorts(context_course::instance($COURSE->id), COHORT_WITH_ENROLLED_MEMBERS_ONLY, 0, 0)) { $options = array(0 => get_string('anycohort', 'cohort')); foreach ($cohorts as $c) { $options[$c->id] = format_string($c->name, true, context::instance_by_id($c->contextid));