By the way, the current style of creating course_sections is ugly. We
should probably have something like
make_sure_that_at_least_default_section_exists($courseid, $sectionid=null)
and not to insert it into database at many places as we do now.
print_courses() produced PHP notice (Trying to get property of
non-object) and generated an invalid button to create a new course in this
case: (1) Passed paramater $category is 0 to display all categores (as in
case of home page, for example) and (2) get_child_categories(0) returns
more than one record. In such case, $categories is still a plain
integer, does not contain ->id property and the called /course/edit.php
exits with error.
This patch uses $CFG->defaultrequestcategory as category id in this
case.