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 outputting the singleactivity course format. 19 * 20 * @package format_singleactivity 21 * @copyright 2013 Marina Glancy 22 * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later 23 */ 24 25 defined('MOODLE_INTERNAL') || die(); 26 27 /** 28 * Basic renderer for singleactivity format. 29 * 30 * @package format_singleactivity 31 * @copyright 2013 Marina Glancy 32 * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later 33 */ 34 class format_singleactivity_renderer extends plugin_renderer_base { 35 36 /** 37 * Displays the activities list in cases when course view page is not 38 * redirected to the activity page. 39 * 40 * @param stdClass $course record from table course 41 * @param bool $orphaned if false displays the main activity (if present) 42 * if true displays all other activities 43 */ 44 public function display($course, $orphaned) { 45 $courserenderer = $this->page->get_renderer('core', 'course'); 46 $output = ''; 47 $modinfo = get_fast_modinfo($course); 48 if ($orphaned) { 49 if (!empty($modinfo->sections[1])) { 50 $output .= $this->output->heading(get_string('orphaned', 'format_singleactivity'), 3, 'sectionname'); 51 $output .= $this->output->box(get_string('orphanedwarning', 'format_singleactivity')); 52 $output .= $courserenderer->course_section_cm_list($course, 1, 1); 53 } 54 } else { 55 $output .= $courserenderer->course_section_cm_list($course, 0, 0); 56 if (empty($modinfo->sections[0]) && course_get_format($course)->activity_has_subtypes()) { 57 // Course format was unable to automatically redirect to add module page. 58 $output .= $courserenderer->course_section_add_cm_control($course, 0, 0); 59 } 60 } 61 return $output; 62 } 63 }
title
Description
Body
title
Description
Body
title
Description
Body
title
Body