Add bbb interface option (flash or html5) see BT#14664

- New DB changes are needed see README file
- Remove DB changes from changelog
- Update version to 2.7
- Fix overwrite of js code "var _p = {web_plugin"
-
pull/2606/head
Julio Montoya 7 years ago
parent b8aa1fd499
commit 85ef745825
  1. 12
      main/inc/lib/plugin.class.php
  2. 21
      plugin/bbb/README.md
  3. 10
      plugin/bbb/admin.php
  4. 27
      plugin/bbb/changelog.md
  5. 7
      plugin/bbb/lang/english.php
  6. 173
      plugin/bbb/lib/bbb.lib.php
  7. 10
      plugin/bbb/lib/bbb_api.php
  8. 83
      plugin/bbb/lib/bbb_plugin.class.php
  9. 82
      plugin/bbb/listing.php
  10. 6
      plugin/bbb/listing.tpl
  11. 6
      plugin/bbb/start.php

@ -523,7 +523,7 @@ class Plugin
return true;
}
//Add an icon in the table tool list
// Add an icon in the table tool list
$this->createLinkToCourseTool($plugin_name, $courseId);
}
@ -537,7 +537,7 @@ class Plugin
*/
public function uninstall_course_fields($courseId)
{
$courseId = intval($courseId);
$courseId = (int) $courseId;
if (empty($courseId)) {
return false;
@ -581,8 +581,8 @@ class Plugin
public function install_course_fields_in_all_courses($add_tool_link = true)
{
// Update existing courses to add plugin settings
$t_courses = Database::get_main_table(TABLE_MAIN_COURSE);
$sql = "SELECT id FROM $t_courses ORDER BY id";
$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)) {
$this->install_course_fields($row['id'], $add_tool_link);
@ -595,8 +595,8 @@ class Plugin
public function uninstall_course_fields_in_all_courses()
{
// Update existing courses to add conference settings
$t_courses = Database::get_main_table(TABLE_MAIN_COURSE);
$sql = "SELECT id FROM $t_courses
$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)) {

@ -28,19 +28,20 @@ ALTER TABLE plugin_bbb_meeting ADD access_url int NOT NULL DEFAULT 1;
```
For version 2.5 you need execute these SQL queries
```sql
CREATE TABLE plugin_bbb_room (
CREATE TABLE IF NOT EXISTS plugin_bbb_room (
id int NOT NULL AUTO_INCREMENT PRIMARY KEY,
meeting_id int(10) unsigned NOT NULL,
participant_id int(11) NOT NULL,
in_at datetime NOT NULL,
out_at datetime NOT NULL,
FOREIGN KEY (meeting_id) REFERENCES plugin_bbb_meeting (id),
FOREIGN KEY (participant_id) REFERENCES user (id)
out_at datetime NOT NULL
);
ALTER TABLE plugin_bbb_meeting ADD video_url TEXT NULL;
ALTER TABLE plugin_bbb_meeting ADD has_video_m4v TINYINT NOT NULL DEFAULT 0;
ALTER TABLE plugin_bbb_meeting ADD COLUMN video_url TEXT NULL;
ALTER TABLE plugin_bbb_meeting ADD COLUMN has_video_m4v TINYINT NOT NULL DEFAULT 0;
ALTER TABLE plugin_bbb_meeting ADD COLUMN user_id INT DEFAULT 0;
ALTER TABLE plugin_bbb_meeting ADD COLUMN access_url INT DEFAULT 0;
ALTER TABLE plugin_bbb_meeting ADD COLUMN remote_id char(30);
ALTER TABLE plugin_bbb_meeting ADD COLUMN visibility TINYINT NOT NULL DEFAULT 1;
ALTER TABLE plugin_bbb_meeting ADD COLUMN session_id INT DEFAULT 0;
```
For version 2.6 (adding limits) you need execute these SQL queries
```sql
@ -48,3 +49,11 @@ INSERT INTO settings_current (variable, subkey, type, category, selected_value,
INSERT INTO extra_field (extra_field_type, field_type, variable, display_text, default_value, field_order, visible_to_self, visible_to_others, changeable, filter, created_at) VALUES (2, 15, 'plugin_bbb_course_users_limit', 'MaxUsersInConferenceRoom', '0', 1, 1, 0, 1, null, '2017-05-28 01:19:32');
INSERT INTO extra_field (extra_field_type, field_type, variable, display_text, default_value, field_order, visible_to_self, visible_to_others, changeable, filter, created_at) VALUES (3, 15, 'plugin_bbb_session_users_limit', 'MaxUsersInConferenceRoom', null, 1, 1, 0, 1, null, '2017-05-28 01:19:32');
```
For version 2.7
```sql
ALTER TABLE plugin_bbb_meeting ADD COLUMN interface INT NOT NULL DEFAULT 0;
ALTER TABLE plugin_bbb_room ADD COLUMN interface INT NOT NULL DEFAULT 0;
ALTER TABLE plugin_bbb_room MODIFY COLUMN in_at datetime;
ALTER TABLE plugin_bbb_room MODIFY COLUMN out_at datetime;
```

@ -1,10 +1,13 @@
<?php
/* For license terms, see /license.txt */
use Chamilo\UserBundle\Entity\User;
/**
* This script initiates a video conference session, calling the BigBlueButton API.
*
* @package chamilo.plugin.bigbluebutton
*/
use Chamilo\UserBundle\Entity\User;
$course_plugin = 'bbb'; //needed in order to load the plugin lang variables
$cidReset = true;
@ -43,13 +46,12 @@ if ($form->validate()) {
$meetings = $bbb->getMeetings(0, 0, 0, true, $dateRange);
foreach ($meetings as &$meeting) {
$participants = $bbb->findMeetingParticipants($meeting['id']);
$participants = $bbb->findConnectedMeetingParticipants($meeting['id']);
foreach ($participants as $meetingParticipant) {
/** @var User $participant */
$participant = $meetingParticipant['participant'];
$meeting['participants'][] = $participant->getCompleteName()
.' ('.$participant->getEmail().')';
$meeting['participants'][] = $participant->getCompleteName().' ('.$participant->getEmail().')';
}
}

@ -1,37 +1,33 @@
Version 2.7 - 2018-07
---------------------
* Add interface option (HTML5 or Flash)
Version 2.6 - 2017-05
---------------------
* Add max users limit
* Requires the following database changes
* INSERT INTO chamilo111x.settings_current (variable, subkey, type, category, selected_value, title, comment, scope, subkeytext, access_url, access_url_changeable, access_url_locked) VALUES ('bbb_max_users_limit', 'bbb', 'setting', 'Plugins', '3', 'bbb', null, null, null, 1, 1, 0);
* INSERT INTO chamilo111x.extra_field (extra_field_type, field_type, variable, display_text, default_value, field_order, visible_to_self, visible_to_others, changeable, filter, created_at) VALUES (2, 15, 'plugin_bbb_course_users_limit', 'MaxUsersInConferenceRoom', '0', 1, 1, 0, 1, null, '2017-05-28 01:19:32');
* INSERT INTO chamilo111x.extra_field (extra_field_type, field_type, variable, display_text, default_value, field_order, visible_to_self, visible_to_others, changeable, filter, created_at) VALUES (3, 15, 'plugin_bbb_session_users_limit', 'MaxUsersInConferenceRoom', null, 1, 1, 0, 1, null, '2017-05-28 01:19:32');
Version 2.5 - 2016-07
---------------------
* User global conference support
* Requires a database change: "ALTER TABLE plugin_bbb_meeting ADD COLUMN user_id INT DEFAULT 0"
* Requires a database change: "ALTER TABLE plugin_bbb_meeting ADD COLUMN access_url INT DEFAULT 0"
Version 2.4 - 2016-05
------------------------
Changes:
* Global conference support (Requires to update the plugin settings).
* Course group conference support
* Requires a database change: "ALTER TABLE plugin_bbb_meeting ADD COLUMN group_id INT DEFAULT 0"
* Requires to update the plugin settings.
Version 2.3 - 2015-05-18
------------------------
Changes:
* Added support for variable voiceBridge to be sent on meeting creation. See https://code.google.com/p/bigbluebutton/issues/detail?can=2&start=0&num=100&q=&colspec=ID%20Type%20Status%20Priority%20Milestone%20Owner%20Component%20Summary&groupby=&sort=&id=1186 and https://support.chamilo.org/issues/7669 for details.
* Requires a database change: "ALTER TABLE plugin_bbb_meeting ADD COLUMN voice_bridge INT NOT NULL DEFAULT 1;"
* Added support for variable voiceBridge to be sent on meeting creation. See:
https://code.google.com/p/bigbluebutton/issues/detail?can=2&start=0&num=100&q=&colspec=ID%20Type%20Status%20Priority%20Milestone%20Owner%20Component%20Summary&groupby=&sort=&id=1186
and https://support.chamilo.org/issues/7669 for details.
Version 2.2 - 2014-10-15
------------------------
Changes:
* Add a pseudo-random guid to avoid clashing conferences when several Chamilo portals use the same server. If you were using this plugin before, you will have to update the plugin_bbb_meeting table to "alter table plugin_bbb_meeting add column remote_id char(36);".
* Add possibility to hide recordings of previous conferences from the list. If you were using this plugin before, you will have to update the plugin_bbb_meeting table to "alter table plugin_bbb_meeting add column visibility tinytint not null default 1;".
* Add a pseudo-random guid to avoid clashing conferences when several Chamilo portals use the same server.
* Add possibility to hide recordings of previous conferences from the list.
* Show action icons in the action column
* Hide the ID of the meeting (this was an internal ID, useless to the final user). It is still in the HTML source, however
* Show number of minutes of the recording (in the recordings list)
@ -39,8 +35,7 @@ Changes:
Version 2.1
-----------
Released with: Chamilo LMS 1.9.8
Changes:
* now supports sessions (requires you to "alter table plugin_bbb_meeting add column session_id int default 0;")
* Session support
Version 2.0
-----------

@ -66,4 +66,9 @@ $strings['MaxXUsersReached'] = 'The limit of %s simultaneous users has been reac
$strings['MaxXUsersReachedManager'] = 'The limit of %s simultaneous users has been reached for this conference room. To increase this limit, please contact the platform administrator.';
$strings['MaxUsersInConferenceRoom'] = 'Max simultaneous users in a conference room';
$strings['global_conference_allow_roles'] = "Global conference link only visible for this user roles";
$strings['CreatedAt'] = "Created at";
$strings['CreatedAt'] = 'Created at';
$strings['interface'] = 'Interface';
$strings['launch_type'] = 'Launch type';
$strings['EnterConferenceFlash'] = 'Enter the videoconference (Flash client)';
$strings['EnterConferenceHTML5'] = 'Enter the videoconference (HTML5 client)';

@ -113,13 +113,18 @@ class bbb
$this->salt = $bbb_salt;
$info = parse_url($bbb_host);
$this->url = $bbb_host.'/bigbluebutton/';
if (isset($info['scheme'])) {
$this->protocol = $info['scheme'].'://';
$this->url = str_replace($this->protocol, '', $this->url);
$urlWithProtocol = $bbb_host;
} else {
$urlWithProtocol = '://'.$bbb_host;
}
// Setting BBB api
define('CONFIG_SECURITY_SALT', $this->salt);
define('CONFIG_SERVER_URL_WITH_PROTOCOL', $urlWithProtocol);
define('CONFIG_SERVER_BASE_URL', $this->url);
$this->api = new BigBlueButtonBN();
@ -228,7 +233,7 @@ class bbb
$extraValue = new ExtraFieldValue('course');
$value = $extraValue->get_values_by_handler_and_field_id($this->courseId, $fieldId[0]['id']);
if (!empty($value['value'])) {
$courseLimit = $value['value'];
$courseLimit = (int) $value['value'];
}
}
if (!empty($this->sessionId)) {
@ -239,7 +244,7 @@ class bbb
$extraValue = new ExtraFieldValue('session');
$value = $extraValue->get_values_by_handler_and_field_id($this->sessionId, $fieldId[0]['id']);
if (!empty($value['value'])) {
$sessionLimit = $value['value'];
$sessionLimit = (int) $value['value'];
}
}
if (!empty($sessionLimit)) {
@ -247,7 +252,7 @@ class bbb
} elseif (!empty($courseLimit)) {
return $courseLimit;
}
return $limit;
return (int) $limit;
}
/**
@ -333,6 +338,14 @@ class bbb
$params['created_at'] = api_get_utc_datetime();
$params['access_url'] = $this->accessUrl;
// Check interface feature is installed
$interfaceFeature = $this->plugin->get('interface');
if ($interfaceFeature === false) {
if (isset($params['interface'])) {
unset($params['interface']);
}
}
$id = Database::insert($this->table, $params);
if ($id) {
@ -395,34 +408,38 @@ class bbb
* Save a participant in a meeting room
* @param int $meetingId
* @param int $participantId
* @param int $interface
*
* @return false|int The last inserted ID. Otherwise return false
*/
public function saveParticipant($meetingId, $participantId)
public function saveParticipant($meetingId, $participantId, $interface = 0)
{
$params = [
'meeting_id' => $meetingId,
'participant_id' => $participantId,
'in_at' => api_get_utc_datetime(),
'out_at' => api_get_utc_datetime()
];
if ($this->plugin->get('interface') !== false) {
$params['interface'] = $interface;
}
return Database::insert(
'plugin_bbb_room',
[
'meeting_id' => $meetingId,
'participant_id' => $participantId,
'in_at' => api_get_utc_datetime(),
'out_at' => api_get_utc_datetime()
]
$params
);
}
/**
* Tells whether the given meeting exists and is running
* (using course code as name)
* @param string $meetingName Meeting name (usually the course code)
* @param string $meetingName
*
* @return bool True if meeting exists, false otherwise
* @assert ('') === false
* @assert ('abcdefghijklmnopqrstuvwxyzabcdefghijklmno') === false
* @return array
*/
public function meetingExists($meetingName)
public function getMeetingByName($meetingName)
{
if (empty($meetingName)) {
return false;
return [];
}
$courseId = api_get_course_int_id();
@ -457,16 +474,27 @@ class bbb
'first'
);
if ($this->debug) {
error_log("meeting_exists ".print_r($meetingData, 1));
error_log('meeting_exists '.print_r($meetingData, 1));
}
if (empty($meetingData)) {
return false;
} else {
return true;
}
return $meetingData;
}
/**
* Tells whether the given meeting exists and is running
* (using course code as name)
* @param string $meetingName Meeting name (usually the course code)
*
* @return bool True if meeting exists, false otherwise
* @assert ('') === false
* @assert ('abcdefghijklmnopqrstuvwxyzabcdefghijklmno') === false
*/
public function meetingExists($meetingName)
{
$meetingData = $this->getMeetingByName($meetingName);
return !empty($meetingData);
}
/**
@ -565,14 +593,15 @@ class bbb
$url = false;
if ($meetingInfoExists) {
$joinParams = array(
$joinParams = [
'meetingId' => $meetingData['remote_id'], // -- REQUIRED - A unique id for the meeting
'username' => $this->userCompleteName, //-- REQUIRED - The name that will display for the user in the meeting
'password' => $pass, //-- REQUIRED - The attendee or moderator password, depending on what's passed here
//'createTime' => api_get_utc_datetime(), //-- OPTIONAL - string. Leave blank ('') unless you set this correctly.
'userID' => api_get_user_id(), //-- OPTIONAL - string
'webVoiceConf' => '' // -- OPTIONAL - string
);
'webVoiceConf' => '', // -- OPTIONAL - string
'interface' => $this->checkInterface($meetingData),
];
$url = $this->api->getJoinMeetingURL($joinParams);
$url = $this->protocol.$url;
}
@ -836,14 +865,15 @@ class bbb
$item['unpublish_url'] = $this->unPublishUrl($meetingBBB);
if ($meetingDB['status'] == 1) {
$joinParams = array(
$joinParams = [
'meetingId' => $meetingDB['remote_id'], //-- REQUIRED - A unique id for the meeting
'username' => $this->userCompleteName, //-- REQUIRED - The name that will display for the user in the meeting
'password' => $pass, //-- REQUIRED - The attendee or moderator password, depending on what's passed here
'createTime' => '', //-- OPTIONAL - string. Leave blank ('') unless you set this correctly.
'userID' => '', // -- OPTIONAL - string
'webVoiceConf' => '' // -- OPTIONAL - string
);
'webVoiceConf' => '', // -- OPTIONAL - string
'interface' => $this->checkInterface($meetingDB),
];
$item['go_url'] = $this->protocol.$this->api->getJoinMeetingURL($joinParams);
}
$item = array_merge($item, $meetingDB, $meetingBBB);
@ -856,6 +886,42 @@ class bbb
return $newMeetingList;
}
/**
* @param $meetingInfo
*
* @return int
*/
public function checkInterface($meetingInfo)
{
$interface = BBBPlugin::LAUNCH_TYPE_DEFAULT;
$type = $this->plugin->get('launch_type');
switch ($type) {
case BBBPlugin::LAUNCH_TYPE_DEFAULT:
$interface = $this->plugin->get('interface');
break;
case BBBPlugin::LAUNCH_TYPE_SET_BY_TEACHER:
if (isset($meetingInfo['interface'])) {
$interface = $meetingInfo['interface'];
}
break;
case BBBPlugin::LAUNCH_TYPE_SET_BY_STUDENT:
if (isset($meetingInfo['id'])) {
$roomInfo = $this->getMeetingParticipantInfo($meetingInfo['id'], api_get_user_id());
if (!empty($roomInfo) && isset($roomInfo['interface'])) {
$interface = $roomInfo['interface'];
} else {
if (isset($_REQUEST['interface'])) {
$interface = isset($_REQUEST['interface']) ? (int) $_REQUEST['interface'] : 0;
}
}
}
break;
}
return $interface;
}
/**
* Function disabled
*/
@ -1334,6 +1400,7 @@ class bbb
/**
* Get the meeting info from DB by its name
* @param string $name
*
* @return array
*/
public function findMeetingByName($name)
@ -1348,16 +1415,34 @@ class bbb
return $meetingData;
}
/**
* Get the meeting info from DB by its name
* @param int $id
*
* @return array
*/
public function getMeeting($id)
{
$meetingData = Database::select(
'*',
'plugin_bbb_meeting',
array('where' => array('id = ?' => $id)),
'first'
);
return $meetingData;
}
/**
* @param int $meetingId
* @return array
*/
public function findMeetingParticipants($meetingId)
public function findConnectedMeetingParticipants($meetingId)
{
$meetingData = Database::select(
'*',
'plugin_bbb_room',
array('where' => array('meeting_id = ?' => intval($meetingId)))
array('where' => array('meeting_id = ? AND in_at IS NOT NULL' => $meetingId))
);
$participantIds = [];
$return = [];
@ -1381,6 +1466,28 @@ class bbb
return $return;
}
/**
* @param int $meetingId
* @param int $userId
*
* @return array
*/
public function getMeetingParticipantInfo($meetingId, $userId)
{
$meetingData = Database::select(
'*',
'plugin_bbb_room',
array('where' => array('meeting_id = ? AND participant_id = ?' => [$meetingId, $userId])),
'first'
);
if ($meetingData) {
return $meetingData;
}
return [];
}
/**
* @param array $meetingInfo
* @param array $recordInfo

@ -219,8 +219,16 @@ class BigBlueButtonBN {
if (((isset($joinParams['createTime'])) && ($joinParams['createTime'] != ''))) {
$params .= '&createTime='.urlencode($joinParams['createTime']);
}
if (isset($joinParams['interface']) && (int) $joinParams['interface'] === BBBPlugin::INTERFACE_HTML5) {
$bbbHost = api_remove_trailing_slash(CONFIG_SERVER_URL_WITH_PROTOCOL);
$params .= '&redirectClient=true&clientURL='.$bbbHost.'/html5client/join';
}
// Return the URL:
return ($joinUrl.$params.'&checksum='.sha1("join".$params.$this->_securitySalt));
$url = $joinUrl.$params.'&checksum='.sha1('join'.$params.$this->_securitySalt);
return $url;
}
public function getEndMeetingURL($endParams) {

@ -1,5 +1,6 @@
<?php
/* For licensing terms, see /license.txt */
/* To show the plugin course icons you need to add these icons:
* main/img/icons/22/plugin_name.png
* main/img/icons/64/plugin_name.png
@ -8,12 +9,19 @@
/**
* Videoconference plugin with BBB
*/
//namespace Chamilo\Plugin\BBB;
/**
* Class BBBPlugin
*/
class BBBPlugin extends Plugin
{
const INTERFACE_FLASH = 0;
const INTERFACE_HTML5 = 1;
const LAUNCH_TYPE_DEFAULT = 0;
const LAUNCH_TYPE_SET_BY_TEACHER = 1;
const LAUNCH_TYPE_SET_BY_STUDENT = 2;
public $isCoursePlugin = true;
// When creating a new course this settings are added to the course
@ -34,7 +42,7 @@ class BBBPlugin extends Plugin
protected function __construct()
{
parent::__construct(
'2.6',
'2.7',
'Julio Montoya, Yannick Warnier, Angel Fernando Quiroz Campos',
[
'tool_enable' => 'boolean',
@ -54,6 +62,21 @@ class BBBPlugin extends Plugin
STUDENT_BOSS => get_lang('StudentBoss')
],
'attributes' => ['multiple' => 'multiple']
],
'interface' => [
'type' => 'select',
'options' => [
self::INTERFACE_FLASH => 'Flash',
self::INTERFACE_HTML5 => 'HTML5',
]
],
'launch_type' => [
'type' => 'select',
'options' => [
self::LAUNCH_TYPE_DEFAULT => 'Default',
self::LAUNCH_TYPE_SET_BY_TEACHER => 'Set by teacher',
self::LAUNCH_TYPE_SET_BY_STUDENT => 'Set by student',
]
]
]
);
@ -92,8 +115,7 @@ class BBBPlugin extends Plugin
*/
public function install()
{
$table = Database::get_main_table('plugin_bbb_meeting');
$sql = "CREATE TABLE IF NOT EXISTS $table (
$sql = "CREATE TABLE IF NOT EXISTS plugin_bbb_meeting (
id INT unsigned NOT NULL auto_increment PRIMARY KEY,
c_id INT unsigned NOT NULL DEFAULT 0,
group_id INT unsigned NOT NULL DEFAULT 0,
@ -113,7 +135,8 @@ class BBBPlugin extends Plugin
voice_bridge INT NOT NULL DEFAULT 1,
access_url INT NOT NULL DEFAULT 1,
video_url TEXT NULL,
has_video_m4v TINYINT NOT NULL DEFAULT 0
has_video_m4v TINYINT NOT NULL DEFAULT 0,
interface INT NOT NULL DEFAULT 0
)";
Database::query($sql);
@ -122,8 +145,9 @@ class BBBPlugin extends Plugin
id int NOT NULL AUTO_INCREMENT PRIMARY KEY,
meeting_id int NOT NULL,
participant_id int(11) NOT NULL,
in_at datetime NOT NULL,
out_at datetime NOT NULL
in_at datetime,
out_at datetime,
interface int NOT NULL DEFAULT 0
);"
);
$fieldLabel = 'plugin_bbb_course_users_limit';
@ -190,7 +214,9 @@ class BBBPlugin extends Plugin
'bbb_plugin_host',
'bbb_plugin_salt',
'max_users_limit',
'global_conference_allow_roles'
'global_conference_allow_roles',
'interface',
'launch_type',
];
foreach ($variables as $variable) {
@ -225,4 +251,45 @@ class BBBPlugin extends Plugin
// Deleting course settings
$this->uninstall_course_fields_in_all_courses($this->course_settings);
}
/**
* @param string $conferenceUrl
*
* @return string
*/
public function getUrlInterfaceLinks($conferenceUrl)
{
$url = $this->getFlashUrl($conferenceUrl);
$url .= '&nbsp;'.$this->getHtmlUrl($conferenceUrl);
return $url;
}
/**
* @param string $conferenceUrl
*
* @return string
*/
public function getFlashUrl($conferenceUrl)
{
return Display::url(
$this->get_lang('EnterConferenceFlash'),
$conferenceUrl.'&interface='.self::INTERFACE_FLASH,
['target' => '_blank', 'class' => 'btn btn-primary btn-large']
);
}
/**
* @param string $conferenceUrl
*
* @return string
*/
public function getHtmlUrl($conferenceUrl)
{
return Display::url(
$this->get_lang('EnterConferenceHTML5'),
$conferenceUrl.'&interface='.self::INTERFACE_HTML5,
['target' => '_blank', 'class' => 'btn btn-primary btn-large']
);
}
}

@ -12,16 +12,11 @@ require_once __DIR__.'/config.php';
$plugin = BBBPlugin::create();
$tool_name = $plugin->get_lang('Videoconference');
$htmlHeadXtra[] = api_get_js_simple(
api_get_path(WEB_PLUGIN_PATH).'bbb/resources/utils.js'
);
$htmlHeadXtra[] = "<script>var _p = {web_plugin: '".api_get_path(WEB_PLUGIN_PATH)."'}</script>";
$tpl = new Template($tool_name);
$htmlHeadXtra[] = api_get_js_simple(api_get_path(WEB_PLUGIN_PATH).'bbb/resources/utils.js');
$isGlobal = isset($_GET['global']) ? true : false;
$isGlobalPerUser = isset($_GET['user_id']) ? (int) $_GET['user_id'] : false;
$action = isset($_GET['action']) ? $_GET['action'] : null;
$action = isset($_GET['action']) ? $_GET['action'] : '';
$bbb = new bbb('', '', $isGlobal, $isGlobalPerUser);
@ -41,7 +36,7 @@ if ($conferenceManager) {
}
$courseInfo = api_get_course_info();
$agenda = new Agenda('course');
$id = intval($_GET['id']);
$id = (int) $_GET['id'];
$title = sprintf($plugin->get_lang('VideoConferenceXCourseX'), $id, $courseInfo['name']);
$content = Display::url($plugin->get_lang('GoToTheVideoConference'), $_GET['url']);
@ -91,12 +86,10 @@ if ($conferenceManager) {
if (file_exists(__DIR__.'/config.vm.php')) {
require __DIR__.'/../../vendor/autoload.php';
require __DIR__.'/lib/vm/AbstractVM.php';
require __DIR__.'/lib/vm/VMInterface.php';
require __DIR__.'/lib/vm/DigitalOceanVM.php';
require __DIR__.'/lib/VM.php';
$config = require __DIR__.'/config.vm.php';
$vm = new VM($config);
@ -129,7 +122,8 @@ if (!empty($meetings)) {
$usersOnline = $bbb->getUsersOnlineInCurrentRoom();
$maxUsers = $bbb->getMaxUsersLimit();
$status = $bbb->isServerRunning();
$meetingExists = $bbb->meetingExists($bbb->getCurrentVideoConferenceName());
$videoConferenceName = $bbb->getCurrentVideoConferenceName();
$meetingExists = $bbb->meetingExists($videoConferenceName);
$showJoinButton = false;
// Only conference manager can see the join button
@ -138,6 +132,7 @@ if ($bbb->isGlobalConference() && $bbb->isGlobalConferencePerUserEnabled()) {
// Any user can see the "join button" BT#12620
$userCanSeeJoinButton = true;
}
if (($meetingExists || $userCanSeeJoinButton) && ($maxUsers == 0 || $maxUsers > $usersOnline)) {
$showJoinButton = true;
}
@ -160,7 +155,7 @@ if ($bbb->isGlobalConference() === false &&
window.location.replace(url+groupId);
});
});
</script>';
</script>';
$form = new FormValidator(api_get_self().'?'.api_get_cidreq());
$groupId = api_get_group_id();
@ -197,11 +192,70 @@ $tpl->assign('show_join_button', $showJoinButton);
$tpl->assign('message', $message);
$tpl->assign('form', $formToString);
// Default URL
$url = Display::url(
$plugin->get_lang('EnterConference'),
$conferenceUrl,
['target' => '_blank', 'class' => 'btn btn-primary btn-large']
);
$type = $plugin->get('launch_type');
switch ($type) {
case BBBPlugin::LAUNCH_TYPE_DEFAULT:
$url = Display::url(
$plugin->get_lang('EnterConference'),
$conferenceUrl.'&interface='.$plugin->get('interface'),
['target' => '_blank', 'class' => 'btn btn-primary btn-large']
);
break;
case BBBPlugin::LAUNCH_TYPE_SET_BY_TEACHER:
if ($conferenceManager) {
$url = $plugin->getUrlInterfaceLinks($conferenceUrl);
} else {
$meetingInfo = $bbb->getMeetingByName($videoConferenceName);
switch ($meetingInfo['interface']) {
case BBBPlugin::INTERFACE_FLASH:
$url = $plugin->getFlashUrl($conferenceUrl);
break;
case BBBPlugin::INTERFACE_HTML5:
$url = $plugin->getHtmlUrl($conferenceUrl);
break;
}
}
break;
case BBBPlugin::LAUNCH_TYPE_SET_BY_STUDENT:
if ($conferenceManager) {
$url = $plugin->getUrlInterfaceLinks($conferenceUrl);
} else {
if ($meetingExists) {
$meetingInfo = $bbb->getMeetingByName($videoConferenceName);
$meetinUserInfo = $bbb->getMeetingParticipantInfo($meetingInfo['id'], api_get_user_id());
if (empty($meetinUserInfo)) {
$url = $plugin->getUrlInterfaceLinks($conferenceUrl);
} else {
switch ($meetinUserInfo['interface']) {
case BBBPlugin::INTERFACE_FLASH:
$url = $plugin->getFlashUrl($conferenceUrl);
break;
case BBBPlugin::INTERFACE_HTML5:
$url = $plugin->getHtmlUrl($conferenceUrl);
break;
}
}
}
}
break;
}
$tpl->assign('enter_conference_links', $url);
$listing_tpl = 'bbb/listing.tpl';
$content = $tpl->fetch($listing_tpl);
$actionLinks = '';
if (api_is_platform_admin()) {
$actionLinks = Display::toolbarButton(
$actionLinks .= Display::toolbarButton(
$plugin->get_lang('AdminView'),
api_get_path(WEB_PLUGIN_PATH).'bbb/admin.php',
'list',

@ -1,13 +1,11 @@
<div class ="row">
{% if bbb_status == true %}
<div class ="col-md-12" style="text-align:center">
{{ form }}
{% if show_join_button == true %}
<p>
<a href="{{ conference_url }}" target="_blank" class="btn btn-primary btn-large">
{{ 'EnterConference'| get_plugin_lang('BBBPlugin') }}
</a>
{{ enter_conference_links }}
<span id="users_online" class="label label-warning">
{{ 'XUsersOnLine'| get_plugin_lang('BBBPlugin') | format(users_online) }}
</span>

@ -19,6 +19,8 @@ $host = '';
$salt = '';
$isGlobal = isset($_GET['global']) ? true : false;
$isGlobalPerUser = isset($_GET['user_id']) ? (int) $_GET['user_id'] : false;
$interface = isset($_GET['interface']) ? (int) $_GET['interface'] : 0;
$bbb = new bbb('', '', $isGlobal, $isGlobalPerUser);
$conferenceManager = $bbb->isConferenceManager();
@ -56,6 +58,8 @@ if ($bbb->pluginEnabled) {
$meetingParams = [];
$meetingParams['meeting_name'] = $bbb->getCurrentVideoConferenceName();
$meetingParams['interface'] = $interface;
if ($bbb->meetingExists($meetingParams['meeting_name'])) {
$joinUrl = $bbb->joinMeeting($meetingParams['meeting_name']);
if ($joinUrl) {
@ -69,7 +73,7 @@ if ($bbb->pluginEnabled) {
$meetingInfo = $bbb->findMeetingByName($meetingParams['meeting_name']);
if (!empty($meetingInfo) && $url) {
$bbb->saveParticipant($meetingInfo['id'], api_get_user_id());
$bbb->saveParticipant($meetingInfo['id'], api_get_user_id(), $interface);
$bbb->redirectToBBB($url);
} else {
$url = $bbb->getListingUrl();

Loading…
Cancel
Save