Merge branch 'MDL-62334-master' of https://github.com/danielneis/moodle

This commit is contained in:
Eloy Lafuente (stronk7) 2018-09-25 22:50:41 +02:00
commit 0ddc272116
2 changed files with 12 additions and 1 deletions

View File

@ -43,6 +43,12 @@ if ($hassiteconfig or has_any_capability($capabilities, $systemcontext)) {
array('moodle/category:manage')
)
);
$ADMIN->add('courses',
new admin_externalpage('addnewcourse', new lang_string('addnewcourse'),
new moodle_url('/course/edit.php', array('category' => 0)),
array('moodle/category:manage')
)
);
$ADMIN->add('courses',
new admin_externalpage('restorecourse', new lang_string('restorecourse', 'admin'),
new moodle_url('/backup/restorefile.php', array('contextid' => context_system::instance()->id)),

View File

@ -103,8 +103,13 @@ if ($id) {
$PAGE->set_context($catcontext);
} else {
// Creating new course in default category.
$course = null;
require_login();
print_error('needcoursecategroyid');
$category = core_course_category::get_default();
$catcontext = context_coursecat::instance($category->id);
require_capability('moodle/course:create', $catcontext);
$PAGE->set_context($catcontext);
}
// Prepare course and the editor.