Proyectos de Subversion Moodle

Rev

| Ultima modificación | Ver Log |

Rev Autor Línea Nro. Línea
1 efrain 1
<?php
2
// This file is part of Moodle - https://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 <https://www.gnu.org/licenses/>.
16
 
17
/**
18
 * Class for restore
19
 *
20
 * @package     mod_stickynotes
21
 * @copyright   2021 Olivier VALENTIN
22
 * @license     https://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/stickynotes/backup/moodle2/restore_stickynotes_stepslib.php');
28
 
29
/**
30
 * stickynotes restore task that provides all the settings and steps to perform one complete restore of the activity.
31
 */
32
class restore_stickynotes_activity_task extends restore_activity_task {
33
 
34
    /**
35
     * Define (add) particular settings this activity can have.
36
     */
37
    protected function define_my_settings() {
38
        // No particular settings for this activity.
39
    }
40
 
41
    /**
42
     * Define (add) particular steps this activity can have.
43
     */
44
    protected function define_my_steps() {
45
        $this->add_step(new restore_stickynotes_activity_structure_step('stickynotes_structure', 'stickynotes.xml'));
46
    }
47
 
48
    /**
49
     * Define the contents in the activity that must be
50
     * processed by the link decoder.
51
     */
52
    public static function define_decode_contents() {
53
        $contents = array();
54
 
55
        $contents[] = new restore_decode_content('stickynotes', array('intro'), null);
56
 
57
        return $contents;
58
    }
59
 
60
    /**
61
     * Define the decoding rules for links belonging
62
     * to the activity to be executed by the link decoder.
63
     */
64
    public static function define_decode_rules() {
65
        $rules = array();
66
 
67
        $rules[] = new restore_decode_rule('STICKYNOTESVIEWBYID', '/mod/stickynotes/view.php?id=$1', 'course_module');
68
        $rules[] = new restore_decode_rule('STICKYNOTESINDEX', '/mod/stickynotes/index.php?id=$1', 'course');
69
 
70
        return $rules;
71
    }
72
 
73
    /**
74
     * Define the restore log rules that will be applied.
75
     */
76
    public static function define_restore_log_rules() {
77
        $rules = array();
78
        $rules[] = new restore_log_rule('stickynotes', 'view', 'view.php?id={course_module}', '{stickynotes}');
79
        return $rules;
80
    }
81
 
82
    /**
83
     * Define the restore log rules that will be applied.
84
     */
85
    public static function define_restore_log_rules_for_course() {
86
        $rules = array();
87
        $rules[] = new restore_log_rule('stickynotes', 'view all', 'index.php?id={course}', null);
88
        return $rules;
89
    }
90
}