commit
0252b595ea
|
After Width: | Height: | Size: 1.1 KiB |
@ -1,370 +1,252 @@ |
|||||||
<?php |
<?php |
||||||
/** |
/** |
||||||
* This file contains the helper libraries for the BigBlueButton conference plugin. |
* This script initiates a videoconference session, calling the BigBlueButton API |
||||||
* It is based on code written by Dual Code Inc in GNU/GPLv2 |
|
||||||
* Copyright (C) 2010 Dual Code Inc. (www.dualcode.com) |
|
||||||
* Copyright (C) 2010 BeezNest Belgium SPRL (www.beeznest.com) - Yannick Warnier - y@beeznest.com |
|
||||||
* @package chamilo.plugin.bigbluebutton |
* @package chamilo.plugin.bigbluebutton |
||||||
*/ |
|
||||||
/** |
|
||||||
* Inserts an item into the plugin_bbb table |
|
||||||
*/ |
|
||||||
function bigbluebutton_insert_record($table,$object) { |
|
||||||
//ignore the first param (used for compatibility with existing code) |
|
||||||
$table = Database::get_main_table('plugin_bbb'); |
|
||||||
$sql = "INSERT INTO $table (course_id, name, meeting_name, meeting_id, attendee_pw, moderator_pw, auto_login, new_window, welcome_msg)" . |
|
||||||
"VALUES (" . |
|
||||||
intval($object->course) .", " . |
|
||||||
"'".Database::escape_string($object->name)."'," . |
|
||||||
"'".Database::escape_string($object->meetingname)."'," . |
|
||||||
"'".Database::escape_string($object->meetingid)."'," . |
|
||||||
"'".Database::escape_string($object->attendeepw)."'," . |
|
||||||
"'".Database::escape_string($object->moderatorpw)."'," . |
|
||||||
"'".Database::escape_string($object->autologin)."'," . |
|
||||||
"'".Database::escape_string($object->newwindow)."'," . |
|
||||||
"'".Database::escape_string($object->welcomemsg)."'" . |
|
||||||
")"; |
|
||||||
Database::query($sql); |
|
||||||
return Database::insert_id(); |
|
||||||
} |
|
||||||
/** |
|
||||||
* Updates a bigbluebutton record |
|
||||||
*/ |
|
||||||
function bigbluebutton_update_record($table, $object) { |
|
||||||
//ignore the first param (used for compatibility with existing code) $table = Database::get_main_table('plugin_bbb'); |
|
||||||
$sql = "UPDATE $table (course_id, name, meeting_name, meeting_id, attendee_pw, moderator_pw, auto_login, new_window, welcome_msg)" . |
|
||||||
" SET course_id = ".intval($object->course) .", " . |
|
||||||
" name = '".Database::escape_string($object->name)."'," . |
|
||||||
" meeting_name = '".Database::escape_string($object->meetingname)."'," . |
|
||||||
" meeting_id = '".Database::escape_string($object->meetingid)."'," . |
|
||||||
" attendee_pw = '".Database::escape_string($object->attendeepw)."'," . |
|
||||||
" moderator_pw = '".Database::escape_string($object->moderatorpw)."'," . |
|
||||||
" auto_login = '".Database::escape_string($object->autologin)."'," . |
|
||||||
" new_window = '".Database::escape_string($object->newwindow)."'," . |
|
||||||
" welcome_msg = '".Database::escape_string($object->welcomemsg)."'," . |
|
||||||
" WHERE id = " .intval($object->id). |
|
||||||
")"; |
|
||||||
Database::query($sql); |
|
||||||
return $oject->id; |
|
||||||
} |
|
||||||
/** |
|
||||||
* Gets a bigbluebutton room record from an ID |
|
||||||
*/ |
|
||||||
function bigbluebutton_get_record($table,$field,$id) { |
|
||||||
//ignore the first param (used for compatibility with existing code) |
|
||||||
$table = Database::get_main_table('plugin_bbb'); |
|
||||||
$sql = "SELECT * FROM $table WHERE id = ".intval($id); |
|
||||||
$res = Database::query($sql); |
|
||||||
if (Database::num_rows($res)>0) { |
|
||||||
$row = Database::fetch_assoc($res); |
|
||||||
$room = null; |
|
||||||
$room->id = $id; |
|
||||||
$room->course = $row['course_id']; |
|
||||||
$room->name = $row['name']; |
|
||||||
$room->meetingname = $row['meeting_name']; |
|
||||||
$room->meetingid = $row['meeting_id']; |
|
||||||
$room->attendeepw = $row['attendee_pw']; |
|
||||||
$room->moderatorpw = $row['moderator_pw']; |
|
||||||
$room->autologin = $row['auto_login']; |
|
||||||
$room->newwindow = $row['new_window']; |
|
||||||
$room->welcomemsg = $row['welcome_msg']; |
|
||||||
return $room; |
|
||||||
} else { |
|
||||||
return null; |
|
||||||
} |
|
||||||
} |
|
||||||
/** |
|
||||||
* Gets a bigbluebutton room record from an ID |
|
||||||
*/ |
|
||||||
function bigbluebutton_delete_records($table,$field,$id) { |
|
||||||
//ignore the first param (used for compatibility with existing code) |
|
||||||
$table = Database::get_main_table('plugin_bbb'); |
|
||||||
$sql = "DELETE FROM $table WHERE id = ".intval($id); |
|
||||||
} |
|
||||||
/** |
|
||||||
* Add an event |
|
||||||
*/ |
|
||||||
function bigbluebutton_add_event($event) { |
|
||||||
// |
|
||||||
} |
|
||||||
/** |
|
||||||
* Given an object containing all the necessary data, |
|
||||||
* (defined by the form in mod.html) this function |
|
||||||
* will create a new instance and return the id number |
|
||||||
* of the new instance. |
|
||||||
*/ |
*/ |
||||||
function bigbluebutton_add_instance($bigbluebutton) { |
|
||||||
$bigbluebutton->timemodified = time(); |
|
||||||
if ($returnid = bigbluebutton_insert_record('bigbluebutton', $bigbluebutton)) { |
|
||||||
$event = NULL; |
|
||||||
$event->courseid = $bigbluebutton->course; |
|
||||||
$event->name = $bigbluebutton->name; |
|
||||||
$event->meetingname = $bigbluebutton->meetingname; |
|
||||||
$event->meetingid = $bigbluebutton->meetingid; |
|
||||||
$event->attendeepw = $bigbluebutton->attendeepw; |
|
||||||
$event->moderatorpw = $bigbluebutton->moderatorpw; |
|
||||||
$event->autologin = $bigbluebutton->autologin; |
|
||||||
$event->newwindow = $bigbluebutton->newwindow; |
|
||||||
$event->welcomemsg = $bigbluebutton->welcomemsg; |
|
||||||
bigbluebutton_add_event($event); |
|
||||||
} |
|
||||||
return $returnid; |
|
||||||
} |
|
||||||
|
|
||||||
|
class bbb { |
||||||
|
|
||||||
/** |
var $url; |
||||||
* Given an object containing all the necessary data, |
var $salt; |
||||||
* (defined by the form in mod.html) this function |
var $api; |
||||||
* will update an existing instance with new data. |
var $user_complete_name = null; |
||||||
*/ |
var $protocol = 'http://'; |
||||||
function bigbluebutton_update_instance($bigbluebutton) { |
var $debug = true; |
||||||
$bigbluebutton->timemodified = time(); |
var $logout_url = null; |
||||||
$bigbluebutton->id = $bigbluebutton->instance; |
|
||||||
if ($returnid = bigbluebutton_update_record('bigbluebutton', $bigbluebutton)) { |
function __construct() { |
||||||
/* |
|
||||||
$event = NULL; |
|
||||||
if ($event->id = bigbluebutton_get_field('event', 'id', 'modulename', 'bigbluebutton', 'instance', $bigbluebutton->id)) { |
|
||||||
$event->courseid = $bigbluebutton->course; |
|
||||||
$event->name = $bigbluebutton->name; |
|
||||||
$event->meetingname = $bigbluebutton->meetingname; |
|
||||||
$event->meetingid = $bigbluebutton->meetingid; |
|
||||||
$event->attendeepw = $bigbluebutton->attendeepw; |
|
||||||
$event->moderatorpw = $bigbluebutton->moderatorpw; |
|
||||||
$event->autologin = $bigbluebutton->autologin; |
|
||||||
$event->newwindow = $bigbluebutton->newwindow; |
|
||||||
$event->welcomemsg = $bigbluebutton->welcomemsg; |
|
||||||
bigbluebutton_update_event($event); |
|
||||||
}*/ |
|
||||||
} |
|
||||||
return $returnid; |
|
||||||
} |
|
||||||
|
|
||||||
|
// initialize video server settings from global settings |
||||||
|
$settings = api_get_settings('Extra','list',api_get_current_access_url_id()); |
||||||
|
$bbb_settings = array(); |
||||||
|
foreach ($settings as $setting) { |
||||||
|
if (substr($setting['variable'],0,4)==='bbb_') { |
||||||
|
$bbb_settings[$setting['variable']] = $setting['selected_value']; |
||||||
|
} |
||||||
|
} |
||||||
|
$bbb_plugin = $bbb_settings['bbb_plugin'] === 'true'; |
||||||
|
$bbb_host = $bbb_settings['bbb_plugin_host']; |
||||||
|
$bbb_salt = $bbb_settings['bbb_plugin_salt']; |
||||||
|
|
||||||
|
$course_code = api_get_course_id(); |
||||||
|
|
||||||
/** |
$this->logout_url = api_get_path(WEB_COURSE_PATH).$course_code; |
||||||
* Given an ID of an instance of this module, |
|
||||||
* this function will permanently delete the instance |
if ($bbb_plugin) { |
||||||
* and any data that depends on it. |
$user_info = api_get_user_info(); |
||||||
*/ |
$this->user_complete_name = $user_info['complete_name']; |
||||||
function bigbluebutton_delete_instance($id) { |
$this->salt = $bbb_salt; |
||||||
if (! $bigbluebutton = bigbluebutton_get_record('bigbluebutton', 'id', $id)) { |
$this->url = $bbb_host.'/bigbluebutton/'; |
||||||
|
$this->table = Database::get_main_table('plugin_bbb_meeting'); |
||||||
|
return true; |
||||||
|
} |
||||||
return false; |
return false; |
||||||
} |
} |
||||||
|
|
||||||
$result = true; |
function create_meeting($params) { |
||||||
|
$params['c_id'] = api_get_course_int_id(); |
||||||
|
$course_code = api_get_course_id(); |
||||||
|
|
||||||
# Delete any dependent records here # |
$attende_password = $params['attendee_pw'] = isset($params['moderator_pw']) ? $params['moderator_pw'] : api_get_course_id(); |
||||||
|
$moderator_password = $params['moderator_pw'] = isset($params['moderator_pw']) ? $params['moderator_pw'] : api_get_course_id().'mod'; |
||||||
|
|
||||||
if (! bigbluebutton_delete_records('bigbluebutton', 'id', $bigbluebutton->id)) { |
$params['record'] = api_get_course_setting('big_blue_button_record_and_store', $course_code) == 1 ? true : false; |
||||||
$result = false; |
$max = api_get_course_setting('big_blue_button_max_students_allowed', $course_code); |
||||||
} |
|
||||||
/* |
$max = isset($max) ? $max : -1; |
||||||
$pagetypes = page_import_types('mod/bigbluebutton/'); |
$params['status'] = 1; |
||||||
foreach($pagetypes as $pagetype) { |
|
||||||
if(!delete_records('block_instance', 'pageid', $bigbluebutton->id, 'pagetype', $pagetype)) { |
if ($this->debug) error_log("enter create_meeting ".print_r($params, 1)); |
||||||
$result = false; |
|
||||||
|
$params['created_at'] = api_get_utc_datetime(); |
||||||
|
$id = Database::insert($this->table, $params); |
||||||
|
|
||||||
|
if ($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($this->user_complete_name, $meeting_name, $id, $welcome_msg, $moderator_password, $attende_password, |
||||||
|
$this->salt, $this->url, $this->logout_url, $record, $duration, $voiceBridge, $metadata); |
||||||
|
|
||||||
|
//$id = Database::update($this->table, array('created_at' => '')); |
||||||
} |
} |
||||||
} |
} |
||||||
*/ |
|
||||||
/* |
function is_meeting_exist($meeting_name) { |
||||||
if (! bigbluebutton_delete_records('event', 'modulename', 'bigbluebutton', 'instance', $bigbluebutton->id)) { |
$course_id = api_get_course_int_id(); |
||||||
$result = false; |
$meeting_data = Database::select('*', $this->table, array('where' => array('c_id = ? AND meeting_name = ? AND status = 1 ' => array($course_id, $meeting_name))), 'first'); |
||||||
|
if ($this->debug) error_log("is_meeting_exist ".print_r($meeting_data,1)); |
||||||
|
if (empty($meeting_data)) { |
||||||
|
return false; |
||||||
|
} else { |
||||||
|
return true; |
||||||
|
} |
||||||
} |
} |
||||||
*/ |
|
||||||
return $result; |
|
||||||
} |
|
||||||
|
|
||||||
|
/** |
||||||
|
* @todo implement moderator pass |
||||||
|
*/ |
||||||
|
function join_meeting($meeting_name) { |
||||||
|
$pass = $this->get_user_metting_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 "); |
||||||
|
return false; |
||||||
|
} |
||||||
|
|
||||||
/** |
$meeting_is_running = BigBlueButtonBN::isMeetingRunning($meeting_data['id'], $this->url, $this->salt); |
||||||
* Create string where we check if the meeting is running |
|
||||||
*/ |
|
||||||
function wc_isMeetingRunningURL($myIP,$mySecuritySalt,$myMeetingID) { |
|
||||||
$checkAPI = "/bigbluebutton/api/isMeetingRunning?"; |
|
||||||
$queryStr = "meetingID=".$myMeetingID; |
|
||||||
$checksum = sha1('isMeetingRunning'.$queryStr.$mySecuritySalt); |
|
||||||
$secQueryURL = "http://".$myIP.$checkAPI.$queryStr."&checksum=".$checksum; |
|
||||||
return $secQueryURL; |
|
||||||
} |
|
||||||
|
|
||||||
|
|
||||||
/** |
$meeting_info = BigBlueButtonBN::getMeetingInfoArray($meeting['id'], $pass, $this->url, $this->salt); |
||||||
* Determine if the meeting is already running (e.g. has attendees in it) |
$meeting_info_exists = false; |
||||||
*/ |
|
||||||
function wc_isMeetingRunning($myIP,$mySecuritySalt,$myMeetingID) { |
|
||||||
$secQueryURL = wc_isMeetingRunningURL($myIP,$mySecuritySalt,$myMeetingID); |
|
||||||
$myResponse = @file_get_contents($secQueryURL); |
|
||||||
if ($myResponse === false) { return false;} |
|
||||||
$doc = new DOMDocument(); |
|
||||||
$doc->loadXML($myResponse); |
|
||||||
$returnCodeNode = $doc->getElementsByTagName("returncode"); |
|
||||||
$returnCode = $returnCodeNode->item(0)->nodeValue; |
|
||||||
$runningNode = $doc->getElementsByTagName("running"); |
|
||||||
$isRunning = $runningNode->item(0)->nodeValue; |
|
||||||
return $isRunning; |
|
||||||
} |
|
||||||
|
|
||||||
/** |
if ($meeting_info['returncode'] != 'FAILED') { |
||||||
* Create meeting if it's not already running |
$meeting_info_exists = true; |
||||||
*/ |
} |
||||||
function wc_createMeeting($myIP,$mySecuritySalt,$myMeetingName,$myMeetingID,$myAttendeePW,$myModeratorPW,$myWelcomeMsg,$myLogoutURL) { |
$url = false; |
||||||
$createAPI = "/bigbluebutton/api/create?"; |
if ($this->debug) error_log("meeting is running".$meeting_is_running); |
||||||
$myVoiceBridge = rand(70000,79999); |
|
||||||
$queryStr = "name=".urlencode($myMeetingName)."&meetingID=".urlencode($myMeetingID)."&attendeePW=".urlencode($myAttendeePW)."&moderatorPW=".urlencode($myModeratorPW)."&voiceBridge=".$myVoiceBridge."&welcome=".urlencode($myWelcomeMsg)."&logoutURL=".urlencode($myLogoutURL); |
if (isset($meeting_is_running) && $meeting_info_exists) { |
||||||
$checksum = sha1('create'.$queryStr.$mySecuritySalt); |
$url = $this->protocol.BigBlueButtonBN::joinURL($meeting_data['id'], $this->user_complete_name, $pass, $this->salt, $this->url); |
||||||
$secQueryURL = "http://".$myIP.$createAPI.$queryStr."&checksum=".$checksum; |
} |
||||||
$myResponse = @file_get_contents($secQueryURL); |
if ($this->debug) error_log("return url :".$url); |
||||||
if ($myResponse === false) { return false; } |
return $url; |
||||||
$doc= new DOMDocument(); |
|
||||||
$doc->loadXML($myResponse); |
|
||||||
$returnCodeNode = $doc->getElementsByTagName("returncode"); |
|
||||||
$returnCode = $returnCodeNode->item(0)->nodeValue; |
|
||||||
|
|
||||||
if ($returnCode=="SUCCESS") { |
|
||||||
return $returnCode; |
|
||||||
} else { |
|
||||||
$messageKeyNode = $doc->getElementsByTagName("messageKey"); |
|
||||||
$messageKey = $messageKeyNode->item(0)->nodeValue; |
|
||||||
return $messageKey; |
|
||||||
} |
} |
||||||
} |
|
||||||
|
|
||||||
|
/** |
||||||
|
* Gets all the course meetings saved in the plugin_bbb_meeting table |
||||||
|
* @return string |
||||||
|
*/ |
||||||
|
function get_course_meetings() { |
||||||
|
$pass = $this->get_user_metting_password(); |
||||||
|
$meeting_list = Database::select('*', $this->table, array('where' => array('c_id = ? ' => api_get_course_int_id()))); |
||||||
|
$new_meeting_list = array(); |
||||||
|
|
||||||
|
foreach ($meeting_list as $meeting) { |
||||||
|
$item_meeting = $meeting; |
||||||
|
$item_meeting['info'] = BigBlueButtonBN::getMeetingInfoArray($meeting['id'], $pass, $this->url, $this->salt); |
||||||
|
|
||||||
|
if ($meeting['info']['returncode'] == 'FAILED') { |
||||||
|
} else { |
||||||
|
$item_meeting['end_url'] = api_get_self().'?action=end&id='.$meeting['id']; |
||||||
|
} |
||||||
|
$record_array = array(); |
||||||
|
|
||||||
|
if ($meeting['record'] == 1) { |
||||||
|
$records = BigBlueButtonBN::getRecordingsArray($meeting['id'], $this->url, $this->salt); |
||||||
|
//var_dump($meeting['id']); |
||||||
|
if (!empty($records)) { |
||||||
|
foreach ($records as $record) { |
||||||
|
if (is_array($record) && isset($record['recordID']) && isset($record['playbacks'])) { |
||||||
|
|
||||||
|
//Fix the bbb timestamp |
||||||
|
$record['startTime'] = substr($record['startTime'], 0, strlen($record['startTime']) -3); |
||||||
|
$record['endTime'] = substr($record['endTime'], 0, strlen($record['endTime']) -3); |
||||||
|
|
||||||
|
foreach ($record['playbacks'] as $item) { |
||||||
|
$url = Display::url(get_lang('ViewRecord'), $item['url'], array('target' => '_blank')).' - '.api_convert_and_format_date($record['startTime']).' - '.api_convert_and_format_date($record['endTime']); |
||||||
|
//$url .= Display::url(get_lang('DeleteRecord'), api_get_self().'?action=delete_record&'.$record['recordID']); |
||||||
|
$url .= Display::url(get_lang('CopyToLinkTool'), api_get_self().'?action=copy_record_to_link_tool&id='.$meeting['id'].'&record_id='.$record['recordID']); |
||||||
|
//$url .= api_get_self().'?action=publish&id='.$record['recordID']; |
||||||
|
$record_array[] = $url; |
||||||
|
} |
||||||
|
} |
||||||
|
} |
||||||
|
} |
||||||
|
$item_meeting['show_links'] = implode('<br />', $record_array); |
||||||
|
} |
||||||
|
|
||||||
/** |
$item_meeting['created_at'] = api_get_local_time($item_meeting['created_at']); |
||||||
* Create a URL to join the meeting |
//created_at |
||||||
*/ |
|
||||||
function wc_joinMeetingURL($myIP,$mySecuritySalt,$myName,$myMeetingID,$myPassword,$userID) { |
|
||||||
$joinAPI = "/bigbluebutton/api/join?"; |
|
||||||
$queryStr = "fullName=".urlencode($myName)."&meetingID=".urlencode($myMeetingID)."&password=".urlencode($myPassword)."&userID=".$userID; |
|
||||||
$checksum = sha1('join'.$queryStr.$mySecuritySalt); |
|
||||||
$createStr = "http://".$myIP.$joinAPI.$queryStr."&checksum=".$checksum; |
|
||||||
|
|
||||||
return $createStr; |
$item_meeting['publish_url'] = api_get_self().'?action=publish&id='.$meeting['id']; |
||||||
} |
$item_meeting['unpublish_url'] = api_get_self().'?action=unpublish&id='.$meeting['id']; |
||||||
|
|
||||||
/** |
if ($meeting['status'] == 1) { |
||||||
* This API is not yet supported in bigbluebutton |
$item_meeting['go_url'] = $this->protocol.BigBlueButtonBN::joinURL($meeting['id'], $this->user_complete_name, $pass, $this->salt, $this->url); |
||||||
*/ |
} |
||||||
function wc_endMeeting($myIP,$mySecuritySalt,$myMeetingID,$myModeratorPW) { |
$new_meeting_list[] = $item_meeting; |
||||||
$endAPI = "/bigbluebutton/api/end?"; |
} |
||||||
$myVoiceBridge = rand(70000,79999); |
return $new_meeting_list; |
||||||
$queryStr = "meetingID=".$myMeetingID."&moderatorPW=".$myModeratorPW."&voiceBridge=".$myVoiceBridge; |
|
||||||
$checksum = sha1('create'.$queryStr.$mySecuritySalt); |
|
||||||
$secQueryURL = "http://".$myIP.$endAPI.$queryStr."&checksum=".$checksum; |
|
||||||
$myResponse = @file_get_contents($secQueryURL); |
|
||||||
if ($myResponse === false) { return false; } |
|
||||||
$doc= new DOMDocument(); |
|
||||||
$doc->loadXML($myResponse); |
|
||||||
$returnCodeNode = $doc->getElementsByTagName("returncode"); |
|
||||||
$returnCode = $returnCodeNode->item(0)->nodeValue; |
|
||||||
if ($returnCode=="SUCCESS") { |
|
||||||
return $returnCode; |
|
||||||
} else { |
|
||||||
$messageKeyNode = $doc->getElementsByTagName("messageKey"); |
|
||||||
$messageKey = $messageKeyNode->item(0)->nodeValue; |
|
||||||
return $messageKey; |
|
||||||
} |
} |
||||||
} |
|
||||||
|
|
||||||
/** |
function publish_meeting($id) { |
||||||
* This API is not yet supported in bigbluebutton |
return BigBlueButtonBN::setPublishRecordings($id, 'true', $this->url, $this->salt); |
||||||
*/ |
} |
||||||
function wc_listAttendees() { |
|
||||||
return false; |
|
||||||
} |
|
||||||
|
|
||||||
/** |
function unpublish_meeting($id) { |
||||||
* This API is not yet supported in bigbluebutton |
return BigBlueButtonBN::setPublishRecordings($id, 'false', $this->url, $this->salt); |
||||||
*/ |
|
||||||
function wc_getMeetingInfo($myIP,$mySecuritySalt,$meetingID,$modPW) { |
|
||||||
$checkAPI = "/bigbluebutton/api/getMeetingInfo?"; |
|
||||||
$queryStr = 'meetingID='.$meetingID.'&password='.$modPW; |
|
||||||
$checksum = sha1('getMeetingInfo'.$queryStr.$mySecuritySalt); |
|
||||||
$secQueryURL = "http://".$myIP.$checkAPI.$queryStr."&checksum=".$checksum; |
|
||||||
$myResponse = @file_get_contents($secQueryURL); |
|
||||||
if ($myResponse === false) { return false;} |
|
||||||
$doc = new DOMDocument(); |
|
||||||
$doc->loadXML($myResponse); |
|
||||||
$returnCodeNode = $doc->getElementsByTagName("returncode"); |
|
||||||
$returnCode = $returnCodeNode->item(0)->nodeValue; |
|
||||||
$createTimeNode = $doc->getElementsByTagName("createTime"); |
|
||||||
$createTime = $createTimeNode->item(0)->nodeValue; |
|
||||||
$runningNode = $doc->getElementsByTagName("running"); |
|
||||||
$running = $runningNode->item(0)->nodeValue; |
|
||||||
$attendeesNode = $doc->getElementsByTagName("attendee"); |
|
||||||
$attendees = array(); |
|
||||||
foreach ($attendeesNode as $attendeeNode) { |
|
||||||
$attendee = array(); |
|
||||||
if ($attendeeNode->childNodes->length) { |
|
||||||
foreach ($attendeeNode->childNodes as $i) { |
|
||||||
//see http://code.google.com/p/bigbluebutton/wiki/API#Get_Meeting_Info for details |
|
||||||
$attendee[$i->nodeName] = $i->nodeValue; |
|
||||||
} |
|
||||||
} |
|
||||||
$attendees[] = $attendee; |
|
||||||
} |
} |
||||||
$info = array('returnCode'=>$returnCode,'createTime'=>$createTime,'attendees'=>$attendees,'running'=>$running); |
|
||||||
return $info; |
|
||||||
} |
|
||||||
|
|
||||||
/** |
function end_meeting($id) { |
||||||
* Determine the URL of the current page (for logoutURL) |
$pass = $this->get_user_metting_password(); |
||||||
*/ |
BigBlueButtonBN::endMeeting($id, $pass, $this->url, $this->salt); |
||||||
function wc_currentPageURL() { |
Database::update($this->table, array('status' => 0), array('id = ? ' => $id)); |
||||||
$isHTTPS = (isset($_SERVER["HTTPS"]) && $_SERVER["HTTPS"] == "on"); |
} |
||||||
$port = (isset($_SERVER["SERVER_PORT"]) && ((!$isHTTPS && $_SERVER["SERVER_PORT"] != "80") || ($isHTTPS && $_SERVER["SERVER_PORT"] != "443"))); |
|
||||||
$port = ($port) ? ':'.$_SERVER["SERVER_PORT"] : ''; |
|
||||||
$pageURL = ($isHTTPS ? 'https://' : 'http://').$_SERVER["SERVER_NAME"].$port.$_SERVER["REQUEST_URI"]; |
|
||||||
return $pageURL; |
|
||||||
} |
|
||||||
|
|
||||||
|
function get_user_metting_password() { |
||||||
|
$teacher = api_is_course_admin() || api_is_coach() || api_is_platform_admin(); |
||||||
|
if ($teacher) { |
||||||
|
return api_get_course_id().'mod'; |
||||||
|
} else { |
||||||
|
return api_get_course_id(); |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
/** |
/** |
||||||
* Determine the IP/Domain of the current Corporate University |
* Get users online in the current course room |
||||||
*/ |
*/ |
||||||
function wc_currentDomain() { |
function get_users_online_in_current_room() { |
||||||
$currentDomain = $_SERVER["SERVER_NAME"]; |
$course_id = api_get_course_int_id(); |
||||||
return $currentDomain; |
$meeting_data = Database::select('*', $this->table, array('where' => array('c_id = ? AND status = 1 ' => $course_id)), 'first'); |
||||||
} |
if (empty($meeting_data)) { |
||||||
|
return 0; |
||||||
|
} |
||||||
|
$pass = $this->get_user_metting_password(); |
||||||
|
//$meeting_is_running = BigBlueButtonBN::isMeetingRunning($meeting_data['id'], $this->url, $this->salt); |
||||||
|
$info = BigBlueButtonBN::getMeetingInfoArray($meeting_data['id'], $pass, $this->url, $this->salt); |
||||||
|
|
||||||
|
if (!empty($info) && isset($info['participantCount'])) { |
||||||
|
return $info['participantCount']; |
||||||
|
|
||||||
/** |
} |
||||||
* Determine if a new version of the plug-in is available |
return 0; |
||||||
*/ |
} |
||||||
function wc_needUpgrade() { |
|
||||||
$returnValue = false; |
|
||||||
$installedVersion = "20100805"; |
|
||||||
$availableVersion = dc_getVersion(); |
|
||||||
if ((int)$installedVersion < (int)$availableVersion) { |
|
||||||
$returnValue = true; |
|
||||||
} |
|
||||||
return $returnValue; |
|
||||||
} |
|
||||||
|
|
||||||
/** |
/** |
||||||
* Gets a list of all meetings currently running |
* @todo |
||||||
*/ |
*/ |
||||||
function wc_getRunningMeetings($myIP,$mySecuritySalt) { |
function delete_record($id) { |
||||||
$checkAPI = "/bigbluebutton/api/getMeetings?"; |
} |
||||||
$queryStr = ''; |
|
||||||
$checksum = sha1('getMeetings'.$queryStr.$mySecuritySalt); |
function copy_record_to_link_tool($id, $record_id) { |
||||||
$secQueryURL = "http://".$myIP.$checkAPI.$queryStr."&checksum=".$checksum; |
require_once api_get_path(LIBRARY_PATH).'link.lib.php'; |
||||||
$myResponse = @file_get_contents($secQueryURL); |
$records = BigBlueButtonBN::getRecordingsArray($id, $this->url, $this->salt); |
||||||
if ($myResponse === false) { return false;} |
if (!empty($records)) { |
||||||
$doc = new DOMDocument(); |
foreach ($records as $record) { |
||||||
$doc->loadXML($myResponse); |
if ($record['recordID'] == $record_id) { |
||||||
$returnCodeNode = $doc->getElementsByTagName("returncode"); |
if (is_array($record) && isset($record['recordID']) && isset($record['playbacks'])) { |
||||||
$returnCode = $returnCodeNode->item(0)->nodeValue; |
foreach ($record['playbacks'] as $item) { |
||||||
$meetingsNode = $doc->getElementsByTagName("meeting"); |
$link = new Link(); |
||||||
$meetings = array(); |
$params['url'] = $item['url']; |
||||||
foreach ($meetingsNode as $meetingNode) { |
$params['title'] = 'bbb 1'; |
||||||
$meeting = array(); |
$id = $link->save($params); |
||||||
if ($meetingNode->childNodes->length) { |
return $id; |
||||||
foreach ($meetingNode->childNodes as $i) { |
} |
||||||
//see http://code.google.com/p/bigbluebutton/wiki/API#Get_Meetings for details |
} |
||||||
$meeting[$i->nodeName] = $i->nodeValue; |
|
||||||
|
} |
||||||
} |
} |
||||||
} |
} |
||||||
$meetings[] = $meeting; |
return false; |
||||||
|
|
||||||
} |
} |
||||||
return $meetings; |
|
||||||
} |
} |
||||||
@ -0,0 +1,760 @@ |
|||||||
|
<?php |
||||||
|
/* |
||||||
|
Copyright 2010-2011 Blindside Networks |
||||||
|
|
||||||
|
This program is free software; you can redistribute it and/or modify |
||||||
|
it under the terms of the GNU General Public License as published by |
||||||
|
the Free Software Foundation; either version 2 of the License, or |
||||||
|
(at your option) any later version. |
||||||
|
|
||||||
|
This program is distributed in the hope that it will be useful, |
||||||
|
but WITHOUT ANY WARRANTY; without even the implied warranty of |
||||||
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
||||||
|
GNU General Public License for more details. |
||||||
|
|
||||||
|
You should have received a copy of the GNU General Public License |
||||||
|
along with this program; if not, write to the Free Software |
||||||
|
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
||||||
|
|
||||||
|
Versions: |
||||||
|
1.0 -- Initial version written by DJP |
||||||
|
(email: djp [a t ] architectes DOT .org) |
||||||
|
1.1 -- Updated by Omar Shammas and Sebastian Schneider |
||||||
|
(email : omar [at] b l i n ds i de n e t w o r ks [dt] com) |
||||||
|
(email : seb DOT sschneider [ a t ] g m ail DOT com) |
||||||
|
1.2 -- Updated by Omar Shammas |
||||||
|
(email : omar [at] b l i n ds i de n e t w o r ks [dt] com) |
||||||
|
1.3 -- Reviewed and extended by Jesus Federico |
||||||
|
(email : jesus [at] b l i n ds i de n e t w o r ks [dt] com) |
||||||
|
0.8_1.4.10 -- Extended by Jesus Federico to support BigBlueButton 0.8 version |
||||||
|
(email : jesus [at] b l i n ds i de n e t w o r ks [dt] com) |
||||||
|
*/ |
||||||
|
|
||||||
|
|
||||||
|
/* |
||||||
|
@param |
||||||
|
$userName = userName AND meetingID (string) |
||||||
|
$welcomeString = welcome message (string) |
||||||
|
|
||||||
|
$modPW = moderator password (string) |
||||||
|
$vPW = viewer password (string) |
||||||
|
$voiceBridge = voice bridge (integer) |
||||||
|
$logout = logout url (url) |
||||||
|
*/ |
||||||
|
// create a meeting and return the url to join as moderator |
||||||
|
|
||||||
|
|
||||||
|
// TODO:: |
||||||
|
// create some set methods |
||||||
|
class BigBlueButtonBN { |
||||||
|
|
||||||
|
var $userName = array(); |
||||||
|
var $meetingID; // the meeting id |
||||||
|
|
||||||
|
var $welcomeString; |
||||||
|
// the next 2 fields are maybe not needed?!? |
||||||
|
var $modPW; // the moderator password |
||||||
|
var $attPW; // the attendee pw |
||||||
|
|
||||||
|
var $securitySalt; // the security salt; gets encrypted with sha1 |
||||||
|
var $URL; // the url the bigbluebuttonbn server is installed |
||||||
|
var $sessionURL; // the url for the administrator to join the sessoin |
||||||
|
var $userURL; |
||||||
|
|
||||||
|
var $conferenceIsRunning = false; |
||||||
|
|
||||||
|
// this constructor is used to create a BigBlueButton Object |
||||||
|
// use this object to create servers |
||||||
|
// Use is either 0 arguments or all 7 arguments |
||||||
|
public function __construct() { |
||||||
|
$numargs = func_num_args(); |
||||||
|
|
||||||
|
if( $numargs == 0 ) { |
||||||
|
# echo "Constructor created"; |
||||||
|
} |
||||||
|
// pass the information to the class variables |
||||||
|
else if( $numargs >= 6 ) { |
||||||
|
$this->userName = func_get_arg(0); |
||||||
|
$this->meetingID = func_get_arg(1); |
||||||
|
$this->welcomeString = func_get_arg(2); |
||||||
|
$this->modPW = func_get_arg(3); |
||||||
|
$this->attPW = func_get_arg(4); |
||||||
|
$this->securitySalt = func_get_arg(5); |
||||||
|
$this->URL = func_get_arg(6); |
||||||
|
|
||||||
|
|
||||||
|
$arg_list = func_get_args(); |
||||||
|
}// end else if |
||||||
|
} |
||||||
|
|
||||||
|
//------------------------------------------------GET URLs------------------------------------------------- |
||||||
|
/** |
||||||
|
*This method returns the url to join the specified meeting. |
||||||
|
* |
||||||
|
*@param meetingID -- the unique meeting identifier used to store the meeting in the bigbluebuttonbn server |
||||||
|
*@param username -- the display name to be used when the user joins the meeting |
||||||
|
*@param PW -- the attendee or moderator password of the meeting |
||||||
|
*@param SALT -- the security salt of the bigbluebuttonbn server |
||||||
|
*@param URL -- the url of the bigbluebuttonbn server |
||||||
|
* |
||||||
|
*@return The url to join the meeting |
||||||
|
*/ |
||||||
|
public static function joinURL( $meetingID, $userName, $PW, $SALT, $URL ) { |
||||||
|
$url_join = $URL."api/join?"; |
||||||
|
$params = 'meetingID='.urlencode($meetingID).'&fullName='.urlencode($userName).'&password='.urlencode($PW); |
||||||
|
return ($url_join.$params.'&checksum='.sha1("join".$params.$SALT) ); |
||||||
|
} |
||||||
|
|
||||||
|
|
||||||
|
/** |
||||||
|
*This method returns the url to join the specified meeting. |
||||||
|
* |
||||||
|
*@param name -- a name fot the meeting |
||||||
|
*@param meetingID -- the unique meeting identifier used to store the meeting in the bigbluebuttonbn server |
||||||
|
*@param attendeePW -- the attendee of the meeting |
||||||
|
*@param moderatorPW -- the moderator of the meeting |
||||||
|
*@param welcome -- the welcome message that gets displayed on the chat window |
||||||
|
*@param logoutURL -- the URL that the bbb client will go to after users logouut |
||||||
|
*@param SALT -- the security salt of the bigbluebuttonbn server |
||||||
|
*@param URL -- the url of the bigbluebuttonbn server |
||||||
|
*@param record -- the flag which indicate if the meetings will be recorded or not record=true|false, default false |
||||||
|
*@param duration -- this value indicate the duration of a meeting to be recorded. Duration is represented in munutes |
||||||
|
* |
||||||
|
*@return The url to join the meeting |
||||||
|
*/ |
||||||
|
public static function createMeetingURL($name, $meetingID, $attendeePW, $moderatorPW, $welcome, $logoutURL, $SALT, $URL, $record = 'false', $duration=0, $voiceBridge=0, $metadata = array() ) { |
||||||
|
$url_create = $URL."api/create?"; |
||||||
|
if ( $voiceBridge == 0) |
||||||
|
$voiceBridge = 70000 + rand(0, 9999); |
||||||
|
|
||||||
|
$meta = ''; |
||||||
|
while ($data = current($metadata)) { |
||||||
|
$meta = $meta.'&'.key($metadata).'='.urlencode($data); |
||||||
|
next($metadata); |
||||||
|
} |
||||||
|
|
||||||
|
|
||||||
|
$params = 'name='.urlencode($name).'&meetingID='.urlencode($meetingID).'&attendeePW='.urlencode($attendeePW).'&moderatorPW='.urlencode($moderatorPW).'&voiceBridge='.$voiceBridge.'&logoutURL='.urlencode($logoutURL).'&record='.$record.$meta; |
||||||
|
|
||||||
|
$duration = intval($duration); |
||||||
|
if( $duration > 0 ) |
||||||
|
$params .= '&duration='.$duration; |
||||||
|
|
||||||
|
if( trim( $welcome ) ) |
||||||
|
$params .= '&welcome='.urlencode($welcome); |
||||||
|
|
||||||
|
return ( $url_create.$params.'&checksum='.sha1("create".$params.$SALT) ); |
||||||
|
} |
||||||
|
|
||||||
|
|
||||||
|
/** |
||||||
|
*This method returns the url to check if the specified meeting is running. |
||||||
|
* |
||||||
|
*@param meetingID -- the unique meeting identifier used to store the meeting in the bigbluebuttonbn server |
||||||
|
*@param SALT -- the security salt of the bigbluebuttonbn server |
||||||
|
*@param URL -- the url of the bigbluebuttonbn server |
||||||
|
* |
||||||
|
*@return The url to check if the specified meeting is running. |
||||||
|
*/ |
||||||
|
public static function isMeetingRunningURL( $meetingID, $URL, $SALT ) { |
||||||
|
$base_url = $URL."api/isMeetingRunning?"; |
||||||
|
$params = 'meetingID='.urlencode($meetingID); |
||||||
|
return ($base_url.$params.'&checksum='.sha1("isMeetingRunning".$params.$SALT) ); |
||||||
|
} |
||||||
|
|
||||||
|
/** |
||||||
|
*This method returns the url to getMeetingInfo of the specified meeting. |
||||||
|
* |
||||||
|
*@param meetingID -- the unique meeting identifier used to store the meeting in the bigbluebuttonbn server |
||||||
|
*@param modPW -- the moderator password of the meeting |
||||||
|
*@param SALT -- the security salt of the bigbluebuttonbn server |
||||||
|
*@param URL -- the url of the bigbluebuttonbn server |
||||||
|
* |
||||||
|
*@return The url to check if the specified meeting is running. |
||||||
|
*/ |
||||||
|
public static function getMeetingInfoURL( $meetingID, $modPW, $URL, $SALT ) { |
||||||
|
$base_url = $URL."api/getMeetingInfo?"; |
||||||
|
$params = 'meetingID='.urlencode($meetingID).'&password='.urlencode($modPW); |
||||||
|
return ( $base_url.$params.'&checksum='.sha1("getMeetingInfo".$params.$SALT)); |
||||||
|
} |
||||||
|
|
||||||
|
/** |
||||||
|
*This method returns the url for listing all meetings in the bigbluebuttonbn server. |
||||||
|
* |
||||||
|
*@param SALT -- the security salt of the bigbluebuttonbn server |
||||||
|
*@param URL -- the url of the bigbluebuttonbn server |
||||||
|
* |
||||||
|
*@return The url of getMeetings. |
||||||
|
*/ |
||||||
|
public static function getMeetingsURL($URL, $SALT) { |
||||||
|
$base_url = $URL."api/getMeetings?"; |
||||||
|
$params = ''; |
||||||
|
return ( $base_url.$params.'&checksum='.sha1("getMeetings".$params.$SALT)); |
||||||
|
} |
||||||
|
|
||||||
|
/** |
||||||
|
*This method returns the url to end the specified meeting. |
||||||
|
* |
||||||
|
*@param meetingID -- the unique meeting identifier used to store the meeting in the bigbluebuttonbn server |
||||||
|
*@param modPW -- the moderator password of the meeting |
||||||
|
*@param SALT -- the security salt of the bigbluebuttonbn server |
||||||
|
*@param URL -- the url of the bigbluebuttonbn server |
||||||
|
* |
||||||
|
*@return The url to end the specified meeting. |
||||||
|
*/ |
||||||
|
public static function endMeetingURL( $meetingID, $modPW, $URL, $SALT ) { |
||||||
|
$base_url = $URL."api/end?"; |
||||||
|
$params = 'meetingID='.urlencode($meetingID).'&password='.urlencode($modPW); |
||||||
|
return ( $base_url.$params.'&checksum='.sha1("end".$params.$SALT) ); |
||||||
|
} |
||||||
|
|
||||||
|
//-----------------------------------------------CREATE---------------------------------------------------- |
||||||
|
/** |
||||||
|
*This method creates a meeting and returnS the join url for moderators. |
||||||
|
* |
||||||
|
*@param username |
||||||
|
*@param meetingID -- the unique meeting identifier used to store the meeting in the bigbluebuttonbn server |
||||||
|
*@param welcomeString -- the welcome message to be displayed when a user logs in to the meeting |
||||||
|
*@param mPW -- the moderator password of the meeting |
||||||
|
*@param aPW -- the attendee password of the meeting |
||||||
|
*@param SALT -- the security salt of the bigbluebuttonbn server |
||||||
|
*@param URL -- the url of the bigbluebuttonbn server |
||||||
|
*@param logoutURL -- the url the user should be redirected to when they logout of bigbluebuttonbn |
||||||
|
*@param record -- the flag which indicate if the meetings will be recorded or not record=true|false, default false |
||||||
|
* |
||||||
|
*@return The joinURL if successful or an error message if unsuccessful |
||||||
|
*/ |
||||||
|
public static function createMeetingAndGetJoinURL( $username, $meeting_name, $meetingID, $welcomeString, $mPW, $aPW, $SALT, $URL, $logoutURL, $record = 'false', $duration=0, $voiceBridge=0, $metadata = array()) { |
||||||
|
|
||||||
|
$xml = BigBlueButtonBN::_wrap_simplexml_load_file( BigBlueButtonBN::createMeetingURL($meeting_name, $meetingID, $aPW, $mPW, $welcomeString, $logoutURL, $SALT, $URL, $record, $duration, $voiceBridge, $metadata ) ); |
||||||
|
|
||||||
|
if( $xml && $xml->returncode == 'SUCCESS' ) { |
||||||
|
return ( BigBlueButtonBN::joinURL( $meetingID, $username, $mPW, $SALT, $URL ) ); |
||||||
|
} |
||||||
|
else if( $xml ) { |
||||||
|
return ( $xml->messageKey.' : '.$xml->message ); |
||||||
|
} |
||||||
|
else { |
||||||
|
return ('Unable to fetch URL '.$url_create.$params.'&checksum='.sha1("create".$params.$SALT) ); |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
/** |
||||||
|
*This method creates a meeting and return an array of the xml packet |
||||||
|
* |
||||||
|
*@param username |
||||||
|
*@param meetingID -- the unique meeting identifier used to store the meeting in the bigbluebuttonbn server |
||||||
|
*@param welcomeString -- the welcome message to be displayed when a user logs in to the meeting |
||||||
|
*@param mPW -- the moderator password of the meeting |
||||||
|
*@param aPW -- the attendee password of the meeting |
||||||
|
*@param SALT -- the security salt of the bigbluebuttonbn server |
||||||
|
*@param URL -- the url of the bigbluebuttonbn server |
||||||
|
*@param logoutURL -- the url the user should be redirected to when they logout of bigbluebuttonbn |
||||||
|
*@param record -- the flag which indicate if the meetings will be recorded or not record=true|false, default false |
||||||
|
* |
||||||
|
*@return |
||||||
|
* - Null if unable to reach the bigbluebuttonbn server |
||||||
|
* - If failed it returns an array containing a returncode, messageKey, message. |
||||||
|
* - If success it returns an array containing a returncode, messageKey, message, meetingID, attendeePW, moderatorPW, hasBeenForciblyEnded. |
||||||
|
*/ |
||||||
|
public static function createMeetingArray( $username, $meetingID, $welcomeString, $mPW, $aPW, $SALT, $URL, $logoutURL, $record='false', $duration=0, $voiceBridge=0, $metadata = array() ) { |
||||||
|
|
||||||
|
$xml = BigBlueButtonBN::_wrap_simplexml_load_file( BigBlueButtonBN::createMeetingURL($username, $meetingID, $aPW, $mPW, $welcomeString, $logoutURL, $SALT, $URL, $record, $duration, $voiceBridge, $metadata ) ); |
||||||
|
|
||||||
|
if( $xml ) { |
||||||
|
if($xml->meetingID) return array('returncode' => $xml->returncode, 'message' => $xml->message, 'messageKey' => $xml->messageKey, 'meetingID' => $xml->meetingID, 'attendeePW' => $xml->attendeePW, 'moderatorPW' => $xml->moderatorPW, 'hasBeenForciblyEnded' => $xml->hasBeenForciblyEnded ); |
||||||
|
else return array('returncode' => $xml->returncode, 'message' => $xml->message, 'messageKey' => $xml->messageKey ); |
||||||
|
} |
||||||
|
else { |
||||||
|
return null; |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
//-------------------------------------------getMeetingInfo--------------------------------------------------- |
||||||
|
/** |
||||||
|
*This method calls the getMeetingInfo on the bigbluebuttonbn server and returns an xml packet. |
||||||
|
* |
||||||
|
*@param meetingID -- the unique meeting identifier used to store the meeting in the bigbluebuttonbn server |
||||||
|
*@param modPW -- the moderator password of the meeting |
||||||
|
*@param SALT -- the security salt of the bigbluebuttonbn server |
||||||
|
*@param URL -- the url of the bigbluebuttonbn server |
||||||
|
* |
||||||
|
*@return An xml packet. |
||||||
|
* If failed it returns an xml packet containing a returncode, messagekey, and message. |
||||||
|
* If success it returnsan xml packet containing a returncode, |
||||||
|
*/ |
||||||
|
public static function getMeetingInfo( $meetingID, $modPW, $URL, $SALT ) { |
||||||
|
$xml = BigBlueButtonBN::_wrap_simplexml_load_file( BigBlueButtonBN::getMeetingInfoURL( $meetingID, $modPW, $URL, $SALT ) ); |
||||||
|
if($xml){ |
||||||
|
return ( str_replace('</response>', '', str_replace("<?xml version=\"1.0\"?>\n<response>", '', $xml->asXML()))); |
||||||
|
} |
||||||
|
return false; |
||||||
|
} |
||||||
|
|
||||||
|
/** |
||||||
|
*This method calls the getMeetingInfo on the bigbluebuttonbn server and returns an array. |
||||||
|
* |
||||||
|
*@param meetingID -- the unique meeting identifier used to store the meeting in the bigbluebuttonbn server |
||||||
|
*@param modPW -- the moderator password of the meeting |
||||||
|
*@param SALT -- the security salt of the bigbluebuttonbn server |
||||||
|
*@param URL -- the url of the bigbluebuttonbn server |
||||||
|
* |
||||||
|
*@return An Array. |
||||||
|
* - Null if unable to reach the bigbluebuttonbn server |
||||||
|
* - If failed it returns an array containing a returncode, messagekey, message. |
||||||
|
* - If success it returns an array containing a meetingID, moderatorPW, attendeePW, hasBeenForciblyEnded, running, startTime, endTime, |
||||||
|
participantCount, moderatorCount, attendees. |
||||||
|
*/ |
||||||
|
public static function getMeetingInfoArray( $meetingID, $modPW, $URL, $SALT ) { |
||||||
|
$xml = BigBlueButtonBN::_wrap_simplexml_load_file( BigBlueButtonBN::getMeetingInfoURL( $meetingID, $modPW, $URL, $SALT ) ); |
||||||
|
|
||||||
|
if( $xml && $xml->returncode == 'SUCCESS' && $xml->messageKey == null){//The meetings were returned |
||||||
|
return array('returncode' => $xml->returncode, 'message' => $xml->message, 'messageKey' => $xml->messageKey ); |
||||||
|
} |
||||||
|
else if($xml && $xml->returncode == 'SUCCESS'){ //If there were meetings already created |
||||||
|
return array( 'meetingID' => $xml->meetingID, 'moderatorPW' => $xml->moderatorPW, 'attendeePW' => $xml->attendeePW, 'hasBeenForciblyEnded' => $xml->hasBeenForciblyEnded, 'running' => $xml->running, 'recording' => $xml->recording, 'startTime' => $xml->startTime, 'endTime' => $xml->endTime, 'participantCount' => $xml->participantCount, 'moderatorCount' => $xml->moderatorCount, 'attendees' => $xml->attendees, 'metadata' => $xml->metadata ); |
||||||
|
} |
||||||
|
else if( ($xml && $xml->returncode == 'FAILED') || $xml) { //If the xml packet returned failure it displays the message to the user |
||||||
|
return array('returncode' => $xml->returncode, 'message' => $xml->message, 'messageKey' => $xml->messageKey); |
||||||
|
//return array('returncode' => $xml->returncode, 'message' => $xml->errors->error['message'], 'messageKey' => $xml->errors->error['key']); //For API version 0.8 |
||||||
|
} |
||||||
|
else { //If the server is unreachable, then prompts the user of the necessary action |
||||||
|
return null; |
||||||
|
} |
||||||
|
|
||||||
|
} |
||||||
|
|
||||||
|
//-----------------------------------------------getMeetings------------------------------------------------------ |
||||||
|
/** |
||||||
|
*This method calls getMeetings on the bigbluebuttonbn server, then calls getMeetingInfo for each meeting and concatenates the result. |
||||||
|
* |
||||||
|
*@param URL -- the url of the bigbluebuttonbn server |
||||||
|
*@param SALT -- the security salt of the bigbluebuttonbn server |
||||||
|
* |
||||||
|
*@return |
||||||
|
* - If failed then returns a boolean of false. |
||||||
|
* - If succeeded then returns an xml of all the meetings. |
||||||
|
*/ |
||||||
|
public static function getMeetings( $URL, $SALT ) { |
||||||
|
$xml = BigBlueButtonBN::_wrap_simplexml_load_file( BigBlueButtonBN::getMeetingsURL( $URL, $SALT ) ); |
||||||
|
if( $xml && $xml->returncode == 'SUCCESS' ) { |
||||||
|
if( $xml->messageKey ) |
||||||
|
return ( $xml->message->asXML() ); |
||||||
|
ob_start(); |
||||||
|
echo '<meetings>'; |
||||||
|
if( count( $xml->meetings ) && count( $xml->meetings->meeting ) ) { |
||||||
|
foreach ($xml->meetings->meeting as $meeting) |
||||||
|
{ |
||||||
|
echo '<meeting>'; |
||||||
|
echo BigBlueButtonBN::getMeetingInfo($meeting->meetingID, $meeting->moderatorPW, $URL, $SALT); |
||||||
|
echo '</meeting>'; |
||||||
|
} |
||||||
|
} |
||||||
|
echo '</meetings>'; |
||||||
|
return (ob_get_clean()); |
||||||
|
} |
||||||
|
else { |
||||||
|
return (false); |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
/** |
||||||
|
*This method calls getMeetings on the bigbluebuttonbn server, then calls getMeetingInfo for each meeting and concatenates the result. |
||||||
|
* |
||||||
|
*@param URL -- the url of the bigbluebuttonbn server |
||||||
|
*@param SALT -- the security salt of the bigbluebuttonbn server |
||||||
|
* |
||||||
|
*@return |
||||||
|
* - Null if the server is unreachable |
||||||
|
* - If FAILED then returns an array containing a returncode, messageKey, message. |
||||||
|
* - If SUCCESS then returns an array of all the meetings. Each element in the array is an array containing a meetingID, |
||||||
|
moderatorPW, attendeePW, hasBeenForciblyEnded, running. |
||||||
|
*/ |
||||||
|
public static function getMeetingsArray( $URL, $SALT ) { |
||||||
|
$xml = BigBlueButtonBN::_wrap_simplexml_load_file( BigBlueButtonBN::getMeetingsURL( $URL, $SALT ) ); |
||||||
|
|
||||||
|
if( $xml && $xml->returncode == 'SUCCESS' && $xml->messageKey ) {//The meetings were returned |
||||||
|
return array('returncode' => $xml->returncode, 'message' => $xml->message, 'messageKey' => $xml->messageKey); |
||||||
|
} |
||||||
|
else if($xml && $xml->returncode == 'SUCCESS'){ //If there were meetings already created |
||||||
|
|
||||||
|
foreach ($xml->meetings->meeting as $meeting) |
||||||
|
{ |
||||||
|
$meetings[] = array( 'meetingID' => $meeting->meetingID, 'moderatorPW' => $meeting->moderatorPW, 'attendeePW' => $meeting->attendeePW, 'hasBeenForciblyEnded' => $meeting->hasBeenForciblyEnded, 'running' => $meeting->running ); |
||||||
|
} |
||||||
|
|
||||||
|
return $meetings; |
||||||
|
|
||||||
|
} |
||||||
|
else if( $xml ) { //If the xml packet returned failure it displays the message to the user |
||||||
|
return array('returncode' => $xml->returncode, 'message' => $xml->message, 'messageKey' => $xml->messageKey); |
||||||
|
} |
||||||
|
else { //If the server is unreachable, then prompts the user of the necessary action |
||||||
|
return null; |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
//----------------------------------------------getUsers--------------------------------------- |
||||||
|
/** |
||||||
|
*This method prints the usernames of the attendees in the specified conference. |
||||||
|
* |
||||||
|
*@param meetingID -- the unique meeting identifier used to store the meeting in the bigbluebuttonbn server |
||||||
|
*@param modPW -- the moderator password of the meeting |
||||||
|
*@param URL -- the url of the bigbluebuttonbn server |
||||||
|
*@param SALT -- the security salt of the bigbluebuttonbn server |
||||||
|
*@param UNAME -- is a boolean to determine how the username is formatted when printed. Default if false. |
||||||
|
* |
||||||
|
*@return A boolean of true if the attendees were printed successfully and false otherwise. |
||||||
|
*/ |
||||||
|
public static function getUsers( $meetingID, $modPW, $URL, $SALT, $UNAME = false ) { |
||||||
|
$xml = BigBlueButtonBN::_wrap_simplexml_load_file( BigBlueButtonBN::getMeetingInfoURL( $meetingID, $modPW, $URL, $SALT ) ); |
||||||
|
if( $xml && $xml->returncode == 'SUCCESS' ) { |
||||||
|
ob_start(); |
||||||
|
if( count( $xml->attendees ) && count( $xml->attendees->attendee ) ) { |
||||||
|
foreach ( $xml->attendees->attendee as $attendee ) { |
||||||
|
if( $UNAME == true ) { |
||||||
|
echo "User name: ".$attendee->fullName.'<br />'; |
||||||
|
} |
||||||
|
else { |
||||||
|
echo $attendee->fullName.'<br />'; |
||||||
|
} |
||||||
|
} |
||||||
|
} |
||||||
|
return (ob_end_flush()); |
||||||
|
} |
||||||
|
else { |
||||||
|
return (false); |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
/** |
||||||
|
*This method returns an array of the attendees in the specified meeting. |
||||||
|
* |
||||||
|
*@param meetingID -- the unique meeting identifier used to store the meeting in the bigbluebuttonbn server |
||||||
|
*@param modPW -- the moderator password of the meeting |
||||||
|
*@param URL -- the url of the bigbluebuttonbn server |
||||||
|
*@param SALT -- the security salt of the bigbluebuttonbn server |
||||||
|
* |
||||||
|
*@return |
||||||
|
* - Null if the server is unreachable. |
||||||
|
* - If FAILED, returns an array containing a returncode, messageKey, message. |
||||||
|
* - If SUCCESS, returns an array of array containing the userID, fullName, role of each attendee |
||||||
|
*/ |
||||||
|
public static function getUsersArray( $meetingID, $modPW, $URL, $SALT ) { |
||||||
|
$xml = BigBlueButtonBN::_wrap_simplexml_load_file( BigBlueButtonBN::getMeetingInfoURL( $meetingID, $modPW, $URL, $SALT ) ); |
||||||
|
|
||||||
|
if( $xml && $xml->returncode == 'SUCCESS' && $xml->messageKey == null ) {//The meetings were returned |
||||||
|
return array('returncode' => $xml->returncode, 'message' => $xml->message, 'messageKey' => $xml->messageKey); |
||||||
|
} |
||||||
|
else if($xml && $xml->returncode == 'SUCCESS'){ //If there were meetings already created |
||||||
|
foreach ($xml->attendees->attendee as $attendee){ |
||||||
|
$users[] = array( 'userID' => $attendee->userID, 'fullName' => $attendee->fullName, 'role' => $attendee->role ); |
||||||
|
} |
||||||
|
return $users; |
||||||
|
} |
||||||
|
else if( $xml ) { //If the xml packet returned failure it displays the message to the user |
||||||
|
return array('returncode' => $xml->returncode, 'message' => $xml->message, 'messageKey' => $xml->messageKey); |
||||||
|
} |
||||||
|
else { //If the server is unreachable, then prompts the user of the necessary action |
||||||
|
return null; |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
|
||||||
|
//------------------------------------------------Other Methods------------------------------------ |
||||||
|
/** |
||||||
|
*This method calls end meeting on the specified meeting in the bigbluebuttonbn server. |
||||||
|
* |
||||||
|
*@param meetingID -- the unique meeting identifier used to store the meeting in the bigbluebuttonbn server |
||||||
|
*@param modPW -- the moderator password of the meeting |
||||||
|
*@param SALT -- the security salt of the bigbluebuttonbn server |
||||||
|
*@param URL -- the url of the bigbluebuttonbn server |
||||||
|
* |
||||||
|
*@return |
||||||
|
* - Null if the server is unreachable |
||||||
|
* - An array containing a returncode, messageKey, message. |
||||||
|
*/ |
||||||
|
public static function endMeeting( $meetingID, $modPW, $URL, $SALT ) { |
||||||
|
$xml = BigBlueButtonBN::_wrap_simplexml_load_file( BigBlueButtonBN::endMeetingURL( $meetingID, $modPW, $URL, $SALT ) ); |
||||||
|
|
||||||
|
if( $xml ) { //If the xml packet returned failure it displays the message to the user |
||||||
|
return array('returncode' => $xml->returncode, 'message' => $xml->message, 'messageKey' => $xml->messageKey); |
||||||
|
} |
||||||
|
else { //If the server is unreachable, then prompts the user of the necessary action |
||||||
|
return null; |
||||||
|
} |
||||||
|
|
||||||
|
} |
||||||
|
|
||||||
|
/** |
||||||
|
*This method check the BigBlueButton server to see if the meeting is running (i.e. there is someone in the meeting) |
||||||
|
* |
||||||
|
*@param meetingID -- the unique meeting identifier used to store the meeting in the bigbluebuttonbn server |
||||||
|
*@param SALT -- the security salt of the bigbluebuttonbn server |
||||||
|
*@param URL -- the url of the bigbluebuttonbn server |
||||||
|
* |
||||||
|
*@return A boolean of true if the meeting is running and false if it is not running |
||||||
|
*/ |
||||||
|
public static function isMeetingRunning( $meetingID, $URL, $SALT ) { |
||||||
|
$xml = BigBlueButtonBN::_wrap_simplexml_load_file( BigBlueButtonBN::isMeetingRunningURL( $meetingID, $URL, $SALT ) ); |
||||||
|
if( $xml && $xml->returncode == 'SUCCESS' ) |
||||||
|
return ( ( $xml->running == 'true' ) ? true : false); |
||||||
|
else |
||||||
|
return ( false ); |
||||||
|
} |
||||||
|
|
||||||
|
/** |
||||||
|
*This method calls isMeetingRunning on the BigBlueButton server. |
||||||
|
* |
||||||
|
*@param meetingID -- the unique meeting identifier used to store the meeting in the bigbluebuttonbn server |
||||||
|
*@param SALT -- the security salt of the bigbluebuttonbn server |
||||||
|
*@param URL -- the url of the bigbluebuttonbn server |
||||||
|
* |
||||||
|
*@return |
||||||
|
* - If SUCCESS it returns an xml packet |
||||||
|
* - If the FAILED or the server is unreachable returns a string of 'false' |
||||||
|
*/ |
||||||
|
public static function getMeetingXML( $meetingID, $URL, $SALT ) { |
||||||
|
$xml = BigBlueButtonBN::_wrap_simplexml_load_file( BigBlueButtonBN::isMeetingRunningURL( $meetingID, $URL, $SALT ) ); |
||||||
|
if( $xml && $xml->returncode == 'SUCCESS') |
||||||
|
return ( str_replace('</response>', '', str_replace("<?xml version=\"1.0\"?>\n<response>", '', $xml->asXML()))); |
||||||
|
else |
||||||
|
return 'false'; |
||||||
|
} |
||||||
|
|
||||||
|
|
||||||
|
// TODO: WRITE AN ITERATOR WHICH GOES OVER WHATEVER IT IS BEING TOLD IN THE API AND LIST INFORMATION |
||||||
|
/* we have to define at least 2 variable fields for getInformation to read out information at any position |
||||||
|
The first is: An identifier to chose if we look for attendees or the meetings or something else |
||||||
|
The second is: An identifier to chose what integrated functions are supposed to be used |
||||||
|
|
||||||
|
@param IDENTIFIER -- needs to be put in for the function to identify the information to print out |
||||||
|
current values which can be used are 'attendee' and 'meetings' |
||||||
|
@param meetingID -- needs to be put in to identify the meeting |
||||||
|
@param modPW -- needs to be put in if the users are supposed to be shown or to retrieve information about the meetings |
||||||
|
@param URL -- needs to be put in the URL to the bigbluebuttonbn server |
||||||
|
@param SALT -- needs to be put in for the security salt calculation |
||||||
|
|
||||||
|
Note: If 'meetings' is used, then only the parameters URL and SALT needs to be used |
||||||
|
If 'attendee' is used, then all the parameters needs to be used |
||||||
|
*/ |
||||||
|
public static function getInformation( $IDENTIFIER, $meetingID, $modPW, $URL, $SALT ) { |
||||||
|
// if the identifier is null or '', then return false |
||||||
|
if( $IDENTIFIER == "" || $IDENTIFIER == null ) { |
||||||
|
echo "You need to type in a valid value into the identifier."; |
||||||
|
return false; |
||||||
|
} |
||||||
|
// if the identifier is attendee, call getUsers |
||||||
|
else if( $IDENTIFIER == 'attendee' ) { |
||||||
|
return BigBlueButtonBN::getUsers( $meetingID, $modPW, $URL, $SALT ); |
||||||
|
} |
||||||
|
// if the identifier is meetings, call getMeetings |
||||||
|
else if( $IDENTIFIER == 'meetings' ) { |
||||||
|
return BigBlueButtonBN::getMeetings( $URL, $SALT ); |
||||||
|
} |
||||||
|
// return nothing |
||||||
|
else { |
||||||
|
return true; |
||||||
|
} |
||||||
|
|
||||||
|
} |
||||||
|
|
||||||
|
|
||||||
|
function getServerIP() { |
||||||
|
// get the server url |
||||||
|
$sIP = $_SERVER['SERVER_ADDR']; |
||||||
|
return $serverIP = 'http://'.$sIP.'/bigbluebuttonbn/'; |
||||||
|
} |
||||||
|
|
||||||
|
|
||||||
|
/** |
||||||
|
*This method check the BigBlueButton server to see if the meeting has been created |
||||||
|
* |
||||||
|
*@param meetingID -- the unique meeting identifier used to store the meeting in the bigbluebuttonbn server |
||||||
|
*@param SALT -- the security salt of the bigbluebuttonbn server |
||||||
|
*@param URL -- the url of the bigbluebuttonbn server |
||||||
|
* |
||||||
|
*@return A boolean of true if the meeting has been created, doesn't matter if is running or not and false if it does not exist |
||||||
|
*/ |
||||||
|
public static function isMeetingCreated( $meetingID, $URL, $SALT ) { |
||||||
|
|
||||||
|
$xml = BigBlueButtonBN::_wrap_simplexml_load_file( BigBlueButtonBN::getMeetingsURL( $URL, $SALT ) ); |
||||||
|
if( $xml && $xml->returncode == 'SUCCESS' ) |
||||||
|
foreach ($xml->meetings->meeting as $meeting) |
||||||
|
if ( $meeting->meetingID == $meetingID && $meeting->hasBeenForciblyEnded == 'false' ) |
||||||
|
return true; |
||||||
|
return false; |
||||||
|
|
||||||
|
} |
||||||
|
|
||||||
|
/** |
||||||
|
*This method creates a new meeting room in the BigBlueButton server |
||||||
|
* |
||||||
|
*@param name -- a name fot the meeting |
||||||
|
*@param meetingID -- the unique meeting identifier used to store the meeting in the bigbluebuttonbn server |
||||||
|
*@param attendeePW -- the attendee of the meeting |
||||||
|
*@param moderatorPW -- the moderator of the meeting |
||||||
|
*@param welcome -- the welcome message that gets displayed on the chat window |
||||||
|
*@param logoutURL -- the URL that the bbb client will go to after users logouut |
||||||
|
*@param SALT -- the security salt of the bigbluebuttonbn server |
||||||
|
*@param URL -- the url of the bigbluebuttonbn server |
||||||
|
*@param record -- the flag which indicate if the meetings will be recorded or not record=true|false, default false |
||||||
|
* |
||||||
|
*@return A boolean of true if the meeting has been created, doesn't matter if is running or not and false if it was an error |
||||||
|
*/ |
||||||
|
|
||||||
|
public static function createMeeting($name, $meetingID, $attendeePW, $moderatorPW, $welcome, $logoutURL, $SALT, $URL, $record = 'false', $duration=0, $voiceBridge=0, $metadata = array() ) { |
||||||
|
|
||||||
|
$xml = BigBlueButtonBN::_wrap_simplexml_load_file( BigBlueButtonBN::createMeetingURL($name, $meetingID, $attendeePW, $moderatorPW, $welcome, $logoutURL, $SALT, $URL, $record, $duration, $voiceBridge, $metadata ) ); |
||||||
|
if( $xml && $xml->returncode == 'SUCCESS' ) |
||||||
|
return true; |
||||||
|
else |
||||||
|
return false; |
||||||
|
|
||||||
|
} |
||||||
|
|
||||||
|
|
||||||
|
////////////////////////TO DO: CHANGE THE DESCRIPTION OF THE NEW METHODS |
||||||
|
|
||||||
|
public static function getRecordingsURL($meetingID, $URL, $SALT ) { |
||||||
|
$base_url_record = $URL."api/getRecordings?"; |
||||||
|
$params = "meetingID=".urlencode($meetingID); |
||||||
|
|
||||||
|
return ($base_url_record.$params."&checksum=".sha1("getRecordings".$params.$SALT) ); |
||||||
|
} |
||||||
|
|
||||||
|
/** |
||||||
|
*This method calls getMeetings on the bigbluebuttonbn server, then calls getMeetingInfo for each meeting and concatenates the result. |
||||||
|
* |
||||||
|
*@param URL -- the url of the bigbluebuttonbn server |
||||||
|
*@param SALT -- the security salt of the bigbluebuttonbn server |
||||||
|
* |
||||||
|
*@return |
||||||
|
* - Null if the server is unreachable |
||||||
|
* - If FAILED then returns an array containing a returncode, messageKey, message. |
||||||
|
* - If SUCCESS then returns an array of all the meetings. Each element in the array is an array containing a meetingID, |
||||||
|
moderatorPW, attendeePW, hasBeenForciblyEnded, running. |
||||||
|
*/ |
||||||
|
public static function getRecordingsArray($meetingID, $URL, $SALT ) { |
||||||
|
$xml = BigBlueButtonBN::_wrap_simplexml_load_file( BigBlueButtonBN::getRecordingsURL( $meetingID, $URL, $SALT ) ); |
||||||
|
if( $xml && $xml->returncode == 'SUCCESS' && $xml->messageKey ) {//The meetings were returned |
||||||
|
return array('returncode' => (string) $xml->returncode, 'message' => (string) $xml->message, 'messageKey' => (string) $xml->messageKey); |
||||||
|
} else if($xml && $xml->returncode == 'SUCCESS'){ //If there were meetings already created |
||||||
|
$recordings = array(); |
||||||
|
|
||||||
|
foreach ($xml->recordings->recording as $recording) { |
||||||
|
$recordings[(string) $recording->recordID] = array( 'recordID' => (string) $recording->recordID, 'meetingID' => (string) $recording->meetingID, 'meetingName' => (string) $recording->name, 'published' => (string) $recording->published, 'startTime' => (string) $recording->startTime, 'endTime' => (string) $recording->endTime ); |
||||||
|
$recordings[(string) $recording->recordID]['playbacks'] = array(); |
||||||
|
foreach ( $recording->playback->format as $format ){ |
||||||
|
$recordings[(string) $recording->recordID]['playbacks'][(string) $format->type] = array( 'type' => (string) $format->type, 'url' => (string) $format->url ); |
||||||
|
} |
||||||
|
// THIS IS FOR TESTING MULTIPLE FORMATS, DO REMOVE IT FOR FINAL RELEASE |
||||||
|
//$recordings[(string) $recording->recordID]['playbacks']['desktop'] = array( 'type' => 'desktop', 'url' => (string) $recording->playback->format->url ); |
||||||
|
|
||||||
|
//Add the metadata to the recordings array |
||||||
|
$metadata = get_object_vars($recording->metadata); |
||||||
|
while ($data = current($metadata)) { |
||||||
|
$recordings[(string) $recording->recordID]['meta_'.key($metadata)] = $data; |
||||||
|
next($metadata); |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
ksort($recordings); |
||||||
|
|
||||||
|
return $recordings; |
||||||
|
|
||||||
|
} else if( $xml ) { //If the xml packet returned failure it displays the message to the user |
||||||
|
return array('returncode' => (string) $xml->returncode, 'message' => (string) $xml->message, 'messageKey' => (string) $xml->messageKey); |
||||||
|
} else { //If the server is unreachable, then prompts the user of the necessary action |
||||||
|
return NULL; |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
|
||||||
|
public static function deleteRecordingsURL( $recordID, $URL, $SALT ) { |
||||||
|
$url_delete = $URL."api/deleteRecordings?"; |
||||||
|
$params = 'recordID='.urlencode($recordID); |
||||||
|
return ($url_delete.$params.'&checksum='.sha1("deleteRecordings".$params.$SALT) ); |
||||||
|
} |
||||||
|
|
||||||
|
|
||||||
|
public static function deleteRecordings( $recordIDs, $URL, $SALT ) { |
||||||
|
|
||||||
|
$ids = explode(",", $recordIDs); |
||||||
|
foreach( $ids as $id){ |
||||||
|
$xml = BigBlueButtonBN::_wrap_simplexml_load_file( BigBlueButtonBN::deleteRecordingsURL($id, $URL, $SALT) ); |
||||||
|
if( $xml && $xml->returncode != 'SUCCESS' ) |
||||||
|
return false; |
||||||
|
} |
||||||
|
return true; |
||||||
|
} |
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
public static function setPublishRecordingsURL( $recordID, $set, $URL, $SALT ) { |
||||||
|
$url_delete = $URL."api/publishRecordings?"; |
||||||
|
$params = 'recordID='.$recordID."&publish=".$set; |
||||||
|
return ($url_delete.$params.'&checksum='.sha1("publishRecordings".$params.$SALT) ); |
||||||
|
} |
||||||
|
|
||||||
|
|
||||||
|
public static function setPublishRecordings( $recordIDs, $set, $URL, $SALT ) { |
||||||
|
|
||||||
|
$ids = explode(",", $recordIDs); |
||||||
|
foreach( $ids as $id){ |
||||||
|
$xml = BigBlueButtonBN::_wrap_simplexml_load_file( BigBlueButtonBN::setPublishRecordingsURL($id, $set, $URL, $SALT) ); |
||||||
|
if( $xml && $xml->returncode != 'SUCCESS' ) |
||||||
|
return false; |
||||||
|
} |
||||||
|
return true; |
||||||
|
} |
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
public static function getServerVersion( $URL ){ |
||||||
|
$base_url_record = $URL."api"; |
||||||
|
|
||||||
|
$xml = BigBlueButtonBN::_wrap_simplexml_load_file( $base_url_record ); |
||||||
|
if( $xml && $xml->returncode == 'SUCCESS' ) |
||||||
|
return $xml->version; |
||||||
|
else |
||||||
|
return NULL; |
||||||
|
|
||||||
|
} |
||||||
|
|
||||||
|
public static function isServerRunning( $URL ){ |
||||||
|
$base_url_record = $URL."api"; |
||||||
|
|
||||||
|
$xml = BigBlueButtonBN::_wrap_simplexml_load_file( $base_url_record ); |
||||||
|
if( $xml && $xml->returncode == 'SUCCESS' ) |
||||||
|
return true; |
||||||
|
else |
||||||
|
return false; |
||||||
|
|
||||||
|
} |
||||||
|
|
||||||
|
|
||||||
|
public function _wrap_simplexml_load_file($url){ |
||||||
|
|
||||||
|
if (extension_loaded('curl')) { |
||||||
|
$ch = curl_init() or die ( curl_error() ); |
||||||
|
$timeout = 10; |
||||||
|
curl_setopt( $ch, CURLOPT_SSL_VERIFYPEER, false); |
||||||
|
curl_setopt( $ch, CURLOPT_URL, $url ); |
||||||
|
curl_setopt( $ch, CURLOPT_RETURNTRANSFER, 1 ); |
||||||
|
curl_setopt( $ch, CURLOPT_CONNECTTIMEOUT, $timeout); |
||||||
|
$data = curl_exec( $ch ); |
||||||
|
curl_close( $ch ); |
||||||
|
|
||||||
|
if($data) |
||||||
|
return (new SimpleXMLElement($data,LIBXML_NOCDATA)); |
||||||
|
else |
||||||
|
return false; |
||||||
|
} |
||||||
|
|
||||||
|
return (simplexml_load_file($url,'SimpleXMLElement', LIBXML_NOCDATA)); |
||||||
|
} |
||||||
|
|
||||||
|
|
||||||
|
} |
||||||
|
//----End |
||||||
@ -0,0 +1,9 @@ |
|||||||
|
<?php |
||||||
|
|
||||||
|
$variables = array( 'big_blue_button_meeting_name', |
||||||
|
'big_blue_button_attendee_password', |
||||||
|
'big_blue_button_moderator_password', |
||||||
|
'big_blue_button_welcome_message', |
||||||
|
'big_blue_button_max_students_allowed', |
||||||
|
|
||||||
|
); |
||||||
@ -0,0 +1,60 @@ |
|||||||
|
<?php |
||||||
|
/** |
||||||
|
* This script initiates a videoconference session, calling the BigBlueButton API |
||||||
|
* @package chamilo.plugin.bigbluebutton |
||||||
|
*/ |
||||||
|
/** |
||||||
|
* Initialization |
||||||
|
*/ |
||||||
|
|
||||||
|
$language_file = array('videoconf'); |
||||||
|
|
||||||
|
require_once '../../main/inc/global.inc.php'; |
||||||
|
require_once 'bbb.lib.php'; |
||||||
|
require_once 'bbb_api.php'; |
||||||
|
|
||||||
|
$bbb = new bbb(); |
||||||
|
|
||||||
|
$action = isset($_GET['action']) ? $_GET['action'] : null; |
||||||
|
switch ($action) { |
||||||
|
case 'copy_record_to_link_tool': |
||||||
|
$result = $bbb->copy_record_to_link_tool($_GET['id'], $_GET['record_id']); |
||||||
|
if ($result) { |
||||||
|
$message = Display::return_message(get_lang('Copied'), 'success'); |
||||||
|
} else { |
||||||
|
$message = Display::return_message(get_lang('Error'), 'error'); |
||||||
|
} |
||||||
|
break; |
||||||
|
case 'delete_recording': |
||||||
|
//$bbb->delete_record($_GET['id']); |
||||||
|
break; |
||||||
|
case 'end': |
||||||
|
$bbb->end_meeting($_GET['id']); |
||||||
|
$message = Display::return_message(get_lang('MeetingClosed'), 'success'); |
||||||
|
break; |
||||||
|
case 'publish': |
||||||
|
//$result = $bbb->publish_meeting($_GET['id']); |
||||||
|
break; |
||||||
|
case 'unpublish': |
||||||
|
//$result = $bbb->unpublish_meeting($_GET['id']); |
||||||
|
break; |
||||||
|
} |
||||||
|
|
||||||
|
$meetings = $bbb->get_course_meetings(); |
||||||
|
$users_online = $bbb->get_users_online_in_current_room(); |
||||||
|
|
||||||
|
$tool_name = get_lang('OrganisationSVideoconference'); |
||||||
|
|
||||||
|
$tpl = new Template($tool_name); |
||||||
|
|
||||||
|
$tpl->assign('meetings', $meetings); |
||||||
|
$conference_url = api_get_path(WEB_PLUGIN_PATH).'bbb/start.php?launch=1&'.api_get_cidreq(); |
||||||
|
$tpl->assign('conference_url', $conference_url); |
||||||
|
$tpl->assign('users_online', $users_online); |
||||||
|
|
||||||
|
$tpl->assign('actions', $actions); |
||||||
|
$tpl->assign('message', $message); |
||||||
|
$listing_tpl = 'bbb/listing.tpl'; |
||||||
|
$content = $tpl->fetch($listing_tpl); |
||||||
|
$tpl->assign('content', $content); |
||||||
|
$tpl->display_one_col_template(); |
||||||
@ -0,0 +1,52 @@ |
|||||||
|
<div class ="row"> |
||||||
|
|
||||||
|
<div class ="span12" style="text-align:center"> |
||||||
|
<a href="{{ conference_url }}" class="btn btn-primary btn-large"> |
||||||
|
{{ 'StartConference'|get_lang }} |
||||||
|
</a> |
||||||
|
<span id="users_online" class="label label-warning">{{ users_online }} user(s) online</span> |
||||||
|
</div> |
||||||
|
|
||||||
|
<div class ="span12"> |
||||||
|
|
||||||
|
<div class="page-header"> |
||||||
|
<h2>{{ 'RecordList'|get_lang }}</h2> |
||||||
|
</div> |
||||||
|
|
||||||
|
<table class="table"> |
||||||
|
<tr> |
||||||
|
<th>#</th> |
||||||
|
<th>{{'Meeting'|get_lang}}</th> |
||||||
|
<th>{{'Date'|get_lang}}</th> |
||||||
|
<th>{{'Actions'|get_lang}}</th> |
||||||
|
</tr> |
||||||
|
{% for meeting in meetings %} |
||||||
|
<tr> |
||||||
|
<td>{{ meeting.id }}</td> |
||||||
|
<td>{{ meeting.meeting_name }}</td> |
||||||
|
<td>{{ meeting.created_at }}</td> |
||||||
|
<td> |
||||||
|
{% if meeting.record == 1 %} |
||||||
|
|
||||||
|
{# Record list #} |
||||||
|
{{ meeting.show_links }} |
||||||
|
|
||||||
|
<!-- <a href="{{ meeting.publish_url}} "> Publish </a> |
||||||
|
<a href="{{ meeting.unpublish_url}} "> UnPublish </a> --> |
||||||
|
{% endif %} |
||||||
|
<br /> |
||||||
|
|
||||||
|
{% if meeting.status == 1 %} |
||||||
|
<span class="label label-success">{{'MeetingOpened'|get_lang}}</span> |
||||||
|
<a class="btn" href="{{ meeting.end_url }} "> {{'CloseMeeting'|get_lang}} </a> |
||||||
|
{% else %} |
||||||
|
<span class="label label-info">{{'MeetingClosed'|get_lang}}</span> |
||||||
|
{% endif %} |
||||||
|
|
||||||
|
|
||||||
|
</td> |
||||||
|
</tr> |
||||||
|
{% endfor %} |
||||||
|
</table> |
||||||
|
</div> |
||||||
|
</div> |
||||||
@ -1,11 +1,11 @@ |
|||||||
<?php |
<?php |
||||||
require_once api_get_path(LIBRARY_PATH).'sortabletable.class.php'; |
require_once api_get_path(LIBRARY_PATH).'sortable_table.class.php'; |
||||||
require_once api_get_path(LIBRARY_PATH).'export.lib.inc.php'; |
require_once api_get_path(LIBRARY_PATH).'export.lib.inc.php'; |
||||||
|
|
||||||
class TestSortableTable extends UnitTestCase { |
class TestSortableTable extends UnitTestCase { |
||||||
|
|
||||||
public function __construct() { |
public function __construct() { |
||||||
$this->UnitTestCase('Sortabletable library - main/inc/lib/sortabletable.class.test.php'); |
$this->UnitTestCase('Sortabletable library - main/inc/lib/sortable_table.class.test.php'); |
||||||
} |
} |
||||||
|
|
||||||
function testdisplay() { |
function testdisplay() { |
||||||
Loading…
Reference in new issue