Merge branch 'MDL-48362-master-fix3' of http://github.com/damyon/moodle

This commit is contained in:
Andrew Nicols 2016-03-02 12:36:56 +08:00
commit 5e785ab084
2 changed files with 12 additions and 2 deletions

View File

@ -130,6 +130,8 @@ class enrol_cohort_plugin extends enrol_plugin {
* @return boolean
*/
public function update_instance($instance, $data) {
global $CFG;
// NOTE: no cohort changes here!!!
$context = context_course::instance($instance->courseid);
if ($data->roleid != $instance->roleid) {

View File

@ -84,11 +84,18 @@ class enrol_manual_plugin extends enrol_plugin {
* @return boolean
*/
public function can_add_instance($courseid) {
global $DB;
$context = context_course::instance($courseid, MUST_EXIST);
if (!has_capability('moodle/course:enrolconfig', $context) or !has_capability('enrol/manual:config', $context)) {
return false;
}
// Multiple instances supported - multiple parent courses linked.
if ($DB->record_exists('enrol', array('courseid'=>$courseid, 'enrol'=>'manual'))) {
// Multiple instances not supported.
return false;
}
return true;
}
@ -107,7 +114,8 @@ class enrol_manual_plugin extends enrol_plugin {
$managelink = new moodle_url("/enrol/manual/manage.php", array('enrolid'=>$instance->id));
$icons[] = $OUTPUT->action_icon($managelink, new pix_icon('t/enrolusers', get_string('enrolusers', 'enrol_manual'), 'core', array('class'=>'iconsmall')));
}
$icons = $icons + parent::get_action_icons($instance);
$parenticons = parent::get_action_icons($instance);
$icons = array_merge($icons, $parenticons);
return $icons;
}