MDL-35263 Converting course formats to OOP

- added class format_base as the base for all course formats
- added class format_site for the pseudo-format 'site' used for displaying activities on the front page
- added class format_legacy that overrides format_base functions with calling old-style 'callback_xxx' functions
- replaced all usage of 'callback_xxx' functions with format_base methods
- made arguments of get_section_name(), get_course_url() more flexible
- deprecated function get_generic_section_name(), it's contents is moved to format_base
- global_navigation::format_display_course_content() is removed, plugins can supress the sections navigations using extend_course_navigation()
This commit is contained in:
Marina Glancy
2012-09-28 13:42:27 +08:00
parent 5d6285c220
commit ee7084e950
9 changed files with 671 additions and 190 deletions
+17
View File
@@ -2907,3 +2907,20 @@ function textlib_get_instance() {
return new textlib();
}
/**
* Gets the generic section name for a courses section
*
* The global function is deprecated. Each course format can define their own generic section name
*
* @deprecated since 2.4
* @see get_section_name()
* @see format_base::get_section_name()
*
* @param string $format Course format ID e.g. 'weeks' $course->format
* @param stdClass $section Section object from database
* @return Display name that the course format prefers, e.g. "Week 2"
*/
function get_generic_section_name($format, stdClass $section) {
debugging('get_generic_section_name() is deprecated. Please use appropriate functionality from class format_base', DEBUG_DEVELOPER);
return get_string('sectionname', "format_$format") . ' ' . $section->section;
}