Moodle 2.0 provides a way to set the section name (e.g. Topic 1) to something more specific (e.g. Introduction to Calculus). Currently the section name is included in navigation, but not anywhere else in Moodle. Other places in Moodle refer to the section name as "Topic 1", "Week 1" or "Section 1" depending on the current course format.
It would be nice if the rest of Moodle supported section names the way navigation does.
The attached patches attempt to incorporate section name functionality into Moodle. I've split the changes into two patches.
The first patch (get-section-name.patch):
- Modifies the get_section_name function in /course/lib.php to return the full name (e.g. Topic 1, Intro to Calculus, Week 4) instead of just the language string.
- Adds support for using navigation's callback_xxx_get_section_name callbacks in course formatters to control what section name is returned.
- Updates code references (as many as I could find) throughout Moodle to use the /course/lib.php get_section_name function.
The second patch (use-sections.patch):
- Adds support for a new function, course_format_uses_sections, in /course/lib.php. This function returns true if the course format uses sections to display information (e.g. Topic format, Week format, but not SCORM format), Activity modules can use this function to determine how to display information.
- By default, course_format_uses_sections returns false. Course formats can implement a callback_xxx_uses_sections function in their lib.php file to indicate they use sections.
- Modifies several places, mainly index.php in activity modules, to use the new course_format_uses_sections function.
In my opinion, students and teachers should benefit from consistently named sections throughout Moodle.
These patches replace a lot of code that specifically looks for the topic or week course formats with more generic code. This should make writing additional course formats a little easier.