See Release Notes
Long Term Support Release
Differences Between: [Versions 401 and 402] [Versions 401 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 * Prepares content for buttons/links to course content export/download. 19 * 20 * @package core_course 21 * @copyright 2020 Michael Hawkins <michaelh@moodle.com> 22 * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later 23 */ 24 25 namespace core_course\output; 26 27 /** 28 * Prepares content for buttons/links to course content export/download. 29 * 30 * @package core_course 31 * @copyright 2020 Michael Hawkins <michaelh@moodle.com> 32 * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later 33 */ 34 class content_export_link { 35 36 /** 37 * Prepare and return the various attributes required for a link/button to populate/trigger the download course content modal. 38 * 39 * @param \context $context The context of the content being exported. 40 * @return stdClass 41 */ 42 public static function get_attributes(\context $context): \stdClass { 43 global $CFG; 44 $downloadattr = new \stdClass(); 45 $downloadattr->url = new \moodle_url('/course/downloadcontent.php', ['contextid' => $context->id]); 46 $downloadattr->displaystring = get_string('downloadcoursecontent', 'course'); 47 $maxfilesize = display_size($CFG->maxsizeperdownloadcoursefile); 48 $downloadlink = new \moodle_url('/course/downloadcontent.php', ['contextid' => $context->id, 'download' => 1]); 49 50 $downloadattr->elementattributes = [ 51 'data-downloadcourse' => 1, 52 'data-download-body' => get_string('downloadcourseconfirmation', 'course', $maxfilesize), 53 'data-download-button-text' => get_string('download'), 54 'data-download-link' => $downloadlink->out(false), 55 'data-download-title' => get_string('downloadcoursecontent', 'course'), 56 'data-overrides-tree-activation-key-handler' => 1, 57 ]; 58 59 return $downloadattr; 60 } 61 }
title
Description
Body
title
Description
Body
title
Description
Body
title
Body