MDL-48390 cohorts: do not limit number of cohorts in dropdowns

This commit is contained in:
Marina Glancy 2014-11-27 11:14:39 +08:00
parent ca0e301c7b
commit 3e70f5792b
5 changed files with 5 additions and 5 deletions

View File

@ -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);
}

View File

@ -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;
}
/**

View File

@ -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) {

View File

@ -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.

View File

@ -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));