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