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