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 mod_lti\output; 18 19 use core\output\notification; 20 use renderer_base; 21 22 /** 23 * Course tools page header renderable, containing the data for the page zero state and 'add tool' button. 24 * 25 * @package mod_lti 26 * @copyright 2023 Jake Dallimore <jrhdallimore@gmail.com> 27 * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later 28 */ 29 class course_tools_page_header implements \templatable { 30 31 /** 32 * Constructor. 33 * 34 * @param int $courseid the course id. 35 * @param int $toolcount the number of tools available in the course. 36 * @param bool $canadd whether the user can add tools to the course or not. 37 */ 38 public function __construct(protected int $courseid, protected int $toolcount, protected bool $canadd) { 39 } 40 41 /** 42 * Export the header's data for template use. 43 * 44 * @param renderer_base $output 45 * @return object the data. 46 */ 47 public function export_for_template(renderer_base $output): \stdClass { 48 49 $context = (object) []; 50 51 if ($this->canadd) { 52 $context->addlink = (new \moodle_url('/mod/lti/coursetooledit.php', ['course' => $this->courseid]))->out(); 53 } 54 55 if ($this->toolcount == 0) { 56 $notification = new notification(get_string('nocourseexternaltoolsnotice', 'mod_lti'), notification::NOTIFY_INFO, true); 57 $context->notoolsnotice = $notification->export_for_template($output); 58 } 59 60 return $context; 61 } 62 }
title
Description
Body
title
Description
Body
title
Description
Body
title
Body