Differences Between: [Versions 400 and 403] [Versions 401 and 403] [Versions 402 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 use admin_category; 20 use admin_setting; 21 use admin_setting_configcheckbox; 22 use admin_setting_configmultiselect; 23 use admin_setting_configpasswordunmask; 24 use admin_setting_configselect; 25 use admin_setting_configstoredfile; 26 use admin_setting_configtext; 27 use admin_setting_configtextarea; 28 use admin_setting_heading; 29 use admin_settingpage; 30 use cache_helper; 31 use core_plugin_manager; 32 use lang_string; 33 use mod_bigbluebuttonbn\local\config; 34 use mod_bigbluebuttonbn\local\helpers\roles; 35 use mod_bigbluebuttonbn\local\plugins\admin_page_manage_extensions; 36 use mod_bigbluebuttonbn\local\proxy\bigbluebutton_proxy; 37 38 /** 39 * The mod_bigbluebuttonbn settings helper 40 * 41 * @package mod_bigbluebuttonbn 42 * @copyright 2021 onwards, Blindside Networks Inc 43 * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later 44 * @author Laurent David (laurent [at] call-learning [dt] fr) 45 */ 46 class settings { 47 48 /** @var admin_category shared value */ 49 private $admin; 50 51 /** @var bool whether the current user has moodle/site:config capability */ 52 private $hassiteconfig; 53 54 /** @var bool Module is enabled */ 55 private $moduleenabled; 56 57 /** @var string The name of the section */ 58 private $section; 59 60 /** @var string The parent name */ 61 private $parent = "modbigbluebuttonbnfolder"; 62 63 /** @var string The section name prefix */ 64 private $sectionnameprefix = "mod_bigbluebuttonbn"; 65 66 /** 67 * Constructor for the bigbluebuttonbn settings. 68 * 69 * @param admin_category $admin 70 * @param \core\plugininfo\mod $module 71 * @param string $categoryname for the plugin setting (main setting page) 72 * @param bool $hassiteconfig whether the current user has moodle/site:config capability 73 */ 74 public function __construct(admin_category $admin, \core\plugininfo\mod $module, string $categoryname, bool $hassiteconfig) { 75 $this->moduleenabled = $module->is_enabled() === true; 76 $this->admin = $admin; 77 $this->section = $categoryname; 78 $this->hassiteconfig = $hassiteconfig; 79 80 $modbigbluebuttobnfolder = new admin_category( 81 $this->parent, 82 new lang_string('pluginname', 'mod_bigbluebuttonbn'), 83 $module->is_enabled() === false 84 ); 85 86 $admin->add('modsettings', $modbigbluebuttobnfolder); 87 88 $mainsettings = $this->add_general_settings(); 89 $admin->add($this->parent, $mainsettings); 90 } 91 92 /** 93 * Add all settings. 94 */ 95 public function add_all_settings(): void { 96 // Renders settings for welcome messages. 97 $this->add_defaultmessages_settings(); 98 // Evaluates if recordings are enabled for the Moodle site. 99 // Renders settings for record feature. 100 $this->add_record_settings(); 101 // Renders settings for import recordings. 102 $this->add_importrecordings_settings(); 103 // Renders settings for showing recordings. 104 $this->add_showrecordings_settings(); 105 106 // Renders settings for meetings. 107 $this->add_waitmoderator_settings(); 108 $this->add_voicebridge_settings(); 109 $this->add_preupload_settings(); 110 $this->add_userlimit_settings(); 111 $this->add_participants_settings(); 112 $this->add_muteonstart_settings(); 113 $this->add_lock_settings(); 114 // Renders settings for extended capabilities. 115 $this->add_extended_settings(); 116 // Renders settings for experimental features. 117 $this->add_experimental_settings(); 118 119 // Add all subplugin settings if any. 120 $this->admin->add($this->parent, new admin_category('bbbextplugins', 121 new lang_string('subplugintype_bbbext', 'mod_bigbluebuttonbn'), !$this->moduleenabled)); 122 $this->admin->add($this->parent, new admin_page_manage_extensions()); 123 foreach (core_plugin_manager::instance()->get_plugins_of_type(extension::BBB_EXTENSION_PLUGIN_NAME) as $plugin) { 124 $plugin->load_settings($this->admin, extension::BBB_EXTENSION_PLUGIN_NAME, $this->hassiteconfig); 125 } 126 } 127 128 /** 129 * Add the setting and lock it conditionally. 130 * 131 * @param string $name 132 * @param admin_setting $item 133 * @param admin_settingpage $settings 134 */ 135 protected function add_conditional_element(string $name, admin_setting $item, admin_settingpage $settings): void { 136 global $CFG; 137 if (isset($CFG->bigbluebuttonbn) && isset($CFG->bigbluebuttonbn[$name])) { 138 if ($item->config_read($item->name)) { 139 // A value has been set, we can safely omit the setting and it won't interfere with installation 140 // process. 141 // The idea behind it is to hide values from end-users in case we use multitenancy for example. 142 return; 143 } 144 } 145 $settings->add($item); 146 } 147 148 /** 149 * Helper function renders general settings if the feature is enabled. 150 * 151 * @return admin_settingpage 152 * @throws \coding_exception 153 */ 154 protected function add_general_settings(): admin_settingpage { 155 global $CFG; 156 $settingsgeneral = new admin_settingpage( 157 $this->section, 158 get_string('config_general', 'bigbluebuttonbn'), 159 'moodle/site:config', 160 !((boolean) setting_validator::section_general_shown()) && ($this->moduleenabled) 161 ); 162 if ($this->admin->fulltree) { 163 // Configuration for BigBlueButton. 164 $item = new admin_setting_heading('bigbluebuttonbn_config_general', 165 '', 166 get_string('config_general_description', 'bigbluebuttonbn') 167 ); 168 $settingsgeneral->add($item); 169 170 if (empty($CFG->bigbluebuttonbn_default_dpa_accepted)) { 171 $settingsgeneral->add(new admin_setting_configcheckbox( 172 'bigbluebuttonbn_default_dpa_accepted', 173 get_string('acceptdpa', 'mod_bigbluebuttonbn'), 174 get_string('enablingbigbluebuttondpainfo', 'mod_bigbluebuttonbn', config::DEFAULT_DPA_URL), 175 0 176 )); 177 } 178 179 $item = new admin_setting_configtext( 180 'bigbluebuttonbn_server_url', 181 get_string('config_server_url', 'bigbluebuttonbn'), 182 get_string('config_server_url_description', 'bigbluebuttonbn'), 183 config::DEFAULT_SERVER_URL, 184 PARAM_RAW 185 ); 186 $item->set_updatedcallback( 187 function() { 188 $this->reset_cache(); 189 $task = new \mod_bigbluebuttonbn\task\reset_recordings(); 190 \core\task\manager::queue_adhoc_task($task); 191 } 192 ); 193 $this->add_conditional_element( 194 'server_url', 195 $item, 196 $settingsgeneral 197 ); 198 $item = new admin_setting_configpasswordunmask( 199 'bigbluebuttonbn_shared_secret', 200 get_string('config_shared_secret', 'bigbluebuttonbn'), 201 get_string('config_shared_secret_description', 'bigbluebuttonbn'), 202 config::DEFAULT_SHARED_SECRET 203 ); 204 $this->add_conditional_element( 205 'shared_secret', 206 $item, 207 $settingsgeneral 208 ); 209 210 $item = new admin_setting_configselect( 211 'bigbluebuttonbn_checksum_algorithm', 212 get_string('config_checksum_algorithm', 'bigbluebuttonbn'), 213 get_string('config_checksum_algorithm_description', 'bigbluebuttonbn'), 214 config::DEFAULT_CHECKSUM_ALGORITHM, 215 array_combine(config::CHECKSUM_ALGORITHMS, config::CHECKSUM_ALGORITHMS) 216 ); 217 $this->add_conditional_element( 218 'checksum_algorithm', 219 $item, 220 $settingsgeneral 221 ); 222 223 $item = new \admin_setting_description( 224 'bigbluebuttonbn_dpa_info', 225 '', 226 get_string('config_dpa_note', 'bigbluebuttonbn', config::DEFAULT_DPA_URL), 227 ); 228 $this->add_conditional_element( 229 'dpa_info', 230 $item, 231 $settingsgeneral 232 ); 233 $item = new admin_setting_configtext( 234 'bigbluebuttonbn_poll_interval', 235 get_string('config_poll_interval', 'bigbluebuttonbn'), 236 get_string('config_poll_interval_description', 'bigbluebuttonbn'), 237 bigbluebutton_proxy::DEFAULT_POLL_INTERVAL, 238 PARAM_INT 239 ); 240 $this->add_conditional_element( 241 'poll_interval', 242 $item, 243 $settingsgeneral 244 ); 245 } 246 return $settingsgeneral; 247 } 248 249 /** 250 * Helper function renders default messages settings if the feature is enabled. 251 */ 252 protected function add_defaultmessages_settings(): void { 253 // Configuration for 'default messages' feature. 254 $defaultmessagessetting = new admin_settingpage( 255 "{$this->sectionnameprefix}_default_messages", 256 get_string('config_default_messages', 'bigbluebuttonbn'), 257 'moodle/site:config', 258 !((boolean) setting_validator::section_default_messages_shown()) && ($this->moduleenabled) 259 ); 260 261 if ($this->admin->fulltree) { 262 $item = new admin_setting_heading( 263 'bigbluebuttonbn_config_default_messages', 264 '', 265 get_string('config_default_messages_description', 'bigbluebuttonbn') 266 ); 267 $defaultmessagessetting->add($item); 268 $item = new admin_setting_configtextarea( 269 'bigbluebuttonbn_welcome_default', 270 get_string('config_welcome_default', 'bigbluebuttonbn'), 271 get_string('config_welcome_default_description', 'bigbluebuttonbn'), 272 '', 273 PARAM_TEXT 274 ); 275 $this->add_conditional_element( 276 'welcome_default', 277 $item, 278 $defaultmessagessetting 279 ); 280 $item = new admin_setting_configcheckbox( 281 'bigbluebuttonbn_welcome_editable', 282 get_string('config_welcome_editable', 'bigbluebuttonbn'), 283 get_string('config_welcome_editable_description', 'bigbluebuttonbn'), 284 1, 285 ); 286 $this->add_conditional_element( 287 'welcome_editable', 288 $item, 289 $defaultmessagessetting 290 ); 291 } 292 $this->admin->add($this->parent, $defaultmessagessetting); 293 294 } 295 296 /** 297 * Helper function renders record settings if the feature is enabled. 298 */ 299 protected function add_record_settings(): void { 300 // Configuration for 'recording' feature. 301 $recordingsetting = new admin_settingpage( 302 "{$this->sectionnameprefix}_recording", 303 get_string('config_recording', 'bigbluebuttonbn'), 304 'moodle/site:config', 305 !((boolean) setting_validator::section_record_meeting_shown()) && ($this->moduleenabled) 306 ); 307 308 if ($this->admin->fulltree) { 309 $item = new admin_setting_heading( 310 'bigbluebuttonbn_config_recording', 311 '', 312 get_string('config_recording_description', 'bigbluebuttonbn') 313 ); 314 $recordingsetting->add($item); 315 $item = new admin_setting_configcheckbox( 316 'bigbluebuttonbn_recording_default', 317 get_string('config_recording_default', 'bigbluebuttonbn'), 318 get_string('config_recording_default_description', 'bigbluebuttonbn'), 319 1 320 ); 321 $this->add_conditional_element( 322 'recording_default', 323 $item, 324 $recordingsetting 325 ); 326 $item = new admin_setting_configtext( 327 'bigbluebuttonbn_recording_refresh_period', 328 get_string('config_recording_refresh_period', 'bigbluebuttonbn'), 329 get_string('config_recording_refresh_period_description', 'bigbluebuttonbn'), 330 recording::RECORDING_REFRESH_DEFAULT_PERIOD, 331 PARAM_INT 332 ); 333 $this->add_conditional_element( 334 'recording_refresh_period', 335 $item, 336 $recordingsetting 337 ); 338 $item = new admin_setting_configcheckbox( 339 'bigbluebuttonbn_recording_editable', 340 get_string('config_recording_editable', 'bigbluebuttonbn'), 341 get_string('config_recording_editable_description', 'bigbluebuttonbn'), 342 1 343 ); 344 $this->add_conditional_element( 345 'recording_editable', 346 $item, 347 $recordingsetting 348 ); 349 350 // Add recording start to load and allow/hide stop/pause. 351 $item = new admin_setting_configcheckbox( 352 'bigbluebuttonbn_recording_all_from_start_default', 353 get_string('config_recording_all_from_start_default', 'bigbluebuttonbn'), 354 get_string('config_recording_all_from_start_default_description', 'bigbluebuttonbn'), 355 0 356 ); 357 $this->add_conditional_element( 358 'recording_all_from_start_default', 359 $item, 360 $recordingsetting 361 ); 362 $item = new admin_setting_configcheckbox( 363 'bigbluebuttonbn_recording_all_from_start_editable', 364 get_string('config_recording_all_from_start_editable', 'bigbluebuttonbn'), 365 get_string('config_recording_all_from_start_editable_description', 'bigbluebuttonbn'), 366 0 367 ); 368 $this->add_conditional_element( 369 'recording_all_from_start_editable', 370 $item, 371 $recordingsetting 372 ); 373 $item = new admin_setting_configcheckbox( 374 'bigbluebuttonbn_recording_hide_button_default', 375 get_string('config_recording_hide_button_default', 'bigbluebuttonbn'), 376 get_string('config_recording_hide_button_default_description', 'bigbluebuttonbn'), 377 0 378 ); 379 $this->add_conditional_element( 380 'recording_hide_button_default', 381 $item, 382 $recordingsetting 383 ); 384 $item = new admin_setting_configcheckbox( 385 'bigbluebuttonbn_recording_hide_button_editable', 386 get_string('config_recording_hide_button_editable', 'bigbluebuttonbn'), 387 get_string('config_recording_hide_button_editable_description', 'bigbluebuttonbn'), 388 0 389 ); 390 $this->add_conditional_element( 391 'recording_hide_button_editable', 392 $item, 393 $recordingsetting 394 ); 395 $recordingsafeformat = [ 396 'notes' => get_string('view_recording_format_notes', 'mod_bigbluebuttonbn'), 397 'podcast' => get_string('view_recording_format_podcast', 'mod_bigbluebuttonbn'), 398 'presentation' => get_string('view_recording_format_presentation', 'mod_bigbluebuttonbn'), 399 'screenshare' => get_string('view_recording_format_screenshare', 'mod_bigbluebuttonbn'), 400 'statistics' => get_string('view_recording_format_statistics', 'mod_bigbluebuttonbn'), 401 'video' => get_string('view_recording_format_video', 'mod_bigbluebuttonbn'), 402 ]; 403 $item = new admin_setting_configmultiselect( 404 'bigbluebuttonbn_recording_safe_formats', 405 get_string('config_recording_safe_formats', 'mod_bigbluebuttonbn'), 406 get_string('config_recording_safe_formats_description', 'mod_bigbluebuttonbn'), 407 ['video', 'presentation'], 408 $recordingsafeformat 409 ); 410 $this->add_conditional_element( 411 'recording_hide_button_editable', 412 $item, 413 $recordingsetting 414 ); 415 } 416 $this->admin->add($this->parent, $recordingsetting); 417 } 418 419 /** 420 * Helper function renders import recording settings if the feature is enabled. 421 */ 422 protected function add_importrecordings_settings(): void { 423 // Configuration for 'import recordings' feature. 424 $importrecordingsettings = new admin_settingpage( 425 "{$this->sectionnameprefix}_importrecording", 426 get_string('config_importrecordings', 'bigbluebuttonbn'), 427 'moodle/site:config', 428 !((boolean) setting_validator::section_import_recordings_shown()) && ($this->moduleenabled) 429 ); 430 431 if ($this->admin->fulltree) { 432 $item = new admin_setting_heading( 433 'bigbluebuttonbn_config_importrecordings', 434 '', 435 get_string('config_importrecordings_description', 'bigbluebuttonbn') 436 ); 437 $importrecordingsettings->add($item); 438 $item = new admin_setting_configcheckbox( 439 'bigbluebuttonbn_importrecordings_enabled', 440 get_string('config_importrecordings_enabled', 'bigbluebuttonbn'), 441 get_string('config_importrecordings_enabled_description', 'bigbluebuttonbn'), 442 0 443 ); 444 $this->add_conditional_element( 445 'importrecordings_enabled', 446 $item, 447 $importrecordingsettings 448 ); 449 $item = new admin_setting_configcheckbox( 450 'bigbluebuttonbn_importrecordings_from_deleted_enabled', 451 get_string('config_importrecordings_from_deleted_enabled', 'bigbluebuttonbn'), 452 get_string('config_importrecordings_from_deleted_enabled_description', 'bigbluebuttonbn'), 453 0 454 ); 455 $this->add_conditional_element( 456 'importrecordings_from_deleted_enabled', 457 $item, 458 $importrecordingsettings 459 ); 460 } 461 $this->admin->add($this->parent, $importrecordingsettings); 462 } 463 464 /** 465 * Helper function renders show recording settings if the feature is enabled. 466 */ 467 protected function add_showrecordings_settings(): void { 468 // Configuration for 'show recordings' feature. 469 $showrecordingsettings = new admin_settingpage( 470 "{$this->sectionnameprefix}_showrecordings", 471 get_string('config_recordings', 'bigbluebuttonbn'), 472 'moodle/site:config', 473 !((boolean) setting_validator::section_show_recordings_shown()) && ($this->moduleenabled) 474 ); 475 476 if ($this->admin->fulltree) { 477 $item = new admin_setting_heading( 478 'bigbluebuttonbn_config_recordings', 479 '', 480 get_string('config_recordings_description', 'bigbluebuttonbn') 481 ); 482 $showrecordingsettings->add($item); 483 $item = new admin_setting_configcheckbox( 484 'bigbluebuttonbn_recordings_deleted_default', 485 get_string('config_recordings_deleted_default', 'bigbluebuttonbn'), 486 get_string('config_recordings_deleted_default_description', 'bigbluebuttonbn'), 487 1 488 ); 489 $this->add_conditional_element( 490 'recordings_deleted_default', 491 $item, 492 $showrecordingsettings 493 ); 494 $item = new admin_setting_configcheckbox( 495 'bigbluebuttonbn_recordings_deleted_editable', 496 get_string('config_recordings_deleted_editable', 'bigbluebuttonbn'), 497 get_string('config_recordings_deleted_editable_description', 'bigbluebuttonbn'), 498 0 499 ); 500 $this->add_conditional_element( 501 'recordings_deleted_editable', 502 $item, 503 $showrecordingsettings 504 ); 505 $item = new admin_setting_configcheckbox( 506 'bigbluebuttonbn_recordings_imported_default', 507 get_string('config_recordings_imported_default', 'bigbluebuttonbn'), 508 get_string('config_recordings_imported_default_description', 'bigbluebuttonbn'), 509 0 510 ); 511 $this->add_conditional_element( 512 'recordings_imported_default', 513 $item, 514 $showrecordingsettings 515 ); 516 $item = new admin_setting_configcheckbox( 517 'bigbluebuttonbn_recordings_imported_editable', 518 get_string('config_recordings_imported_editable', 'bigbluebuttonbn'), 519 get_string('config_recordings_imported_editable_description', 'bigbluebuttonbn'), 520 1 521 ); 522 $this->add_conditional_element( 523 'recordings_imported_editable', 524 $item, 525 $showrecordingsettings 526 ); 527 $item = new admin_setting_configcheckbox( 528 'bigbluebuttonbn_recordings_preview_default', 529 get_string('config_recordings_preview_default', 'bigbluebuttonbn'), 530 get_string('config_recordings_preview_default_description', 'bigbluebuttonbn'), 531 1 532 ); 533 $this->add_conditional_element( 534 'recordings_preview_default', 535 $item, 536 $showrecordingsettings 537 ); 538 $item = new admin_setting_configcheckbox( 539 'bigbluebuttonbn_recordings_preview_editable', 540 get_string('config_recordings_preview_editable', 'bigbluebuttonbn'), 541 get_string('config_recordings_preview_editable_description', 'bigbluebuttonbn'), 542 0 543 ); 544 $this->add_conditional_element( 545 'recordings_preview_editable', 546 $item, 547 $showrecordingsettings 548 ); 549 $item = new admin_setting_configcheckbox( 550 'bigbluebuttonbn_recordings_asc_sort', 551 get_string('config_recordings_asc_sort', 'bigbluebuttonbn'), 552 get_string('config_recordings_asc_sort_description', 'bigbluebuttonbn'), 553 0 554 ); 555 $this->add_conditional_element( 556 'recordings_asc_sort', 557 $item, 558 $showrecordingsettings 559 ); 560 $item = new admin_setting_configcheckbox( 561 'bigbluebuttonbn_recording_protect_editable', 562 get_string('config_recording_protect_editable', 'bigbluebuttonbn'), 563 get_string('config_recording_protect_editable_description', 'bigbluebuttonbn'), 564 1 565 ); 566 $this->add_conditional_element( 567 'recording_protect_editable', 568 $item, 569 $showrecordingsettings 570 ); 571 } 572 $this->admin->add($this->parent, $showrecordingsettings); 573 } 574 575 /** 576 * Helper function renders wait for moderator settings if the feature is enabled. 577 */ 578 protected function add_waitmoderator_settings(): void { 579 // Configuration for wait for moderator feature. 580 $waitmoderatorsettings = new admin_settingpage( 581 "{$this->sectionnameprefix}_waitformoderator", 582 get_string('config_waitformoderator', 'bigbluebuttonbn'), 583 'moodle/site:config', 584 !((boolean) setting_validator::section_wait_moderator_shown()) && ($this->moduleenabled) 585 ); 586 587 if ($this->admin->fulltree) { 588 $item = new admin_setting_heading( 589 'bigbluebuttonbn_config_waitformoderator', 590 '', 591 get_string('config_waitformoderator_description', 'bigbluebuttonbn') 592 ); 593 $waitmoderatorsettings->add($item); 594 $item = new admin_setting_configcheckbox( 595 'bigbluebuttonbn_waitformoderator_default', 596 get_string('config_waitformoderator_default', 'bigbluebuttonbn'), 597 get_string('config_waitformoderator_default_description', 'bigbluebuttonbn'), 598 0 599 ); 600 $this->add_conditional_element( 601 'waitformoderator_default', 602 $item, 603 $waitmoderatorsettings 604 ); 605 $item = new admin_setting_configcheckbox( 606 'bigbluebuttonbn_waitformoderator_editable', 607 get_string('config_waitformoderator_editable', 'bigbluebuttonbn'), 608 get_string('config_waitformoderator_editable_description', 'bigbluebuttonbn'), 609 1 610 ); 611 $this->add_conditional_element( 612 'waitformoderator_editable', 613 $item, 614 $waitmoderatorsettings 615 ); 616 $item = new admin_setting_configtext( 617 'bigbluebuttonbn_waitformoderator_ping_interval', 618 get_string('config_waitformoderator_ping_interval', 'bigbluebuttonbn'), 619 get_string('config_waitformoderator_ping_interval_description', 'bigbluebuttonbn'), 620 10, 621 PARAM_INT 622 ); 623 $this->add_conditional_element( 624 'waitformoderator_ping_interval', 625 $item, 626 $waitmoderatorsettings 627 ); 628 $item = new admin_setting_configtext( 629 'bigbluebuttonbn_waitformoderator_cache_ttl', 630 get_string('config_waitformoderator_cache_ttl', 'bigbluebuttonbn'), 631 get_string('config_waitformoderator_cache_ttl_description', 'bigbluebuttonbn'), 632 60, 633 PARAM_INT 634 ); 635 $this->add_conditional_element( 636 'waitformoderator_cache_ttl', 637 $item, 638 $waitmoderatorsettings 639 ); 640 } 641 $this->admin->add($this->parent, $waitmoderatorsettings); 642 } 643 644 /** 645 * Helper function renders static voice bridge settings if the feature is enabled. 646 */ 647 protected function add_voicebridge_settings(): void { 648 // Configuration for "static voice bridge" feature. 649 $voicebridgesettings = new admin_settingpage( 650 "{$this->sectionnameprefix}_voicebridge", 651 get_string('config_voicebridge', 'bigbluebuttonbn'), 652 'moodle/site:config', 653 !((boolean) setting_validator::section_static_voice_bridge_shown()) && ($this->moduleenabled) 654 ); 655 656 if ($this->admin->fulltree) { 657 $item = new admin_setting_heading( 658 'bigbluebuttonbn_config_voicebridge', 659 '', 660 get_string('config_voicebridge_description', 'bigbluebuttonbn') 661 ); 662 $voicebridgesettings->add($item); 663 $item = new admin_setting_configcheckbox( 664 'bigbluebuttonbn_voicebridge_editable', 665 get_string('config_voicebridge_editable', 'bigbluebuttonbn'), 666 get_string('config_voicebridge_editable_description', 'bigbluebuttonbn'), 667 0 668 ); 669 $this->add_conditional_element( 670 'voicebridge_editable', 671 $item, 672 $voicebridgesettings 673 ); 674 } 675 $this->admin->add($this->parent, $voicebridgesettings); 676 } 677 678 /** 679 * Helper function renders preuploaded presentation settings if the feature is enabled. 680 */ 681 protected function add_preupload_settings(): void { 682 // Configuration for "preupload presentation" feature. 683 $preuploadsettings = new admin_settingpage( 684 "{$this->sectionnameprefix}_preupload", 685 get_string('config_preuploadpresentation', 'bigbluebuttonbn'), 686 'moodle/site:config', 687 !((boolean) setting_validator::section_preupload_presentation_shown()) && ($this->moduleenabled) 688 ); 689 690 if ($this->admin->fulltree) { 691 // This feature only works if curl is installed (but it is as now required by Moodle). The checks have been removed. 692 $item = new admin_setting_heading( 693 'bigbluebuttonbn_config_preuploadpresentation', 694 '', 695 get_string('config_preuploadpresentation_description', 'bigbluebuttonbn') 696 ); 697 $preuploadsettings->add($item); 698 699 $item = new admin_setting_configcheckbox( 700 'bigbluebuttonbn_preuploadpresentation_editable', 701 get_string('config_preuploadpresentation_editable', 'bigbluebuttonbn'), 702 get_string('config_preuploadpresentation_editable_description', 'bigbluebuttonbn'), 703 0 704 ); 705 $this->add_conditional_element( 706 'preuploadpresentation_editable', 707 $item, 708 $preuploadsettings 709 ); 710 // Note: checks on curl library have been removed as it is a requirement from Moodle. 711 $filemanageroptions = []; 712 $filemanageroptions['accepted_types'] = '*'; 713 $filemanageroptions['maxbytes'] = 0; 714 $filemanageroptions['subdirs'] = 0; 715 $filemanageroptions['maxfiles'] = 1; 716 $filemanageroptions['mainfile'] = true; 717 718 $filemanager = new admin_setting_configstoredfile( 719 'mod_bigbluebuttonbn/presentationdefault', 720 get_string('config_presentation_default', 'bigbluebuttonbn'), 721 get_string('config_presentation_default_description', 'bigbluebuttonbn'), 722 'presentationdefault', 723 0, 724 $filemanageroptions 725 ); 726 727 $preuploadsettings->add($filemanager); 728 } 729 $this->admin->add($this->parent, $preuploadsettings); 730 } 731 732 /** 733 * Helper function renders userlimit settings if the feature is enabled. 734 */ 735 protected function add_userlimit_settings(): void { 736 $userlimitsettings = new admin_settingpage( 737 "{$this->sectionnameprefix}_userlimit", 738 get_string('config_userlimit', 'bigbluebuttonbn'), 739 'moodle/site:config', 740 !((boolean) setting_validator::section_user_limit_shown()) && ($this->moduleenabled) 741 ); 742 743 if ($this->admin->fulltree) { 744 // Configuration for "user limit" feature. 745 $item = new admin_setting_heading( 746 'bigbluebuttonbn_config_userlimit', 747 '', 748 get_string('config_userlimit_description', 'bigbluebuttonbn') 749 ); 750 $userlimitsettings->add($item); 751 $item = new admin_setting_configtext( 752 'bigbluebuttonbn_userlimit_default', 753 get_string('config_userlimit_default', 'bigbluebuttonbn'), 754 get_string('config_userlimit_default_description', 'bigbluebuttonbn'), 755 0, 756 PARAM_INT 757 ); 758 $this->add_conditional_element( 759 'userlimit_default', 760 $item, 761 $userlimitsettings 762 ); 763 $item = new admin_setting_configcheckbox( 764 'bigbluebuttonbn_userlimit_editable', 765 get_string('config_userlimit_editable', 'bigbluebuttonbn'), 766 get_string('config_userlimit_editable_description', 'bigbluebuttonbn'), 767 0 768 ); 769 $this->add_conditional_element( 770 'userlimit_editable', 771 $item, 772 $userlimitsettings 773 ); 774 } 775 $this->admin->add($this->parent, $userlimitsettings); 776 } 777 778 /** 779 * Helper function renders participant settings if the feature is enabled. 780 */ 781 protected function add_participants_settings(): void { 782 // Configuration for defining the default role/user that will be moderator on new activities. 783 $participantsettings = new admin_settingpage( 784 "{$this->sectionnameprefix}_participant", 785 get_string('config_participant', 'bigbluebuttonbn'), 786 'moodle/site:config', 787 !((boolean) setting_validator::section_moderator_default_shown()) && ($this->moduleenabled) 788 ); 789 790 if ($this->admin->fulltree) { 791 $item = new admin_setting_heading( 792 'bigbluebuttonbn_config_participant', 793 '', 794 get_string('config_participant_description', 'bigbluebuttonbn') 795 ); 796 $participantsettings->add($item); 797 798 // UI for 'participants' feature. 799 $roles = roles::get_roles(null, false); 800 $owner = [ 801 '0' => get_string('mod_form_field_participant_list_type_owner', 'bigbluebuttonbn') 802 ]; 803 $item = new admin_setting_configmultiselect( 804 'bigbluebuttonbn_participant_moderator_default', 805 get_string('config_participant_moderator_default', 'bigbluebuttonbn'), 806 get_string('config_participant_moderator_default_description', 'bigbluebuttonbn'), 807 array_keys($owner), 808 $owner + $roles 809 ); 810 $this->add_conditional_element( 811 'participant_moderator_default', 812 $item, 813 $participantsettings 814 ); 815 } 816 $this->admin->add($this->parent, $participantsettings); 817 } 818 819 /** 820 * Helper function renders general settings if the feature is enabled. 821 */ 822 protected function add_muteonstart_settings(): void { 823 // Configuration for BigBlueButton. 824 $muteonstartsetting = new admin_settingpage( 825 "{$this->sectionnameprefix}_muteonstart", 826 get_string('config_muteonstart', 'bigbluebuttonbn'), 827 'moodle/site:config', 828 !((boolean) setting_validator::section_muteonstart_shown()) && ($this->moduleenabled) 829 ); 830 831 if ($this->admin->fulltree) { 832 $item = new admin_setting_heading( 833 'bigbluebuttonbn_config_muteonstart', 834 '', 835 get_string('config_muteonstart_description', 'bigbluebuttonbn') 836 ); 837 $muteonstartsetting->add($item); 838 $item = new admin_setting_configcheckbox( 839 'bigbluebuttonbn_muteonstart_default', 840 get_string('config_muteonstart_default', 'bigbluebuttonbn'), 841 get_string('config_muteonstart_default_description', 'bigbluebuttonbn'), 842 0 843 ); 844 $this->add_conditional_element( 845 'muteonstart_default', 846 $item, 847 $muteonstartsetting 848 ); 849 $item = new admin_setting_configcheckbox( 850 'bigbluebuttonbn_muteonstart_editable', 851 get_string('config_muteonstart_editable', 'bigbluebuttonbn'), 852 get_string('config_muteonstart_editable_description', 'bigbluebuttonbn'), 853 0 854 ); 855 $this->add_conditional_element( 856 'muteonstart_editable', 857 $item, 858 $muteonstartsetting 859 ); 860 } 861 $this->admin->add($this->parent, $muteonstartsetting); 862 } 863 864 /** 865 * Helper function to render lock settings. 866 */ 867 protected function add_lock_settings(): void { 868 $lockingsetting = new admin_settingpage( 869 "{$this->sectionnameprefix}_locksettings", 870 get_string('config_locksettings', 'bigbluebuttonbn'), 871 'moodle/site:config', 872 !((boolean) setting_validator::section_lock_shown()) && ($this->moduleenabled) 873 ); 874 // Configuration for various lock settings for meetings. 875 if ($this->admin->fulltree) { 876 $this->add_lock_setting_from_name('disablecam', $lockingsetting); 877 $this->add_lock_setting_from_name('disablemic', $lockingsetting); 878 $this->add_lock_setting_from_name('disableprivatechat', $lockingsetting); 879 $this->add_lock_setting_from_name('disablepublicchat', $lockingsetting); 880 $this->add_lock_setting_from_name('disablenote', $lockingsetting); 881 $this->add_lock_setting_from_name('hideuserlist', $lockingsetting); 882 } 883 $this->admin->add($this->parent, $lockingsetting); 884 } 885 886 /** 887 * Helper function renders setting if the feature is enabled. 888 * 889 * @param string $settingname 890 * @param admin_settingpage $lockingsetting The parent settingpage to add to 891 */ 892 protected function add_lock_setting_from_name(string $settingname, admin_settingpage $lockingsetting): void { 893 $validatorname = "section_{$settingname}_shown"; 894 if ((boolean) setting_validator::$validatorname()) { 895 // Configuration for BigBlueButton. 896 $item = new admin_setting_configcheckbox( 897 'bigbluebuttonbn_' . $settingname . '_default', 898 get_string('config_' . $settingname . '_default', 'bigbluebuttonbn'), 899 get_string('config_' . $settingname . '_default_description', 'bigbluebuttonbn'), 900 config::defaultvalue($settingname . '_default') 901 ); 902 $this->add_conditional_element( 903 $settingname . '_default', 904 $item, 905 $lockingsetting 906 ); 907 $item = new admin_setting_configcheckbox( 908 'bigbluebuttonbn_' . $settingname . '_editable', 909 get_string('config_' . $settingname . '_editable', 'bigbluebuttonbn'), 910 get_string('config_' . $settingname . '_editable_description', 'bigbluebuttonbn'), 911 config::defaultvalue($settingname . '_editable') 912 ); 913 $this->add_conditional_element( 914 $settingname . '_editable', 915 $item, 916 $lockingsetting 917 ); 918 } 919 } 920 921 /** 922 * Helper function renders extended settings if any of the features there is enabled. 923 */ 924 protected function add_extended_settings(): void { 925 // Configuration for extended capabilities. 926 $extendedcapabilitiessetting = new admin_settingpage( 927 "{$this->sectionnameprefix}_extendedcapabilities", 928 get_string('config_extended_capabilities', 'bigbluebuttonbn'), 929 'moodle/site:config', 930 !((boolean) setting_validator::section_settings_extended_shown()) && ($this->moduleenabled) 931 ); 932 933 if ($this->admin->fulltree) { 934 $item = new admin_setting_heading( 935 'bigbluebuttonbn_config_extended_capabilities', 936 '', 937 get_string('config_extended_capabilities_description', 'bigbluebuttonbn') 938 ); 939 $extendedcapabilitiessetting->add($item); 940 // UI for 'notify users when recording ready' feature. 941 $item = new admin_setting_configcheckbox( 942 'bigbluebuttonbn_recordingready_enabled', 943 get_string('config_recordingready_enabled', 'bigbluebuttonbn'), 944 get_string('config_recordingready_enabled_description', 'bigbluebuttonbn'), 945 0 946 ); 947 $this->add_conditional_element( 948 'recordingready_enabled', 949 $item, 950 $extendedcapabilitiessetting 951 ); 952 $item = new admin_setting_configcheckbox( 953 'bigbluebuttonbn_profile_picture_enabled', 954 get_string('config_profile_picture_enabled', 'bigbluebuttonbn'), 955 get_string('config_profile_picture_enabled_description', 'bigbluebuttonbn'), 956 false 957 ); 958 $this->add_conditional_element( 959 'profile_picture_enabled', 960 $item, 961 $extendedcapabilitiessetting 962 ); 963 } 964 $this->admin->add($this->parent, $extendedcapabilitiessetting); 965 // Configuration for extended BN capabilities should go here. 966 } 967 968 /** 969 * Helper function renders experimental settings if any of the features there is enabled. 970 */ 971 protected function add_experimental_settings(): void { 972 // Configuration for experimental features should go here. 973 $experimentalfeaturessetting = new admin_settingpage( 974 "{$this->sectionnameprefix}_experimentalfeatures", 975 get_string('config_experimental_features', 'bigbluebuttonbn'), 976 'moodle/site:config', 977 !((boolean) setting_validator::section_settings_extended_shown()) && ($this->moduleenabled) 978 ); 979 980 if ($this->admin->fulltree) { 981 $item = new admin_setting_heading( 982 'bigbluebuttonbn_config_experimental_features', 983 '', 984 get_string('config_experimental_features_description', 'bigbluebuttonbn') 985 ); 986 $experimentalfeaturessetting->add($item); 987 // UI for 'register meeting events' feature. 988 $item = new admin_setting_configcheckbox( 989 'bigbluebuttonbn_meetingevents_enabled', 990 get_string('config_meetingevents_enabled', 'bigbluebuttonbn'), 991 get_string('config_meetingevents_enabled_description', 'bigbluebuttonbn'), 992 0 993 ); 994 $this->add_conditional_element( 995 'meetingevents_enabled', 996 $item, 997 $experimentalfeaturessetting 998 ); 999 // UI for 'register meeting events' feature. 1000 $item = new admin_setting_configcheckbox( 1001 'bigbluebuttonbn_guestaccess_enabled', 1002 get_string('config_guestaccess_enabled', 'bigbluebuttonbn'), 1003 get_string('config_guestaccess_enabled_description', 'bigbluebuttonbn'), 1004 0 1005 ); 1006 $this->add_conditional_element( 1007 'guestaccess_enabled', 1008 $item, 1009 $experimentalfeaturessetting 1010 ); 1011 } 1012 $this->admin->add($this->parent, $experimentalfeaturessetting); 1013 } 1014 1015 /** 1016 * Process reset cache. 1017 */ 1018 protected function reset_cache() { 1019 // Reset serverinfo cache. 1020 cache_helper::purge_by_event('mod_bigbluebuttonbn/serversettingschanged'); 1021 } 1022 }
title
Description
Body
title
Description
Body
title
Description
Body
title
Body