Merge branch 'MDL-83115-main' of https://github.com/aanabit/moodle

This commit is contained in:
Sara Arjona
2025-12-23 06:48:42 +01:00
2 changed files with 15 additions and 0 deletions
@@ -151,6 +151,18 @@ class content implements named_templatable, renderable {
$format = $this->format;
$course = $format->get_course();
if (!$format->uses_sections()) {
if (has_capability('moodle/course:update', \core\context\course::instance($course->id))) {
$url = new \moodle_url('/course/edit.php', ['id' => $course->id]);
$params = [
'courseformat' => $format->get_format_name(),
];
throw new \moodle_exception('nosections_editor', 'error', $url, $params);
}
throw new \moodle_exception('nosections_noneditor', 'error');
}
$modinfo = $this->format->get_modinfo();
// Generate section list.
+3
View File
@@ -480,6 +480,9 @@ $string['nopermissiontoviewcalendar'] = 'Sorry, but you do not have permission t
$string['nopermissiontoviewgrades'] = 'Cannot view grades.';
$string['nopermissiontoviewletergrade'] = 'Missing permission to view letter grades';
$string['nopermissiontoviewpage'] = 'You are not allowed to look at this page';
$string['nosections_editor'] = 'The course can\'t be displayed because the current course format \'{$a->courseformat}\' is not compatible with the way the course content is organised.
To display the course correctly, choose a different course format. Use the \'Continue\' button to go to course format settings.';
$string['nosections_noneditor'] = 'This course is not available right now. Contact your teacher or instructor for help.';
$string['nosite'] = 'Could not find a top-level course!';
$string['nositeid'] = 'No site ID';
$string['nostartdatenoenddate'] = 'A course end date can only be set if a start date is also set.';