Search moodle.org's
Developer Documentation

See Release Notes
Long Term Support Release

  • Bug fixes for general core bugs in 4.1.x will end 13 November 2023 (12 months).
  • Bug fixes for security issues in 4.1.x will end 10 November 2025 (36 months).
  • PHP version: minimum PHP 7.4.0 Note: minimum PHP version has increased since Moodle 4.0. PHP 8.0.x is supported too.

Differences Between: [Versions 400 and 401] [Versions 401 and 402] [Versions 401 and 403]

   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  namespace mod_bigbluebuttonbn;
  18  
  19  defined('MOODLE_INTERNAL') || die();
  20  global $CFG;
  21  require_once($CFG->libdir.'/adminlib.php');
  22  
  23  /**
  24   * Helper class for validating settings used HTML for settings.php.
  25   *
  26   * @package mod_bigbluebuttonbn
  27   * @copyright 2010 onwards, Blindside Networks Inc
  28   * @license   http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
  29   */
  30  class setting_validator {
  31  
  32      /**
  33       * Validate if general section will be shown.
  34       *
  35       * @return bool
  36       */
  37      public static function section_general_shown() {
  38          global $CFG;
  39          return (!isset($CFG->bigbluebuttonbn['server_url']) ||
  40                  !isset($CFG->bigbluebuttonbn['shared_secret'])
  41              );
  42      }
  43  
  44      /**
  45       * Validate if default messages section will be shown.
  46       *
  47       * @return bool
  48       */
  49      public static function section_default_messages_shown() {
  50          global $CFG;
  51          return (!isset($CFG->bigbluebuttonbn['welcome_default']) ||
  52                  !isset($CFG->bigbluebuttonbn['welcome_editable']));
  53      }
  54  
  55      /**
  56       * Validate if record meeting section  will be shown.
  57       *
  58       * @return bool
  59       */
  60      public static function section_record_meeting_shown() {
  61          global $CFG;
  62          return (!isset($CFG->bigbluebuttonbn['recording_default']) ||
  63                  !isset($CFG->bigbluebuttonbn['recording_editable']) ||
  64                  !isset($CFG->bigbluebuttonbn['recording_all_from_start_default']) ||
  65                  !isset($CFG->bigbluebuttonbn['recording_all_from_start_editable']) ||
  66                  !isset($CFG->bigbluebuttonbn['recording_hide_button_default']) ||
  67                  !isset($CFG->bigbluebuttonbn['recording_hide_button_editable'])
  68              );
  69      }
  70  
  71      /**
  72       * Validate if import recording section will be shown.
  73       *
  74       * @return bool
  75       */
  76      public static function section_import_recordings_shown() {
  77          global $CFG;
  78          return (!isset($CFG->bigbluebuttonbn['importrecordings_enabled']) ||
  79                  !isset($CFG->bigbluebuttonbn['importrecordings_from_deleted_enabled']));
  80      }
  81  
  82      /**
  83       * Validate if show recording section will be shown.
  84       *
  85       * @return bool
  86       */
  87      public static function section_show_recordings_shown() {
  88          global $CFG;
  89          return (!isset($CFG->bigbluebuttonbn['recordings_deleted_default']) ||
  90                  !isset($CFG->bigbluebuttonbn['recordings_deleted_editable']) ||
  91                  !isset($CFG->bigbluebuttonbn['recordings_imported_default']) ||
  92                  !isset($CFG->bigbluebuttonbn['recordings_imported_editable']) ||
  93                  !isset($CFG->bigbluebuttonbn['recordings_preview_default']) ||
  94                  !isset($CFG->bigbluebuttonbn['recordings_preview_editable']) ||
  95                  !isset($CFG->bigbluebuttonbn['recording_protect_editable'])
  96                );
  97      }
  98  
  99      /**
 100       * Validate if wait moderator section will be shown.
 101       *
 102       * @return bool
 103       */
 104      public static function section_wait_moderator_shown() {
 105          global $CFG;
 106          return (!isset($CFG->bigbluebuttonbn['waitformoderator_default']) ||
 107                  !isset($CFG->bigbluebuttonbn['waitformoderator_editable']) ||
 108                  !isset($CFG->bigbluebuttonbn['waitformoderator_ping_interval']) ||
 109                  !isset($CFG->bigbluebuttonbn['waitformoderator_cache_ttl']));
 110      }
 111  
 112      /**
 113       * Validate if static voice bridge section will be shown.
 114       *
 115       * @return bool
 116       */
 117      public static function section_static_voice_bridge_shown() {
 118          global $CFG;
 119          return (!isset($CFG->bigbluebuttonbn['voicebridge_editable']));
 120      }
 121  
 122      /**
 123       * Validate if preupload presentation section will be shown.
 124       *
 125       * @return bool
 126       */
 127      public static function section_preupload_presentation_shown() {
 128          global $CFG;
 129          return (!isset($CFG->bigbluebuttonbn['preuploadpresentation_editable']));
 130      }
 131  
 132      /**
 133       * Validate if user limit section will be shown.
 134       *
 135       * @return bool
 136       */
 137      public static function section_user_limit_shown() {
 138          global $CFG;
 139          return (!isset($CFG->bigbluebuttonbn['userlimit_default']) ||
 140                  !isset($CFG->bigbluebuttonbn['userlimit_editable']));
 141      }
 142  
 143      /**
 144       * Validate if moderator default section will be shown.
 145       *
 146       * @return bool
 147       */
 148      public static function section_moderator_default_shown() {
 149          global $CFG;
 150          return (!isset($CFG->bigbluebuttonbn['participant_moderator_default']));
 151      }
 152  
 153      /**
 154       * Validate if settings extended section will be shown.
 155       *
 156       * @return bool
 157       */
 158      public static function section_settings_extended_shown() {
 159          global $CFG;
 160          return (!isset($CFG->bigbluebuttonbn['recordingready_enabled']) ||
 161                  !isset($CFG->bigbluebuttonbn['meetingevents_enabled']));
 162      }
 163  
 164      /**
 165       * Validate if muteonstart section will be shown.
 166       *
 167       * @return bool
 168       */
 169      public static function section_muteonstart_shown() {
 170          global $CFG;
 171          return (!isset($CFG->bigbluebuttonbn['muteonstart_default']) ||
 172              !isset($CFG->bigbluebuttonbn['muteonstart_editable']));
 173      }
 174  
 175      /**
 176       * Validate if disablecam section will be shown.
 177       *
 178       * @return bool
 179       */
 180      public static function section_disablecam_shown() {
 181          global $CFG;
 182          return (!isset($CFG->bigbluebuttonbn['disablecam_default']) ||
 183              !isset($CFG->bigbluebuttonbn['disablecam_editable']));
 184      }
 185  
 186      /**
 187       * Validate if disablemic section will be shown.
 188       *
 189       * @return bool
 190       */
 191      public static function section_disablemic_shown() {
 192          global $CFG;
 193          return (!isset($CFG->bigbluebuttonbn['disablemic_default']) ||
 194              !isset($CFG->bigbluebuttonbn['disablemic_editable']));
 195      }
 196  
 197      /**
 198       * Validate if disableprivatechat section will be shown.
 199       *
 200       * @return bool
 201       */
 202      public static function section_disableprivatechat_shown() {
 203          global $CFG;
 204          return (!isset($CFG->bigbluebuttonbn['disableprivatechat_default']) ||
 205              !isset($CFG->bigbluebuttonbn['disableprivatechat_editable']));
 206      }
 207  
 208      /**
 209       * Validate if disablepublicchat section will be shown.
 210       *
 211       * @return bool
 212       */
 213      public static function section_disablepublicchat_shown() {
 214          global $CFG;
 215          return (!isset($CFG->bigbluebuttonbn['disablepublicchat_default']) ||
 216              !isset($CFG->bigbluebuttonbn['disablepublicchat_editable']));
 217      }
 218  
 219      /**
 220       * Validate if disablenote section will be shown.
 221       *
 222       * @return bool
 223       */
 224      public static function section_disablenote_shown() {
 225          global $CFG;
 226          return (!isset($CFG->bigbluebuttonbn['disablenote_default']) ||
 227              !isset($CFG->bigbluebuttonbn['disablenote_editable']));
 228      }
 229  
 230      /**
 231       * Validate if hideuserlist section will be shown.
 232       *
 233       * @return bool
 234       */
 235      public static function section_hideuserlist_shown() {
 236          global $CFG;
 237          return (!isset($CFG->bigbluebuttonbn['hideuserlist_default']) ||
 238              !isset($CFG->bigbluebuttonbn['hideuserlist_editable']));
 239      }
 240  
 241      /**
 242       * Validate that session lock settings is shown or not
 243       * @return bool
 244       */
 245      public static function section_lock_shown() {
 246          return self::section_disablecam_shown() ||
 247                  self::section_disablemic_shown() ||
 248                  self::section_disablenote_shown() ||
 249                  self::section_disableprivatechat_shown() ||
 250                  self::section_disablepublicchat_shown() ||
 251                  self::section_disablenote_shown() ||
 252                  self::section_hideuserlist_shown();
 253      }
 254  }