ensure that the order they are displayed in is always the same as the
order they have been defined in. See bug 553.
This involved API changes to the function get_all_instances_in_course()
Sections covers "weeks", "topics" and anything else that may come along.
Note, again, some databases have changed esp course_weeks -> course_sections
and several fields called "week" are now "section. Also course no longer
has an enddate, but instead has a numsections field.