Differences Between: [Versions 400 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 * Output the report action menu for this activity. 19 * 20 * @package mod_lesson 21 * @copyright 2021 Adrian Greeve <adrian@moodle.com> 22 * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later 23 */ 24 25 namespace mod_lesson\output; 26 27 use moodle_url; 28 use templatable; 29 use renderable; 30 31 /** 32 * Output the report action menu for this activity. 33 * 34 * @package mod_lesson 35 * @copyright 2021 Adrian Greeve <adrian@moodle.com> 36 * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later 37 */ 38 class report_action_menu implements templatable, renderable { 39 40 /** int The lesson id. */ 41 protected $lessonid; 42 /** moodle_url The url for this page. */ 43 protected $url; 44 45 /** 46 * Constructor for this object. 47 * 48 * @param int $lessonid The lessonid. 49 * @param moodle_url $url The url for this page. 50 */ 51 public function __construct(int $lessonid, moodle_url $url) { 52 $this->lessonid = $lessonid; 53 $this->url = $url; 54 } 55 56 /** 57 * Export this url select menu for navigating between reports. 58 * 59 * @param \renderer_base $output Renderer output. 60 * @return array The data for the template. 61 */ 62 public function export_for_template(\renderer_base $output): array { 63 global $PAGE; 64 65 $overviewlink = new moodle_url('/mod/lesson/report.php', ['id' => $this->lessonid, 'action' => 'reportoverview']); 66 $fulllink = new moodle_url('/mod/lesson/report.php', ['id' => $this->lessonid, 'action' => 'reportdetail']); 67 $menu = [ 68 $overviewlink->out(false) => get_string('overview', 'mod_lesson'), 69 $fulllink->out(false) => get_string('detailedstats', 'mod_lesson') 70 ]; 71 $reportselect = new \url_select($menu, $this->url->out(false), null, 'lesson-report-select'); 72 $reportselect->label = get_string('selectreport', 'mod_lesson'); 73 $reportselect->labelattributes = ['class' => 'sr-only']; 74 75 $data = [ 76 'reportselect' => $reportselect->export_for_template($output), 77 'heading' => $menu[$reportselect->selected] ?? '', 78 'headinglevel' => $PAGE->activityheader->get_heading_level(), 79 ]; 80 return $data; 81 } 82 }
title
Description
Body
title
Description
Body
title
Description
Body
title
Body