See Release Notes
Long Term Support Release
Differences Between: [Versions 39 and 311] [Versions 39 and 400] [Versions 39 and 401] [Versions 39 and 402] [Versions 39 and 403]
1 <?php 2 // This file is part of Moodle - http://moodle.org/ 3 // 4 // Moodle is free software: you can redistribute it and/or modify 5 // it under the terms of the GNU General Public License as published by 6 // the Free Software Foundation, either version 3 of the License, or 7 // (at your option) any later version. 8 // 9 // Moodle is distributed in the hope that it will be useful, 10 // but WITHOUT ANY WARRANTY; without even the implied warranty of 11 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 // GNU General Public License for more details. 13 // 14 // You should have received a copy of the GNU General Public License 15 // along with Moodle. If not, see <http://www.gnu.org/licenses/>. 16 17 /** 18 * Renderer for the section links block. 19 * 20 * @since Moodle 2.5 21 * @package block_section_links 22 * @copyright 2013 Sam Hemelryk 23 * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later 24 */ 25 26 /** 27 * Renderer for the section links block. 28 * 29 * @package block_section_links 30 * @copyright 2013 Sam Hemelryk 31 * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later 32 */ 33 class block_section_links_renderer extends plugin_renderer_base { 34 35 /** 36 * Render a series of section links. 37 * 38 * @param stdClass $course The course we are rendering for. 39 * @param array $sections An array of section objects to render. 40 * @param bool|int The section to provide a jump to link for. 41 * @return string The HTML to display. 42 */ 43 public function render_section_links(stdClass $course, array $sections, $jumptosection = false) { 44 $html = html_writer::start_tag('ol', array('class' => 'inline-list')); 45 foreach ($sections as $section) { 46 $attributes = array(); 47 if (!$section->visible) { 48 $attributes['class'] = 'dimmed'; 49 } 50 $html .= html_writer::start_tag('li'); 51 $sectiontext = $section->section; 52 if ($section->highlight) { 53 $sectiontext = html_writer::tag('strong', $sectiontext); 54 } 55 $html .= html_writer::link(course_get_url($course, $section->section), $sectiontext, $attributes); 56 $html .= html_writer::end_tag('li').' '; 57 } 58 $html .= html_writer::end_tag('ol'); 59 if ($jumptosection && isset($sections[$jumptosection])) { 60 61 if ($course->format == 'weeks') { 62 $linktext = new lang_string('jumptocurrentweek', 'block_section_links'); 63 } else if ($course->format == 'topics') { 64 $linktext = new lang_string('jumptocurrenttopic', 'block_section_links'); 65 } 66 67 $attributes = array(); 68 if (!$sections[$jumptosection]->visible) { 69 $attributes['class'] = 'dimmed'; 70 } 71 $html .= html_writer::link(course_get_url($course, $jumptosection), $linktext, $attributes); 72 } 73 74 return $html; 75 } 76 }
title
Description
Body
title
Description
Body
title
Description
Body
title
Body