course_format_renderer.php 2.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  1. <?php
  2. // This file is part of The Bootstrap 3 Moodle theme
  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. * Renderers to align Moodle's HTML with that expected by Bootstrap
  18. *
  19. * @package theme
  20. * @subpackage bootstrap
  21. * @copyright &copy; 2014-onwards G J Barnard.
  22. * @author G J Barnard - gjbarnard at gmail dot com and {@link http://moodle.org/user/profile.php?id=442195}
  23. * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
  24. */
  25. defined('MOODLE_INTERNAL') || die();
  26. include_once($CFG->dirroot . "/course/format/topics/renderer.php");
  27. class theme_bootstrap_format_topics_renderer extends format_topics_renderer {
  28. /**
  29. * Generate the content to displayed on the left part of a section
  30. * before course modules are included
  31. *
  32. * @param stdClass $section The course_section entry from DB
  33. * @param stdClass $course The course entry from DB
  34. * @param bool $onsectionpage true if being printed on a section page
  35. * @return string HTML to output.
  36. */
  37. protected function section_left_content($section, $course, $onsectionpage) {
  38. $o = $this->output->spacer();
  39. if ($section->section != 0) {
  40. // Only in the non-general sections.
  41. if (course_get_format($course)->is_section_current($section)) {
  42. $o .= get_accesshide(get_string('currentsection', 'format_'.$course->format));
  43. }
  44. }
  45. return $o;
  46. }
  47. }
  48. include_once($CFG->dirroot . "/course/format/weeks/renderer.php");
  49. class theme_bootstrap_format_weeks_renderer extends format_weeks_renderer {
  50. /**
  51. * Generate the content to displayed on the left part of a section
  52. * before course modules are included
  53. *
  54. * @param stdClass $section The course_section entry from DB
  55. * @param stdClass $course The course entry from DB
  56. * @param bool $onsectionpage true if being printed on a section page
  57. * @return string HTML to output.
  58. */
  59. protected function section_left_content($section, $course, $onsectionpage) {
  60. $o = $this->output->spacer();
  61. if ($section->section != 0) {
  62. // Only in the non-general sections.
  63. if (course_get_format($course)->is_section_current($section)) {
  64. $o .= get_accesshide(get_string('currentsection', 'format_'.$course->format));
  65. }
  66. }
  67. return $o;
  68. }
  69. }