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\moodlenet; 18 19 use backup; 20 use backup_controller; 21 use stdClass; 22 23 defined('MOODLE_INTERNAL') || die(); 24 25 require_once($CFG->dirroot . '/backup/util/includes/backup_includes.php'); 26 27 /** 28 * Packager to prepare appropriate backup of a course to share to MoodleNet. 29 * 30 * @package core 31 * @copyright 2023 Safat Shahin <safat.shahin@moodle.com> 32 * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later 33 */ 34 class course_packager extends resource_packager { 35 36 /** 37 * Constructor for course packager. 38 * 39 * @param stdClass $course The course to package 40 * @param int $userid The ID of the user performing the packaging 41 */ 42 public function __construct( 43 stdClass $course, 44 int $userid, 45 ) { 46 parent::__construct($course, $userid, $course->shortname); 47 } 48 49 /** 50 * Get the backup controller for the course. 51 * 52 * @return backup_controller the backup controller for the course. 53 */ 54 protected function get_backup_controller(): backup_controller { 55 return new backup_controller( 56 backup::TYPE_1COURSE, 57 $this->course->id, 58 backup::FORMAT_MOODLE, 59 backup::INTERACTIVE_NO, 60 backup::MODE_GENERAL, 61 $this->userid, 62 ); 63 } 64 }
title
Description
Body
title
Description
Body
title
Description
Body
title
Body