From 435f3044dfeb78d23b54758ad8801091acd503a0 Mon Sep 17 00:00:00 2001 From: poltawski Date: Tue, 8 Jan 2008 12:00:11 +0000 Subject: [PATCH] MDL-12873 - show an add course button when editing at the top level (which is the default view when you click 'Add/Edit Courses') merged from MOODLE_19_STABLE --- course/index.php | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/course/index.php b/course/index.php index 5c8407ca26..1301b09a95 100644 --- a/course/index.php +++ b/course/index.php @@ -291,13 +291,20 @@ echo '
'; - // Print link to create a new course - if (has_capability('moodle/course:create', $context)) { - unset($options); - if (!empty($category->id)) { + if (!empty($category->id)) { + // Print link to create a new course in current category + if (has_capability('moodle/course:create', $context)) { + $options = array(); $options['category'] = $category->id; print_single_button('edit.php', $options, get_string('addnewcourse'), 'get'); } + }else{ + if (has_capability('moodle/course:create', $sysctx)) { + // print create course link to first category + $options = array(); + $options = array('category' => get_field('course_categories', 'id', 'parent', '0')); + print_single_button('edit.php', $options, get_string('addnewcourse'), 'get'); + } } // Print button for creating new categories -- 2.39.5