MDL-39833 format: tidied up API improvement to allow for future backport

This commit is contained in:
Sam Hemelryk 2014-04-08 10:11:23 +12:00
parent da98185a58
commit 0a293483e8
2 changed files with 12 additions and 3 deletions

View File

@ -551,16 +551,23 @@ abstract class format_section_renderer_base extends plugin_renderer_base {
* Generate the html for a hidden section
*
* @param int $sectionno The section number in the coruse which is being dsiplayed
* @param int|stdClass $courseorid The course to get the section name for (object or just course id)
* @return string HTML to output.
*/
protected function section_hidden($sectionno, $courseorid) {
protected function section_hidden($sectionno, $courseorid = null) {
if ($courseorid) {
$sectionname = get_section_name($courseorid, $sectionno);
$strnotavailable = get_string('notavailablecourse', '', $sectionname);
} else {
$strnotavailable = get_string('notavailable');
}
$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'));
$o.= html_writer::tag('div', '', array('class' => 'right side'));
$o.= html_writer::start_tag('div', array('class' => 'content'));
$o .= html_writer::tag('div', get_string('notavailablecourse', '', get_section_name(
$courseorid, $sectionno, array('class' => 'availabilityinfo'))));
$o.= html_writer::tag('div', $strnotavailable);
$o.= html_writer::end_tag('div');
$o.= html_writer::end_tag('li');
return $o;

View File

@ -4,6 +4,8 @@ Overview of this plugin type at http://docs.moodle.org/dev/Course_formats
=== 2.7 ===
* The ->testedbrowsers array no longer needs to be defined in supports_ajax().
* format_section_renderer_base::section_hidden has an new second optional argument $courseorid.
If provided the section name is printed in the not available string when displaying the hidden section.
=== 2.6 ===