diff --git a/plugin/bbb/lang/english.php b/plugin/bbb/lang/english.php index c1ec57333c..e1a37552f7 100755 --- a/plugin/bbb/lang/english.php +++ b/plugin/bbb/lang/english.php @@ -76,3 +76,4 @@ $strings['SetByStudent'] = 'Set by student'; $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'; diff --git a/plugin/bbb/lang/french.php b/plugin/bbb/lang/french.php index ef15ca0f87..3e2a410d60 100755 --- a/plugin/bbb/lang/french.php +++ b/plugin/bbb/lang/french.php @@ -73,3 +73,4 @@ $strings['ParticipantsWillUseSameInterface'] = 'Les apprenants utiliseront la m $strings['SetByDefault'] = 'Lancement de l\'interface par défaut'; $strings['SetByTeacher'] = 'Choisi par le professeur'; $strings['SetByStudent'] = 'Choisi par l\'apprenant'; +$strings['bbb_force_record_generation'] = 'Forcer la génération de l\'enregistrement à la fin de la session'; \ No newline at end of file diff --git a/plugin/bbb/lib/bbb.lib.php b/plugin/bbb/lib/bbb.lib.php index db1e3a84ba..780e3bbd67 100755 --- a/plugin/bbb/lib/bbb.lib.php +++ b/plugin/bbb/lib/bbb.lib.php @@ -143,8 +143,8 @@ class bbb public function forceCIdReq($courseCode, $sessionId = 0, $groupId = 0) { $this->courseCode = $courseCode; - $this->sessionId = intval($sessionId); - $this->groupId = intval($groupId); + $this->sessionId = (int) $sessionId; + $this->groupId = (int) $groupId; } /** @@ -265,39 +265,40 @@ class bbb if ($max < 0) { $max = 0; } - $this->maxUsersLimit = intval($max); + $this->maxUsersLimit = (int) $max; } /** * See this file in you BBB to set up default values - * @param array $params Array of parameters that will be completed if not containing all expected variables - - /var/lib/tomcat6/webapps/bigbluebutton/WEB-INF/classes/bigbluebutton.properties * - More record information: - http://code.google.com/p/bigbluebutton/wiki/RecordPlaybackSpecification - - # Default maximum number of users a meeting can have. - # Doesn't get enforced yet but is the default value when the create - # API doesn't pass a value. - defaultMaxUsers=20 - - # Default duration of the meeting in minutes. - # Current default is 0 (meeting doesn't end). - defaultMeetingDuration=0 - - # Remove the meeting from memory when the end API is called. - # This allows 3rd-party apps to recycle the meeting right-away - # instead of waiting for the meeting to expire (see below). - removeMeetingWhenEnded=false - - # The number of minutes before the system removes the meeting from memory. - defaultMeetingExpireDuration=1 - - # The number of minutes the system waits when a meeting is created and when - # a user joins. If after this period, a user hasn't joined, the meeting is - # removed from memory. - defaultMeetingCreateJoinDuration=5 + * @param array $params Array of parameters that will be completed if not containing all expected variables + * + * /var/lib/tomcat6/webapps/bigbluebutton/WEB-INF/classes/bigbluebutton.properties + * + * More record information: + * http://code.google.com/p/bigbluebutton/wiki/RecordPlaybackSpecification + * + * Default maximum number of users a meeting can have. + * Doesn't get enforced yet but is the default value when the create + * API doesn't pass a value. + * defaultMaxUsers=20 + * + * Default duration of the meeting in minutes. + * Current default is 0 (meeting doesn't end). + * defaultMeetingDuration=0 + * + * Remove the meeting from memory when the end API is called. + * This allows 3rd-party apps to recycle the meeting right-away + * instead of waiting for the meeting to expire (see below). + * removeMeetingWhenEnded=false + * + * The number of minutes before the system removes the meeting from memory. + * defaultMeetingExpireDuration=1 + * + * The number of minutes the system waits when a meeting is created and when + * a user joins. If after this period, a user hasn't joined, the meeting is + * removed from memory. + * defaultMeetingCreateJoinDuration=5 * * @return mixed */ @@ -361,7 +362,7 @@ class bbb 'dialNumber' => '', // The main number to call into. Optional. 'voiceBridge' => $params['voice_bridge'], // PIN to join voice. Required. 'webVoice' => '', // Alphanumeric to join voice. Optional. - 'logoutUrl' => $this->logoutUrl, + 'logoutUrl' => $this->logoutUrl.'&action=logout&remote_id='.$params['remote_id'], 'maxParticipants' => $max, // Optional. -1 = unlimitted. Not supported in BBB. [number] 'record' => $record, // New. 'true' will tell BBB to record the meeting. 'duration' => $duration, // Default = 0 which means no set duration in minutes. [number] @@ -374,7 +375,8 @@ class bbb $result = $this->api->createMeetingWithXmlResponseArray($bbbParams); if (isset($result) && strval($result['returncode']) == 'SUCCESS') { if ($this->plugin->get('allow_regenerate_recording') === 'true') { - $sql = "UPDATE $this->table SET internal_meeting_id = '".$result['internalMeetingID']."' + $internalId = Database::escape_string($result['internalMeetingID']); + $sql = "UPDATE $this->table SET internal_meeting_id = '".$internalId."' WHERE id = $id"; Database::query($sql); } @@ -1098,12 +1100,12 @@ class bbb } /** - * @param int $id - * @param int $recordId + * @param int $id + * @param string $recordId * * @return bool */ - public function regenerateRecording($id, $recordId) + public function regenerateRecording($id, $recordId = '') { if ($this->plugin->get('allow_regenerate_recording') !== 'true') { return false; @@ -1519,6 +1521,25 @@ class bbb return $meetingData; } + /** + * Get the meeting info. + * + * @param int $id + * + * @return array + */ + public function getMeetingByRemoteId($id) + { + $meetingData = Database::select( + '*', + 'plugin_bbb_meeting', + array('where' => array('remote_id = ?' => $id)), + 'first' + ); + + return $meetingData; + } + /** * @param int $meetingId * @return array diff --git a/plugin/bbb/lib/bbb_plugin.class.php b/plugin/bbb/lib/bbb_plugin.class.php index dc1f7fef56..205a774f1f 100755 --- a/plugin/bbb/lib/bbb_plugin.class.php +++ b/plugin/bbb/lib/bbb_plugin.class.php @@ -33,6 +33,10 @@ class BBBPlugin extends Plugin [ 'name' => 'bbb_enable_conference_in_groups', 'type' => 'checkbox', + ], + [ + 'name' => 'bbb_force_record_generation', + 'type' => 'checkbox', ] ]; @@ -42,7 +46,7 @@ class BBBPlugin extends Plugin protected function __construct() { parent::__construct( - '2.8', + '2.8.1', 'Julio Montoya, Yannick Warnier, Angel Fernando Quiroz Campos', [ 'tool_enable' => 'boolean', diff --git a/plugin/bbb/listing.php b/plugin/bbb/listing.php index fcd9970724..98609d4de2 100755 --- a/plugin/bbb/listing.php +++ b/plugin/bbb/listing.php @@ -27,6 +27,9 @@ if ($bbb->isGlobalConference()) { api_protect_course_script(true); } +$courseInfo = api_get_course_info(); +$courseCode = isset($courseInfo['code']) ? $courseInfo['code'] : ''; + $message = ''; if ($conferenceManager) { switch ($action) { @@ -64,7 +67,7 @@ if ($conferenceManager) { break; case 'regenerate_record': if ($plugin->get('allow_regenerate_recording') !== 'true') { - api_not_allowed(); + api_not_allowed(true); } $recordId = isset($_GET['record_id']) ? $_GET['record_id'] : ''; $result = $bbb->regenerateRecording($_GET['id'], $recordId); @@ -115,10 +118,35 @@ if ($conferenceManager) { exit; break; case 'publish': - $result = $bbb->publishMeeting($_GET['id']); + $bbb->publishMeeting($_GET['id']); + Display::addFlash(Display::return_message(get_lang('Updated'))); + header('Location: '.$bbb->getListingUrl()); + exit; break; case 'unpublish': - $result = $bbb->unpublishMeeting($_GET['id']); + $bbb->unpublishMeeting($_GET['id']); + Display::addFlash(Display::return_message(get_lang('Updated'))); + header('Location: '.$bbb->getListingUrl()); + exit; + break; + case 'logout': + if ($plugin->get('allow_regenerate_recording') !== 'true') { + api_not_allowed(true); + } + $allow = api_get_course_setting('bbb_force_record_generation', $courseCode) == 1 ? true : false; + if ($allow) { + $result = $bbb->getMeetingByRemoteId($_GET['remote_id']); + if (!empty($result)) { + $result = $bbb->regenerateRecording($result['id']); + if ($result) { + Display::addFlash(Display::return_message(get_lang('Success'))); + } else { + Display::addFlash(Display::return_message(get_lang('Error'), 'error')); + } + } + } + header('Location: '.$bbb->getListingUrl()); + exit; break; default: break;