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 namespace core_courseformat\output\local\content; 18 19 use core\output\named_templatable; 20 use core_courseformat\base as course_format; 21 use core_courseformat\output\local\courseformat_named_templatable; 22 use renderable; 23 24 /** 25 * Course bulk edit mode toggler button. 26 * 27 * @package core_courseformat 28 * @copyright 2023 Ferran Recio <ferran@moodle.com> 29 * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later 30 */ 31 class bulkedittoggler implements named_templatable, renderable { 32 use courseformat_named_templatable; 33 34 /** @var core_courseformat\base the course format class */ 35 protected $format; 36 37 /** 38 * Constructor. 39 * 40 * @param course_format $format the course format 41 */ 42 public function __construct(course_format $format) { 43 $this->format = $format; 44 } 45 46 /** 47 * Export this data so it can be used as the context for a mustache template (core/inplace_editable). 48 * 49 * @param renderer_base $output typically, the renderer that's calling this function 50 * @return stdClass data context for a mustache template 51 */ 52 public function export_for_template(\renderer_base $output) { 53 $section = optional_param('section', 0, PARAM_INT); 54 $format = $this->format; 55 $course = $format->get_course(); 56 57 $data = (object)[ 58 'id' => $course->id, 59 'coursename' => format_string($course->fullname), 60 ]; 61 62 if ($section) { 63 $data->sectionname = get_string('sectionname', "format_$course->format"); 64 $data->sectiontitle = get_section_name($course, $section); 65 } 66 67 return $data; 68 } 69 }
title
Description
Body
title
Description
Body
title
Description
Body
title
Body