diff --git a/plugin/openmeetings/config.php b/plugin/openmeetings/config.php
index e505b47ff1..f71f246f4f 100644
--- a/plugin/openmeetings/config.php
+++ b/plugin/openmeetings/config.php
@@ -7,5 +7,7 @@ require_once '../../main/inc/global.inc.php';
require_once api_get_path(LIBRARY_PATH).'plugin.class.php';
require_once 'lib/openmeetings.lib.php';
-require_once 'lib/openmeetings_api.php';
require_once 'lib/openmeetings_plugin.class.php';
+require_once 'lib/openmeetings_gateway.php';
+require_once 'lib/openmeetings_rest_service.php';
+
diff --git a/plugin/openmeetings/lib/openmeetings.lib.php b/plugin/openmeetings/lib/openmeetings.lib.php
index 99afced6d2..a3ab39aa7c 100644
--- a/plugin/openmeetings/lib/openmeetings.lib.php
+++ b/plugin/openmeetings/lib/openmeetings.lib.php
@@ -7,28 +7,25 @@
/**
* Initialization
*/
-include_once 'services/getSession/getSession.class.php';
-include_once 'services/loginUser/loginUser.class.php';
-include_once 'services/addRoomWithModerationAndExternalType/addRoomWithModerationAndExternalType.class.php';
-include_once 'services/getRoomWithCurrentUsersById/getRoomWithCurrentUsersById.class.php';
-include_once 'services/setUserObjectAndGenerateRoomHashByURLAndRecFlag/setUserObjectAndGenerateRoomHashByURLAndRecFlag.class.php';
-include_once 'services/closeRoom/closeRoom.class.php';
-include_once 'services/getRoomById/getRoomById.class.php';
+include_once __DIR__.'/session.class.php';
+include_once __DIR__.'/room.class.php';
+include_once __DIR__.'/user.class.php';
/**
* Open Meetings-Chamilo connector class
*/
class OpenMeetings
{
- var $url;
- var $salt;
- var $api;
- var $user_complete_name = null;
- var $protocol = 'http://';
- var $debug = false;
- var $logout_url = null;
- var $plugin_enabled = false;
- var $sessionId = "";
+ public $url;
+ public $user;
+ public $pass;
+ public $api;
+ public $user_complete_name = null;
+ public $protocol = 'http://';
+ public $debug = false;
+ public $logout_url = null;
+ public $plugin_enabled = false;
+ public $sessionId = "";
/**
* Constructor (generates a connection to the API and the Chamilo settings
@@ -54,12 +51,14 @@ class OpenMeetings
$this->url = $om_host;
// Setting OM api
- define('CONFIG_OPENMEETINGS_USER_SALT', $this->user);
- define('CONFIG_OPENMEETINGS_PASS_SALT', $this->pass);
- define('CONFIG_OPENMEETINGS_SERVER_BASE_URL', $this->url);
+ define('CONFIG_OPENMEETINGS_USER', $this->user);
+ define('CONFIG_OPENMEETINGS_PASS', $this->pass);
+ define('CONFIG_OPENMEETINGS_SERVER_URL', $this->url);
- $this->api = new OpenMeetingsAPI();
+ $this->gateway = new OpenMeetingsGateway();
$this->plugin_enabled = $om_plugin;
+ // The room has a name composed of C + course ID + '-' + session ID
+ $this->room_name = 'C'.api_get_course_int_id().'-'.api_get_session_id();
}
}
/**
@@ -77,25 +76,26 @@ class OpenMeetings
function loginUser()
{
try {
- $objGetSession = new getSession();
- $objloginUser = new loginUser();
- $urlWsdl = CONFIG_OPENMEETINGS_SERVER_BASE_URL . "/services/UserService?wsdl";
- $omServices = new SoapClient( $urlWsdl );
+ //$objGetSession = new Chamilo\Plugin\OpenMeetings\Session();
+ //$urlWsdl = CONFIG_OPENMEETINGS_SERVER_URL . "/services/UserService?wsdl";
+ //$omServices = new SoapClient( $urlWsdl );
//Verifying if there is already an active session
if (empty($_SESSION['sessOpenMeeting'])) {
- $gsFun = $omServices->getSession($objGetSession);
- $_SESSION['sessOpenMeeting'] = $objloginUser->SID = $this->sessionId = $gsFun->return->session_id;
- $objloginUser->username = CONFIG_OPENMEETINGS_USER_SALT;
- $objloginUser->userpass = CONFIG_OPENMEETINGS_PASS_SALT;
+ //$gsFun = $omServices->getSession($objGetSession);
- $luFn = $omServices->loginUser($objloginUser);
+ //$loginUser = $omServices->loginUser(array('SID' => $this->sessionId, 'username' => $this->user, 'userpass' => $this->pass));
+ $loginUser = $this->gateway->loginUser();
+ $_SESSION['sessOpenMeeting'] = $this->sessionId = $this->gateway->session_id;
- if ($luFn->return > 0) {
+ if ($loginUser) {
+ error_log(__LINE__.' user logged in');
return true;
} else {
+ error_log(__LINE__);
return false;
}
} else {
+ error_log(__LINE__.' '.$_SESSION['sessOpenMeeting']);
$this->sessionId = $_SESSION['sessOpenMeeting'];
return true;
}
@@ -114,14 +114,13 @@ class OpenMeetings
{
//$id = Database::insert($this->table, $params);
try {
- $objAddRoom = new addRoomWithModerationAndExternalType();
+ $objAddRoom = new Chamilo\Plugin\OpenMeetings\Room();
$roomTypeId = $isModerated = ( $this->isTeacher() ) ? 1 : 2 ;
$params['c_id'] = api_get_course_int_id();
- $course_name = 'C'.$params['c_id'].'-'.api_get_session_id();
- $urlWsdl = CONFIG_OPENMEETINGS_SERVER_BASE_URL . "/services/RoomService?wsdl";
+ $urlWsdl = CONFIG_OPENMEETINGS_SERVER_URL . "/services/RoomService?wsdl";
$objAddRoom->SID = $this->sessionId;
- $objAddRoom->name = $course_name;
+ $objAddRoom->name = $this->room_name;
$objAddRoom->roomtypes_id = $roomTypeId;
$objAddRoom->comment = get_lang('Course').': ' . $params['meeting_name'] . ' Plugin for Chamilo';
$objAddRoom->numberOfPartizipants = 40;
@@ -188,10 +187,10 @@ class OpenMeetings
$params = array( 'room_id' => $meetingId );
$returnVal = $this->setUserObjectAndGenerateRoomHashByURLAndRecFlag( $params );
- //$urlWithoutProtocol = str_replace("http://", CONFIG_OPENMEETINGS_SERVER_BASE_URL);
+ //$urlWithoutProtocol = str_replace("http://", CONFIG_OPENMEETINGS_SERVER_URL);
//$imgWithoutProtocol = str_replace("http://", $_SESSION['_user']['avatar'] );
- $iframe = CONFIG_OPENMEETINGS_SERVER_BASE_URL . "/?" .
+ $iframe = CONFIG_OPENMEETINGS_SERVER_URL . "/?" .
"secureHash=" . $returnVal /*.
'&username=FRAGOTE' .
'&firstname=DD' .
@@ -271,9 +270,9 @@ class OpenMeetings
$systemType = 'chamilo';
$room_id = $params['room_id'];
- $urlWsdl = CONFIG_OPENMEETINGS_SERVER_BASE_URL . "/services/UserService?wsdl";
+ $urlWsdl = CONFIG_OPENMEETINGS_SERVER_URL . "/services/UserService?wsdl";
$omServices = new SoapClient( $urlWsdl );
- $objRec = new setUserObjectAndGenerateRecordingHashByURL();
+ $objRec = new Chamilo\Plugin\OpenMeetings\User();
$objRec->SID = $this->sessionId;
$objRec->username = $username;
@@ -305,9 +304,9 @@ class OpenMeetings
$becomeModerator = ( $this->isTeacher() ? 1 : 0 );
$allowRecording = 1; //Provisional
- $urlWsdl = CONFIG_OPENMEETINGS_SERVER_BASE_URL . "/services/UserService?wsdl";
+ $urlWsdl = CONFIG_OPENMEETINGS_SERVER_URL . "/services/UserService?wsdl";
$omServices = new SoapClient( $urlWsdl );
- $objRec = new setUserObjectAndGenerateRoomHashByURLAndRecFlag();
+ $objRec = new Chamilo\Plugin\OpenMeetings\User();
$objRec->SID = $this->sessionId;
$objRec->username = $username;
@@ -335,25 +334,40 @@ class OpenMeetings
{
$new_meeting_list = array();
$item = array();
- $pass = $this->getMeetingUserPassword();
$this->loginUser();
- $meeting_list = Database::select('*', $this->table, array('where' => array('c_id = ? ' => api_get_course_int_id(), 'session_id = ? ' => api_get_session_id())));
+ $meeting_list = Database::select('*', $this->table, array('where' => array('c_id = ? ' => api_get_course_int_id(), ' AND session_id = ? ' => api_get_session_id())));
- $urlWsdl = CONFIG_OPENMEETINGS_SERVER_BASE_URL . "/services/RoomService?wsdl";
+ $urlWsdl = CONFIG_OPENMEETINGS_SERVER_URL . "/services/RoomService?wsdl";
$omServices = new SoapClient($urlWsdl);
- $objRoom = new getRoomById();
- $objCurrentUsers = new getRoomWithCurrentUsersById();
- $objRoom->SID = $objCurrentUsers->SID = $this->sessionId;
+ $objRoom = new Chamilo\Plugin\OpenMeetings\Room();
+ try {
+ $rooms = $this->gateway->getRoomsWithCurrentUsersByType($this->sessionId);
+ //$rooms = $omServices->getRoomsPublic(array(
+ //'SID' => $this->sessionId,
+ //'start' => 0,
+ //'max' => 10,
+ //'orderby' => 'name',
+ //'asc' => 'true',
+ //'externalRoomType' => 'chamilo',
+ //'roomtypes_id' => 'chamilo',
+ //)
+ //);
+ } catch (SoapFault $e) {
+ error_log($e->faultstring);
+ //error_log($rooms->getDebug());
+ return false;
+ }
+ $objRoom->SID = $this->sessionId;
foreach ($meeting_list as $meeting_db) {
- $objRoom->rooms_id = $objCurrentUsers->rooms_id = $meeting_db['id'];
+ $objRoom->rooms_id = $meeting_db['id'];
try {
$objRoomId = $omServices->getRoomById($objRoom);
if (empty($objRoomId->return)) {
Database::delete($this->table, "id = {$meeting_db['id']}");
continue;
}
- $objCurUs = $omServices->getRoomWithCurrentUsersById($objCurrentUsers);
+ //$objCurUs = $omServices->getRoomWithCurrentUsersById($objCurrentUsers);
} catch (SoapFault $e) {
echo $e->faultstring;
exit;
@@ -452,7 +466,7 @@ class OpenMeetings
// 'webVoiceConf' => '' // -- OPTIONAL - string
// );
// $returnVal = $this->setUserObjectAndGenerateRoomHashByURLAndRecFlag( array('room_id' => $meeting_db['id']) );
-// $joinUrl = CONFIG_OPENMEETINGS_SERVER_BASE_URL . "?" .
+// $joinUrl = CONFIG_OPENMEETINGS_SERVER_URL . "?" .
// "secureHash=" . $returnVal;
//
// $item['go_url'] = $joinUrl;
@@ -472,9 +486,9 @@ class OpenMeetings
{
try {
$this->loginUser();
- $urlWsdl = CONFIG_OPENMEETINGS_SERVER_BASE_URL . "/services/RoomService?wsdl";
+ $urlWsdl = CONFIG_OPENMEETINGS_SERVER_URL . "/services/RoomService?wsdl";
$omServices = new SoapClient( $urlWsdl );
- $objClose = new closeRoom();
+ $objClose = new Chamilo\Plugin\OpenMeetings\Room();
$objClose->SID = $this->sessionId;
$objClose->room_id = $meetingId;
$objClose->status = false;
diff --git a/plugin/openmeetings/lib/openmeetings_api.php b/plugin/openmeetings/lib/openmeetings_api.php
index 16864d2a4f..f3f395ec1b 100644
--- a/plugin/openmeetings/lib/openmeetings_api.php
+++ b/plugin/openmeetings/lib/openmeetings_api.php
@@ -8,7 +8,8 @@
*/
class OpenMeetingsAPI
{
- private $_securitySalt;
+ private $_user;
+ private $_pass;
private $_serverBaseUrl;
/**
@@ -16,60 +17,10 @@ class OpenMeetingsAPI
*/
function __construct()
{
- $this->_securitySalt = CONFIG_SECURITY_SALT;
- $this->_serverBaseUrl = CONFIG_OPENMEETINGS_SERVER_BASE_URL;
+ $this->_user = CONFIG_OPENMEETINGS_USER;
+ $this->_pass = CONFIG_OPENMEETINGS_PASS;
+ $this->_serverBaseUrl = CONFIG_OPENMEETINGS_SERVER_URL;
}
- /**
- * Gets info about a given meeting
- * @param $infoParams
- * @return array|null
- */
- function getMeetingInfoArray($infoParams)
- {
-
- $xml = $this->_processXmlResponse($this->getMeetingInfoUrl($infoParams));
- if ($xml) {
- // If we don't get a success code or messageKey, find out why:
- if (($xml->returncode != 'SUCCESS') || ($xml->messageKey == null)) {
- $result = array(
- 'returncode' => $xml->returncode,
- 'messageKey' => $xml->messageKey,
- 'message' => $xml->message
- );
- return $result;
- } else {
- // In this case, we have success and meeting info:
- $result = array(
- 'returncode' => $xml->returncode,
- 'meetingName' => $xml->meetingName,
- 'meetingId' => $xml->meetingID,
- 'createTime' => $xml->createTime,
- 'voiceBridge' => $xml->voiceBridge,
- 'attendeePw' => $xml->attendeePW,
- 'moderatorPw' => $xml->moderatorPW,
- 'running' => $xml->running,
- 'recording' => $xml->recording,
- 'hasBeenForciblyEnded' => $xml->hasBeenForciblyEnded,
- 'startTime' => $xml->startTime,
- 'endTime' => $xml->endTime,
- 'participantCount' => $xml->participantCount,
- 'maxUsers' => $xml->maxUsers,
- 'moderatorCount' => $xml->moderatorCount,
- );
- // Then interate through attendee results and return them as part of the array:
- foreach ($xml->attendees->attendee as $a) {
- $result[] = array(
- 'userId' => $a->userID,
- 'fullName' => $a->fullName,
- 'role' => $a->role
- );
- }
- return $result;
- }
- } else {
- return null;
- }
- }
}
diff --git a/plugin/openmeetings/lib/openmeetings_gateway.php b/plugin/openmeetings/lib/openmeetings_gateway.php
index e276ed584d..ccf7d3fc05 100644
--- a/plugin/openmeetings/lib/openmeetings_gateway.php
+++ b/plugin/openmeetings/lib/openmeetings_gateway.php
@@ -31,6 +31,7 @@ class OpenMeetingsGateway
{
public $session_id = "";
public $config;
+ private $rest;
function __construct()
{
@@ -40,6 +41,14 @@ class OpenMeetingsGateway
if (substr($this->_url, -1, 1) == '/') {
$this->_url = substr($this->_url, 0, -1);
}
+ $this->rest = new OpenMeetingsRestService();
+ $err = $this->rest->getError();
+ if ($err) {
+ error_log('Constructor error: ' . $err);
+ error_log('Debug: ' . $this->rest->getDebug());;
+ exit();
+ }
+
}
function getRestUrl($name)
@@ -67,27 +76,26 @@ class OpenMeetingsGateway
*/
function loginUser()
{
- $restService = new OpenMeetingsRestService();
-
- $response = $restService->call($this->getRestUrl("UserService") . "getSession", "session_id");
+
+ $response = $this->rest->call($this->getRestUrl("UserService") . "getSession", "session_id");
- if ($restService->getError()) {
+ if ($this->rest->getError()) {
error_log('Fault (Expect - The request contains an invalid SOAP body) '.print_r($response,1));
} else {
- $err = $restService->getError();
+ $err = $this->rest->getError();
if ($err) {
error_log('Error: ' . $err);
} else {
$this->session_id = $response;
- $result = $restService->call($this->getRestUrl("UserService") . "loginUser?SID=" . $this->session_id
- . "&username=" . urlencode($this->config["adminUser"])
- . "&userpass=" . urlencode($this->config["adminPass"]));
+ $result = $this->rest->call($this->getRestUrl("UserService") . "loginUser?SID=" . $this->session_id
+ . "&username=" . urlencode(CONFIG_OPENMEETINGS_USER)
+ . "&userpass=" . urlencode(CONFIG_OPENMEETINGS_PASS));
- if ($restService->getError()) {
+ if ($this->rest->getError()) {
error_log('Fault (Expect - The request contains an invalid SOAP body) '.print_r($result,1));
} else {
- $err = $restService->getError();
+ $err = $this->rest->getError();
if ($err) {
error_log('Error '. $err);
} else {
@@ -105,12 +113,10 @@ class OpenMeetingsGateway
}
function updateRoomWithModeration($openmeetings)
{
- $restService = new OpenMeetingsRestService();
- // echo $restService."
";
- $err = $restService->getError();
+ $err = $this->rest->getError();
if ($err) {
error_log('Constructor error: ' . $err);
- error_log('Debug: ' . $restService->getDebug());
+ error_log('Debug: ' . $this->rest->getDebug());
exit();
}
@@ -119,16 +125,16 @@ class OpenMeetingsGateway
$isModeratedRoom = true;
}
- $result = $restService->call($this->getRestUrl("RoomService") . "updateRoomWithModeration?SID=" . $this->session_id
+ $result = $this->rest->call($this->getRestUrl("RoomService") . "updateRoomWithModeration?SID=" . $this->session_id
. "&room_id=" . $openmeetings->room_id . "&name=" . urlencode($openmeetings->roomname) . "&roomtypes_id="
. urlencode($openmeetings->type) . "&comment=" . urlencode("Created by SOAP-Gateway")
. "&numberOfPartizipants=" . $openmeetings->max_user . "&ispublic=false" . "&appointment=false" . "&isDemoRoom=false"
. "&demoTime=0" . "&isModeratedRoom=" . $this->var_to_str($isModeratedRoom));
- if ($restService->fault) {
+ if ($result->fault) {
error_log('Fault (Expect - The request contains an invalid SOAP body) '.print_r($result,1));
} else {
- $err = $restService->getError();
+ $err = $this->rest->getError();
if ($err) {
error_log('Error: ' . $err);
} else {
@@ -144,15 +150,14 @@ class OpenMeetingsGateway
*/
function setUserObjectAndGenerateRecordingHashByURL($username, $firstname, $lastname, $userId, $systemType, $recording_id)
{
- $restService = new OpenMeetingsRestService();
- $result = $restService->call($this->getRestUrl("UserService") . 'setUserObjectAndGenerateRecordingHashByURL?SID=' . $this->session_id
+ $result = $this->rest->call($this->getRestUrl("UserService") . 'setUserObjectAndGenerateRecordingHashByURL?SID=' . $this->session_id
. '&username=' . urlencode($username) . '&firstname=' . urlencode($firstname) . '&lastname=' . urlencode($lastname)
. '&externalUserId=' . $userId . '&externalUserType=' . urlencode($systemType) . '&recording_id=' . $recording_id, 'return');
- if ($restService->fault) {
+ if ($result->fault) {
error_log('Fault (Expect - The request contains an invalid SOAP body) '.print_r($result,1));
} else {
- $err = $restService->getError();
+ $err = $this->rest->getError();
if ($err) {
error_log('Error: '.$err);
} else {
@@ -163,25 +168,23 @@ class OpenMeetingsGateway
}
function setUserObjectAndGenerateRoomHashByURLAndRecFlag($username, $firstname, $lastname, $profilePictureUrl, $email, $userId, $systemType, $room_id, $becomeModerator, $allowRecording)
{
- $restService = new OpenMeetingsRestService();
- // echo $restService."
";
- $err = $restService->getError();
+ $err = $this->rest->getError();
if ($err) {
error_log('Constructor error: ' . $err);
- error_log('Debug: ' . $restService->getDebug());;
+ error_log('Debug: ' . $this->rest->getDebug());;
exit();
}
- $result = $restService->call($this->getRestUrl("UserService") . "setUserObjectAndGenerateRoomHashByURLAndRecFlag?SID=" . $this->session_id
+ $result = $this->rest->call($this->getRestUrl("UserService") . "setUserObjectAndGenerateRoomHashByURLAndRecFlag?SID=" . $this->session_id
. "&username=" . urlencode($username) . "&firstname=" . urlencode($firstname) . "&lastname=" . urlencode($lastname)
. "&profilePictureUrl=" . urlencode($profilePictureUrl) . "&email=" . urlencode($email) . "&externalUserId=" . urlencode($userId)
. "&externalUserType=" . urlencode($systemType) . "&room_id=" . urlencode($room_id) . "&becomeModeratorAsInt=" . $becomeModerator
. "&showAudioVideoTestAsInt=1" . "&allowRecording=" . $this->var_to_str($allowRecording));
- if ($restService->fault) {
+ if ($result->fault) {
error_log('Fault (Expect - The request contains an invalid SOAP body) '.print_r($result,1));
} else {
- $err = $restService->getError();
+ $err = $this->rest->getError();
if ($err) {
error_log('Error: '.$err);
} else {
@@ -193,22 +196,20 @@ class OpenMeetingsGateway
}
function deleteRoom($openmeetings)
{
- // echo $client_roomService."
";
- $restService = new OpenMeetingsRestService();
- $err = $restService->getError();
+ $err = $this->rest->getError();
if ($err) {
error_log('Constructor error: ' . $err);
- error_log('Debug: ' . $restService->getDebug());;
+ error_log('Debug: ' . $this->rest->getDebug());;
exit();
}
- $result = $restService->call($this->getRestUrl("RoomService") . "deleteRoom?SID=" . $this->session_id
+ $result = $this->rest->call($this->getRestUrl("RoomService") . "deleteRoom?SID=" . $this->session_id
. "&rooms_id=" . $openmeetings->room_id);
- if ($restService->fault) {
+ if ($result->fault) {
error_log('Fault (Expect - The request contains an invalid SOAP body) '.print_r($result,1));
} else {
- $err = $restService->getError();
+ $err = $this->rest->getError();
if ($err) {
error_log('Error: '.$err);
} else {
@@ -225,25 +226,16 @@ class OpenMeetingsGateway
*/
function setUserObjectAndGenerateRoomHash($username, $firstname, $lastname, $profilePictureUrl, $email, $externalUserId, $externalUserType, $room_id, $becomeModeratorAsInt, $showAudioVideoTestAsInt)
{
- $restService = new OpenMeetingsRestService();
-
- $result = $restService->call($this->getRestUrl("UserService") . "setUserObjectAndGenerateRoomHash?SID=" . $this->session_id
+ $result = $this->rest->call($this->getRestUrl("UserService") . "setUserObjectAndGenerateRoomHash?SID=" . $this->session_id
. "&username=" . urlencode($username) . "&firstname=" . urlencode($firstname) . "&lastname=" . urlencode($lastname)
. "&profilePictureUrl=" . urlencode($profilePictureUrl) . "&email=" . urlencode($email) . "&externalUserId="
. urlencode($externalUserId) . "&externalUserType=" . urlencode($externalUserType) . "&room_id=" . $room_id
. "&becomeModeratorAsInt=" . $becomeModeratorAsInt . "&showAudioVideoTestAsInt=" . $showAudioVideoTestAsInt);
- $err = $restService->getError();
- if ($err) {
- error_log('Constructor error: ' . $err);
- error_log('Debug: ' . $restService->getDebug());;
- exit();
- }
-
- if ($restService->getError()) {
+ if ($result->getError()) {
error_log('Fault (Expect - The request contains an invalid SOAP body) '.print_r($result,1));
} else {
- $err = $restService->getError();
+ $err = $this->rest->getError();
if ($err) {
error_log('Error: '.$err);
} else {
@@ -259,10 +251,6 @@ class OpenMeetingsGateway
*/
function createRoomWithModAndType($openmeetings)
{
- global $USER;
-
- $restService = new OpenMeetingsRestService();
-
$isModeratedRoom = "false";
if ($openmeetings->is_moderated_room == 1) {
$isModeratedRoom = "true";
@@ -274,12 +262,12 @@ class OpenMeetingsGateway
. '&ispublic=false' . '&appointment=false' . '&isDemoRoom=false' . '&demoTime=0' . '&isModeratedRoom=' . $isModeratedRoom
. '&externalRoomType=' . urlencode($this->config["moduleKey"]);
- $result = $restService->call($url, "return");
+ $result = $this->rest->call($url, "return");
- if ($restService->fault) {
+ if ($this->rest->fault) {
error_log('Fault (Expect - The request contains an invalid SOAP body) '.print_r($result,1));
} else {
- $err = $restService->getError();
+ $err = $this->rest->getError();
if ($err) {
error_log('Error: '.$err);
} else {
@@ -288,18 +276,38 @@ class OpenMeetingsGateway
}
return - 1;
}
-
+
+ /**
+ * Gets the list of open rooms of type "Chamilo"
+ */
+ public function getRoomsWithCurrentUsersByType($sid)
+ {
+ if (empty($sid)) {
+ if (empty($this->session_id)) {
+ return false;
+ }
+ $sid = $this->session_id;
+ }
+ //$url = $this->getRestUrl("RoomService") . "getRoomsWithCurrentUsersByListAndType?SID=" . $sid
+ // . "&start=1&max=100&orderby=name&asc=true&externalRoomType=chamilo";
+ $url = $this->getRestUrl("RoomService") . "getRoomTypes?SID=" . $sid;
+ // . "&roomtypes_id=1";
+error_log($url);
+ $result = $this->rest->call($url, "return");
+ error_log(print_r($result,1));
+ return $result;
+
+ }
+
/**
* Get list of available recordings made by this instance
*/
function getRecordingsByExternalRooms()
{
- $restService = new OpenMeetingsRestService();
-
- $url = $this->getRestUrl("RoomService") . "getFlvRecordingByExternalRoomType?SID=" . $this->session_id
+ $url = $this->getRestUrl("RoomService") . "getFlvRecordingByExternalRoomType?SID=" . $this->session_id
. "&externalRoomType=" . urlencode($this->config["moduleKey"]);
- $result = $restService->call($url, "return");
+ $result = $this->rest->call($url, "return");
return $result;
}
@@ -309,12 +317,10 @@ class OpenMeetingsGateway
*/
function getRecordingsByExternalUser($id)
{
- $restService = new OpenMeetingsRestService();
-
- $url = $this->getRestUrl("RoomService") . "getFlvRecordingByExternalUserId?SID=" . $this->session_id
+ $url = $this->getRestUrl("RoomService") . "getFlvRecordingByExternalUserId?SID=" . $this->session_id
. "&externalUserId=" . $id;
- $result = $restService->call($url, "return");
+ $result = $this->rest->call($url, "return");
return $result;
}
diff --git a/plugin/openmeetings/lib/openmeetings_rest_service.php b/plugin/openmeetings/lib/openmeetings_rest_service.php
index f0f9b07586..ed97ff099a 100644
--- a/plugin/openmeetings/lib/openmeetings_rest_service.php
+++ b/plugin/openmeetings/lib/openmeetings_rest_service.php
@@ -72,21 +72,25 @@ class OpenMeetingsRestService
// Success
break;
case 503 :
- die ( 'Your call to OpenMeetings Web Services failed and returned an HTTP status of 503.
+ error_log( 'Your call to OpenMeetings Web Services failed and returned an HTTP status of 503.
That means: Service unavailable. An internal problem prevented us from returning data to you.' );
+ return false;
break;
case 403 :
- die ( 'Your call to OpenMeetings Web Services failed and returned an HTTP status of 403.
+ error_log( 'Your call to OpenMeetings Web Services failed and returned an HTTP status of 403.
That means: Forbidden. You do not have permission to access this resource, or are over your rate limit.' );
+ return false;
break;
case 400 :
// You may want to fall through here and read the specific XML error
- die ( 'Your call to OpenMeetings Web Services failed and returned an HTTP status of 400.
+ error_log( 'Your call to OpenMeetings Web Services failed and returned an HTTP status of 400.
That means: Bad request. The parameters passed to the service did not match as expected.
The exact error is returned in the XML response.' );
+ return false;
break;
default :
- die ( 'Your call to OpenMeetings Web Services returned an unexpected HTTP status of: ' . $status_code [0] . " Request " . $request );
+ error_log( 'Your call to OpenMeetings Web Services returned an unexpected HTTP status of: ' . $status_code [0] . " Request " . $request );
+ return false;
}
// Get the XML from the response, bypassing the header
diff --git a/plugin/openmeetings/lib/services/addRoomWithModerationAndExternalType/addRoomWithModerationAndExternalType.class.php b/plugin/openmeetings/lib/room.class.php
similarity index 52%
rename from plugin/openmeetings/lib/services/addRoomWithModerationAndExternalType/addRoomWithModerationAndExternalType.class.php
rename to plugin/openmeetings/lib/room.class.php
index d8a4faf194..8577c3cdda 100644
--- a/plugin/openmeetings/lib/services/addRoomWithModerationAndExternalType/addRoomWithModerationAndExternalType.class.php
+++ b/plugin/openmeetings/lib/room.class.php
@@ -1,7 +1,17 @@
getCourseMeetings();
if (!empty($meetings)) {
$meetings = array_reverse($meetings);
}
+error_log(__FILE__.':'.__LINE__.': '.print_r($meetings,1));
$users_online = $meetings->participantCount;
//$status = !$meetings->isClosed;