Completed
Pull Request — master (#92)
by Jesus
02:32 queued 31s
created

validator::section_muteonstart_shown()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 5

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 2
nc 2
nop 0
dl 0
loc 5
rs 10
c 0
b 0
f 0
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 settings/validator.
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\settings;
27
28
defined('MOODLE_INTERNAL') || die();
29
30
require_once($CFG->dirroot . '/mod/bigbluebuttonbn/locallib.php');
31
require_once($CFG->libdir.'/adminlib.php');
32
33
/**
34
 * Helper class for validating settings used HTML for settings.php.
35
 *
36
 * @copyright 2010 onwards, Blindside Networks Inc
37
 * @license   http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
38
 */
39
class validator {
40
41
    /**
42
     * Validate if general section will be shown.
43
     *
44
     * @return boolean
45
     */
46
    public static function section_general_shown() {
47
        global $CFG;
48
        return (!isset($CFG->bigbluebuttonbn['server_url']) ||
49
                !isset($CFG->bigbluebuttonbn['shared_secret']));
50
    }
51
52
    /**
53
     * Validate if record meeting section  will be shown.
54
     *
55
     * @return boolean
56
     */
57
    public static function section_record_meeting_shown() {
58
        global $CFG;
59
        return (!isset($CFG->bigbluebuttonbn['recording_default']) ||
60
                !isset($CFG->bigbluebuttonbn['recording_editable']) ||
61
                !isset($CFG->bigbluebuttonbn['recording_icons_enabled']));
62
    }
63
64
    /**
65
     * Validate if import recording section will be shown.
66
     *
67
     * @return boolean
68
     */
69
    public static function section_import_recordings_shown() {
70
        global $CFG;
71
        return (!isset($CFG->bigbluebuttonbn['importrecordings_enabled']) ||
72
                !isset($CFG->bigbluebuttonbn['importrecordings_from_deleted_enabled']));
73
    }
74
75
    /**
76
     * Validate if show recording section will be shown.
77
     *
78
     * @return boolean
79
     */
80
    public static function section_show_recordings_shown() {
81
        global $CFG;
82
        return (!isset($CFG->bigbluebuttonbn['recordings_html_default']) ||
83
                !isset($CFG->bigbluebuttonbn['recordings_html_editable']) ||
84
                !isset($CFG->bigbluebuttonbn['recordings_deleted_default']) ||
85
                !isset($CFG->bigbluebuttonbn['recordings_deleted_editable']) ||
86
                !isset($CFG->bigbluebuttonbn['recordings_imported_default']) ||
87
                !isset($CFG->bigbluebuttonbn['recordings_imported_editable']) ||
88
                !isset($CFG->bigbluebuttonbn['recordings_preview_default']) ||
89
                !isset($CFG->bigbluebuttonbn['recordings_preview_editable'])
90
              );
91
    }
92
93
    /**
94
     * Validate if wait moderator section will be shown.
95
     *
96
     * @return boolean
97
     */
98
    public static function section_wait_moderator_shown() {
99
        global $CFG;
100
        return (!isset($CFG->bigbluebuttonbn['waitformoderator_default']) ||
101
                !isset($CFG->bigbluebuttonbn['waitformoderator_editable']) ||
102
                !isset($CFG->bigbluebuttonbn['waitformoderator_ping_interval']) ||
103
                !isset($CFG->bigbluebuttonbn['waitformoderator_cache_ttl']));
104
    }
105
106
    /**
107
     * Validate if static voice bridge section will be shown.
108
     *
109
     * @return boolean
110
     */
111
    public static function section_static_voice_bridge_shown() {
112
        global $CFG;
113
        return (!isset($CFG->bigbluebuttonbn['voicebridge_editable']));
114
    }
115
116
    /**
117
     * Validate if preupload presentation section will be shown.
118
     *
119
     * @return boolean
120
     */
121
    public static function section_preupload_presentation_shown() {
122
        global $CFG;
123
        return (!isset($CFG->bigbluebuttonbn['preuploadpresentation_enabled']));
124
    }
125
126
    /**
127
     * Validate if user limit section will be shown.
128
     *
129
     * @return boolean
130
     */
131
    public static function section_user_limit_shown() {
132
        global $CFG;
133
        return (!isset($CFG->bigbluebuttonbn['userlimit_default']) ||
134
                !isset($CFG->bigbluebuttonbn['userlimit_editable']));
135
    }
136
137
    /**
138
     * Validate if scheduled duration section will be shown.
139
     *
140
     * @return boolean
141
     */
142
    public static function section_scheduled_duration_shown() {
143
        global $CFG;
144
        return (!isset($CFG->bigbluebuttonbn['scheduled_duration_enabled']));
145
    }
146
147
    /**
148
     * Validate if moderator default section will be shown.
149
     *
150
     * @return boolean
151
     */
152
    public static function section_moderator_default_shown() {
153
        global $CFG;
154
        return (!isset($CFG->bigbluebuttonbn['participant_moderator_default']));
155
    }
156
157
    /**
158
     * Validate if send notification section will be shown.
159
     *
160
     * @return boolean
161
     */
162
    public static function section_send_notifications_shown() {
163
        global $CFG;
164
        return (!isset($CFG->bigbluebuttonbn['sendnotifications_enabled']));
165
    }
166
167
    /**
168
     * Validate if clienttype section will be shown.
169
     *
170
     * @return boolean
171
     */
172
    public static function section_clienttype_shown() {
173
        global $CFG;
174
        if (!isset($CFG->bigbluebuttonbn['clienttype_enabled']) ||
175
            !$CFG->bigbluebuttonbn['clienttype_enabled']) {
176
            return false;
177
        }
178
        if (!bigbluebuttonbn_has_html5_client()) {
179
            return false;
180
        }
181
        return (!isset($CFG->bigbluebuttonbn['clienttype_default']) ||
182
                !isset($CFG->bigbluebuttonbn['clienttype_editable']));
183
    }
184
185
    /**
186
     * Validate if settings extended section will be shown.
187
     *
188
     * @return boolean
189
     */
190
    public static function section_settings_extended_shown() {
191
        global $CFG;
192
        return (!isset($CFG->bigbluebuttonbn['recordingready_enabled']) ||
193
                !isset($CFG->bigbluebuttonbn['meetingevents_enabled']));
194
    }
195
196
    /**
197
     * Validate if muteonstart section will be shown.
198
     *
199
     * @return boolean
200
     */
201
    public static function section_muteonstart_shown() {
202
        global $CFG;
203
        return (!isset($CFG->bigbluebuttonbn['muteonstart_default']) ||
204
            !isset($CFG->bigbluebuttonbn['muteonstart_editable']));
205
    }
206
}
207