MDL-21432 backup - all sort of restore tasks
[moodle.git] / backup / moodle2 / backup_settingslib.php
CommitLineData
77547b46
EL
1<?php
2
3// This file is part of Moodle - http://moodle.org/
4//
5// Moodle is free software: you can redistribute it and/or modify
6// it under the terms of the GNU General Public License as published by
7// the Free Software Foundation, either version 3 of the License, or
8// (at your option) any later version.
9//
10// Moodle is distributed in the hope that it will be useful,
11// but WITHOUT ANY WARRANTY; without even the implied warranty of
12// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13// GNU General Public License for more details.
14//
15// You should have received a copy of the GNU General Public License
16// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
17
18/**
19 * @package moodlecore
20 * @subpackage backup-moodle2
21 * @copyright 2010 onwards Eloy Lafuente (stronk7) {@link http://stronk7.com}
22 * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
23 */
24
864842aa
EL
25// TODO: Reduce these to the minimum because ui/dependencies are 100% separated
26
77547b46
EL
27// Root backup settings
28
29/**
30 * root generic setting to store different things without dependencies
31 */
d698081e 32class backup_generic_setting extends root_backup_setting {}
77547b46
EL
33
34/**
35 * root setting to handle backup file names (no dependencies nor anything else)
36 */
37class backup_filename_setting extends backup_generic_setting {
1904e9b3 38
b46ba22b 39 public function __construct($name, $vtype, $value = null, $visibility = self::VISIBLE, $status = self::NOT_LOCKED) {
1904e9b3
SH
40 parent::__construct($name, $vtype, $value, $visibility, $status);
41 }
42
43 public function set_ui($label, $value, array $options = null) {
44 parent::make_ui(self::UI_HTML_TEXTFIELD, $label, null, $options);
45 $this->set_value($value);
46 }
77547b46
EL
47}
48
49/**
50 * root setting to control if backup will include user information
e35fb479 51 * A lot of other settings are dependent of this (module's user info,
77547b46
EL
52 * grades user info, messages, blogs...
53 */
d698081e 54class backup_users_setting extends backup_generic_setting {}
77547b46 55
1c9e93c7
EL
56/**
57 * root setting to control if backup will include activities or no.
58 * A lot of other settings (_included at activity levels)
59 * are dependent of this setting
60 */
d698081e 61class backup_activities_setting extends backup_generic_setting {}
1c9e93c7 62
77547b46
EL
63/**
64 * root setting to control if backup will generate anonymized
65 * user info or no, depends of @backup_users_setting so only is
66 * availabe if the former is enabled (apart from security
67 * that can change it
68 */
d698081e 69class backup_anonymize_setting extends root_backup_setting {}
77547b46
EL
70
71/**
72 * root setting to control if backup will include
73 * user files or no (images, local storage), depends of @backup_users_setting
74 * exactly in the same way than @backup_anonymize_setting so we extend from it
75 */
d698081e 76class backup_user_files_setting extends backup_anonymize_setting {}
77547b46
EL
77
78/**
79 * root setting to control if backup will include
80 * role assignments or no (any level), depends of @backup_users_setting
81 * exactly in the same way than @backup_anonymize_setting so we extend from it
82 */
d698081e 83class backup_role_assignments_setting extends backup_anonymize_setting {}
77547b46
EL
84
85/**
86 * root setting to control if backup will include
87 * logs or no (any level), depends of @backup_users_setting
88 * exactly in the same way than @backup_anonymize_setting so we extend from it
89 */
d698081e 90class backup_logs_setting extends backup_anonymize_setting {}
77547b46
EL
91
92/**
93 * root setting to control if backup will include
94 * comments or no (any level), depends of @backup_users_setting
95 * exactly in the same way than @backup_anonymize_setting so we extend from it
96 */
d698081e 97class backup_comments_setting extends backup_anonymize_setting {}
77547b46
EL
98
99/**
100 * root setting to control if backup will include
101 * users completion data or no (any level), depends of @backup_users_setting
102 * exactly in the same way than @backup_anonymize_setting so we extend from it
103 */
d698081e 104class backup_userscompletion_setting extends backup_anonymize_setting {}
77547b46 105
1c9e93c7
EL
106// Section backup settings
107
108/**
109 * generic section setting to pass various settings between tasks and steps
110 */
d698081e 111class backup_section_generic_setting extends section_backup_setting {}
1c9e93c7
EL
112
113/**
114 * Setting to define if one section is included or no. Activities _included
115 * settings depend of them if available
116 */
d698081e 117class backup_section_included_setting extends section_backup_setting {}
1c9e93c7
EL
118
119/**
120 * section backup setting to control if section will include
121 * user information or no, depends of @backup_users_setting
122 */
d698081e 123class backup_section_userinfo_setting extends section_backup_setting {}
1c9e93c7 124
77547b46
EL
125
126// Activity backup settings
127
128/**
129 * generic activity setting to pass various settings between tasks and steps
130 */
d698081e 131class backup_activity_generic_setting extends activity_backup_setting {}
77547b46 132
1c9e93c7
EL
133/**
134 * activity backup setting to control if activity will
135 * be included or no, depends of @backup_activities_setting and
136 * optionally parent section included setting
137 */
d698081e 138class backup_activity_included_setting extends activity_backup_setting {}
1c9e93c7 139
77547b46
EL
140/**
141 * activity backup setting to control if activity will include
142 * user information or no, depends of @backup_users_setting
143 */
d698081e 144class backup_activity_userinfo_setting extends activity_backup_setting {}