mirror of
https://github.com/moodle/moodle.git
synced 2025-08-04 16:36:37 +02:00
MDL-75604 mod_bigbluebuttonbn: Fix welcome section
* Removed welcome message from General settings * Cleaned settings.php file to remove hardcoded add($item) after adding conditional element
This commit is contained in:
parent
57c1e97bf1
commit
4d64f23395
2 changed files with 62 additions and 33 deletions
|
@ -37,7 +37,19 @@ class setting_validator {
|
||||||
public static function section_general_shown() {
|
public static function section_general_shown() {
|
||||||
global $CFG;
|
global $CFG;
|
||||||
return (!isset($CFG->bigbluebuttonbn['server_url']) ||
|
return (!isset($CFG->bigbluebuttonbn['server_url']) ||
|
||||||
!isset($CFG->bigbluebuttonbn['shared_secret']));
|
!isset($CFG->bigbluebuttonbn['shared_secret'])
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Validate if default messages section will be shown.
|
||||||
|
*
|
||||||
|
* @return bool
|
||||||
|
*/
|
||||||
|
public static function section_default_messages_shown() {
|
||||||
|
global $CFG;
|
||||||
|
return (!isset($CFG->bigbluebuttonbn['welcome_default']) ||
|
||||||
|
!isset($CFG->bigbluebuttonbn['welcome_editable']));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -85,8 +85,9 @@ class settings {
|
||||||
* Add all settings.
|
* Add all settings.
|
||||||
*/
|
*/
|
||||||
public function add_all_settings(): void {
|
public function add_all_settings(): void {
|
||||||
|
// Renders settings for welcome messages.
|
||||||
|
$this->add_defaultmessages_settings();
|
||||||
// Evaluates if recordings are enabled for the Moodle site.
|
// Evaluates if recordings are enabled for the Moodle site.
|
||||||
|
|
||||||
// Renders settings for record feature.
|
// Renders settings for record feature.
|
||||||
$this->add_record_settings();
|
$this->add_record_settings();
|
||||||
// Renders settings for import recordings.
|
// Renders settings for import recordings.
|
||||||
|
@ -188,37 +189,6 @@ class settings {
|
||||||
$item,
|
$item,
|
||||||
$settingsgeneral
|
$settingsgeneral
|
||||||
);
|
);
|
||||||
$settingsgeneral->add($item);
|
|
||||||
$item = new admin_setting_heading(
|
|
||||||
'bigbluebuttonbn_config_default_messages',
|
|
||||||
get_string('config_default_messages', 'bigbluebuttonbn'),
|
|
||||||
get_string('config_default_messages_description', 'bigbluebuttonbn')
|
|
||||||
);
|
|
||||||
$settingsgeneral->add($item);
|
|
||||||
$item = new admin_setting_configtextarea(
|
|
||||||
'bigbluebuttonbn_welcome_default',
|
|
||||||
get_string('config_welcome_default', 'bigbluebuttonbn'),
|
|
||||||
get_string('config_welcome_default_description', 'bigbluebuttonbn'),
|
|
||||||
'',
|
|
||||||
PARAM_TEXT
|
|
||||||
);
|
|
||||||
$this->add_conditional_element(
|
|
||||||
'welcome_default',
|
|
||||||
$item,
|
|
||||||
$settingsgeneral
|
|
||||||
);
|
|
||||||
$settingsgeneral->add($item);
|
|
||||||
$item = new admin_setting_configcheckbox(
|
|
||||||
'bigbluebuttonbn_welcome_editable',
|
|
||||||
get_string('config_welcome_editable', 'bigbluebuttonbn'),
|
|
||||||
get_string('config_welcome_editable_description', 'bigbluebuttonbn'),
|
|
||||||
1,
|
|
||||||
);
|
|
||||||
$this->add_conditional_element(
|
|
||||||
'welcome_editable',
|
|
||||||
$item,
|
|
||||||
$settingsgeneral
|
|
||||||
);
|
|
||||||
$item = new admin_setting_configtext(
|
$item = new admin_setting_configtext(
|
||||||
'bigbluebuttonbn_poll_interval',
|
'bigbluebuttonbn_poll_interval',
|
||||||
get_string('config_poll_interval', 'bigbluebuttonbn'),
|
get_string('config_poll_interval', 'bigbluebuttonbn'),
|
||||||
|
@ -235,6 +205,53 @@ class settings {
|
||||||
return $settingsgeneral;
|
return $settingsgeneral;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Helper function renders default messages settings if the feature is enabled.
|
||||||
|
*/
|
||||||
|
protected function add_defaultmessages_settings(): void {
|
||||||
|
// Configuration for 'default messages' feature.
|
||||||
|
$defaultmessagessetting = new admin_settingpage(
|
||||||
|
"{$this->sectionnameprefix}_default_messages",
|
||||||
|
get_string('config_default_messages', 'bigbluebuttonbn'),
|
||||||
|
'moodle/site:config',
|
||||||
|
!((boolean) setting_validator::section_default_messages_shown()) && ($this->moduleenabled)
|
||||||
|
);
|
||||||
|
|
||||||
|
if ($this->admin->fulltree) {
|
||||||
|
$item = new admin_setting_heading(
|
||||||
|
'bigbluebuttonbn_config_default_messages',
|
||||||
|
'',
|
||||||
|
get_string('config_default_messages_description', 'bigbluebuttonbn')
|
||||||
|
);
|
||||||
|
$defaultmessagessetting->add($item);
|
||||||
|
$item = new admin_setting_configtextarea(
|
||||||
|
'bigbluebuttonbn_welcome_default',
|
||||||
|
get_string('config_welcome_default', 'bigbluebuttonbn'),
|
||||||
|
get_string('config_welcome_default_description', 'bigbluebuttonbn'),
|
||||||
|
'',
|
||||||
|
PARAM_TEXT
|
||||||
|
);
|
||||||
|
$this->add_conditional_element(
|
||||||
|
'welcome_default',
|
||||||
|
$item,
|
||||||
|
$defaultmessagessetting
|
||||||
|
);
|
||||||
|
$item = new admin_setting_configcheckbox(
|
||||||
|
'bigbluebuttonbn_welcome_editable',
|
||||||
|
get_string('config_welcome_editable', 'bigbluebuttonbn'),
|
||||||
|
get_string('config_welcome_editable_description', 'bigbluebuttonbn'),
|
||||||
|
1,
|
||||||
|
);
|
||||||
|
$this->add_conditional_element(
|
||||||
|
'welcome_editable',
|
||||||
|
$item,
|
||||||
|
$defaultmessagessetting
|
||||||
|
);
|
||||||
|
}
|
||||||
|
$this->admin->add($this->parent, $defaultmessagessetting);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Helper function renders record settings if the feature is enabled.
|
* Helper function renders record settings if the feature is enabled.
|
||||||
*/
|
*/
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue