|
@@ -1,4 +1,5 @@
|
|
|
<?php
|
|
|
+
|
|
|
/**
|
|
|
* This script initiates a videoconference session, calling the BigBlueButton API
|
|
|
* @package chamilo.plugin.bigbluebutton
|
|
@@ -43,6 +44,10 @@ class bbb {
|
|
|
return false;
|
|
|
}
|
|
|
|
|
|
+ function is_teacher() {
|
|
|
+ return api_is_course_admin() || api_is_coach() || api_is_platform_admin();
|
|
|
+ }
|
|
|
+
|
|
|
function create_meeting($params) {
|
|
|
$params['c_id'] = api_get_course_int_id();
|
|
|
$course_code = api_get_course_id();
|
|
@@ -62,21 +67,22 @@ class bbb {
|
|
|
$id = Database::insert($this->table, $params);
|
|
|
|
|
|
if ($id) {
|
|
|
- if ($this->debug) error_log("create_meeting $id ");
|
|
|
+ if ($this->debug) error_log("create_meeting: $id ");
|
|
|
|
|
|
$meeting_name = isset($params['meeting_name']) ? $params['meeting_name'] : api_get_course_id();
|
|
|
$welcome_msg = isset($params['welcome_msg']) ? $params['welcome_msg'] : null;
|
|
|
$record = isset($params['record']) && $params['record'] ? 'true' : 'false';
|
|
|
$duration = isset($params['duration']) ? intval($params['duration']) : 0;
|
|
|
|
|
|
-
|
|
|
// ??
|
|
|
$voiceBridge = 0;
|
|
|
$metadata = array('maxParticipants' => $max);
|
|
|
- return $this->protocol.BigBlueButtonBN::createMeetingAndGetJoinURL(
|
|
|
+ $result = $this->protocol.BigBlueButtonBN::createMeetingAndGetJoinURL(
|
|
|
$this->user_complete_name, $meeting_name, $id, $welcome_msg, $moderator_password, $attende_password,
|
|
|
$this->salt, $this->url, $this->logout_url, $record, $duration, $voiceBridge, $metadata
|
|
|
);
|
|
|
+ if ($this->debug) error_log("create_meeting result: ".print_r($result,1));
|
|
|
+ return $result;
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -95,7 +101,8 @@ class bbb {
|
|
|
* @todo implement moderator pass
|
|
|
*/
|
|
|
function join_meeting($meeting_name) {
|
|
|
- $pass = $this->get_user_metting_password();
|
|
|
+ $pass = $this->get_user_meeting_password();
|
|
|
+ $mod_pass = $this->get_mod_meeting_password();
|
|
|
$meeting_data = Database::select('*', $this->table, array('where' => array('meeting_name = ? AND status = 1 ' => $meeting_name)), 'first');
|
|
|
if (empty($meeting_data)) {
|
|
|
if ($this->debug) error_log("meeting does not exist: $meeting_name ");
|
|
@@ -103,16 +110,16 @@ class bbb {
|
|
|
}
|
|
|
|
|
|
$meeting_is_running = BigBlueButtonBN::isMeetingRunning($meeting_data['id'], $this->url, $this->salt);
|
|
|
-
|
|
|
-
|
|
|
- $meeting_info = BigBlueButtonBN::getMeetingInfoArray($meeting['id'], $pass, $this->url, $this->salt);
|
|
|
+ $meeting_info = BigBlueButtonBN::getMeetingInfoArray($meeting_data['id'], $mod_pass, $this->url, $this->salt);
|
|
|
$meeting_info_exists = false;
|
|
|
|
|
|
if ($meeting_info['returncode'] != 'FAILED') {
|
|
|
$meeting_info_exists = true;
|
|
|
- }
|
|
|
+ }
|
|
|
+
|
|
|
$url = false;
|
|
|
- if ($this->debug) error_log("meeting is running".$meeting_is_running);
|
|
|
+ if ($this->debug) error_log("meeting is running: ".$meeting_is_running);
|
|
|
+ if ($this->debug) error_log("meeting is running:getMeetingInfoArray ".print_r($meeting_info, 1));
|
|
|
|
|
|
if (isset($meeting_is_running) && $meeting_info_exists) {
|
|
|
$url = $this->protocol.BigBlueButtonBN::joinURL($meeting_data['id'], $this->user_complete_name, $pass, $this->salt, $this->url);
|
|
@@ -126,7 +133,7 @@ class bbb {
|
|
|
* @return string
|
|
|
*/
|
|
|
function get_course_meetings() {
|
|
|
- $pass = $this->get_user_metting_password();
|
|
|
+ $pass = $this->get_user_meeting_password();
|
|
|
$meeting_list = Database::select('*', $this->table, array('where' => array('c_id = ? ' => api_get_course_int_id())));
|
|
|
$new_meeting_list = array();
|
|
|
|
|
@@ -139,6 +146,7 @@ class bbb {
|
|
|
$item_meeting['end_url'] = api_get_self().'?action=end&id='.$meeting['id'];
|
|
|
$item_meeting['add_to_calendar_url'] = api_get_self().'?action=add_to_calendar&id='.$meeting['id'].'&start='.api_strtotime($meeting['created_at']);
|
|
|
}
|
|
|
+
|
|
|
$record_array = array();
|
|
|
|
|
|
if ($meeting['record'] == 1) {
|
|
@@ -156,10 +164,12 @@ class bbb {
|
|
|
foreach ($record['playbacks'] as $item) {
|
|
|
$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(Display::return_icon('link.gif',get_lang('CopyToLinkTool')), api_get_self().'?action=copy_record_to_link_tool&id='.$meeting['id'].'&record_id='.$record['recordID']);
|
|
|
- $url .= Display::url(Display::return_icon('agenda.png',get_lang('AddToCalendar')), api_get_self().'?action=add_to_calendar&id='.$meeting['id'].'&start='.api_strtotime($meeting['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']);
|
|
|
-
|
|
|
+ if ($this->is_teacher()) {
|
|
|
+ $url .= Display::url(Display::return_icon('link.gif',get_lang('CopyToLinkTool')), api_get_self().'?action=copy_record_to_link_tool&id='.$meeting['id'].'&record_id='.$record['recordID']);
|
|
|
+ $url .= Display::url(Display::return_icon('agenda.png',get_lang('AddToCalendar')), api_get_self().'?action=add_to_calendar&id='.$meeting['id'].'&start='.api_strtotime($meeting['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 .= api_get_self().'?action=publish&id='.$record['recordID'];
|
|
|
$count++;
|
|
@@ -194,20 +204,23 @@ class bbb {
|
|
|
}
|
|
|
|
|
|
function end_meeting($id) {
|
|
|
- $pass = $this->get_user_metting_password();
|
|
|
+ $pass = $this->get_user_meeting_password();
|
|
|
BigBlueButtonBN::endMeeting($id, $pass, $this->url, $this->salt);
|
|
|
Database::update($this->table, array('status' => 0), array('id = ? ' => $id));
|
|
|
}
|
|
|
|
|
|
- function get_user_metting_password() {
|
|
|
- $teacher = api_is_course_admin() || api_is_coach() || api_is_platform_admin();
|
|
|
- if ($teacher) {
|
|
|
+ function get_user_meeting_password() {
|
|
|
+ if ($this->is_teacher()) {
|
|
|
return api_get_course_id().'mod';
|
|
|
} else {
|
|
|
return api_get_course_id();
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ function get_mod_meeting_password() {
|
|
|
+ return api_get_course_id().'mod';
|
|
|
+ }
|
|
|
+
|
|
|
/**
|
|
|
* Get users online in the current course room
|
|
|
*/
|
|
@@ -217,7 +230,7 @@ class bbb {
|
|
|
if (empty($meeting_data)) {
|
|
|
return 0;
|
|
|
}
|
|
|
- $pass = $this->get_user_metting_password();
|
|
|
+ $pass = $this->get_mod_meeting_password();
|
|
|
//$meeting_is_running = BigBlueButtonBN::isMeetingRunning($meeting_data['id'], $this->url, $this->salt);
|
|
|
$info = BigBlueButtonBN::getMeetingInfoArray($meeting_data['id'], $pass, $this->url, $this->salt);
|
|
|
|