Skip to content

Commit

Permalink
MDL-52811 course: Require course:setforcedlanguage to force language.
Browse files Browse the repository at this point in the history
  • Loading branch information
Yair Spielmann authored and davosmith committed Feb 1, 2018
1 parent a4f914b commit ecce451
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 2 deletions.
7 changes: 5 additions & 2 deletions course/edit_form.php
Expand Up @@ -205,8 +205,11 @@ function definition() {
$languages=array();
$languages[''] = get_string('forceno');
$languages += get_string_manager()->get_list_of_translations();
$mform->addElement('select', 'lang', get_string('forcelanguage'), $languages);
$mform->setDefault('lang', $courseconfig->lang);
if ((empty($course->id) && guess_if_creator_will_have_course_capability('moodle/course:setforcedlanguage', $categorycontext))
|| (!empty($course->id) && has_capability('moodle/course:setforcedlanguage', $coursecontext))) {
$mform->addElement('select', 'lang', get_string('forcelanguage'), $languages);
$mform->setDefault('lang', $courseconfig->lang);
}

// Multi-Calendar Support - see MDL-18375.
$calendartypes = \core_calendar\type_factory::get_list_of_calendar_types();
Expand Down
1 change: 1 addition & 0 deletions lang/en/role.php
Expand Up @@ -164,6 +164,7 @@
$string['course:changesummary'] = 'Change course summary';
$string['course:enrolconfig'] = 'Configure enrol instances in courses';
$string['course:enrolreview'] = 'Review course enrolments';
$string['course:setforcedlanguage'] = 'Force course language';
$string['course:ignoreavailabilityrestrictions'] = 'Ignore availability restrictions';
$string['course:ignorefilesizelimits'] = 'Use files larger than any file size restrictions';
$string['course:isincompletionreports'] = 'Be shown on completion reports';
Expand Down
10 changes: 10 additions & 0 deletions lib/db/access.php
Expand Up @@ -1062,6 +1062,16 @@
'clonepermissionsfrom' => 'moodle/course:update'
),

'moodle/course:setforcedlanguage' => array(
'captype' => 'write',
'contextlevel' => CONTEXT_COURSE,
'archetypes' => array(
'editingteacher' => CAP_ALLOW,
'manager' => CAP_ALLOW
),
'clonepermissionsfrom' => 'moodle/course:update'
),


'moodle/site:viewparticipants' => array(

Expand Down

0 comments on commit ecce451

Please sign in to comment.