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 - 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
 * Define all the backup steps that will be used by the backup_reengagement_activity_task
19
 *
20
 * @package    mod_reengagement
21
 * @author     Peter Bulmer <peter.bulmer@catlayst.net.nz>
22
 * @copyright  2016 Catalyst IT {@link http://www.catalyst.net.nz}
23
 * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
24
 */
25
 
26
/**
27
 * Define the complete reengagement structure for backup, with file and id annotations
28
 *
29
 * @package    mod_reengagement
30
 * @author     Peter Bulmer <peter.bulmer@catlayst.net.nz>
31
 * @copyright  2016 Catalyst IT {@link http://www.catalyst.net.nz}
32
 * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
33
 */
34
class backup_reengagement_activity_structure_step extends backup_activity_structure_step {
35
 
36
    /**
37
     * Define the structure for the assign activity
38
     * @return void
39
     */
40
    protected function define_structure() {
41
 
42
        // To know if we are including userinfo.
43
        $userinfo = $this->get_setting_value('userinfo');
44
 
45
        // Define each element separated.
46
        $reengagement = new backup_nested_element('reengagement', array('id'), array(
47
            'name', 'timecreated', 'timemodified',
48
            'emailuser', 'emailsubject', 'emailcontent', 'emailcontentformat',
49
            'duration', 'suppresstarget', 'emaildelay', 'emailrecipient',
50
            'emailsubjectmanager', 'emailcontentmanager', 'emailcontentmanagerformat',
51
            'remindercount', 'thirdpartyemails', 'emailsubjectthirdparty',
52
            'emailcontentthirdparty', 'emailcontentthirdpartyformat'));
53
 
54
        $inprogresses = new backup_nested_element('inprogresses');
55
 
56
        $inprogress = new backup_nested_element('inprogress', array('id'), array(
57
            'reengagement', 'userid', 'completiontime', 'emailtime', 'emailsent', 'completed'));
58
 
59
        // Build the tree.
60
        $reengagement->add_child($inprogresses);
61
        $inprogresses->add_child($inprogress);
62
 
63
        // Define sources.
64
        $reengagement->set_source_table('reengagement', array('id' => backup::VAR_ACTIVITYID));
65
 
66
        // All the rest of elements only happen if we are including user info.
67
        if ($userinfo) {
68
            $inprogress->set_source_table('reengagement_inprogress', array('reengagement' => '../../id'));
69
        }
70
 
71
        // Define id annotations.
72
        $inprogress->annotate_ids('user', 'userid');
73
 
74
        // Return the root element (reengagement), wrapped into standard activity structure.
75
        return $this->prepare_activity_structure($reengagement);
76
    }
77
}