Merge with 1.10.x

pull/2487/head
jmontoyaa 10 years ago
commit d8ae3ae40f
  1. 2
      app/Migrations/Schema/V110/Version110.php
  2. 10
      main/inc/lib/database.lib.php
  3. 54
      main/inc/lib/userportal.lib.php
  4. 1
      main/install/configuration.dist.php
  5. 4
      main/lang/spanish/trad4all.inc.php
  6. 4
      main/session/session_category_edit.php
  7. 27
      main/template/default/user_portal/session.tpl
  8. 4
      plugin/bbb/cron.php
  9. 2
      plugin/bbb/index.php
  10. 5
      plugin/bbb/install.php
  11. 3
      plugin/bbb/lang/english.php
  12. 3
      plugin/bbb/lang/french.php
  13. 3
      plugin/bbb/lang/spanish.php
  14. 5
      plugin/bbb/lib/VM.php
  15. 305
      plugin/bbb/lib/bbb.lib.php
  16. 36
      plugin/bbb/lib/bbb_plugin.class.php
  17. 51
      plugin/bbb/listing.php
  18. 2
      plugin/bbb/plugin.php
  19. 3
      plugin/bbb/readme.txt
  20. 38
      plugin/bbb/start.php
  21. 7
      plugin/bbb/uninstall.php
  22. 80
      plugin/ticket/database.php
  23. 5
      user_portal.php

@ -123,8 +123,8 @@ class Version110 extends AbstractMigrationChamilo
$this->addSql("ALTER TABLE track_e_online CHANGE COLUMN login_ip user_ip varchar(39) NOT NULL DEFAULT ''"); $this->addSql("ALTER TABLE track_e_online CHANGE COLUMN login_ip user_ip varchar(39) NOT NULL DEFAULT ''");
$this->addSql("ALTER TABLE track_e_login CHANGE COLUMN login_ip user_ip varchar(39) NOT NULL DEFAULT ''"); $this->addSql("ALTER TABLE track_e_login CHANGE COLUMN login_ip user_ip varchar(39) NOT NULL DEFAULT ''");
$this->addSql("ALTER TABLE user MODIFY COLUMN user_id int unsigned DEFAULT NULL");
$this->addSql("ALTER TABLE user DROP PRIMARY KEY"); $this->addSql("ALTER TABLE user DROP PRIMARY KEY");
$this->addSql("ALTER TABLE user MODIFY COLUMN user_id int unsigned DEFAULT NULL");
$this->addSql("ALTER TABLE user ADD COLUMN id INT DEFAULT NULL"); $this->addSql("ALTER TABLE user ADD COLUMN id INT DEFAULT NULL");
$this->addSql("UPDATE user SET id = user_id"); $this->addSql("UPDATE user SET id = user_id");
$this->addSql("ALTER TABLE user MODIFY COLUMN id INT NOT NULL PRIMARY KEY AUTO_INCREMENT AFTER user_id"); $this->addSql("ALTER TABLE user MODIFY COLUMN id INT NOT NULL PRIMARY KEY AUTO_INCREMENT AFTER user_id");

@ -676,4 +676,14 @@ class Database
return $config; return $config;
} }
/**
* @param string $table
*
* @return bool
*/
public static function tableExists($table)
{
return self::getManager()->getConnection()->getSchemaManager()->tablesExist($table);
}
} }

@ -291,7 +291,14 @@ class IndexManager
if (!empty($home_notice)) { if (!empty($home_notice)) {
$home_notice = api_to_system_encoding($home_notice, api_detect_encoding(strip_tags($home_notice))); $home_notice = api_to_system_encoding($home_notice, api_detect_encoding(strip_tags($home_notice)));
//$home_notice = Display::div($home_notice, array('class' => 'homepage_notice')); //$home_notice = Display::div($home_notice, array('class' => 'homepage_notice'));
$html = self::show_right_block(get_lang('Notice'), $home_notice, 'notice_block', null, 'notices', 'noticesCollapse'); $html = self::show_right_block(
get_lang('Notice'),
$home_notice,
'notice_block',
null,
'notices',
'noticesCollapse'
);
} }
return $html; return $html;
} }
@ -315,7 +322,14 @@ class IndexManager
$home_menu_content = '<ul class="nav nav-pills nav-stacked">'; $home_menu_content = '<ul class="nav nav-pills nav-stacked">';
$home_menu_content .= api_to_system_encoding($home_menu, api_detect_encoding(strip_tags($home_menu))); $home_menu_content .= api_to_system_encoding($home_menu, api_detect_encoding(strip_tags($home_menu)));
$home_menu_content .= '</ul>'; $home_menu_content .= '</ul>';
$html .= self::show_right_block(get_lang('MenuGeneral'), $home_menu_content, 'help_block', null, 'helps', 'helpsCollapse'); $html .= self::show_right_block(
get_lang('MenuGeneral'),
$home_menu_content,
'help_block',
null,
'helps',
'helpsCollapse'
);
} }
return $html; return $html;
} }
@ -706,17 +720,30 @@ class IndexManager
/** /**
* @todo use the template system * @todo use the template system
* @param $title
* @param $content
* @param string $id
* @param array $params
* @param string $idAccordion
* @param string $idCollapse
* @return null|string
*/ */
function show_right_block($title, $content, $id = null, $params = null, $idAccordion = null, $idCollpase = null) public function show_right_block(
{ $title,
$content,
$id = '',
$params = [],
$idAccordion = '',
$idCollapse = ''
) {
if (!empty($idAccordion)) { if (!empty($idAccordion)) {
$html = null; $html = null;
$html .= '<div class="panel-group" id="'.$idAccordion.'" role="tablist" aria-multiselectable="true">' . PHP_EOL; $html .= '<div class="panel-group" id="'.$idAccordion.'" role="tablist" aria-multiselectable="true">' . PHP_EOL;
$html .= '<div class="panel panel-default" id="'.$id.'">' . PHP_EOL; $html .= '<div class="panel panel-default" id="'.$id.'">' . PHP_EOL;
$html .= '<div class="panel-heading" role="tab"><h4 class="panel-title">' . PHP_EOL; $html .= '<div class="panel-heading" role="tab"><h4 class="panel-title">' . PHP_EOL;
$html .= '<a role="button" data-toggle="collapse" data-parent="#'.$idAccordion.'" href="#'.$idCollpase.'" aria-expanded="true" aria-controls="'.$idCollpase.'">'.$title.'</a>' . PHP_EOL; $html .= '<a role="button" data-toggle="collapse" data-parent="#'.$idAccordion.'" href="#'.$idCollapse.'" aria-expanded="true" aria-controls="'.$idCollapse.'">'.$title.'</a>' . PHP_EOL;
$html .= '</h4></div>' . PHP_EOL; $html .= '</h4></div>' . PHP_EOL;
$html .= '<div id="'.$idCollpase.'" class="panel-collapse collapse in" role="tabpanel">' . PHP_EOL; $html .= '<div id="'.$idCollapse.'" class="panel-collapse collapse in" role="tabpanel">' . PHP_EOL;
$html .= '<div class="panel-body">'.$content.'</div>' . PHP_EOL; $html .= '<div class="panel-body">'.$content.'</div>' . PHP_EOL;
$html .= '</div></div></div>' . PHP_EOL; $html .= '</div></div></div>' . PHP_EOL;
@ -1075,8 +1102,11 @@ class IndexManager
$sessions_with_category = ''; $sessions_with_category = '';
$sessions_with_no_category = ''; $sessions_with_no_category = '';
$sessionTitleLink = api_get_configuration_value('courses_list_session_title_link'); $coursesListSessionStyle = api_get_configuration_value('courses_list_session_title_link');
$sessionTitleLink = $sessionTitleLink === false ? 1 : $sessionTitleLink; $coursesListSessionStyle = $coursesListSessionStyle === false ? 1 : $coursesListSessionStyle;
if (api_is_drh()) {
$coursesListSessionStyle = 1;
}
if (is_array($session_categories)) { if (is_array($session_categories)) {
foreach ($session_categories as $session_category) { foreach ($session_categories as $session_category) {
@ -1183,7 +1213,8 @@ class IndexManager
: null; : null;
$params['extra_fields'] = $session_box['extra_fields']; $params['extra_fields'] = $session_box['extra_fields'];
$params['show_link_to_session'] = !api_is_drh() && $sessionTitleLink; $params['course_list_session_style'] = $coursesListSessionStyle;
$params['title'] = $session_box['title']; $params['title'] = $session_box['title'];
$params['subtitle'] = $extra_info; $params['subtitle'] = $extra_info;
$params['show_actions'] = api_is_platform_admin() ? true : false; $params['show_actions'] = api_is_platform_admin() ? true : false;
@ -1292,11 +1323,12 @@ class IndexManager
} }
$sessionParams = array(); $sessionParams = array();
//Category // Category
if ($count > 0) { if ($count > 0) {
$session_box = Display:: get_session_title_box($session_id); $session_box = Display:: get_session_title_box($session_id);
$sessionParams['id'] = $session_id; $sessionParams['id'] = $session_id;
$sessionParams['show_link_to_session'] = !api_is_drh() && $sessionTitleLink; //$sessionParams['show_link_to_session'] = !api_is_drh() && $sessionTitleLink;
$sessionParams['course_list_session_style'] = $coursesListSessionStyle;
$sessionParams['title'] = $session_box['title']; $sessionParams['title'] = $session_box['title'];
$sessionParams['subtitle'] = (!empty($session_box['coach']) ? $session_box['coach'] . ' | ': '') . $session_box['dates']; $sessionParams['subtitle'] = (!empty($session_box['coach']) ? $session_box['coach'] . ' | ': '') . $session_box['dates'];
$sessionParams['show_actions'] = api_is_platform_admin(); $sessionParams['show_actions'] = api_is_platform_admin();

@ -223,6 +223,7 @@ $_configuration['system_stable'] = NEW_VERSION_STABLE;
// 1 = Default. Works as it is now (default is to link to the special session page) // 1 = Default. Works as it is now (default is to link to the special session page)
// 0 = No link (not clickable) // 0 = No link (not clickable)
// 2 = Link to the course if there is only one course // 2 = Link to the course if there is only one course
// 3 = Session link will make course list foldable
//$_configuration['courses_list_session_title_link'] = 1; //$_configuration['courses_list_session_title_link'] = 1;
// Fix embedded videos inside lps, adding an optional popup // Fix embedded videos inside lps, adding an optional popup
//$_configuration['lp_fix_embed_content'] = false; //$_configuration['lp_fix_embed_content'] = false;

@ -7669,4 +7669,8 @@ $Quote = "Citar";
$ValueTooSmall = "Valor demasiado bajo."; $ValueTooSmall = "Valor demasiado bajo.";
$ValueTooBig = "Valor demasiado alto."; $ValueTooBig = "Valor demasiado alto.";
$YouAreATeacherOfThisCourse = "Usted es profesor en este curso"; $YouAreATeacherOfThisCourse = "Usted es profesor en este curso";
$CouldNotResetPasswordBecauseLDAP = "No se pudo reiniciar la contraseña LDAP, por favor contacte su equipo de soporte.";
$ValueTooSmall = "Valor demasiado bajo.";
$ValueTooBig = "Valor demasiado alto.";
$YouAreATeacherOfThisCourse = "Usted es profesor en este curso";
?> ?>

@ -18,8 +18,8 @@ $errorMsg = '';
$tbl_session_category = Database::get_main_table(TABLE_MAIN_SESSION_CATEGORY); $tbl_session_category = Database::get_main_table(TABLE_MAIN_SESSION_CATEGORY);
$tool_name = get_lang('EditSessionCategory'); $tool_name = get_lang('EditSessionCategory');
$interbreadcrumb[] = array( $interbreadcrumb[] = array(
'url' => 'index.php', 'url' => 'session_list.php',
"name" => get_lang('PlatformAdmin') "name" => get_lang('SessionList')
); );
$interbreadcrumb[] = array( $interbreadcrumb[] = array(
'url' => "session_category_list.php", 'url' => "session_category_list.php",

@ -1,33 +1,43 @@
<div class="panel panel-default"> <div class="panel panel-default">
{% if not session.show_simple_session_info %} {% if not session.show_simple_session_info %}
{% set collapsable = '' %}
<div class="panel-heading"> <div class="panel-heading">
{% if session.show_link_to_session %} {% if session.course_list_session_style == 1 %}
{# Classic #}
<a href="{{ _p.web_main ~ 'session/index.php?session_id=' ~ session.id }}"> <a href="{{ _p.web_main ~ 'session/index.php?session_id=' ~ session.id }}">
<img id="session_img_{{ session.id }}" src="{{ "window_list.png"|icon(32) }}" width="32" height="32" alt="{{ session.title }}" title="{{ session.title }}"> <img id="session_img_{{ session.id }}" src="{{ "window_list.png"|icon(32) }}" width="32" height="32" alt="{{ session.title }}" title="{{ session.title }}" />
{{ session.title }} {{ session.title }}
</a> </a>
{% else %} {% elseif session.course_list_session_style == 2 %}
<img id="session_img_{{ session.id }}" src="{{ "window_list.png"|icon(32) }}" width="32" height="32" alt="{{ session.title }}" title="{{ session.title }}"> {# No link #}
<img id="session_img_{{ session.id }}" src="{{ "window_list.png"|icon(32) }}" width="32" height="32" alt="{{ session.title }}" title="{{ session.title }}" />
{{ session.title }}
{% elseif session.course_list_session_style == 3 %}
{# Foldable #}
<a role="button" data-toggle="collapse" data-parent="#page-content" href="#collapse_{{ session.id }}" aria-expanded="false" >
<img id="session_img_{{ session.id }}" src="{{ "window_list.png"|icon(32) }}" width="32" height="32" alt="{{ session.title }}" title="{{ session.title }}" />
{{ session.title }} {{ session.title }}
</a>
{% set collapsable = 'collapse' %}
{% endif %} {% endif %}
{% if session.show_actions %} {% if session.show_actions %}
<div class="pull-right"> <div class="pull-right">
<a href="{{ _p.web_main ~ "session/resume_session.php?id_session=" ~ session.id }}"> <a href="{{ _p.web_main ~ "session/resume_session.php?id_session=" ~ session.id }}">
<img src="{{ "edit.png"|icon(22) }}" width="22" height="22" alt="{{ "Edit"|get_lang }}" title="{{ "Edit"|get_lang }}"> <img src="{{ "edit.png"|icon(22) }}" width="22" height="22" alt="{{ "Edit"|get_lang }}" title="{{ "Edit"|get_lang }}" />
</a> </a>
</div> </div>
{% endif %} {% endif %}
</div> </div>
{% endif %} {% endif %}
<div class="sessions panel-body"> <div class="sessions panel-body {{ collapsable }}" id="collapse_{{ session.id }}">
{% if session.show_simple_session_info %} {% if session.show_simple_session_info %}
<div class="row"> <div class="row">
<div class="col-md-7"> <div class="col-md-7">
<h3> <h3>
{{ session.title ~ session.notifications }} {{ session.title ~ session.notifications }}
</h3> </h3>
{% if session.show_description %} {% if session.show_description %}
<div> <div>
{{ session.description }} {{ session.description }}
@ -80,13 +90,10 @@
</div> </div>
<div class="col-md-10"> <div class="col-md-10">
{{ item.title }} {{ item.title }}
{% if item.coaches|length > 0 %} {% if item.coaches|length > 0 %}
<img src="{{ 'teacher.png'|icon(16) }}" width="16" height="16"> <img src="{{ 'teacher.png'|icon(16) }}" width="16" height="16">
{% for coach in item.coaches %} {% for coach in item.coaches %}
{{ loop.index > 1 ? ' | ' }} {{ loop.index > 1 ? ' | ' }}
<a href="{{ _p.web_ajax ~ 'user_manager.ajax.php?' ~ {'a': 'get_user_popup', 'user_id': coach.user_id}|url_encode() }}" data-title="{{ coach.full_name }}" class="ajax"> <a href="{{ _p.web_ajax ~ 'user_manager.ajax.php?' ~ {'a': 'get_user_popup', 'user_id': coach.user_id}|url_encode() }}" data-title="{{ coach.full_name }}" class="ajax">
{{ coach.full_name }} {{ coach.full_name }}
</a> </a>

@ -14,9 +14,9 @@ if (file_exists(__DIR__ . '/config.vm.php')) {
$vm = new VM($config); $vm = new VM($config);
if ($vm->IsEnabled()) { if ($vm->isEnabled()) {
$bbb = new bbb(); $bbb = new bbb();
if ($bbb->plugin_enabled) { if ($bbb->pluginEnabled) {
$activeSessions = $bbb->getActiveSessionsCount(); $activeSessions = $bbb->getActiveSessionsCount();
if (empty($activeSessions)) { if (empty($activeSessions)) {
$vm->runCron(); $vm->runCron();

@ -1,3 +1 @@
<?php <?php
?>

@ -4,9 +4,6 @@
* includes things to execute in the main database (settings_current table) * includes things to execute in the main database (settings_current table)
* @package chamilo.plugin.bigbluebutton * @package chamilo.plugin.bigbluebutton
*/ */
/**
* Initialization
*/
require_once dirname(__FILE__).'/config.php'; require_once __DIR__.'/config.php';
BBBPlugin::create()->install(); BBBPlugin::create()->install();

@ -5,8 +5,7 @@
* @license GNU General Public License - http://www.gnu.org/copyleft/gpl.html * @license GNU General Public License - http://www.gnu.org/copyleft/gpl.html
* @author Laurent Opprecht <laurent@opprecht.info> * @author Laurent Opprecht <laurent@opprecht.info>
*/ */
// Needed in order to show the plugin title
//Needed in order to show the plugin title
$strings['plugin_title'] = "Videoconference"; $strings['plugin_title'] = "Videoconference";
$strings['plugin_comment'] = "Add a videoconference room in a Chamilo course using BigBlueButton (BBB)"; $strings['plugin_comment'] = "Add a videoconference room in a Chamilo course using BigBlueButton (BBB)";

@ -1,4 +1,5 @@
<?php /* License: see /license.txt */ <?php
/* License: see /license.txt */
//Needed in order to show the plugin title //Needed in order to show the plugin title
$strings['plugin_title'] = "Vidéoconférence"; $strings['plugin_title'] = "Vidéoconférence";
$strings['plugin_comment'] = "Ajoutez un espace de vidéoconférences aux cours de Chamilo avec BigBlueButton (BBB)"; $strings['plugin_comment'] = "Ajoutez un espace de vidéoconférences aux cours de Chamilo avec BigBlueButton (BBB)";

@ -1,4 +1,5 @@
<?php /* License: see /license.txt */ <?php
/* License: see /license.txt */
//Needed in order to show the plugin title //Needed in order to show the plugin title
$strings['plugin_title'] = "Videoconferencia"; $strings['plugin_title'] = "Videoconferencia";
$strings['plugin_comment'] = "Añade una sala de videoconferencia en los cursos de Chamilo con BigBlueButton (BBB)"; $strings['plugin_comment'] = "Añade una sala de videoconferencia en los cursos de Chamilo con BigBlueButton (BBB)";

@ -9,6 +9,10 @@ class VM
protected $config; protected $config;
public $virtualMachine; public $virtualMachine;
/**
* VM constructor.
* @param $config
*/
public function __construct($config) public function __construct($config)
{ {
$this->config = $config; $this->config = $config;
@ -30,6 +34,7 @@ class VM
$config = $this->getConfig(); $config = $this->getConfig();
if (!isset($config)) { if (!isset($config)) {
return false; return false;
} }

@ -20,41 +20,36 @@ class bbb
public $url; public $url;
public $salt; public $salt;
public $api; public $api;
public $user_complete_name = null; public $user_complete_name = '';
public $protocol = 'http://'; public $protocol = 'http://';
public $debug = false; public $debug = false;
public $logout_url = null; public $logoutUrl = '';
public $plugin_enabled = false; public $pluginEnabled = false;
public $enableGlobalConference = false;
public $isGlobalConference = false;
/** /**
*
* Constructor (generates a connection to the API and the Chamilo settings * Constructor (generates a connection to the API and the Chamilo settings
* required for the connection to the video conference server) * required for the connection to the video conference server)
* @param string $host * @param string $host
* @param string $salt * @param string $salt
*/ */
public function __construct($host = null, $salt = null) public function __construct($host = '', $salt = '', $isGlobalConference = false)
{ {
// Initialize video server settings from global settings // Initialize video server settings from global settings
$plugin = BBBPlugin::create(); $plugin = BBBPlugin::create();
$bbb_plugin = $plugin->get('tool_enable'); $bbbPlugin = $plugin->get('tool_enable');
if (empty($host)) { $bbb_host = !empty($host) ? $host : $plugin->get('host');
$bbb_host = $plugin->get('host'); $bbb_salt = !empty($salt) ? $salt : $plugin->get('salt');
} else {
$bbb_host = $host;
}
if (empty($salt)) {
$bbb_salt = $plugin->get('salt');
} else {
$bbb_salt = $salt;
}
$this->logout_url = api_get_path(WEB_PLUGIN_PATH).'bbb/listing.php?'.api_get_cidreq(); $this->logoutUrl = $this->getListingUrl();
$this->table = Database::get_main_table('plugin_bbb_meeting'); $this->table = Database::get_main_table('plugin_bbb_meeting');
$this->enableGlobalConference = $plugin->get('enable_global_conference');
$this->isGlobalConference = (bool) $isGlobalConference;
if ($bbb_plugin == true) { if ($bbbPlugin === true) {
$userInfo = api_get_user_info(); $userInfo = api_get_user_info();
$this->user_complete_name = $userInfo['complete_name']; $this->user_complete_name = $userInfo['complete_name'];
$this->salt = $bbb_salt; $this->salt = $bbb_salt;
@ -70,15 +65,36 @@ class bbb
define('CONFIG_SERVER_BASE_URL', $this->url); define('CONFIG_SERVER_BASE_URL', $this->url);
$this->api = new BigBlueButtonBN(); $this->api = new BigBlueButtonBN();
$this->plugin_enabled = true; $this->pluginEnabled = true;
}
}
/**
* @return bool
*/
public function isGlobalConferenceEnabled()
{
return (bool) $this->enableGlobalConference;
}
/**
* @return bool
*/
public function isGlobalConference()
{
if ($this->isGlobalConferenceEnabled() === false) {
return false;
} }
return (bool) $this->isGlobalConference;
} }
/** /**
* Checks whether a user is teacher in the current course * Checks whether a user is teacher in the current course
* @return bool True if the user can be considered a teacher in this course, false otherwise * @return bool True if the user can be considered a teacher in this course, false otherwise
*/ */
public function isTeacher() public function isConferenceManager()
{ {
return api_is_course_admin() || api_is_coach() || api_is_platform_admin(); return api_is_course_admin() || api_is_coach() || api_is_platform_admin();
} }
@ -117,11 +133,11 @@ class bbb
*/ */
public function createMeeting($params) public function createMeeting($params)
{ {
$params['c_id'] = api_get_course_int_id();
$courseCode = api_get_course_id(); $courseCode = api_get_course_id();
$params['c_id'] = api_get_course_int_id();
$params['session_id'] = api_get_session_id(); $params['session_id'] = api_get_session_id();
$params['attendee_pw'] = isset($params['moderator_pw']) ? $params['moderator_pw'] : api_get_course_id(); $params['attendee_pw'] = isset($params['moderator_pw']) ? $params['moderator_pw'] : $courseCode;
$attendeePassword = $params['attendee_pw']; $attendeePassword = $params['attendee_pw'];
$params['moderator_pw'] = isset($params['moderator_pw']) ? $params['moderator_pw'] : $this->getModMeetingPassword(); $params['moderator_pw'] = isset($params['moderator_pw']) ? $params['moderator_pw'] : $this->getModMeetingPassword();
$moderatorPassword = $params['moderator_pw']; $moderatorPassword = $params['moderator_pw'];
@ -129,13 +145,14 @@ class bbb
$params['record'] = api_get_course_setting('big_blue_button_record_and_store', $courseCode) == 1 ? true : false; $params['record'] = api_get_course_setting('big_blue_button_record_and_store', $courseCode) == 1 ? true : false;
$max = api_get_course_setting('big_blue_button_max_students_allowed', $courseCode); $max = api_get_course_setting('big_blue_button_max_students_allowed', $courseCode);
$max = isset($max) ? $max : -1; $max = isset($max) ? $max : -1;
$params['status'] = 1; $params['status'] = 1;
// Generate a pseudo-global-unique-id to avoid clash of conferences on // Generate a pseudo-global-unique-id to avoid clash of conferences on
// the same BBB server with several Chamilo portals // the same BBB server with several Chamilo portals
$params['remote_id'] = uniqid(true, true); $params['remote_id'] = uniqid(true, true);
// Each simultaneous conference room needs to have a different // Each simultaneous conference room needs to have a different
// voice_bridge composed of a 5 digits number, so generating a random one // voice_bridge composed of a 5 digits number, so generating a random one
$params['voice_bridge'] = rand(10000,99999); $params['voice_bridge'] = rand(10000, 99999);
if ($this->debug) { if ($this->debug) {
error_log("enter create_meeting ".print_r($params, 1)); error_log("enter create_meeting ".print_r($params, 1));
@ -166,7 +183,7 @@ class bbb
'dialNumber' => '', // The main number to call into. Optional. 'dialNumber' => '', // The main number to call into. Optional.
'voiceBridge' => $params['voice_bridge'], // PIN to join voice. Required. 'voiceBridge' => $params['voice_bridge'], // PIN to join voice. Required.
'webVoice' => '', // Alphanumeric to join voice. Optional. 'webVoice' => '', // Alphanumeric to join voice. Optional.
'logoutUrl' => $this->logout_url, 'logoutUrl' => $this->logoutUrl,
'maxParticipants' => $max, // Optional. -1 = unlimitted. Not supported in BBB. [number] 'maxParticipants' => $max, // Optional. -1 = unlimitted. Not supported in BBB. [number]
'record' => $record, // New. 'true' will tell BBB to record the meeting. 'record' => $record, // New. 'true' will tell BBB to record the meeting.
'duration' => $duration, // Default = 0 which means no set duration in minutes. [number] 'duration' => $duration, // Default = 0 which means no set duration in minutes. [number]
@ -180,12 +197,11 @@ class bbb
$status = false; $status = false;
$meeting = null; $meeting = null;
while ($status == false) { while ($status === false) {
$result = $this->api->createMeetingWithXmlResponseArray( $result = $this->api->createMeetingWithXmlResponseArray(
$bbbParams $bbbParams
); );
if (isset($result) && strval($result['returncode']) == 'SUCCESS' if (isset($result) && strval($result['returncode']) == 'SUCCESS') {
) {
if ($this->debug) { if ($this->debug) {
error_log( error_log(
"create_meeting result: " . print_r($result, 1) "create_meeting result: " . print_r($result, 1)
@ -196,7 +212,8 @@ class bbb
return $meeting; return $meeting;
} }
} }
return $this->logout;
return $this->logoutUrl;
} }
} }
@ -212,8 +229,10 @@ class bbb
public function meetingExists($meetingName) public function meetingExists($meetingName)
{ {
if (empty($meetingName)) { if (empty($meetingName)) {
return false; return false;
} }
$courseId = api_get_course_int_id(); $courseId = api_get_course_int_id();
$sessionId = api_get_session_id(); $sessionId = api_get_session_id();
$meetingData = Database::select( $meetingData = Database::select(
@ -230,7 +249,9 @@ class bbb
if ($this->debug) { if ($this->debug) {
error_log("meeting_exists ".print_r($meetingData, 1)); error_log("meeting_exists ".print_r($meetingData, 1));
} }
if (empty($meetingData)) { if (empty($meetingData)) {
return false; return false;
} else { } else {
return true; return true;
@ -277,7 +298,7 @@ class bbb
$status = false; $status = false;
$meetingInfoExists = false; $meetingInfoExists = false;
while ($status == false) { while ($status === false) {
$meetingIsRunningInfo = $this->getMeetingInfo($params); $meetingIsRunningInfo = $this->getMeetingInfo($params);
if ($meetingIsRunningInfo === false) { if ($meetingIsRunningInfo === false) {
@ -333,11 +354,12 @@ class bbb
$url = $this->api->getJoinMeetingURL($joinParams); $url = $this->api->getJoinMeetingURL($joinParams);
$url = $this->protocol.$url; $url = $this->protocol.$url;
} else { } else {
$url = $this->logout_url; $url = $this->logoutUrl;
} }
if ($this->debug) { if ($this->debug) {
error_log("return url :" . $url); error_log("return url :" . $url);
} }
return $url; return $url;
} }
@ -363,6 +385,7 @@ class bbb
error_log('Caught exception: ', $e->getMessage(), "\n"); error_log('Caught exception: ', $e->getMessage(), "\n");
} }
} }
return false; return false;
} }
@ -370,16 +393,26 @@ class bbb
* Gets all the course meetings saved in the plugin_bbb_meeting table * Gets all the course meetings saved in the plugin_bbb_meeting table
* @return array Array of current open meeting rooms * @return array Array of current open meeting rooms
*/ */
public function getCourseMeetings() public function getMeetings()
{ {
$pass = $this->getUserMeetingPassword(); $pass = $this->getUserMeetingPassword();
$meetingList = Database::select('*', $this->table, array('where' => array('c_id = ? AND session_id = ? ' => array(api_get_course_int_id(), api_get_session_id())))); $meetingList = Database::select(
'*',
$this->table,
array(
'where' => array(
'c_id = ? AND session_id = ? ' => array(
api_get_course_int_id(),
api_get_session_id(),
),
),
)
);
$isGlobal = $this->isGlobalConference();
$newMeetingList = array(); $newMeetingList = array();
$item = array(); $item = array();
foreach ($meetingList as $meetingDB) { foreach ($meetingList as $meetingDB) {
$meetingBBB = $this->getMeetingInfo(array('meetingId' => $meetingDB['remote_id'], 'password' => $pass)); $meetingBBB = $this->getMeetingInfo(['meetingId' => $meetingDB['remote_id'], 'password' => $pass]);
if ($meetingBBB === false) { if ($meetingBBB === false) {
//checking with the remote_id didn't work, so just in case and //checking with the remote_id didn't work, so just in case and
// to provide backwards support, check with the id // to provide backwards support, check with the id
@ -392,17 +425,17 @@ class bbb
$meetingBBB = $this->getMeetingInfo($params); $meetingBBB = $this->getMeetingInfo($params);
} }
if ($meetingDB['visibility'] == 0 and $this->isTeacher() == false) { if ($meetingDB['visibility'] == 0 && $this->isConferenceManager() === false) {
continue; continue;
} }
$meetingBBB['end_url'] = api_get_self().'?'.api_get_cidreq().'&action=end&id='.$meetingDB['id']; $meetingBBB['end_url'] = $this->endUrl($meetingDB);
if ((string)$meetingBBB['returncode'] == 'FAILED') { if ((string)$meetingBBB['returncode'] == 'FAILED') {
if ($meetingDB['status'] == 1 && $this->isTeacher()) { if ($meetingDB['status'] == 1 && $this->isConferenceManager()) {
$this->endMeeting($meetingDB['id']); $this->endMeeting($meetingDB['id']);
} }
} else { } else {
$meetingBBB['add_to_calendar_url'] = api_get_self().'?'.api_get_cidreq().'&action=add_to_calendar&id='.$meetingDB['id'].'&start='.api_strtotime($meetingDB['created_at']); $meetingBBB['add_to_calendar_url'] = $this->addToCalendarUrl($meetingDB);
} }
$recordArray = array(); $recordArray = array();
@ -438,9 +471,7 @@ class bbb
array(), array(),
ICON_SIZE_MEDIUM ICON_SIZE_MEDIUM
), ),
api_get_self().'?'. $this->publishUrl($meetingDB)
api_get_cidreq().
'&action=publish&id='.$meetingDB['id']
); );
} else { } else {
$actionLinksArray[] = Display::url( $actionLinksArray[] = Display::url(
@ -450,13 +481,9 @@ class bbb
array(), array(),
ICON_SIZE_MEDIUM ICON_SIZE_MEDIUM
), ),
api_get_self().'?'. $this->unPublishUrl($meetingDB)
api_get_cidreq().
'&action=unpublish&id='.$meetingDB['id']
); );
} }
} else {
//$recordArray[] = $records['message'];
} }
} else { } else {
foreach ($records as $record) { foreach ($records as $record) {
@ -471,36 +498,31 @@ class bbb
array('target' => '_blank') array('target' => '_blank')
); );
$actionLinks = ''; $actionLinks = '';
if ($this->isTeacher()) { if ($this->isConferenceManager()) {
if ($isGlobal === false) {
$actionLinks .= Display::url( $actionLinks .= Display::url(
Display::return_icon( Display::return_icon(
'link.gif', 'link.gif',
get_lang('CopyToLinkTool') get_lang('CopyToLinkTool')
), ),
api_get_self().'?'. $this->copyToRecordToLinkTool($meetingDB)
api_get_cidreq().
'&action=copy_record_to_link_tool&id='.$meetingDB['id']
); );
$actionLinks .= Display::url( $actionLinks .= Display::url(
Display::return_icon( Display::return_icon(
'agenda.png', 'agenda.png',
get_lang('AddToCalendar') get_lang('AddToCalendar')
), ),
api_get_self().'?'. $this->addToCalendarUrl($meetingDB, $record)
api_get_cidreq().
'&action=add_to_calendar&id='.$meetingDB['id'].
'&start='.api_strtotime($meetingDB['created_at']).
'&url='.$record['playbackFormatUrl']
); );
}
$actionLinks .= Display::url( $actionLinks .= Display::url(
Display::return_icon( Display::return_icon(
'delete.png', 'delete.png',
get_lang('Delete') get_lang('Delete')
), ),
api_get_self().'?'. $this->deleteRecordUrl($meetingDB)
api_get_cidreq().
'&action=delete_record&id='.$meetingDB['id']
); );
if ($meetingDB['visibility'] == 0) { if ($meetingDB['visibility'] == 0) {
$actionLinks .= Display::url( $actionLinks .= Display::url(
Display::return_icon( Display::return_icon(
@ -509,9 +531,7 @@ class bbb
array(), array(),
ICON_SIZE_MEDIUM ICON_SIZE_MEDIUM
), ),
api_get_self().'?'. $this->publishUrl($meetingDB)
api_get_cidreq().
'&action=publish&id='.$meetingDB['id']
); );
} else { } else {
$actionLinks .= Display::url( $actionLinks .= Display::url(
@ -521,13 +541,10 @@ class bbb
array(), array(),
ICON_SIZE_MEDIUM ICON_SIZE_MEDIUM
), ),
api_get_self().'?'. $this->unPublishUrl($meetingDB)
api_get_cidreq().
'&action=unpublish&id='.$meetingDB['id']
); );
} }
} }
//$url .= api_get_self().'?action=publish&id='.$record['recordID'];
$count++; $count++;
$recordArray[] = $url; $recordArray[] = $url;
$actionLinksArray[] = $actionLinks; $actionLinksArray[] = $actionLinks;
@ -541,7 +558,7 @@ class bbb
foreach($record['playbacks'] as $item) { foreach($record['playbacks'] as $item) {
$url = Display::url(get_lang('ViewRecord'), $item['url'], array('target' => '_blank')); $url = Display::url(get_lang('ViewRecord'), $item['url'], array('target' => '_blank'));
//$url .= Display::url(get_lang('DeleteRecord'), api_get_self().'?action=delete_record&'.$record['recordID']); //$url .= Display::url(get_lang('DeleteRecord'), api_get_self().'?action=delete_record&'.$record['recordID']);
if ($this->isTeacher()) { if ($this->isConferenceManager()) {
$url .= Display::url(Display::return_icon('link.gif',get_lang('CopyToLinkTool')), api_get_self().'?action=copy_record_to_link_tool&id='.$meetingDB['id'].'&record_id='.$record['recordID']); $url .= Display::url(Display::return_icon('link.gif',get_lang('CopyToLinkTool')), api_get_self().'?action=copy_record_to_link_tool&id='.$meetingDB['id'].'&record_id='.$record['recordID']);
$url .= Display::url(Display::return_icon('agenda.png',get_lang('AddToCalendar')), api_get_self().'?action=add_to_calendar&id='.$meetingDB['id'].'&start='.api_strtotime($meetingDB['created_at']).'&url='.$item['url']); $url .= Display::url(Display::return_icon('agenda.png',get_lang('AddToCalendar')), api_get_self().'?action=add_to_calendar&id='.$meetingDB['id'].'&start='.api_strtotime($meetingDB['created_at']).'&url='.$item['url']);
$url .= Display::url(Display::return_icon('delete.png',get_lang('Delete')), api_get_self().'?action=delete_record&id='.$record['recordID']); $url .= Display::url(Display::return_icon('delete.png',get_lang('Delete')), api_get_self().'?action=delete_record&id='.$record['recordID']);
@ -556,7 +573,7 @@ class bbb
} }
} else { } else {
$actionLinks = ''; $actionLinks = '';
if ($this->isTeacher()) { if ($this->isConferenceManager()) {
if ($meetingDB['visibility'] == 0) { if ($meetingDB['visibility'] == 0) {
$actionLinks .= Display::url( $actionLinks .= Display::url(
Display::return_icon( Display::return_icon(
@ -565,9 +582,7 @@ class bbb
array(), array(),
ICON_SIZE_MEDIUM ICON_SIZE_MEDIUM
), ),
api_get_self().'?'. $this->publishUrl($meetingDB)
api_get_cidreq().
'&action=publish&id='.$meetingDB['id']
); );
} else { } else {
$actionLinks .= Display::url( $actionLinks .= Display::url(
@ -577,9 +592,7 @@ class bbb
array(), array(),
ICON_SIZE_MEDIUM ICON_SIZE_MEDIUM
), ),
api_get_self().'?'. $this->unPublishUrl($meetingDB)
api_get_cidreq().
'&action=unpublish&id='.$meetingDB['id']
); );
} }
} }
@ -595,8 +608,8 @@ class bbb
//created_at //created_at
$meetingDB['created_at'] = $item['created_at']; //avoid overwrite in array_merge() below $meetingDB['created_at'] = $item['created_at']; //avoid overwrite in array_merge() below
$item['publish_url'] = api_get_self().'?'.api_get_cidreq().'&action=publish&id='.$meetingDB['id']; $item['publish_url'] = $this->publishUrl($meetingDB);
$item['unpublish_url'] = api_get_self().'?'.api_get_cidreq().'&action=unpublish&id='.$meetingDB['id']; $item['unpublish_url'] = $this->unPublishUrl($meetingBBB);
if ($meetingDB['status'] == 1) { if ($meetingDB['status'] == 1) {
$joinParams = array( $joinParams = array(
@ -612,6 +625,7 @@ class bbb
$item = array_merge($item, $meetingDB, $meetingBBB); $item = array_merge($item, $meetingDB, $meetingBBB);
$newMeetingList[] = $item; $newMeetingList[] = $item;
} }
return $newMeetingList; return $newMeetingList;
} }
@ -622,10 +636,12 @@ class bbb
{ {
//return BigBlueButtonBN::setPublishRecordings($id, 'true', $this->url, $this->salt); //return BigBlueButtonBN::setPublishRecordings($id, 'true', $this->url, $this->salt);
if (empty($id)) { if (empty($id)) {
return false; return false;
} }
$id = intval($id); $id = intval($id);
Database::update($this->table, array('visibility' => 1), array('id = ? ' => $id)); Database::update($this->table, array('visibility' => 1), array('id = ? ' => $id));
return true; return true;
} }
@ -636,10 +652,12 @@ class bbb
{ {
//return BigBlueButtonBN::setPublishRecordings($id, 'false', $this->url, $this->salt); //return BigBlueButtonBN::setPublishRecordings($id, 'false', $this->url, $this->salt);
if (empty($id)) { if (empty($id)) {
return false; return false;
} }
$id = intval($id); $id = intval($id);
Database::update($this->table, array('visibility' => 0), array('id = ? ' => $id)); Database::update($this->table, array('visibility' => 0), array('id = ?' => $id));
return true; return true;
} }
@ -653,6 +671,7 @@ class bbb
public function endMeeting($id) public function endMeeting($id)
{ {
if (empty($id)) { if (empty($id)) {
return false; return false;
} }
$meetingData = Database::select('*', $this->table, array('where' => array('id = ?' => array($id))), 'first'); $meetingData = Database::select('*', $this->table, array('where' => array('id = ?' => array($id))), 'first');
@ -663,7 +682,11 @@ class bbb
'password' => $pass, // REQUIRED - Must match moderator pass for meeting. 'password' => $pass, // REQUIRED - Must match moderator pass for meeting.
); );
$this->api->endMeetingWithXmlResponseArray($endParams); $this->api->endMeetingWithXmlResponseArray($endParams);
Database::update($this->table, array('status' => 0, 'closed_at' => api_get_utc_datetime()), array('id = ? ' => $id)); Database::update(
$this->table,
array('status' => 0, 'closed_at' => api_get_utc_datetime()),
array('id = ? ' => $id)
);
} }
/** /**
@ -672,9 +695,16 @@ class bbb
*/ */
public function getUserMeetingPassword() public function getUserMeetingPassword()
{ {
if ($this->isTeacher()) { if ($this->isConferenceManager()) {
return $this->getModMeetingPassword(); return $this->getModMeetingPassword();
} else { } else {
if ($this->isGlobalConference()) {
return 'url_'.api_get_current_access_url_id();
}
return api_get_course_id(); return api_get_course_id();
} }
} }
@ -685,6 +715,11 @@ class bbb
*/ */
public function getModMeetingPassword() public function getModMeetingPassword()
{ {
if ($this->isGlobalConference()) {
return 'url_'.api_get_current_access_url_id().'_mod';
}
return api_get_course_id().'mod'; return api_get_course_id().'mod';
} }
@ -697,7 +732,12 @@ class bbb
{ {
$courseId = api_get_course_int_id(); $courseId = api_get_course_int_id();
$sessionId = api_get_session_id(); $sessionId = api_get_session_id();
$meetingData = Database::select('*', $this->table, array('where' => array('c_id = ? AND session_id = ? AND status = 1 ' => array($courseId, $sessionId))), 'first'); $meetingData = Database::select(
'*',
$this->table,
array('where' => array('c_id = ? AND session_id = ? AND status = 1 ' => array($courseId, $sessionId))),
'first'
);
if (empty($meetingData)) { if (empty($meetingData)) {
return 0; return 0;
} }
@ -786,7 +826,6 @@ class bbb
$records = $this->api->getRecordingsWithXmlResponseArray(array('meetingId' => $meetingData['remote_id'])); $records = $this->api->getRecordingsWithXmlResponseArray(array('meetingId' => $meetingData['remote_id']));
if (!empty($records)) { if (!empty($records)) {
$count = 1;
if (isset($records['message']) && !empty($records['message'])) { if (isset($records['message']) && !empty($records['message'])) {
if ($records['messageKey'] == 'noRecordings') { if ($records['messageKey'] == 'noRecordings') {
$recordArray[] = get_lang('NoRecording'); $recordArray[] = get_lang('NoRecording');
@ -858,4 +897,108 @@ class bbb
echo '</script>'; echo '</script>';
exit;*/ exit;*/
} }
/**
* @return string
*/
public function getUrlParams()
{
$courseInfo = api_get_course_info();
if (empty($courseInfo)) {
if ($this->isGlobalConference()) {
return 'global=1';
}
return '';
}
return api_get_cidreq();
}
/**
* @return string
*/
public function getCurrentVideoConferenceName()
{
if ($this->isGlobalConference()) {
return 'url_'.api_get_current_access_url_id();
}
return api_get_course_id().'-'.api_get_session_id();
}
/**
* @return string
*/
public function getConferenceUrl()
{
return api_get_path(WEB_PLUGIN_PATH).'bbb/start.php?launch=1&'.$this->getUrlParams();
}
/**
* @return string
*/
public function getListingUrl()
{
return api_get_path(WEB_PLUGIN_PATH).'bbb/listing.php?'.$this->getUrlParams();
}
/**
* @param array $meeting
* @return string
*/
public function endUrl($meeting)
{
return api_get_path(WEB_PLUGIN_PATH).'bbb/listing.php?'.$this->getUrlParams().'&action=end&id='.$meeting['id'];
}
/**
* @param array $meeting
* @param array $record
* @return string
*/
public function addToCalendarUrl($meeting, $record = [])
{
$url = isset($record['playbackFormatUrl']) ? $record['playbackFormatUrl'] : '';
return api_get_path(WEB_PLUGIN_PATH).'bbb/listing.php?'.$this->getUrlParams().'&action=add_to_calendar&id='.$meeting['id'].'&start='.api_strtotime($meeting['created_at']).'&url='.$url;
}
/**
* @param array $meeting
* @return string
*/
public function publishUrl($meeting)
{
return api_get_path(WEB_PLUGIN_PATH).'bbb/listing.php?'.$this->getUrlParams().'&action=publish&id='.$meeting['id'];
}
/**
* @param array $meeting
* @return string
*/
public function unPublishUrl($meeting)
{
return api_get_path(WEB_PLUGIN_PATH).'bbb/listing.php?'.$this->getUrlParams().'&action=unpublish&id='.$meeting['id'];
}
/**
* @param array $meeting
* @return string
*/
public function deleteRecordUrl($meeting)
{
return api_get_path(WEB_PLUGIN_PATH).'bbb/listing.php?'.$this->getUrlParams().'&action=delete_record&id='.$meeting['id'];
}
/**
* @param array $meeting
* @return string
*/
public function copyToRecordToLinkTool($meeting)
{
return api_get_path(WEB_PLUGIN_PATH).'bbb/listing.php?'.$this->getUrlParams().'&action=copy_record_to_link_tool&id='.$meeting['id'];
}
} }

@ -16,7 +16,7 @@ class BBBPlugin extends Plugin
{ {
public $isCoursePlugin = true; public $isCoursePlugin = true;
//When creating a new course this settings are added to the course // When creating a new course this settings are added to the course
public $course_settings = array( public $course_settings = array(
array( array(
'name' => 'big_blue_button_record_and_store', 'name' => 'big_blue_button_record_and_store',
@ -24,17 +24,35 @@ class BBBPlugin extends Plugin
) )
); );
public static function create() /**
* BBBPlugin constructor.
*/
protected function __construct()
{ {
static $result = null; parent::__construct(
return $result ? $result : $result = new self(); '2.3',
'Julio Montoya, Yannick Warnier',
[
'tool_enable' => 'boolean',
'host' => 'text',
'salt' => 'text',
'enable_global_conference' => 'boolean',
]
);
} }
protected function __construct() /**
* @return BBBPlugin|null
*/
public static function create()
{ {
parent::__construct('2.2', 'Julio Montoya, Yannick Warnier', array('tool_enable' => 'boolean', 'host' =>'text', 'salt' => 'text')); static $result = null;
return $result ? $result : $result = new self();
} }
/**
* Install
*/
public function install() public function install()
{ {
$table = Database::get_main_table('plugin_bbb_meeting'); $table = Database::get_main_table('plugin_bbb_meeting');
@ -61,14 +79,16 @@ class BBBPlugin extends Plugin
$this->install_course_fields_in_all_courses(); $this->install_course_fields_in_all_courses();
} }
/**
* Uninstall
*/
public function uninstall() public function uninstall()
{ {
$t_settings = Database::get_main_table(TABLE_MAIN_SETTINGS_CURRENT); $t_settings = Database::get_main_table(TABLE_MAIN_SETTINGS_CURRENT);
$t_options = Database::get_main_table(TABLE_MAIN_SETTINGS_OPTIONS); $t_options = Database::get_main_table(TABLE_MAIN_SETTINGS_OPTIONS);
$t_tool = Database::get_course_table(TABLE_TOOL_LIST); $t_tool = Database::get_course_table(TABLE_TOOL_LIST);
//New settings // New settings
$sql = "DELETE FROM $t_settings WHERE variable = 'bbb_tool_enable'"; $sql = "DELETE FROM $t_settings WHERE variable = 'bbb_tool_enable'";
Database::query($sql); Database::query($sql);
$sql = "DELETE FROM $t_settings WHERE variable = 'bbb_salt'"; $sql = "DELETE FROM $t_settings WHERE variable = 'bbb_salt'";

@ -1,38 +1,46 @@
<?php <?php
/** /**
* This script initiates a videoconference session, calling the BigBlueButton API * This script initiates a video conference session, calling the BigBlueButton API
* @package chamilo.plugin.bigbluebutton * @package chamilo.plugin.bigbluebutton
*/ */
/**
* Initialization
*/
$course_plugin = 'bbb'; //needed in order to load the plugin lang variables $course_plugin = 'bbb'; //needed in order to load the plugin lang variables
require_once dirname(__FILE__).'/config.php'; require_once __DIR__.'/config.php';
$plugin = BBBPlugin::create(); $plugin = BBBPlugin::create();
$tool_name = $plugin->get_lang('Videoconference'); $tool_name = $plugin->get_lang('Videoconference');
$tpl = new Template($tool_name); $tpl = new Template($tool_name);
$bbb = new bbb(); $isGlobal = isset($_GET['global']) ? true : false;
$bbb = new bbb('', '', $isGlobal);
$action = isset($_GET['action']) ? $_GET['action'] : null; $action = isset($_GET['action']) ? $_GET['action'] : null;
$teacher = $bbb->isTeacher(); $conferenceManager = $bbb->isConferenceManager();
if ($bbb->isGlobalConference()) {
api_block_anonymous_users();
} else {
api_protect_course_script(true);
}
api_protect_course_script(true);
$message = null; $message = null;
if ($teacher) { if ($conferenceManager) {
switch ($action) { switch ($action) {
case 'add_to_calendar': case 'add_to_calendar':
$course_info = api_get_course_info(); if ($bbb->isGlobalConference()) {
return false;
}
$courseInfo = api_get_course_info();
$agenda = new Agenda(); $agenda = new Agenda();
$agenda->type = 'course'; $agenda->type = 'course';
$id = intval($_GET['id']); $id = intval($_GET['id']);
$title = sprintf(get_lang('VideoConferenceXCourseX'), $id, $course_info['name']); $title = sprintf(get_lang('VideoConferenceXCourseX'), $id, $courseInfo['name']);
$content = Display::url(get_lang('GoToTheVideoConference'), $_GET['url']); $content = Display::url(get_lang('GoToTheVideoConference'), $_GET['url']);
$event_id = $agenda->addEvent( $eventId = $agenda->addEvent(
$_REQUEST['start'], $_REQUEST['start'],
null, null,
'true', 'true',
@ -40,7 +48,7 @@ if ($teacher) {
$content, $content,
array('everyone') array('everyone')
); );
if (!empty($event_id)) { if (!empty($eventId)) {
$message = Display::return_message(get_lang('VideoConferenceAddedToTheCalendar'), 'success'); $message = Display::return_message(get_lang('VideoConferenceAddedToTheCalendar'), 'success');
} else { } else {
$message = Display::return_message(get_lang('Error'), 'error'); $message = Display::return_message(get_lang('Error'), 'error');
@ -98,27 +106,26 @@ if ($teacher) {
} }
} }
$meetings = $bbb->getCourseMeetings(); $meetings = $bbb->getMeetings();
if (!empty($meetings)) { if (!empty($meetings)) {
$meetings = array_reverse($meetings); $meetings = array_reverse($meetings);
} }
$users_online = $bbb->getUsersOnlineInCurrentRoom(); $users_online = $bbb->getUsersOnlineInCurrentRoom();
$status = $bbb->isServerRunning(); $status = $bbb->isServerRunning();
$meeting_exists = $bbb->meetingExists(api_get_course_id().'-'.api_get_session_id()); $meetingExists = $bbb->meetingExists($bbb->getCurrentVideoConferenceName());
$show_join_button = false; $showJoinButton = false;
if ($meeting_exists || $teacher) { if ($meetingExists || $conferenceManager) {
$show_join_button = true; $showJoinButton = true;
} }
$tpl->assign('allow_to_edit', $teacher); $tpl->assign('allow_to_edit', $conferenceManager);
$tpl->assign('meetings', $meetings); $tpl->assign('meetings', $meetings);
$conferenceUrl = api_get_path(WEB_PLUGIN_PATH).'bbb/start.php?launch=1&'.api_get_cidreq(); $conferenceUrl = $bbb->getConferenceUrl();
$tpl->assign('conference_url', $conferenceUrl); $tpl->assign('conference_url', $conferenceUrl);
$tpl->assign('users_online', $users_online); $tpl->assign('users_online', $users_online);
$tpl->assign('bbb_status', $status); $tpl->assign('bbb_status', $status);
$tpl->assign('show_join_button', $show_join_button); $tpl->assign('show_join_button', $showJoinButton);
//$tpl->assign('actions', $actions);
$tpl->assign('message', $message); $tpl->assign('message', $message);
$listing_tpl = 'bbb/listing.tpl'; $listing_tpl = 'bbb/listing.tpl';
$content = $tpl->fetch($listing_tpl); $content = $tpl->fetch($listing_tpl);

@ -1,5 +1,5 @@
<?php <?php
require_once dirname(__FILE__).'/config.php'; require_once __DIR__.'/config.php';
$plugin_info = BBBPlugin::create()->get_info(); $plugin_info = BBBPlugin::create()->get_info();

@ -1 +1,2 @@
This plugin will create a link in existing and new courses for the teachers to start a videoconference room, as well as the administration settings to configure this tool. This plugin will create a link in existing and new courses for the teachers to start a videoconference room,
as well as the administration settings to configure this tool.

@ -1,5 +1,4 @@
<?php <?php
/** /**
* This script initiates a video conference session, calling the BigBlueButton API * This script initiates a video conference session, calling the BigBlueButton API
* @package chamilo.plugin.bigbluebutton * @package chamilo.plugin.bigbluebutton
@ -8,19 +7,18 @@
require __DIR__ . '/../../vendor/autoload.php'; require __DIR__ . '/../../vendor/autoload.php';
$course_plugin = 'bbb'; //needed in order to load the plugin lang variables $course_plugin = 'bbb'; //needed in order to load the plugin lang variables
require_once dirname(__FILE__).'/config.php'; require_once __DIR__.'/config.php';
$tool_name = get_lang('Videoconference'); $tool_name = get_lang('Videoconference');
$tpl = new Template($tool_name); $tpl = new Template($tool_name);
$vmIsEnabled = false; $vmIsEnabled = false;
$host = null; $host = '';
$salt = null; $salt = '';
$isGlobal = isset($_GET['global']) ? true : false;
$bbb = new bbb('', '', $isGlobal);
$bbb = new bbb();
if ($bbb->plugin_enabled) { if ($bbb->pluginEnabled) {
if ($bbb->isServerRunning()) { if ($bbb->isServerRunning()) {
if (isset($_GET['launch']) && $_GET['launch'] == 1) { if (isset($_GET['launch']) && $_GET['launch'] == 1) {
@ -28,8 +26,8 @@ if ($bbb->plugin_enabled) {
if (file_exists(__DIR__ . '/config.vm.php')) { if (file_exists(__DIR__ . '/config.vm.php')) {
$config = require __DIR__ . '/config.vm.php'; $config = require __DIR__ . '/config.vm.php';
$vmIsEnabled = true; $vmIsEnabled = true;
$host = null; $host = '';
$salt = null; $salt = '';
require __DIR__ . '/lib/vm/AbstractVM.php'; require __DIR__ . '/lib/vm/AbstractVM.php';
require __DIR__ . '/lib/vm/VMInterface.php'; require __DIR__ . '/lib/vm/VMInterface.php';
@ -38,7 +36,7 @@ if ($bbb->plugin_enabled) {
$vm = new VM($config); $vm = new VM($config);
if ($vm->IsEnabled()) { if ($vm->isEnabled()) {
try { try {
$vm->resizeToMaxLimit(); $vm->resizeToMaxLimit();
} catch (\Exception $e) { } catch (\Exception $e) {
@ -48,28 +46,28 @@ if ($bbb->plugin_enabled) {
} }
} }
$meeting_params = array(); $meetingParams = array();
$meeting_params['meeting_name'] = api_get_course_id().'-'.api_get_session_id(); $meetingParams['meeting_name'] = $bbb->getCurrentVideoConferenceName();
if ($bbb->meetingExists($meeting_params['meeting_name'])) { if ($bbb->meetingExists($meetingParams['meeting_name'])) {
$url = $bbb->joinMeeting($meeting_params['meeting_name']); $url = $bbb->joinMeeting($meetingParams['meeting_name']);
if ($url) { if ($url) {
$bbb->redirectToBBB($url); $bbb->redirectToBBB($url);
} else { } else {
$url = $bbb->createMeeting($meeting_params); $url = $bbb->createMeeting($meetingParams);
$bbb->redirectToBBB($url); $bbb->redirectToBBB($url);
} }
} else { } else {
if ($bbb->isTeacher()) { if ($bbb->isConferenceManager()) {
$url = $bbb->createMeeting($meeting_params); $url = $bbb->createMeeting($meetingParams);
$bbb->redirectToBBB($url); $bbb->redirectToBBB($url);
} else { } else {
$url = 'listing.php?'.api_get_cidreq(); $url = $bbb->getListingUrl();
$bbb->redirectToBBB($url); $bbb->redirectToBBB($url);
} }
} }
} else { } else {
$url = 'listing.php?'.api_get_cidreq(); $url = $bbb->getListingUrl();
header('Location: ' . $url); header('Location: ' . $url);
exit; exit;
} }

@ -1,13 +1,10 @@
<?php <?php
/** /**
* This script is included by main/admin/settings.lib.php when unselecting a plugin * This script is included by main/admin/settings.lib.php when unselecting a plugin
* and is meant to remove things installed by the install.php script in both * and is meant to remove things installed by the install.php script in both
* the global database and the courses tables * the global database and the courses tables
* @package chamilo.plugin.bigbluebutton * @package chamilo.plugin.bigbluebutton
*/ */
/**
* Queries require_once __DIR__.'/config.php';
*/
require_once dirname(__FILE__).'/config.php';
BBBPlugin::create()->uninstall(); BBBPlugin::create()->uninstall();

@ -7,8 +7,12 @@
$objPlugin = TicketPlugin::create(); $objPlugin = TicketPlugin::create();
$table = Database::get_main_table(TABLE_TICKET_ASSIGNED_LOG); // Category
$sql = "CREATE TABLE IF NOT EXISTS ".$table." ( $table = Database::get_main_table(TABLE_TICKET_CATEGORY);
if (!Database::tableExists($table)) {
$table = Database::get_main_table(TABLE_TICKET_ASSIGNED_LOG);
$sql = "CREATE TABLE IF NOT EXISTS ".$table." (
id int UNSIGNED NOT NULL AUTO_INCREMENT, id int UNSIGNED NOT NULL AUTO_INCREMENT,
ticket_id int UNSIGNED DEFAULT NULL, ticket_id int UNSIGNED DEFAULT NULL,
user_id int UNSIGNED DEFAULT NULL, user_id int UNSIGNED DEFAULT NULL,
@ -16,11 +20,9 @@ $sql = "CREATE TABLE IF NOT EXISTS ".$table." (
sys_insert_user_id int UNSIGNED DEFAULT NULL, sys_insert_user_id int UNSIGNED DEFAULT NULL,
PRIMARY KEY PK_ticket_assigned_log (id), PRIMARY KEY PK_ticket_assigned_log (id),
KEY FK_ticket_assigned_log (ticket_id))"; KEY FK_ticket_assigned_log (ticket_id))";
Database::query($sql); Database::query($sql);
//Category $sql = "CREATE TABLE IF NOT EXISTS $table (
$table = Database::get_main_table(TABLE_TICKET_CATEGORY);
$sql = "CREATE TABLE IF NOT EXISTS ".$table." (
id int UNSIGNED NOT NULL AUTO_INCREMENT, id int UNSIGNED NOT NULL AUTO_INCREMENT,
category_id char(3) NOT NULL, category_id char(3) NOT NULL,
project_id char(3) NOT NULL, project_id char(3) NOT NULL,
@ -33,21 +35,21 @@ $sql = "CREATE TABLE IF NOT EXISTS ".$table." (
sys_lastedit_user_id int UNSIGNED DEFAULT NULL, sys_lastedit_user_id int UNSIGNED DEFAULT NULL,
sys_lastedit_datetime datetime DEFAULT NULL, sys_lastedit_datetime datetime DEFAULT NULL,
PRIMARY KEY (id))"; PRIMARY KEY (id))";
Database::query($sql); $result = Database::query($sql);
//Default Categories // Default Categories
$categoRow = array( $categories = array(
$objPlugin->get_lang('Enrollment') => $objPlugin->get_lang('TicketsAboutEnrollment'), $objPlugin->get_lang('Enrollment') => $objPlugin->get_lang('TicketsAboutEnrollment'),
$objPlugin->get_lang('GeneralInformation') => $objPlugin->get_lang('TicketsAboutGeneralInformation'), $objPlugin->get_lang('GeneralInformation') => $objPlugin->get_lang('TicketsAboutGeneralInformation'),
$objPlugin->get_lang('RequestAndPapework') => $objPlugin->get_lang('TicketsAboutRequestAndPapework'), $objPlugin->get_lang('RequestAndPapework') => $objPlugin->get_lang('TicketsAboutRequestAndPapework'),
$objPlugin->get_lang('AcademicIncidence') => $objPlugin->get_lang('TicketsAboutAcademicIncidence'), $objPlugin->get_lang('AcademicIncidence') => $objPlugin->get_lang('TicketsAboutAcademicIncidence'),
$objPlugin->get_lang('VirtualCampus') => $objPlugin->get_lang('TicketsAboutVirtualCampus'), $objPlugin->get_lang('VirtualCampus') => $objPlugin->get_lang('TicketsAboutVirtualCampus'),
$objPlugin->get_lang('OnlineEvaluation') => $objPlugin->get_lang('TicketsAboutOnlineEvaluation') $objPlugin->get_lang('OnlineEvaluation') => $objPlugin->get_lang('TicketsAboutOnlineEvaluation')
); );
$i = 1; $i = 1;
foreach ($categoRow as $category => $description) { foreach ($categories as $category => $description) {
//Online evaluation requires a course // Online evaluation requires a course
if ($i == 6) { if ($i == 6) {
$attributes = array( $attributes = array(
'id' => $i, 'id' => $i,
@ -69,6 +71,7 @@ foreach ($categoRow as $category => $description) {
Database::insert($table, $attributes); Database::insert($table, $attributes);
$i++; $i++;
}
} }
$table = Database::get_main_table(TABLE_TICKET_MESSAGE); $table = Database::get_main_table(TABLE_TICKET_MESSAGE);
@ -105,9 +108,11 @@ $sql = "CREATE TABLE IF NOT EXISTS ".$table." (
KEY ticket_message_id_fk (message_id))"; KEY ticket_message_id_fk (message_id))";
Database::query($sql); Database::query($sql);
//Priority // Priority
$table = Database::get_main_table(TABLE_TICKET_PRIORITY); $table = Database::get_main_table(TABLE_TICKET_PRIORITY);
$sql = "CREATE TABLE IF NOT EXISTS ".$table." (
if (!Database::tableExists($table)) {
$sql = "CREATE TABLE IF NOT EXISTS ".$table." (
id int UNSIGNED NOT NULL AUTO_INCREMENT, id int UNSIGNED NOT NULL AUTO_INCREMENT,
priority_id char(3) NOT NULL, priority_id char(3) NOT NULL,
priority varchar(20) DEFAULT NULL, priority varchar(20) DEFAULT NULL,
@ -119,16 +124,16 @@ $sql = "CREATE TABLE IF NOT EXISTS ".$table." (
sys_lastedit_user_id int UNSIGNED DEFAULT NULL, sys_lastedit_user_id int UNSIGNED DEFAULT NULL,
sys_lastedit_datetime datetime DEFAULT NULL, sys_lastedit_datetime datetime DEFAULT NULL,
PRIMARY KEY (id))"; PRIMARY KEY (id))";
Database::query($sql); Database::query($sql);
//Default Priorities //Default Priorities
$defaultPriorities = array( $defaultPriorities = array(
'NRM' => $objPlugin->get_lang('PriorityNormal'), 'NRM' => $objPlugin->get_lang('PriorityNormal'),
'HGH' => $objPlugin->get_lang('PriorityHigh'), 'HGH' => $objPlugin->get_lang('PriorityHigh'),
'LOW' => $objPlugin->get_lang('PriorityLow') 'LOW' => $objPlugin->get_lang('PriorityLow')
); );
$i = 1; $i = 1;
foreach ($defaultPriorities as $pId => $priority) { foreach ($defaultPriorities as $pId => $priority) {
$attributes = array( $attributes = array(
'id' => $i, 'id' => $i,
'priority_id' => $pId, 'priority_id' => $pId,
@ -137,10 +142,12 @@ foreach ($defaultPriorities as $pId => $priority) {
); );
Database::insert($table, $attributes); Database::insert($table, $attributes);
$i++; $i++;
}
} }
$table = Database::get_main_table(TABLE_TICKET_PROJECT); $table = Database::get_main_table(TABLE_TICKET_PROJECT);
$sql = "CREATE TABLE IF NOT EXISTS ".$table." ( if (!Database::tableExists($table)) {
$sql = "CREATE TABLE IF NOT EXISTS ".$table." (
id int UNSIGNED NOT NULL AUTO_INCREMENT, id int UNSIGNED NOT NULL AUTO_INCREMENT,
project_id char(3) NOT NULL, project_id char(3) NOT NULL,
name varchar(50) DEFAULT NULL, name varchar(50) DEFAULT NULL,
@ -152,44 +159,47 @@ $sql = "CREATE TABLE IF NOT EXISTS ".$table." (
sys_lastedit_user_id int UNSIGNED DEFAULT NULL, sys_lastedit_user_id int UNSIGNED DEFAULT NULL,
sys_lastedit_datetime datetime DEFAULT NULL, sys_lastedit_datetime datetime DEFAULT NULL,
PRIMARY KEY (id))"; PRIMARY KEY (id))";
Database::query($sql); Database::query($sql);
//Default Project Table Ticket //Default Project Table Ticket
$attributes = array( $attributes = array(
'id' => 1, 'id' => 1,
'project_id' => 1, 'project_id' => 1,
'name' => 'Ticket System' 'name' => 'Ticket System'
); );
Database::insert($table, $attributes); Database::insert($table, $attributes);
}
//STATUS //STATUS
$table = Database::get_main_table(TABLE_TICKET_STATUS); $table = Database::get_main_table(TABLE_TICKET_STATUS);
$sql = "CREATE TABLE IF NOT EXISTS ".$table." ( if (!Database::tableExists($table)) {
$sql = "CREATE TABLE IF NOT EXISTS ".$table." (
id int UNSIGNED NOT NULL AUTO_INCREMENT, id int UNSIGNED NOT NULL AUTO_INCREMENT,
status_id char(3) NOT NULL, status_id char(3) NOT NULL,
name varchar(100) NOT NULL, name varchar(100) NOT NULL,
description varchar(255) DEFAULT NULL, description varchar(255) DEFAULT NULL,
PRIMARY KEY (id))"; PRIMARY KEY (id))";
Database::query($sql); Database::query($sql);
//Default status //Default status
$defaultStatus = array( $defaultStatus = array(
'NAT' => $objPlugin->get_lang('StatusNew'), 'NAT' => $objPlugin->get_lang('StatusNew'),
'PND' => $objPlugin->get_lang('StatusPending'), 'PND' => $objPlugin->get_lang('StatusPending'),
'XCF' => $objPlugin->get_lang('StatusUnconfirmed'), 'XCF' => $objPlugin->get_lang('StatusUnconfirmed'),
'CLS' => $objPlugin->get_lang('StatusClose'), 'CLS' => $objPlugin->get_lang('StatusClose'),
'REE' => $objPlugin->get_lang('StatusForwarded') 'REE' => $objPlugin->get_lang('StatusForwarded')
); );
$i = 1; $i = 1;
foreach ($defaultStatus as $abr => $status) { foreach ($defaultStatus as $abr => $status) {
$attributes = array( $attributes = array(
'id' => $i, 'id' => $i,
'status_id' => $abr, 'status_id' => $abr,
'name' => $status 'name' => $status
); );
Database::insert($table, $attributes); Database::insert($table, $attributes);
$i ++; $i++;
}
} }
$table = Database::get_main_table(TABLE_TICKET_TICKET); $table = Database::get_main_table(TABLE_TICKET_TICKET);

@ -80,7 +80,7 @@ if ($load_dirs) {
} }
if ($displayMyCourseViewBySessionLink) { if ($displayMyCourseViewBySessionLink) {
$htmlHeadXtra[] = ' $htmlHeadXtra[] = '
<script type="text/javascript"> <script>
userId = ' . $userId . ' userId = ' . $userId . '
$(document).ready(function() { $(document).ready(function() {
changeMyCoursesView($.cookie("defaultMyCourseView"+userId)); changeMyCoursesView($.cookie("defaultMyCourseView"+userId));
@ -101,8 +101,7 @@ if ($displayMyCourseViewBySessionLink) {
$("#viewBySession").removeClass("btn-primary"); $("#viewBySession").removeClass("btn-primary");
} }
} }
</script> </script>';
';
} }
$controller = new IndexManager(get_lang('MyCourses')); $controller = new IndexManager(get_lang('MyCourses'));

Loading…
Cancel
Save