source: moodle/trunk/fuentes/backup/moodle2/backup_settingslib.php @ 136

Last change on this file since 136 was 136, checked in by mabarracus, 3 years ago

Ported code to xenial

File size: 5.6 KB
Line 
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 * Defines classes used to handle backup settings
20 *
21 * @package     core_backup
22 * @subpackage  moodle2
23 * @category    backup
24 * @copyright   2010 onwards Eloy Lafuente (stronk7) {@link http://stronk7.com}
25 * @license     http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
26 */
27
28// TODO: Reduce these to the minimum because ui/dependencies are 100% separated
29
30// Root backup settings
31
32/**
33 * root generic setting to store different things without dependencies
34 */
35class backup_generic_setting extends root_backup_setting {}
36
37/**
38 * root setting to handle backup file names (no dependencies nor anything else)
39 */
40class backup_filename_setting extends backup_generic_setting {
41
42    /**
43     * Instantiates a setting object
44     *
45     * @param string $name Name of the setting
46     * @param string $vtype Type of the setting, eg {@link base_setting::IS_TEXT}
47     * @param mixed $value Value of the setting
48     * @param bool $visibility Is the setting visible in the UI, eg {@link base_setting::VISIBLE}
49     * @param int $status Status of the setting with regards to the locking, eg {@link base_setting::NOT_LOCKED}
50     */
51    public function __construct($name, $vtype, $value = null, $visibility = self::VISIBLE, $status = self::NOT_LOCKED) {
52        parent::__construct($name, $vtype, $value, $visibility, $status);
53    }
54
55    public function set_ui_filename($label, $value, array $options = null) {
56        $this->make_ui(self::UI_HTML_TEXTFIELD, $label, null, $options);
57        $this->set_value($value);
58    }
59}
60
61/**
62 * root setting to control if backup will include user information
63 * A lot of other settings are dependent of this (module's user info,
64 * grades user info, messages, blogs...
65 */
66class backup_users_setting extends backup_generic_setting {}
67
68/**
69 * root setting to control if backup will include activities or no.
70 * A lot of other settings (_included at activity levels)
71 * are dependent of this setting
72 */
73class backup_activities_setting extends backup_generic_setting {}
74
75/**
76 * root setting to control if backup will generate anonymized
77 * user info or no, depends of @backup_users_setting so only is
78 * available if the former is enabled (apart from security
79 * that can change it
80 */
81class backup_anonymize_setting extends root_backup_setting {}
82
83/**
84 * root setting to control if backup will include
85 * role assignments 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 */
88class backup_role_assignments_setting extends backup_anonymize_setting {}
89
90/**
91 * root setting to control if backup will include
92 * logs 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 */
95class backup_logs_setting extends backup_anonymize_setting {}
96
97/**
98 * root setting to control if backup will include
99 * comments 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 */
102class backup_comments_setting extends backup_anonymize_setting {}
103
104/**
105 * root setting to control if backup will include badges or not,
106 * depends on @backup_activities_setting
107 */
108class backup_badges_setting extends backup_generic_setting {}
109
110/**
111 * root setting to control if backup will include
112 * calender events or no (any level), depends of @backup_users_setting
113 * exactly in the same way than @backup_anonymize_setting so we extend from it
114 */
115class backup_calendarevents_setting extends backup_anonymize_setting {}
116
117/**
118 * root setting to control if backup will include
119 * users completion data or no (any level), depends of @backup_users_setting
120 * exactly in the same way than @backup_anonymize_setting so we extend from it
121 */
122class backup_userscompletion_setting extends backup_anonymize_setting {}
123
124// Section backup settings
125
126/**
127 * generic section setting to pass various settings between tasks and steps
128 */
129class backup_section_generic_setting extends section_backup_setting {}
130
131/**
132 * Setting to define if one section is included or no. Activities _included
133 * settings depend of them if available
134 */
135class backup_section_included_setting extends section_backup_setting {}
136
137/**
138 * section backup setting to control if section will include
139 * user information or no, depends of @backup_users_setting
140 */
141class backup_section_userinfo_setting extends section_backup_setting {}
142
143
144// Activity backup settings
145
146/**
147 * generic activity setting to pass various settings between tasks and steps
148 */
149class backup_activity_generic_setting extends activity_backup_setting {}
150
151/**
152 * activity backup setting to control if activity will
153 * be included or no, depends of @backup_activities_setting and
154 * optionally parent section included setting
155 */
156class backup_activity_included_setting extends activity_backup_setting {}
157
158/**
159 * activity backup setting to control if activity will include
160 * user information or no, depends of @backup_users_setting
161 */
162class backup_activity_userinfo_setting extends activity_backup_setting {}
Note: See TracBrowser for help on using the repository browser.