mirror of
https://github.com/moodle/moodle.git
synced 2025-04-15 13:33:52 +02:00
MDL-48390 cohorts: do not limit number of cohorts in dropdowns
This commit is contained in:
parent
ca0e301c7b
commit
3e70f5792b
@ -65,7 +65,7 @@ class enrol_cohort_edit_form extends moodleform {
|
||||
|
||||
} 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);
|
||||
}
|
||||
|
@ -101,7 +101,7 @@ class enrol_cohort_plugin extends enrol_plugin {
|
||||
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;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -247,7 +247,7 @@ class enrol_manual_plugin extends enrol_plugin {
|
||||
'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) {
|
||||
|
@ -106,7 +106,7 @@ class enrol_self_edit_form extends moodleform {
|
||||
$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.
|
||||
|
@ -82,7 +82,7 @@ class autogroup_form extends moodleform {
|
||||
$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));
|
||||
|
Loading…
x
Reference in New Issue
Block a user