Skip to content

Commit

Permalink
MDL-48390 cohorts: do not limit number of cohorts in dropdowns
Browse files Browse the repository at this point in the history
  • Loading branch information
marinaglancy committed Nov 27, 2014
1 parent ca0e301 commit 3e70f57
Show file tree
Hide file tree
Showing 5 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion enrol/cohort/edit_form.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down
2 changes: 1 addition & 1 deletion enrol/cohort/lib.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

/**
Expand Down
2 changes: 1 addition & 1 deletion enrol/manual/lib.php
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
2 changes: 1 addition & 1 deletion enrol/self/edit_form.php
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
2 changes: 1 addition & 1 deletion group/autogroup_form.php
Original file line number Diff line number Diff line change
Expand Up @@ -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));
Expand Down

0 comments on commit 3e70f57

Please sign in to comment.