echo '</tr>'; print_category_edit(NULL, $displaylist, $parentlist); echo '</table>'; echo '<div class="buttons">'; if (has_capability('moodle/course:create', $systemcontext)) { // print create course link to first category $options = array(); $options = array('category' => $CFG->defaultrequestcategory); print_single_button('edit.php', $options, get_string('addnewcourse'), 'get'); } // Hook for local specific buttons - assumes /local/lib.php has been included before now if (function_exists('local_print_course_index_buttons')) { if (empty($category)) { local_print_course_index_buttons(); } else { local_print_course_index_buttons($category); } } // Print button for creating new categories if (has_capability('moodle/category:manage', $systemcontext)) { $options = array(); $options['parent'] = 0; print_single_button('editcategory.php', $options, get_string('addnewcategory'), 'get'); } print_course_request_buttons($systemcontext); echo '</div>'; admin_externalpage_print_footer(); function print_category_edit($category, $displaylist, $parentslist, $depth = -1, $up = false, $down = false) { /// Recursive function to print all the categories ready for editing global $CFG, $USER;
echo '</table>'; echo '</div></form>'; echo '<br />'; } } echo '<div class="buttons">'; if (has_capability('moodle/category:manage', $context) and $numcourses > 1) { /// Print button to re-sort courses by name unset($options); $options['id'] = $category->id; $options['resort'] = 'name'; $options['sesskey'] = $USER->sesskey; print_single_button('category.php', $options, get_string('resortcoursesbyname'), 'get'); } if (has_capability('moodle/course:create', $context)) { /// Print button to create a new course unset($options); $options['category'] = $category->id; print_single_button('edit.php', $options, get_string('addnewcourse'), 'get'); } // Hook for local specific buttons - assumes /local/lib.php has been included before now if (function_exists('local_print_course_index_buttons') && !empty($category)) { local_print_course_index_buttons($category, $context, null); } echo '</div>'; if (!empty($CFG->enablecourserequests) && $category->id == $CFG->enablecourserequests) { print_course_request_buttons(get_context_instance(CONTEXT_SYSTEM)); } echo '</div>'; print_course_search(); print_footer();