MDL-26935 course: Require course:renameroles to rename roles.

This commit is contained in:
Andrew Hancox 2015-10-01 18:04:40 +01:00
parent fd57d685c7
commit 502336f215
4 changed files with 24 additions and 10 deletions

View File

@ -288,16 +288,19 @@ class course_edit_form extends moodleform {
$options[0] = get_string('none');
$mform->addElement('select', 'defaultgroupingid', get_string('defaultgrouping', 'group'), $options);
// Customizable role names in this course.
$mform->addElement('header','rolerenaming', get_string('rolerenaming'));
$mform->addHelpButton('rolerenaming', 'rolerenaming');
if ((empty($course->id) && guess_if_creator_will_have_course_capability('moodle/course:renameroles', $categorycontext))
|| (!empty($course->id) && has_capability('moodle/course:renameroles', $coursecontext))) {
// Customizable role names in this course.
$mform->addElement('header', 'rolerenaming', get_string('rolerenaming'));
$mform->addHelpButton('rolerenaming', 'rolerenaming');
if ($roles = get_all_roles()) {
$roles = role_fix_names($roles, null, ROLENAME_ORIGINAL);
$assignableroles = get_roles_for_contextlevels(CONTEXT_COURSE);
foreach ($roles as $role) {
$mform->addElement('text', 'role_'.$role->id, get_string('yourwordforx', '', $role->localname));
$mform->setType('role_'.$role->id, PARAM_TEXT);
if ($roles = get_all_roles()) {
$roles = role_fix_names($roles, null, ROLENAME_ORIGINAL);
$assignableroles = get_roles_for_contextlevels(CONTEXT_COURSE);
foreach ($roles as $role) {
$mform->addElement('text', 'role_' . $role->id, get_string('yourwordforx', '', $role->localname));
$mform->setType('role_' . $role->id, PARAM_TEXT);
}
}
}

View File

@ -141,6 +141,7 @@ $string['course:managescales'] = 'Manage scales';
$string['course:markcomplete'] = 'Mark users as complete in course completion';
$string['course:movesections'] = 'Move sections';
$string['course:publish'] = 'Publish a course into hub';
$string['course:renameroles'] = 'Rename roles';
$string['course:request'] = 'Request new courses';
$string['course:reset'] = 'Reset course';
$string['course:reviewotherusers'] = 'Review other users';

View File

@ -982,6 +982,16 @@ $capabilities = array(
'clonepermissionsfrom' => 'moodle/course:update'
),
'moodle/course:renameroles' => array(
'captype' => 'write',
'contextlevel' => CONTEXT_COURSE,
'archetypes' => array(
'editingteacher' => CAP_ALLOW,
'manager' => CAP_ALLOW
),
'clonepermissionsfrom' => 'moodle/course:update'
),
'moodle/course:changeidnumber' => array(
'riskbitmask' => RISK_XSS,

View File

@ -29,7 +29,7 @@
defined('MOODLE_INTERNAL') || die();
$version = 2015092400.00; // YYYYMMDD = weekly release date of this DEV branch.
$version = 2015092400.01; // YYYYMMDD = weekly release date of this DEV branch.
// RR = release increments - 00 in DEV branches.
// .XX = incremental changes.