Search moodle.org's
Developer Documentation

See Release Notes

  • Bug fixes for general core bugs in 4.2.x will end 22 April 2024 (12 months).
  • Bug fixes for security issues in 4.2.x will end 7 October 2024 (18 months).
  • PHP version: minimum PHP 8.0.0 Note: minimum PHP version has increased since Moodle 4.1. PHP 8.1.x is supported too.

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

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