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 * The task that provides a complete restore of mod_h5pactivity is defined here. 19 * 20 * @package mod_h5pactivity 21 * @copyright 2020 Ferran Recio <ferran@moodle.com> 22 * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later 23 */ 24 25 defined('MOODLE_INTERNAL') || die(); 26 27 require_once($CFG->dirroot.'/mod/h5pactivity/backup/moodle2/restore_h5pactivity_stepslib.php'); 28 29 /** 30 * Restore task for mod_h5pactivity. 31 */ 32 class restore_h5pactivity_activity_task extends restore_activity_task { 33 34 /** 35 * Defines particular settings that this activity can have. 36 */ 37 protected function define_my_settings(): void { 38 return; 39 } 40 41 /** 42 * Defines particular steps that this activity can have. 43 * 44 * @return base_step. 45 */ 46 protected function define_my_steps(): void { 47 $this->add_step(new restore_h5pactivity_activity_structure_step('h5pactivity_structure', 'h5pactivity.xml')); 48 } 49 50 /** 51 * Defines the contents in the activity that must be processed by the link decoder. 52 * 53 * @return array. 54 */ 55 static public function define_decode_contents(): array { 56 $contents = []; 57 58 // Define the contents. 59 $contents[] = new restore_decode_content('h5pactivity', ['intro'], 'h5pactivity'); 60 61 return $contents; 62 } 63 64 /** 65 * Defines the decoding rules for links belonging to the activity to be executed by the link decoder. 66 * 67 * @return restore_decode_rule[]. 68 */ 69 static public function define_decode_rules(): array { 70 $rules = []; 71 72 $rules[] = new restore_decode_rule('H5PACTIVITYVIEWBYID', '/mod/h5pactivity/view.php?id=$1', 'course_module'); 73 $rules[] = new restore_decode_rule('H5PACTIVITYINDEX', '/mod/h5pactivity/index.php?id=$1', 'course'); 74 75 return $rules; 76 } 77 78 /** 79 * Defines the restore log rules that will be applied by the 80 * {@link restore_logs_processor} when restoring mod_h5pactivity logs. It 81 * must return one array of {@link restore_log_rule} objects. 82 * 83 * @return restore_log_rule[]. 84 */ 85 static public function define_restore_log_rules(): array { 86 $rules = []; 87 88 // Define the rules. 89 $rules[] = new restore_log_rule('h5pactivity', 'view all', 'index.php?id={course}', null); 90 91 return $rules; 92 } 93 }
title
Description
Body
title
Description
Body
title
Description
Body
title
Body