add bbb plugin option to hide settings on course administration options

pull/3213/head
juan-cortizas-ponte 6 years ago
parent b5481d8e12
commit 5d368bc2bc
  1. 3
      plugin/bbb/README.md
  2. 1
      plugin/bbb/lang/english.php
  3. 63
      plugin/bbb/lib/bbb_plugin.class.php

@ -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.

@ -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';

@ -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']]]
);
}
}
}

Loading…
Cancel
Save