MDL-36017 Fields numsections, hiddensections and coursedisplay are now format-specific options
- Fields added to format_legacy as default course format options;
- Upgrade script copies fields values from table course to course_format_options;
- Fields removed from table course;
- Fields removed from edit course form;
- Since front-page course has a 'numsections' setting, format_site defines it as it's option;
- Removed accessing those fields in core code unless we know that format supports them and in this
case instead of $course = $DB->get_record('course'); we use:
$course = course_get_format($courseorid)->get_course(); This way all format-specific options
are added to the $course object
This commit is contained in:
@@ -448,6 +448,7 @@ abstract class format_section_renderer_base extends plugin_renderer_base {
|
||||
*/
|
||||
protected function get_nav_links($course, $sections, $sectionno) {
|
||||
// FIXME: This is really evil and should by using the navigation API.
|
||||
$course = course_get_format($course)->get_course();
|
||||
$canviewhidden = has_capability('moodle/course:viewhiddensections', context_course::instance($course->id))
|
||||
or !$course->hiddensections;
|
||||
|
||||
@@ -542,6 +543,7 @@ abstract class format_section_renderer_base extends plugin_renderer_base {
|
||||
global $PAGE;
|
||||
|
||||
$modinfo = get_fast_modinfo($course);
|
||||
$course = course_get_format($course)->get_course();
|
||||
|
||||
// Can we view the section in question?
|
||||
if (!($sectioninfo = $modinfo->get_section_info($displaysection))) {
|
||||
@@ -637,6 +639,7 @@ abstract class format_section_renderer_base extends plugin_renderer_base {
|
||||
global $PAGE;
|
||||
|
||||
$modinfo = get_fast_modinfo($course);
|
||||
$course = course_get_format($course)->get_course();
|
||||
|
||||
$context = context_course::instance($course->id);
|
||||
// Title with completion help icon.
|
||||
|
||||
Reference in New Issue
Block a user