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
|
|
|
* The mod_bigbluebuttonbn locallib/config. |
19
|
|
|
* |
20
|
|
|
* @package mod_bigbluebuttonbn |
21
|
|
|
* @copyright 2010 onwards, Blindside Networks Inc |
22
|
|
|
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later |
23
|
|
|
* @author Jesus Federico (jesus [at] blindsidenetworks [dt] com) |
24
|
|
|
*/ |
25
|
|
|
|
26
|
|
|
namespace mod_bigbluebuttonbn\locallib; |
27
|
|
|
|
28
|
|
|
defined('MOODLE_INTERNAL') || die(); |
29
|
|
|
|
30
|
|
|
require_once($CFG->dirroot . '/mod/bigbluebuttonbn/locallib.php'); |
31
|
|
|
|
32
|
|
|
/** |
33
|
|
|
* Handles the global configuration based on config.php. |
34
|
|
|
* |
35
|
|
|
* @copyright 2010 onwards, Blindside Networks Inc |
36
|
|
|
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later |
37
|
|
|
*/ |
38
|
|
|
class config { |
39
|
|
|
|
40
|
|
|
/** |
41
|
|
|
* Returns moodle version. |
42
|
|
|
* |
43
|
|
|
* @return string |
44
|
|
|
*/ |
45
|
|
|
public static function get_moodle_version_major() { |
46
|
|
|
global $CFG; |
47
|
|
|
$versionarray = explode('.', $CFG->version); |
48
|
|
|
return $versionarray[0]; |
49
|
|
|
} |
50
|
|
|
|
51
|
|
|
/** |
52
|
|
|
* Returns configuration default values. |
53
|
|
|
* |
54
|
|
|
* @return array |
55
|
|
|
*/ |
56
|
|
|
public static function defaultvalues() { |
57
|
|
|
return array( |
58
|
|
|
'server_url' => (string) BIGBLUEBUTTONBN_DEFAULT_SERVER_URL, |
59
|
|
|
'shared_secret' => (string) BIGBLUEBUTTONBN_DEFAULT_SHARED_SECRET, |
60
|
|
|
'voicebridge_editable' => false, |
61
|
|
|
'importrecordings_enabled' => false, |
62
|
|
|
'importrecordings_from_deleted_enabled' => false, |
63
|
|
|
'waitformoderator_default' => false, |
64
|
|
|
'waitformoderator_editable' => true, |
65
|
|
|
'waitformoderator_ping_interval' => '10', |
66
|
|
|
'waitformoderator_cache_ttl' => '60', |
67
|
|
|
'userlimit_default' => '0', |
68
|
|
|
'userlimit_editable' => false, |
69
|
|
|
'preuploadpresentation_enabled' => false, |
70
|
|
|
'sendnotifications_enabled' => false, |
71
|
|
|
'recordingready_enabled' => false, |
72
|
|
|
'recordingstatus_enabled' => false, |
73
|
|
|
'meetingevents_enabled' => false, |
74
|
|
|
'participant_moderator_default' => '0', |
75
|
|
|
'scheduled_duration_enabled' => false, |
76
|
|
|
'scheduled_duration_compensation' => '10', |
77
|
|
|
'scheduled_pre_opening' => '10', |
78
|
|
|
'recordings_enabled' => true, |
79
|
|
|
'recordings_html_default' => false, |
80
|
|
|
'recordings_html_editable' => false, |
81
|
|
|
'recordings_deleted_default' => false, |
82
|
|
|
'recordings_deleted_editable' => false, |
83
|
|
|
'recordings_imported_default' => false, |
84
|
|
|
'recordings_imported_editable' => false, |
85
|
|
|
'recordings_preview_default' => true, |
86
|
|
|
'recordings_preview_editable' => false, |
87
|
|
|
'recordings_validate_url' => true, |
88
|
|
|
'recording_default' => true, |
89
|
|
|
'recording_editable' => true, |
90
|
|
|
'recording_icons_enabled' => true, |
91
|
|
|
'recording_all_from_start_default' => false, |
92
|
|
|
'recording_all_from_start_editable' => false, |
93
|
|
|
'recording_hide_button_default' => false, |
94
|
|
|
'recording_hide_button_editable' => false, |
95
|
|
|
'general_warning_message' => '', |
96
|
|
|
'general_warning_roles' => 'editingteacher,teacher', |
97
|
|
|
'general_warning_box_type' => 'info', |
98
|
|
|
'general_warning_button_text' => '', |
99
|
|
|
'general_warning_button_href' => '', |
100
|
|
|
'general_warning_button_class' => '', |
101
|
|
|
'clienttype_enabled' => false, |
102
|
|
|
'clienttype_default' => '0', |
103
|
|
|
'clienttype_editable' => true, |
104
|
|
|
'muteonstart_default' => false, |
105
|
|
|
'muteonstart_editable' => false, |
106
|
|
|
'disablecam_default' => false, |
107
|
|
|
'disablecam_editable' => true, |
108
|
|
|
'disablemic_default' => false, |
109
|
|
|
'disablemic_editable' => true, |
110
|
|
|
'disableprivatechat_default' => false, |
111
|
|
|
'disableprivatechat_editable' => true, |
112
|
|
|
'disablepublicchat_default' => false, |
113
|
|
|
'disablepublicchat_editable' => true, |
114
|
|
|
'disablenote_default' => false, |
115
|
|
|
'disablenote_editable' => true, |
116
|
|
|
'hideuserlist_default' => false, |
117
|
|
|
'hideuserlist_editable' => true, |
118
|
|
|
'lockedlayout_default' => false, |
119
|
|
|
'lockedlayout_editable' => true, |
120
|
|
|
'lockonjoin_default' => false, |
121
|
|
|
'lockonjoin_editable' => true, |
122
|
|
|
'lockonjoinconfigurable_default' => false, |
123
|
|
|
'lockonjoinconfigurable_editable' => true, |
124
|
|
|
); |
125
|
|
|
} |
126
|
|
|
|
127
|
|
|
/** |
128
|
|
|
* Returns default value for an specific setting. |
129
|
|
|
* |
130
|
|
|
* @param string $setting |
131
|
|
|
* @return string |
132
|
|
|
*/ |
133
|
|
|
public static function defaultvalue($setting) { |
134
|
|
|
$defaultvalues = self::defaultvalues(); |
135
|
|
|
if (!array_key_exists($setting, $defaultvalues)) { |
136
|
|
|
return; |
137
|
|
|
} |
138
|
|
|
return $defaultvalues[$setting]; |
139
|
|
|
} |
140
|
|
|
|
141
|
|
|
/** |
142
|
|
|
* Returns value for an specific setting. |
143
|
|
|
* |
144
|
|
|
* @param string $setting |
145
|
|
|
* @return string |
146
|
|
|
*/ |
147
|
|
|
public static function get($setting) { |
148
|
|
|
global $CFG; |
149
|
|
|
if (isset($CFG->bigbluebuttonbn[$setting])) { |
150
|
|
|
return (string)$CFG->bigbluebuttonbn[$setting]; |
151
|
|
|
} |
152
|
|
|
if (isset($CFG->{'bigbluebuttonbn_'.$setting})) { |
153
|
|
|
return (string)$CFG->{'bigbluebuttonbn_'.$setting}; |
154
|
|
|
} |
155
|
|
|
return self::defaultvalue($setting); |
156
|
|
|
} |
157
|
|
|
|
158
|
|
|
/** |
159
|
|
|
* Validates if recording settings are enabled. |
160
|
|
|
* |
161
|
|
|
* @return boolean |
162
|
|
|
*/ |
163
|
|
|
public static function recordings_enabled() { |
164
|
|
|
return (boolean)self::get('recordings_enabled'); |
165
|
|
|
} |
166
|
|
|
|
167
|
|
|
/** |
168
|
|
|
* Validates if imported recording settings are enabled. |
169
|
|
|
* |
170
|
|
|
* @return boolean |
171
|
|
|
*/ |
172
|
|
|
public static function importrecordings_enabled() { |
173
|
|
|
return (boolean)self::get('importrecordings_enabled'); |
174
|
|
|
} |
175
|
|
|
|
176
|
|
|
/** |
177
|
|
|
* Validates if clienttype settings are enabled. |
178
|
|
|
* |
179
|
|
|
* @return boolean |
180
|
|
|
*/ |
181
|
|
|
public static function clienttype_enabled() { |
182
|
|
|
return (boolean)self::get('clienttype_enabled'); |
183
|
|
|
} |
184
|
|
|
|
185
|
|
|
/** |
186
|
|
|
* Wraps current settings in an array. |
187
|
|
|
* |
188
|
|
|
* @return array |
189
|
|
|
*/ |
190
|
|
|
public static function get_options() { |
191
|
|
|
return array( |
192
|
|
|
'version_major' => self::get_moodle_version_major(), |
193
|
|
|
'voicebridge_editable' => self::get('voicebridge_editable'), |
194
|
|
|
'importrecordings_enabled' => self::get('importrecordings_enabled'), |
195
|
|
|
'importrecordings_from_deleted_enabled' => self::get('importrecordings_from_deleted_enabled'), |
196
|
|
|
'waitformoderator_default' => self::get('waitformoderator_default'), |
197
|
|
|
'waitformoderator_editable' => self::get('waitformoderator_editable'), |
198
|
|
|
'userlimit_default' => self::get('userlimit_default'), |
199
|
|
|
'userlimit_editable' => self::get('userlimit_editable'), |
200
|
|
|
'preuploadpresentation_enabled' => self::get('preuploadpresentation_enabled'), |
201
|
|
|
'sendnotifications_enabled' => self::get('sendnotifications_enabled'), |
202
|
|
|
'recordings_enabled' => self::get('recordings_enabled'), |
203
|
|
|
'meetingevents_enabled' => self::get('meetingevents_enabled'), |
204
|
|
|
'recordings_html_default' => self::get('recordings_html_default'), |
205
|
|
|
'recordings_html_editable' => self::get('recordings_html_editable'), |
206
|
|
|
'recordings_deleted_default' => self::get('recordings_deleted_default'), |
207
|
|
|
'recordings_deleted_editable' => self::get('recordings_deleted_editable'), |
208
|
|
|
'recordings_imported_default' => self::get('recordings_imported_default'), |
209
|
|
|
'recordings_imported_editable' => self::get('recordings_imported_editable'), |
210
|
|
|
'recordings_preview_default' => self::get('recordings_preview_default'), |
211
|
|
|
'recordings_preview_editable' => self::get('recordings_preview_editable'), |
212
|
|
|
'recordings_validate_url' => self::get('recordings_validate_url'), |
213
|
|
|
'recording_default' => self::get('recording_default'), |
214
|
|
|
'recording_editable' => self::get('recording_editable'), |
215
|
|
|
'recording_icons_enabled' => self::get('recording_icons_enabled'), |
216
|
|
|
'recording_all_from_start_default' => self::get('recording_all_from_start_default'), |
217
|
|
|
'recording_all_from_start_editable' => self::get('recording_all_from_start_editable'), |
218
|
|
|
'recording_hide_button_default' => self::get('recording_hide_button_default'), |
219
|
|
|
'recording_hide_button_editable' => self::get('recording_hide_button_editable'), |
220
|
|
|
'general_warning_message' => self::get('general_warning_message'), |
221
|
|
|
'general_warning_box_type' => self::get('general_warning_box_type'), |
222
|
|
|
'general_warning_button_text' => self::get('general_warning_button_text'), |
223
|
|
|
'general_warning_button_href' => self::get('general_warning_button_href'), |
224
|
|
|
'general_warning_button_class' => self::get('general_warning_button_class'), |
225
|
|
|
'clienttype_enabled' => self::get('clienttype_enabled'), |
226
|
|
|
'clienttype_editable' => self::get('clienttype_editable'), |
227
|
|
|
'clienttype_default' => self::get('clienttype_default'), |
228
|
|
|
'muteonstart_editable' => self::get('muteonstart_editable'), |
229
|
|
|
'muteonstart_default' => self::get('muteonstart_default'), |
230
|
|
|
|
231
|
|
|
'disablecam_editable' => self::get('disablecam_editable'), |
232
|
|
|
'disablecam_default' => self::get('disablecam_default'), |
233
|
|
|
'disablemic_editable' => self::get('disablemic_editable'), |
234
|
|
|
'disablemic_default' => self::get('disablemic_default'), |
235
|
|
|
'disableprivatechat_editable' => self::get('disableprivatechat_editable'), |
236
|
|
|
'disableprivatechat_default' => self::get('disableprivatechat_default'), |
237
|
|
|
'disablepublicchat_editable' => self::get('disablepublicchat_editable'), |
238
|
|
|
'disablepublicchat_default' => self::get('disablepublicchat_default'), |
239
|
|
|
'disablenote_editable' => self::get('disablenote_editable'), |
240
|
|
|
'disablenote_default' => self::get('disablenote_default'), |
241
|
|
|
'hideuserlist_editable' => self::get('hideuserlist_editable'), |
242
|
|
|
'hideuserlist_default' => self::get('hideuserlist_default'), |
243
|
|
|
'lockedlayout_editable' => self::get('lockedlayout_editable'), |
244
|
|
|
'lockedlayout_default' => self::get('lockedlayout_default'), |
245
|
|
|
'lockonjoin_editable' => self::get('lockonjoin_editable'), |
246
|
|
|
'lockonjoin_default' => self::get('lockonjoin_default'), |
247
|
|
|
'lockonjoinconfigurable_editable' => self::get('lockonjoinconfigurable_editable'), |
248
|
|
|
'lockonjoinconfigurable_default' => self::get('lockonjoinconfigurable_default'), |
249
|
|
|
|
250
|
|
|
); |
251
|
|
|
} |
252
|
|
|
} |
253
|
|
|
|