';
diff --git a/main/reservation/rsys.php b/main/reservation/rsys.php
old mode 100755
new mode 100644
index 829a6ccb9a..577cc9ccc2
--- a/main/reservation/rsys.php
+++ b/main/reservation/rsys.php
@@ -1741,7 +1741,7 @@ class Rsys {
$language_file = 'reservation';
$cidReset = true;
require_once '../inc/global.inc.php';
-require_once api_get_path(LIBRARY_PATH).'sortabletable.class.php';
+require_once api_get_path(LIBRARY_PATH).'sortable_table.class.php';
Rsys :: init();
require_once 'rcalendar.php';
-require_once api_get_path(LIBRARY_PATH).'formvalidator/FormValidator.class.php';
\ No newline at end of file
+require_once api_get_path(LIBRARY_PATH).'formvalidator/FormValidator.class.php';
diff --git a/main/session/index.php b/main/session/index.php
index ca6e00df09..6a222c630a 100644
--- a/main/session/index.php
+++ b/main/session/index.php
@@ -80,7 +80,7 @@ if (!empty($new_session_list)) {
$exercise = new Exercise($course_info['real_id']);
$exercise->read($exercise_item['id']);
$visible_return = $exercise->is_visible();
- if ($visible_return['value'] == false) {
+ if ($visible_return['value'] != false) {
//$exercise_course_list[$exercise_item['id']] = $exercise;
//Reading all Exercise results by user, exercise_id, code, and session
$user_results = get_exercise_results_by_user(api_get_user_id(), $exercise_item['id'], $my_course['code'], $my_session_id);
diff --git a/plugin/bbb/bbb.lib.php b/plugin/bbb/bbb.lib.php
index 243bb019bd..ab929ea7cc 100644
--- a/plugin/bbb/bbb.lib.php
+++ b/plugin/bbb/bbb.lib.php
@@ -1,370 +1,252 @@
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;
-}
-
-/**
- * Given an object containing all the necessary data,
- * (defined by the form in mod.html) this function
- * will update an existing instance with new data.
- */
-function bigbluebutton_update_instance($bigbluebutton) {
- $bigbluebutton->timemodified = time();
- $bigbluebutton->id = $bigbluebutton->instance;
- if ($returnid = bigbluebutton_update_record('bigbluebutton', $bigbluebutton)) {
- /*
- $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;
-}
-
-
-
-/**
- * Given an ID of an instance of this module,
- * this function will permanently delete the instance
- * and any data that depends on it.
- */
-function bigbluebutton_delete_instance($id) {
- if (! $bigbluebutton = bigbluebutton_get_record('bigbluebutton', 'id', $id)) {
+class bbb {
+
+ var $url;
+ var $salt;
+ var $api;
+ var $user_complete_name = null;
+ var $protocol = 'http://';
+ var $debug = true;
+ var $logout_url = null;
+
+ function __construct() {
+
+ // 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;
+
+ if ($bbb_plugin) {
+ $user_info = api_get_user_info();
+ $this->user_complete_name = $user_info['complete_name'];
+ $this->salt = $bbb_salt;
+ $this->url = $bbb_host.'/bigbluebutton/';
+ $this->table = Database::get_main_table('plugin_bbb_meeting');
+ return true;
+ }
return false;
}
-
- $result = true;
-
- # Delete any dependent records here #
-
- if (! bigbluebutton_delete_records('bigbluebutton', 'id', $bigbluebutton->id)) {
- $result = false;
+
+ function create_meeting($params) {
+ $params['c_id'] = api_get_course_int_id();
+ $course_code = api_get_course_id();
+
+ $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';
+
+ $params['record'] = api_get_course_setting('big_blue_button_record_and_store', $course_code) == 1 ? true : false;
+ $max = api_get_course_setting('big_blue_button_max_students_allowed', $course_code);
+
+ $max = isset($max) ? $max : -1;
+ $params['status'] = 1;
+
+ if ($this->debug) error_log("enter create_meeting ".print_r($params, 1));
+
+ $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' => ''));
+ }
}
-/*
- $pagetypes = page_import_types('mod/bigbluebutton/');
- foreach($pagetypes as $pagetype) {
- if(!delete_records('block_instance', 'pageid', $bigbluebutton->id, 'pagetype', $pagetype)) {
- $result = false;
+
+ function is_meeting_exist($meeting_name) {
+ $course_id = api_get_course_int_id();
+ $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;
}
}
-*/
-/*
- if (! bigbluebutton_delete_records('event', 'modulename', 'bigbluebutton', 'instance', $bigbluebutton->id)) {
- $result = false;
+
+ /**
+ * @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);
+
+
+ $meeting_info = BigBlueButtonBN::getMeetingInfoArray($meeting['id'], $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 (isset($meeting_is_running) && $meeting_info_exists) {
+ $url = $this->protocol.BigBlueButtonBN::joinURL($meeting_data['id'], $this->user_complete_name, $pass, $this->salt, $this->url);
+ }
+ if ($this->debug) error_log("return url :".$url);
+ return $url;
+ }
+
+ /**
+ * 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(' ', $record_array);
+ }
+
+ $item_meeting['created_at'] = api_get_local_time($item_meeting['created_at']);
+ //created_at
+
+ $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) {
+ $item_meeting['go_url'] = $this->protocol.BigBlueButtonBN::joinURL($meeting['id'], $this->user_complete_name, $pass, $this->salt, $this->url);
+ }
+ $new_meeting_list[] = $item_meeting;
+ }
+ return $new_meeting_list;
}
-*/
- return $result;
-}
-
-
-/**
- * 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;
-}
-
-
-/**
- * Determine if the meeting is already running (e.g. has attendees in it)
- */
-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;
-}
-
-/**
- * Create meeting if it's not already running
- */
-function wc_createMeeting($myIP,$mySecuritySalt,$myMeetingName,$myMeetingID,$myAttendeePW,$myModeratorPW,$myWelcomeMsg,$myLogoutURL) {
- $createAPI = "/bigbluebutton/api/create?";
- $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);
- $checksum = sha1('create'.$queryStr.$mySecuritySalt);
- $secQueryURL = "http://".$myIP.$createAPI.$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) {
+ return BigBlueButtonBN::setPublishRecordings($id, 'true', $this->url, $this->salt);
}
-}
-
-
-/**
- * Create a URL to join the meeting
- */
-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;
-}
-
-/**
- * This API is not yet supported in bigbluebutton
- */
-function wc_endMeeting($myIP,$mySecuritySalt,$myMeetingID,$myModeratorPW) {
- $endAPI = "/bigbluebutton/api/end?";
- $myVoiceBridge = rand(70000,79999);
- $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 unpublish_meeting($id) {
+ return BigBlueButtonBN::setPublishRecordings($id, 'false', $this->url, $this->salt);
}
-}
-
-/**
- * This API is not yet supported in bigbluebutton
- */
-function wc_listAttendees() {
- return false;
-}
-
-/**
- * This API is not yet supported in bigbluebutton
- */
-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;
- }
+
+ function end_meeting($id) {
+ $pass = $this->get_user_metting_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) {
+ return api_get_course_id().'mod';
+ } else {
+ return api_get_course_id();
}
- $attendees[] = $attendee;
}
- $info = array('returnCode'=>$returnCode,'createTime'=>$createTime,'attendees'=>$attendees,'running'=>$running);
- return $info;
-}
-
-/**
- * Determine the URL of the current page (for logoutURL)
- */
-function wc_currentPageURL() {
- $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;
-}
-
-
-/**
- * Determine the IP/Domain of the current Corporate University
- */
-function wc_currentDomain() {
- $currentDomain = $_SERVER["SERVER_NAME"];
- return $currentDomain;
-}
-
-
-/**
- * Determine if a new version of the plug-in is available
- */
-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
- */
-function wc_getRunningMeetings($myIP,$mySecuritySalt) {
- $checkAPI = "/bigbluebutton/api/getMeetings?";
- $queryStr = '';
- $checksum = sha1('getMeetings'.$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;
- $meetingsNode = $doc->getElementsByTagName("meeting");
- $meetings = array();
- foreach ($meetingsNode as $meetingNode) {
- $meeting = array();
- if ($meetingNode->childNodes->length) {
- foreach ($meetingNode->childNodes as $i) {
- //see http://code.google.com/p/bigbluebutton/wiki/API#Get_Meetings for details
- $meeting[$i->nodeName] = $i->nodeValue;
+
+ /**
+ * Get users online in the current course room
+ */
+ function get_users_online_in_current_room() {
+ $course_id = api_get_course_int_id();
+ $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'];
+
+ }
+ return 0;
+ }
+
+ /**
+ * @todo
+ */
+ function delete_record($id) {
+ }
+
+ function copy_record_to_link_tool($id, $record_id) {
+ require_once api_get_path(LIBRARY_PATH).'link.lib.php';
+ $records = BigBlueButtonBN::getRecordingsArray($id, $this->url, $this->salt);
+ if (!empty($records)) {
+ foreach ($records as $record) {
+ if ($record['recordID'] == $record_id) {
+ if (is_array($record) && isset($record['recordID']) && isset($record['playbacks'])) {
+ foreach ($record['playbacks'] as $item) {
+ $link = new Link();
+ $params['url'] = $item['url'];
+ $params['title'] = 'bbb 1';
+ $id = $link->save($params);
+ return $id;
+ }
+ }
+
+ }
}
}
- $meetings[] = $meeting;
+ return false;
+
}
- return $meetings;
-}
+}
\ No newline at end of file
diff --git a/plugin/bbb/bbb_api.php b/plugin/bbb/bbb_api.php
new file mode 100644
index 0000000000..810de50f06
--- /dev/null
+++ b/plugin/bbb/bbb_api.php
@@ -0,0 +1,760 @@
+= 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('', '', str_replace("\n", '', $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 '';
+ if( count( $xml->meetings ) && count( $xml->meetings->meeting ) ) {
+ foreach ($xml->meetings->meeting as $meeting)
+ {
+ echo '';
+ echo BigBlueButtonBN::getMeetingInfo($meeting->meetingID, $meeting->moderatorPW, $URL, $SALT);
+ echo '';
+ }
+ }
+ echo '';
+ 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.' ';
+ }
+ else {
+ echo $attendee->fullName.' ';
+ }
+ }
+ }
+ 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('', '', str_replace("\n", '', $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
\ No newline at end of file
diff --git a/plugin/bbb/config.php b/plugin/bbb/config.php
new file mode 100644
index 0000000000..403b3690d1
--- /dev/null
+++ b/plugin/bbb/config.php
@@ -0,0 +1,9 @@
+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();
diff --git a/plugin/bbb/listing.tpl b/plugin/bbb/listing.tpl
new file mode 100644
index 0000000000..5358d655de
--- /dev/null
+++ b/plugin/bbb/listing.tpl
@@ -0,0 +1,52 @@
+
\ No newline at end of file
diff --git a/plugin/bbb/plugin.php b/plugin/bbb/plugin.php
old mode 100755
new mode 100644
index beec0ba11a..9a61ed7270
--- a/plugin/bbb/plugin.php
+++ b/plugin/bbb/plugin.php
@@ -15,6 +15,6 @@ $plugin_info['comment']="Open Source Videoconference tool";
//the locations where this plugin can be shown
$plugin_info['location']=array('course_tool_plugin');
//the plugin version
-$plugin_info['version']='0.9';
+$plugin_info['version']='1.0';
//the plugin author
-$plugin_info['author']='Yannick Warnier';
\ No newline at end of file
+$plugin_info['author']='Julio Montoya & Yannick Warnier';
\ No newline at end of file
diff --git a/plugin/bbb/start.php b/plugin/bbb/start.php
index ff1a61d7fd..35923fd0df 100644
--- a/plugin/bbb/start.php
+++ b/plugin/bbb/start.php
@@ -8,41 +8,56 @@
*/
require_once '../../main/inc/global.inc.php';
require_once 'bbb.lib.php';
-//The script receives the course_code (cidReq), which allows it to get the corresponding data
-$cid = api_get_real_course_id();
-$ccode = api_get_course_id();
-// initialize conference settings from course settings
-$meeting_name = api_get_course_setting('big_blue_button_meeting_name',$ccode);
-if (empty($meeting_name) or $meeting_name==-1) { $meeting_name = $ccode; }
-$meeting_att_pw = api_get_course_setting('big_blue_button_meeting_attendee_pw',$ccode);
-if (empty($meeting_att_pw) or $meeting_att_pw==-1) { $meeting_att_pw = $ccode; }
-$meeting_mod_pw = api_get_course_setting('big_blue_button_meeting_moderator_pw',$ccode);
-if (empty($meeting_mod_pw) or $meeting_mod_pw==-1) { $meeting_mod_pw = $ccode.'mod'; }
-$meeting_wel_ms = api_get_course_setting('big_blue_button_meeting_welcome_message',$ccode);
-if (empty($meeting_wel_ms) or $meeting_wel_ms==-1) { $meeting_wel_ms = ''; }
+require_once 'bbb_api.php';
-// 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'];
- }
+$course_code = api_get_course_id();
+
+$meeting_params = array();
+$meeting_params['meeting_name'] = api_get_course_id();
+
+$teacher = api_is_course_admin() || api_is_coach() || api_is_platform_admin();
+
+//If I'm a teacher I'm going to the listing page
+if ($teacher && !isset($_GET['launch'])) {
+ header('location: listing.php?'.api_get_cidreq());
+ exit;
}
-$bbb_plugin = $bbb_settings['bbb_plugin'] === 'true';
-$bbb_host = $bbb_settings['bbb_plugin_host'];
-$bbb_salt = $bbb_settings['bbb_plugin_salt'];
-if (!$bbb_plugin) {
- //the BigBlueButton plugin is not enabled (strangely), return to course homepage
- header('location: '.api_get_path(WEB_COURSE_PATH).'/'.$ccode);
+$bbb = new bbb();
+
+if ($bbb) {
+ if ($bbb->is_meeting_exist($meeting_params['meeting_name'])) {
+ $url = $bbb->join_meeting($meeting_params['meeting_name']);
+ if ($url) {
+ header('location: '.$url);
+ exit;
+ } else {
+ $url = $bbb->create_meeting($meeting_params);
+ header('location: '.$url);
+ exit;
+ }
+ } else {
+ $url = $bbb->create_meeting($meeting_params);
+ header('location: '.$url);
+ exit;
+ }
+} else {
+ if (api_is_platform_admin()) {
+ Display::display_warning_message(get_lang('NotConfigured'));
+ }
}
+
+header('location: '.api_get_path(WEB_COURSE_PATH).'/'.$course_code);
+exit;
+
+/*
$teacher = api_is_course_admin() || api_is_coach() || api_is_platform_admin();
$user_info = api_get_user_info(api_get_user_id());
$full_user_name = api_get_person_name($user_info['firstname'],$user_info['lastname']);
$user_id = api_get_user_id();
-$is_running = wc_isMeetingRunning($bbb_host,$bbb_salt,$meeting_name);
+$is_running = wc_isMeetingRunning($bbb_host, $bbb_salt, $meeting_name);
+
if ($is_running == 'true') {
// The conference is running, everything is fine, join
header('location: '.wc_joinMeetingURL($bbb_host,$bbb_salt,$full_user_name,$meeting_name,($teacher?$meeting_mod_pw:$meeting_att_pw),$user_id));
@@ -51,33 +66,41 @@ if ($is_running == 'true') {
// The conference room does not seem to be running...
// First, try harder and ignore the "running" status
$meetings = wc_getRunningMeetings($bbb_host,$bbb_salt);
- $found = false;
- foreach ($meetings as $meeting) {
- //Try to find our meeting room in the list...
- if ($meeting['meetingID'] == $meeting_name) {
- $meeting_info = wc_getMeetingInfo($bbb_host,$bbb_salt,$meeting_name,$meeting_mod_pw);
- error_log('Found passive meeting created '.($meeting_info['createTime']).' seconds ago with '.count($meeting_info['attendees']).' attendees - joining as '.($teacher?'teacher':'student'));
- //if the user is a teacher, or if there are already attendees in
- // the conference room, then allow joining it
- if ($teacher or count($meeting_info['attendees'])>0) {
- header('location: '.wc_joinMeetingURL($bbb_host,$bbb_salt,$full_user_name,$meeting_name,($teacher?$meeting_mod_pw:$meeting_att_pw),$user_id));
- exit;
+
+ if (!empty($meetings)) {
+ foreach ($meetings as $meeting) {
+ //Try to find our meeting room in the list...
+ if ($meeting['meetingID'] == $meeting_name) {
+ $meeting_info = wc_getMeetingInfo($bbb_host,$bbb_salt,$meeting_name,$meeting_mod_pw);
+ error_log('Found passive meeting created '.($meeting_info['createTime']).' seconds ago with '.count($meeting_info['attendees']).' attendees - joining as '.($teacher?'teacher':'student'));
+ //if the user is a teacher, or if there are already attendees in
+ // the conference room, then allow joining it
+ if ($teacher or count($meeting_info['attendees'])>0) {
+ header('location: '.wc_joinMeetingURL($bbb_host,$bbb_salt,$full_user_name,$meeting_name,($teacher?$meeting_mod_pw:$meeting_att_pw),$user_id));
+ exit;
+ }
}
}
}
- // That conference room is really not running or it has no
- // accompanying moderator subscribed
+
+ // That conference room is really not running or it has no accompanying moderator subscribed
+ //if (1) {
+
if ($teacher) {
// The user is a teacher, so he has the right to create the
// room, so create it and join it
- wc_createMeeting($bbb_host,$bbb_salt,$meeting_name,$meeting_name,$meeting_att_pw,$meeting_mod_pw,$meeting_wel_ms,api_get_path(WEB_COURSE_PATH).'/'.$ccode);
- header('location: '.wc_joinMeetingURL($bbb_host,$bbb_salt,$full_user_name,$meeting_name,($teacher?$meeting_mod_pw:$meeting_att_pw),$user_id));
- exit;
- } else {
- // There is no conference room for this course and the user
- // is a mere student, so he cannot start a conference room by
- // himself: a teacher has to launch it first
- header('location: '.api_get_path(WEB_COURSE_PATH).'/'.$ccode);
- exit;
+ //var_dump($bbb_host,$bbb_salt,$meeting_name,$meeting_name,$meeting_att_pw,$meeting_mod_pw,$meeting_wel_ms,api_get_path(WEB_COURSE_PATH).'/'.$course_code);
+ $result = wc_createMeeting($bbb_host, $bbb_salt, $meeting_name, $meeting_name, $meeting_att_pw, $meeting_mod_pw, $meeting_wel_ms, api_get_path(WEB_COURSE_PATH).'/'.$course_code, $record_conference);
+ if ($result) {
+ header('location: '.wc_joinMeetingURL($bbb_host,$bbb_salt,$full_user_name,$meeting_name,($teacher?$meeting_mod_pw:$meeting_att_pw),$user_id));
+ exit;
+ }
}
+ // There is no conference room for this course and the user
+ // is a mere student, so he cannot start a conference room by
+ // himself: a teacher has to launch it first
+
+ header('location: '.api_get_path(WEB_COURSE_PATH).'/'.$course_code);
+ exit;
}
+*/
\ No newline at end of file
diff --git a/plugin/bbb/uninstall.php b/plugin/bbb/uninstall.php
index 0302c1f64c..39b1cf3c4a 100644
--- a/plugin/bbb/uninstall.php
+++ b/plugin/bbb/uninstall.php
@@ -8,8 +8,12 @@
/**
* Queries
*/
+
+require 'config.php';
+
$t_settings = Database::get_main_table(TABLE_MAIN_SETTINGS_CURRENT);
$t_options = Database::get_main_table(TABLE_MAIN_SETTINGS_OPTIONS);
+
$sql = "DELETE FROM $t_settings WHERE variable = 'bbb_plugin'";
Database::query($sql);
$sql = "DELETE FROM $t_options WHERE variable = 'bbb_plugin'";
@@ -18,22 +22,21 @@ $sql = "DELETE FROM $t_settings WHERE variable = 'bbb_plugin_host'";
Database::query($sql);
$sql = "DELETE FROM $t_settings WHERE variable = 'bbb_plugin_salt'";
Database::query($sql);
-$sql = "DROP TABLE IF EXISTS plugin_bbb";
+$sql = "DROP TABLE IF EXISTS plugin_bbb_meeting";
Database::query($sql);
// update existing courses to add conference settings
$t_courses = Database::get_main_table(TABLE_MAIN_COURSE);
-$sql = "SELECT id, code, db_name FROM $t_courses ORDER BY id";
+$sql = "SELECT id, code FROM $t_courses ORDER BY id";
$res = Database::query($sql);
while ($row = Database::fetch_assoc($res)) {
$t_course = Database::get_course_table(TABLE_COURSE_SETTING);
- $sql_course = "DELETE FROM $t_course WHERE c_id = ".$row['id']." AND variable = 'big_blue_button_meeting_name'";
- $r = Database::query($sql_course);
- $sql_course = "DELETE FROM $t_course WHERE c_id = ".$row['id']." AND variable = 'big_blue_button_attendee_password'";
- $r = Database::query($sql_course);
- $sql_course = "DELETE FROM $t_course WHERE c_id = ".$row['id']." AND variable = 'big_blue_button_moderator_password'";
- $r = Database::query($sql_course);
- $sql_course = "DELETE FROM $t_course WHERE c_id = ".$row['id']." AND variable = 'big_blue_button_welcome_message'";
- $r = Database::query($sql_course);
+
+ foreach ($variables as $variable) {
+ $sql_course = "DELETE FROM $t_course WHERE c_id = ".$row['id']." AND variable = '$variable'";
+ $r = Database::query($sql_course);
+ }
+
+
$t_tool = Database::get_course_table(TABLE_TOOL_LIST);
$sql_course = "DELETE FROM $t_tool WHERE c_id = ".$row['id']." AND link = '../../plugin/bbb/start.php'";
$r = Database::query($sql_course);
diff --git a/plugin/share_buttons/plugin.php b/plugin/share_buttons/plugin.php
old mode 100644
new mode 100755
index 1d12705ebf..7fb406420f
--- a/plugin/share_buttons/plugin.php
+++ b/plugin/share_buttons/plugin.php
@@ -1,14 +1,11 @@
Plugins)
+ * This script is a configuration file for the add_this plugin.
+ * These settings will be used in the administration interface for plugins
+ * (Chamilo configuration settings->Plugins)
* @package chamilo.plugin
* @author Julio Montoya
*/
-/**
- * Plugin details (must be present)
- */
-
/* Plugin config */
//the plugin title
@@ -19,6 +16,5 @@ $plugin_info['comment'] = "Show social icons to share a page using addthis.c
$plugin_info['version'] = '1.0';
//the plugin author
$plugin_info['author'] = 'Julio Montoya';
-
//For bigger icons change this value to addthis_32x32_style
$plugin_info['icon_class'] = '';
diff --git a/tests/main/announcements/announcements.inc.test.php b/tests/main/announcements/announcements.inc.test.php
index c3a5d4a78f..c1faa7ec86 100755
--- a/tests/main/announcements/announcements.inc.test.php
+++ b/tests/main/announcements/announcements.inc.test.php
@@ -13,7 +13,7 @@ class TestAnnouncements extends UnitTestCase {
}
/*public function Testdisplay_announcement(){
global $_user, $dateFormatLong, $_course;
- global $defaultVisibilityForANewCourse, $error_msg;
+ global $error_msg;
ob_start();
//create course
$courseSysCode= '142';
diff --git a/tests/main/inc/lib/sortabletable.class.test.php b/tests/main/inc/lib/sortable_table.class.test.php
similarity index 97%
rename from tests/main/inc/lib/sortabletable.class.test.php
rename to tests/main/inc/lib/sortable_table.class.test.php
index 9c6ec2507e..f89a01f568 100755
--- a/tests/main/inc/lib/sortabletable.class.test.php
+++ b/tests/main/inc/lib/sortable_table.class.test.php
@@ -1,11 +1,11 @@
UnitTestCase('Sortabletable library - main/inc/lib/sortabletable.class.test.php');
+ $this->UnitTestCase('Sortabletable library - main/inc/lib/sortable_table.class.test.php');
}
function testdisplay() {