diff --git a/plugin/bbb/README.md b/plugin/bbb/README.md index 8b48e04fc6..ef097d7223 100644 --- a/plugin/bbb/README.md +++ b/plugin/bbb/README.md @@ -16,7 +16,8 @@ ALTER TABLE plugin_bbb_meeting ADD voice_bridge int NOT NULL DEFAULT 1; ALTER TABLE plugin_bbb_meeting ADD group_id int unsigned NOT NULL DEFAULT 0; ``` ## Migrating to Chamilo LMS 1.11.x -For Chamilo 1.11.x, Videoconference plugin has two new settings options: +For Chamilo 1.11.x, Videoconference plugin has one new setting option: +*Disable Course Settings*. ##### Database changes You need execute this SQL query in your database after making the Chamilo migration process from 1.10.x. diff --git a/plugin/bbb/lang/english.php b/plugin/bbb/lang/english.php index a1f08e2926..349752d911 100755 --- a/plugin/bbb/lang/english.php +++ b/plugin/bbb/lang/english.php @@ -77,3 +77,4 @@ $strings['SetByTeacher'] = 'Set by teacher'; $strings['SetByDefault'] = 'Set to default interface'; $strings['allow_regenerate_recording'] = 'Allow regenerate recording'; $strings['bbb_force_record_generation'] = 'Force record generation at the end of the meeting'; +$strings['disable_course_settings'] = 'Disable course settings'; diff --git a/plugin/bbb/lib/bbb_plugin.class.php b/plugin/bbb/lib/bbb_plugin.class.php index 2f8c8be173..c44deeb5ba 100755 --- a/plugin/bbb/lib/bbb_plugin.class.php +++ b/plugin/bbb/lib/bbb_plugin.class.php @@ -87,6 +87,7 @@ class BBBPlugin extends Plugin 'big_blue_button_record_and_store' => 'checkbox', 'bbb_enable_conference_in_groups' => 'checkbox', 'bbb_force_record_generation' => 'checkbox', + 'disable_course_settings' => 'boolean', ] ); @@ -110,6 +111,10 @@ class BBBPlugin extends Plugin */ public function validateCourseSetting($variable) { + if ($this->get('disable_course_settings') === 'true') { + return false; + } + $result = true; switch ($variable) { case 'bbb_enable_conference_in_groups': @@ -124,6 +129,41 @@ class BBBPlugin extends Plugin return $result; } + /** + * + * @return array + */ + public function getCourseSettings() + { + $settings = []; + if ($this->get('disable_course_settings') !== 'true') { + $settings = parent::getCourseSettings(); + } + + return $settings; + } + + /** + * + * @return \Plugin + */ + public function performActionsAfterConfigure() + { + $result = $this->get('disable_course_settings') === 'true'; + if ($result) { + $valueConference = $this->get('bbb_enable_conference_in_groups') === 'true' ? 1 : 0; + self::update_course_field_in_all_courses('bbb_enable_conference_in_groups', $valueConference); + + $valueForceRecordGeneration = $this->get('bbb_force_record_generation') === 'true' ? 1 : 0; + self::update_course_field_in_all_courses('bbb_force_record_generation', $valueForceRecordGeneration); + + $valueForceRecordStore = $this->get('big_blue_button_record_and_store') === 'true' ? 1 : 0; + self::update_course_field_in_all_courses('big_blue_button_record_and_store', $valueForceRecordStore); + } + + return $this; + } + /** * Install */ @@ -315,4 +355,27 @@ class BBBPlugin extends Plugin return $data; } + + /** + * Set the course setting in all courses + * + * @param bool $variable Course setting to update + * @param bool $value New values of the course setting + */ + public function update_course_field_in_all_courses($variable, $value) + { + // Update existing courses to add the new course setting value + $table = Database::get_main_table(TABLE_MAIN_COURSE); + $sql = "SELECT id FROM $table ORDER BY id"; + $res = Database::query($sql); + while ($row = Database::fetch_assoc($res)) { + $courseSettingTable = Database::get_course_table(TABLE_COURSE_SETTING); + + Database::update( + $courseSettingTable, + ['value' => $value], + ['variable = ? AND c_id = ?' => [$variable, $row['id']]] + ); + } + } }