a8dd45d29407930d16f537b44aeca7aaec1554f8
[moodle.git] / backup / moodle2 / backup_settingslib.php
1 <?php
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/>.
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  */
25 // Root backup settings
27 /**
28  * root generic setting to store different things without dependencies
29  */
30 class backup_generic_setting extends root_backup_setting {}
32 /**
33  * root setting to handle backup file names (no dependencies nor anything else)
34  */
35 class backup_filename_setting extends backup_generic_setting {
37     public function  __construct($name, $vtype, $value = null, $visibility = self::VISIBLE, $status = self::NOT_LOCKED) {
38         parent::__construct($name, $vtype, $value, $visibility, $status);
39     }
41     public function set_ui($label, $value, array $options = null) {
42         parent::make_ui(self::UI_HTML_TEXTFIELD, $label, null, $options);
43         $this->set_value($value);
44     }
45 }
47 /**
48  * root setting to control if backup will include user information
49  * A lot of other settings are dependent of this (module's user info,
50  * grades user info, messages, blogs...
51  */
52 class backup_users_setting extends backup_generic_setting {}
54 /**
55  * root setting to control if backup will include activities or no.
56  * A lot of other settings (_included at activity levels)
57  * are dependent of this setting
58  */
59 class backup_activities_setting extends backup_generic_setting {}
61 /**
62  * root setting to control if backup will generate anonymized
63  * user info or no, depends of @backup_users_setting so only is
64  * availabe if the former is enabled (apart from security
65  * that can change it
66  */
67 class backup_anonymize_setting extends root_backup_setting {}
69 /**
70  * root setting to control if backup will include
71  * user files or no (images, local storage), depends of @backup_users_setting
72  * exactly in the same way than @backup_anonymize_setting so we extend from it
73  */
74 class backup_user_files_setting extends backup_anonymize_setting {}
76 /**
77  * root setting to control if backup will include
78  * role assignments or no (any level), depends of @backup_users_setting
79  * exactly in the same way than @backup_anonymize_setting so we extend from it
80  */
81 class backup_role_assignments_setting extends backup_anonymize_setting {}
83 /**
84  * root setting to control if backup will include
85  * logs or no (any level), depends of @backup_users_setting
86  * exactly in the same way than @backup_anonymize_setting so we extend from it
87  */
88 class backup_logs_setting extends backup_anonymize_setting {}
90 /**
91  * root setting to control if backup will include
92  * comments or no (any level), depends of @backup_users_setting
93  * exactly in the same way than @backup_anonymize_setting so we extend from it
94  */
95 class backup_comments_setting extends backup_anonymize_setting {}
97 /**
98  * root setting to control if backup will include
99  * users completion data or no (any level), depends of @backup_users_setting
100  * exactly in the same way than @backup_anonymize_setting so we extend from it
101  */
102 class backup_userscompletion_setting extends backup_anonymize_setting {}
104 // Section backup settings
106 /**
107  * generic section setting to pass various settings between tasks and steps
108  */
109 class backup_section_generic_setting extends section_backup_setting {}
111 /**
112  * Setting to define if one section is included or no. Activities _included
113  * settings depend of them if available
114  */
115 class backup_section_included_setting extends section_backup_setting {}
117 /**
118  * section backup setting to control if section will include
119  * user information or no, depends of @backup_users_setting
120  */
121 class backup_section_userinfo_setting extends section_backup_setting {}
124 // Activity backup settings
126 /**
127  * generic activity setting to pass various settings between tasks and steps
128  */
129 class backup_activity_generic_setting extends activity_backup_setting {}
131 /**
132  * activity backup setting to control if activity will
133  * be included or no, depends of @backup_activities_setting and
134  * optionally parent section included setting
135  */
136 class backup_activity_included_setting extends activity_backup_setting {}
138 /**
139  * activity backup setting to control if activity will include
140  * user information or no, depends of @backup_users_setting
141  */
142 class backup_activity_userinfo_setting extends activity_backup_setting {}