From cbf449972fee4c393311bd7fb8ef6591ca3caadf Mon Sep 17 00:00:00 2001 From: Dan Poltawski Date: Thu, 3 May 2012 19:09:02 +0800 Subject: [PATCH] MDL-32508 course formats: make renderer methods protected The renderer isn't a public API yet, its just reducing code duplication and tidying things up. So not making the methods public for other plugins to abuse. We hope to solve this properly in 2.4 --- course/format/renderer.php | 28 ++++++++++++++-------------- course/format/topics/renderer.php | 10 +++++----- course/format/weeks/renderer.php | 6 +++--- 3 files changed, 22 insertions(+), 22 deletions(-) diff --git a/course/format/renderer.php b/course/format/renderer.php index f9570780ecd..c829e2c768a 100644 --- a/course/format/renderer.php +++ b/course/format/renderer.php @@ -42,19 +42,19 @@ abstract class format_section_renderer_base extends plugin_renderer_base { * Generate the starting container html for a list of sections * @return string HTML to output. */ - abstract public function start_section_list(); + abstract protected function start_section_list(); /** * Generate the closing container html for a list of sections * @return string HTML to output. */ - abstract public function end_section_list(); + abstract protected function end_section_list(); /** * Generate the title for this section page * @return string the page title */ - abstract public function page_title(); + abstract protected function page_title(); /** * Generate the content to displayed on the right part of a section @@ -65,7 +65,7 @@ abstract class format_section_renderer_base extends plugin_renderer_base { * @param bool $onsectionpage true if being printed on a section page * @return string HTML to output. */ - public function section_right_content($section, $course, $onsectionpage) { + protected function section_right_content($section, $course, $onsectionpage) { $o = $this->output->spacer(); if ($section->section != 0) { @@ -87,7 +87,7 @@ abstract class format_section_renderer_base extends plugin_renderer_base { * @param bool $onsectionpage true if being printed on a section page * @return string HTML to output. */ - public function section_left_content($section, $course, $onsectionpage) { + protected function section_left_content($section, $course, $onsectionpage) { $o = $this->output->spacer(); if ($section->section != 0) { @@ -109,7 +109,7 @@ abstract class format_section_renderer_base extends plugin_renderer_base { * @param bool $onsectionpage true if being printed on a section page * @return string HTML to output. */ - public function section_header($section, $course, $onsectionpage) { + protected function section_header($section, $course, $onsectionpage) { global $PAGE; $o = ''; @@ -177,7 +177,7 @@ abstract class format_section_renderer_base extends plugin_renderer_base { * * @return string HTML to output. */ - public function section_footer() { + protected function section_footer() { $o = html_writer::end_tag('div'); $o.= html_writer::end_tag('li'); @@ -192,7 +192,7 @@ abstract class format_section_renderer_base extends plugin_renderer_base { * @param bool $onsectionpage true if being printed on a section page * @return array of links with edit controls */ - public function section_edit_controls($course, $section, $onsectionpage = false) { + protected function section_edit_controls($course, $section, $onsectionpage = false) { global $PAGE; if (!$PAGE->user_is_editing()) { @@ -265,7 +265,7 @@ abstract class format_section_renderer_base extends plugin_renderer_base { * @param stdClass $course The course entry from DB * @return string HTML to output. */ - public function section_summary($section, $course) { + protected function section_summary($section, $course) { $o = ''; $o.= html_writer::start_tag('li', array('id' => 'section-'.$section->section)); @@ -292,7 +292,7 @@ abstract class format_section_renderer_base extends plugin_renderer_base { * @param int $sectionno The section number in the coruse which is being dsiplayed * @return string HTML to output. */ - public function course_activity_clipboard($course, $sectionno = 0) { + protected function course_activity_clipboard($course, $sectionno = 0) { global $USER; $o = ''; @@ -324,7 +324,7 @@ abstract class format_section_renderer_base extends plugin_renderer_base { * @param int $sectionno The section number in the coruse which is being dsiplayed * @return string HTML to output. */ - public function get_nav_links($course, $sections, $sectionno) { + protected function get_nav_links($course, $sections, $sectionno) { // FIXME: This is really evil and should by using the navigation API. $canviewhidden = has_capability('moodle/course:viewhiddensections', context_course::instance($course->id)) or !$course->hiddensections; @@ -363,7 +363,7 @@ abstract class format_section_renderer_base extends plugin_renderer_base { * @param int $sectionno The section number in the coruse which is being dsiplayed * @return string HTML to output. */ - public function stealth_section_header($sectionno) { + protected function stealth_section_header($sectionno) { $o = ''; $o.= html_writer::start_tag('li', array('id' => 'section-'.$sectionno, 'class' => 'section main clearfix orphaned hidden')); $o.= html_writer::tag('div', '', array('class' => 'left side')); @@ -378,7 +378,7 @@ abstract class format_section_renderer_base extends plugin_renderer_base { * * @return string HTML to output. */ - public function stealth_section_footer() { + protected function stealth_section_footer() { $o = html_writer::end_tag('div'); $o.= html_writer::end_tag('li'); return $o; @@ -390,7 +390,7 @@ abstract class format_section_renderer_base extends plugin_renderer_base { * @param int $sectionno The section number in the coruse which is being dsiplayed * @return string HTML to output. */ - public function section_hidden($sectionno) { + protected function section_hidden($sectionno) { $o = ''; $o.= html_writer::start_tag('li', array('id' => 'section-'.$sectionno, 'class' => 'section main clearfix hidden')); $o.= html_writer::tag('div', '', array('class' => 'left side')); diff --git a/course/format/topics/renderer.php b/course/format/topics/renderer.php index c500bae15d9..7050488c5b1 100644 --- a/course/format/topics/renderer.php +++ b/course/format/topics/renderer.php @@ -39,7 +39,7 @@ class format_topics_renderer extends format_section_renderer_base { * Generate the starting container html for a list of sections * @return string HTML to output. */ - public function start_section_list() { + protected function start_section_list() { return html_writer::start_tag('ul', array('class' => 'topics')); } @@ -47,7 +47,7 @@ class format_topics_renderer extends format_section_renderer_base { * Generate the closing container html for a list of sections * @return string HTML to output. */ - public function end_section_list() { + protected function end_section_list() { return html_writer::end_tag('ul'); } @@ -55,7 +55,7 @@ class format_topics_renderer extends format_section_renderer_base { * Generate the title for this section page * @return string the page title */ - public function page_title() { + protected function page_title() { return get_string('topicoutline'); } @@ -67,7 +67,7 @@ class format_topics_renderer extends format_section_renderer_base { * @param bool $onsectionpage true if being printed on a section page * @return array of links with edit controls */ - public function section_edit_controls($course, $section, $onsectionpage = false) { + protected function section_edit_controls($course, $section, $onsectionpage = false) { global $PAGE; if (!$PAGE->user_is_editing()) { @@ -112,7 +112,7 @@ class format_topics_renderer extends format_section_renderer_base { * @param bool $onsectionpage true if being printed on a section page * @return string HTML to output. */ - public function section_left_content($section, $course, $onsectionpage) { + protected function section_left_content($section, $course, $onsectionpage) { $o = parent::section_left_content($section, $course, $onsectionpage); if ($section->section > 0) { diff --git a/course/format/weeks/renderer.php b/course/format/weeks/renderer.php index 6459249a6f8..33d640281b6 100644 --- a/course/format/weeks/renderer.php +++ b/course/format/weeks/renderer.php @@ -39,7 +39,7 @@ class format_weeks_renderer extends format_section_renderer_base { * Generate the starting container html for a list of sections * @return string HTML to output. */ - public function start_section_list() { + protected function start_section_list() { return html_writer::start_tag('ul', array('class' => 'weeks')); } @@ -47,7 +47,7 @@ class format_weeks_renderer extends format_section_renderer_base { * Generate the closing container html for a list of sections * @return string HTML to output. */ - public function end_section_list() { + protected function end_section_list() { return html_writer::end_tag('ul'); } @@ -55,7 +55,7 @@ class format_weeks_renderer extends format_section_renderer_base { * Generate the title for this section page * @return string the page title */ - public function page_title() { + protected function page_title() { return get_string('weeklyoutline'); } }