mirror of
https://github.com/moodle/moodle.git
synced 2025-08-04 16:36:37 +02:00
Make course themes work on course settings page MDL-10833
This commit is contained in:
parent
83601351d7
commit
76655d6ff1
1 changed files with 3 additions and 1 deletions
|
@ -10,23 +10,25 @@
|
||||||
$id = optional_param('id', 0, PARAM_INT); // course id
|
$id = optional_param('id', 0, PARAM_INT); // course id
|
||||||
$categoryid = optional_param('category', 0, PARAM_INT); // course category - can be changed in edit form
|
$categoryid = optional_param('category', 0, PARAM_INT); // course category - can be changed in edit form
|
||||||
|
|
||||||
require_login();
|
|
||||||
|
|
||||||
/// basic access control checks
|
/// basic access control checks
|
||||||
if ($id) { // editing course
|
if ($id) { // editing course
|
||||||
if (!$course = get_record('course', 'id', $id)) {
|
if (!$course = get_record('course', 'id', $id)) {
|
||||||
error('Course ID was incorrect');
|
error('Course ID was incorrect');
|
||||||
}
|
}
|
||||||
|
require_login($course->id);
|
||||||
$category = get_record('course_categories', 'id', $course->category);
|
$category = get_record('course_categories', 'id', $course->category);
|
||||||
require_capability('moodle/course:update', get_context_instance(CONTEXT_COURSE, $course->id));
|
require_capability('moodle/course:update', get_context_instance(CONTEXT_COURSE, $course->id));
|
||||||
|
|
||||||
} else if ($categoryid) { // creating new course in this category
|
} else if ($categoryid) { // creating new course in this category
|
||||||
$course = null;
|
$course = null;
|
||||||
|
require_login();
|
||||||
if (!$category = get_record('course_categories', 'id', $categoryid)) {
|
if (!$category = get_record('course_categories', 'id', $categoryid)) {
|
||||||
error('Category ID was incorrect');
|
error('Category ID was incorrect');
|
||||||
}
|
}
|
||||||
require_capability('moodle/course:create', get_context_instance(CONTEXT_COURSECAT, $category->id));
|
require_capability('moodle/course:create', get_context_instance(CONTEXT_COURSECAT, $category->id));
|
||||||
} else {
|
} else {
|
||||||
|
require_login();
|
||||||
error('Either course id or category must be specified');
|
error('Either course id or category must be specified');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue