mirror of
https://github.com/moodle/moodle.git
synced 2025-04-20 07:56:06 +02:00
MDL-23708 removing ENrol cohort button when no cohort visible by user or user not allowed to use it
This commit is contained in:
parent
5513379ae6
commit
6aae37125d
@ -579,8 +579,12 @@ class course_enrolment_users_table extends course_enrolment_table {
|
||||
if (!array_key_exists('cohort', $plugins)) {
|
||||
return false;
|
||||
}
|
||||
$count ++;
|
||||
$course = $this->manager->get_course();
|
||||
if (!$plugins['cohort']->get_newinstance_link($course->id)) {
|
||||
// user can not see any cohort === can not use this
|
||||
return false;
|
||||
}
|
||||
$count ++;
|
||||
$cohorturl = new moodle_url('/enrol/cohort/addinstance.php', array('id'=>$course->id));
|
||||
$control = new single_button($cohorturl, get_string('enrolcohort', 'enrol'), 'get');
|
||||
$control->class = 'singlebutton enrolcohortbutton instance'.$count;
|
||||
|
Loading…
x
Reference in New Issue
Block a user