Remove useless classes, renamed others and added namespaces in OpenMeetings plugin - refs BT#7046 refs #5491

1.9.x
Yannick Warnier 12 years ago
parent b550586753
commit 3e63c7deac
  1. 4
      plugin/openmeetings/config.php
  2. 116
      plugin/openmeetings/lib/openmeetings.lib.php
  3. 59
      plugin/openmeetings/lib/openmeetings_api.php
  4. 132
      plugin/openmeetings/lib/openmeetings_gateway.php
  5. 12
      plugin/openmeetings/lib/openmeetings_rest_service.php
  6. 18
      plugin/openmeetings/lib/room.class.php
  7. 6
      plugin/openmeetings/lib/services/closeRoom/closeRoom.class.php
  8. 5
      plugin/openmeetings/lib/services/getRoomById/getRoomById.class.php
  9. 5
      plugin/openmeetings/lib/services/getRoomWithCurrentUsersById/getRoomWithCurrentUsersById.class.php
  10. 4
      plugin/openmeetings/lib/services/getSession/getSession.class.php
  11. 6
      plugin/openmeetings/lib/services/loginUser/loginUser.class.php
  12. 10
      plugin/openmeetings/lib/services/setUserObjectAndGenerateRecordingHashByURL/setUserObjectAndGenerateRecordingHashByURL.class.php
  13. 16
      plugin/openmeetings/lib/session.class.php
  14. 17
      plugin/openmeetings/lib/user.class.php
  15. 1
      plugin/openmeetings/listing.php

@ -7,5 +7,7 @@ require_once '../../main/inc/global.inc.php';
require_once api_get_path(LIBRARY_PATH).'plugin.class.php'; require_once api_get_path(LIBRARY_PATH).'plugin.class.php';
require_once 'lib/openmeetings.lib.php'; require_once 'lib/openmeetings.lib.php';
require_once 'lib/openmeetings_api.php';
require_once 'lib/openmeetings_plugin.class.php'; require_once 'lib/openmeetings_plugin.class.php';
require_once 'lib/openmeetings_gateway.php';
require_once 'lib/openmeetings_rest_service.php';

@ -7,28 +7,25 @@
/** /**
* Initialization * Initialization
*/ */
include_once 'services/getSession/getSession.class.php'; include_once __DIR__.'/session.class.php';
include_once 'services/loginUser/loginUser.class.php'; include_once __DIR__.'/room.class.php';
include_once 'services/addRoomWithModerationAndExternalType/addRoomWithModerationAndExternalType.class.php'; include_once __DIR__.'/user.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';
/** /**
* Open Meetings-Chamilo connector class * Open Meetings-Chamilo connector class
*/ */
class OpenMeetings class OpenMeetings
{ {
var $url; public $url;
var $salt; public $user;
var $api; public $pass;
var $user_complete_name = null; public $api;
var $protocol = 'http://'; public $user_complete_name = null;
var $debug = false; public $protocol = 'http://';
var $logout_url = null; public $debug = false;
var $plugin_enabled = false; public $logout_url = null;
var $sessionId = ""; public $plugin_enabled = false;
public $sessionId = "";
/** /**
* Constructor (generates a connection to the API and the Chamilo settings * Constructor (generates a connection to the API and the Chamilo settings
@ -54,12 +51,14 @@ class OpenMeetings
$this->url = $om_host; $this->url = $om_host;
// Setting OM api // Setting OM api
define('CONFIG_OPENMEETINGS_USER_SALT', $this->user); define('CONFIG_OPENMEETINGS_USER', $this->user);
define('CONFIG_OPENMEETINGS_PASS_SALT', $this->pass); define('CONFIG_OPENMEETINGS_PASS', $this->pass);
define('CONFIG_OPENMEETINGS_SERVER_BASE_URL', $this->url); define('CONFIG_OPENMEETINGS_SERVER_URL', $this->url);
$this->api = new OpenMeetingsAPI(); $this->gateway = new OpenMeetingsGateway();
$this->plugin_enabled = $om_plugin; $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() function loginUser()
{ {
try { try {
$objGetSession = new getSession(); //$objGetSession = new Chamilo\Plugin\OpenMeetings\Session();
$objloginUser = new loginUser(); //$urlWsdl = CONFIG_OPENMEETINGS_SERVER_URL . "/services/UserService?wsdl";
$urlWsdl = CONFIG_OPENMEETINGS_SERVER_BASE_URL . "/services/UserService?wsdl"; //$omServices = new SoapClient( $urlWsdl );
$omServices = new SoapClient( $urlWsdl );
//Verifying if there is already an active session //Verifying if there is already an active session
if (empty($_SESSION['sessOpenMeeting'])) { if (empty($_SESSION['sessOpenMeeting'])) {
$gsFun = $omServices->getSession($objGetSession); //$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;
$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; return true;
} else { } else {
error_log(__LINE__);
return false; return false;
} }
} else { } else {
error_log(__LINE__.' '.$_SESSION['sessOpenMeeting']);
$this->sessionId = $_SESSION['sessOpenMeeting']; $this->sessionId = $_SESSION['sessOpenMeeting'];
return true; return true;
} }
@ -114,14 +114,13 @@ class OpenMeetings
{ {
//$id = Database::insert($this->table, $params); //$id = Database::insert($this->table, $params);
try { try {
$objAddRoom = new addRoomWithModerationAndExternalType(); $objAddRoom = new Chamilo\Plugin\OpenMeetings\Room();
$roomTypeId = $isModerated = ( $this->isTeacher() ) ? 1 : 2 ; $roomTypeId = $isModerated = ( $this->isTeacher() ) ? 1 : 2 ;
$params['c_id'] = api_get_course_int_id(); $params['c_id'] = api_get_course_int_id();
$course_name = 'C'.$params['c_id'].'-'.api_get_session_id(); $urlWsdl = CONFIG_OPENMEETINGS_SERVER_URL . "/services/RoomService?wsdl";
$urlWsdl = CONFIG_OPENMEETINGS_SERVER_BASE_URL . "/services/RoomService?wsdl";
$objAddRoom->SID = $this->sessionId; $objAddRoom->SID = $this->sessionId;
$objAddRoom->name = $course_name; $objAddRoom->name = $this->room_name;
$objAddRoom->roomtypes_id = $roomTypeId; $objAddRoom->roomtypes_id = $roomTypeId;
$objAddRoom->comment = get_lang('Course').': ' . $params['meeting_name'] . ' Plugin for Chamilo'; $objAddRoom->comment = get_lang('Course').': ' . $params['meeting_name'] . ' Plugin for Chamilo';
$objAddRoom->numberOfPartizipants = 40; $objAddRoom->numberOfPartizipants = 40;
@ -188,10 +187,10 @@ class OpenMeetings
$params = array( 'room_id' => $meetingId ); $params = array( 'room_id' => $meetingId );
$returnVal = $this->setUserObjectAndGenerateRoomHashByURLAndRecFlag( $params ); $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'] ); //$imgWithoutProtocol = str_replace("http://", $_SESSION['_user']['avatar'] );
$iframe = CONFIG_OPENMEETINGS_SERVER_BASE_URL . "/?" . $iframe = CONFIG_OPENMEETINGS_SERVER_URL . "/?" .
"secureHash=" . $returnVal /*. "secureHash=" . $returnVal /*.
'&username=FRAGOTE' . '&username=FRAGOTE' .
'&firstname=DD' . '&firstname=DD' .
@ -271,9 +270,9 @@ class OpenMeetings
$systemType = 'chamilo'; $systemType = 'chamilo';
$room_id = $params['room_id']; $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 ); $omServices = new SoapClient( $urlWsdl );
$objRec = new setUserObjectAndGenerateRecordingHashByURL(); $objRec = new Chamilo\Plugin\OpenMeetings\User();
$objRec->SID = $this->sessionId; $objRec->SID = $this->sessionId;
$objRec->username = $username; $objRec->username = $username;
@ -305,9 +304,9 @@ class OpenMeetings
$becomeModerator = ( $this->isTeacher() ? 1 : 0 ); $becomeModerator = ( $this->isTeacher() ? 1 : 0 );
$allowRecording = 1; //Provisional $allowRecording = 1; //Provisional
$urlWsdl = CONFIG_OPENMEETINGS_SERVER_BASE_URL . "/services/UserService?wsdl"; $urlWsdl = CONFIG_OPENMEETINGS_SERVER_URL . "/services/UserService?wsdl";
$omServices = new SoapClient( $urlWsdl ); $omServices = new SoapClient( $urlWsdl );
$objRec = new setUserObjectAndGenerateRoomHashByURLAndRecFlag(); $objRec = new Chamilo\Plugin\OpenMeetings\User();
$objRec->SID = $this->sessionId; $objRec->SID = $this->sessionId;
$objRec->username = $username; $objRec->username = $username;
@ -335,25 +334,40 @@ class OpenMeetings
{ {
$new_meeting_list = array(); $new_meeting_list = array();
$item = array(); $item = array();
$pass = $this->getMeetingUserPassword();
$this->loginUser(); $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); $omServices = new SoapClient($urlWsdl);
$objRoom = new getRoomById(); $objRoom = new Chamilo\Plugin\OpenMeetings\Room();
$objCurrentUsers = new getRoomWithCurrentUsersById(); try {
$objRoom->SID = $objCurrentUsers->SID = $this->sessionId; $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) { foreach ($meeting_list as $meeting_db) {
$objRoom->rooms_id = $objCurrentUsers->rooms_id = $meeting_db['id']; $objRoom->rooms_id = $meeting_db['id'];
try { try {
$objRoomId = $omServices->getRoomById($objRoom); $objRoomId = $omServices->getRoomById($objRoom);
if (empty($objRoomId->return)) { if (empty($objRoomId->return)) {
Database::delete($this->table, "id = {$meeting_db['id']}"); Database::delete($this->table, "id = {$meeting_db['id']}");
continue; continue;
} }
$objCurUs = $omServices->getRoomWithCurrentUsersById($objCurrentUsers); //$objCurUs = $omServices->getRoomWithCurrentUsersById($objCurrentUsers);
} catch (SoapFault $e) { } catch (SoapFault $e) {
echo $e->faultstring; echo $e->faultstring;
exit; exit;
@ -452,7 +466,7 @@ class OpenMeetings
// 'webVoiceConf' => '' // -- OPTIONAL - string // 'webVoiceConf' => '' // -- OPTIONAL - string
// ); // );
// $returnVal = $this->setUserObjectAndGenerateRoomHashByURLAndRecFlag( array('room_id' => $meeting_db['id']) ); // $returnVal = $this->setUserObjectAndGenerateRoomHashByURLAndRecFlag( array('room_id' => $meeting_db['id']) );
// $joinUrl = CONFIG_OPENMEETINGS_SERVER_BASE_URL . "?" . // $joinUrl = CONFIG_OPENMEETINGS_SERVER_URL . "?" .
// "secureHash=" . $returnVal; // "secureHash=" . $returnVal;
// //
// $item['go_url'] = $joinUrl; // $item['go_url'] = $joinUrl;
@ -472,9 +486,9 @@ class OpenMeetings
{ {
try { try {
$this->loginUser(); $this->loginUser();
$urlWsdl = CONFIG_OPENMEETINGS_SERVER_BASE_URL . "/services/RoomService?wsdl"; $urlWsdl = CONFIG_OPENMEETINGS_SERVER_URL . "/services/RoomService?wsdl";
$omServices = new SoapClient( $urlWsdl ); $omServices = new SoapClient( $urlWsdl );
$objClose = new closeRoom(); $objClose = new Chamilo\Plugin\OpenMeetings\Room();
$objClose->SID = $this->sessionId; $objClose->SID = $this->sessionId;
$objClose->room_id = $meetingId; $objClose->room_id = $meetingId;
$objClose->status = false; $objClose->status = false;

@ -8,7 +8,8 @@
*/ */
class OpenMeetingsAPI class OpenMeetingsAPI
{ {
private $_securitySalt; private $_user;
private $_pass;
private $_serverBaseUrl; private $_serverBaseUrl;
/** /**
@ -16,60 +17,10 @@ class OpenMeetingsAPI
*/ */
function __construct() function __construct()
{ {
$this->_securitySalt = CONFIG_SECURITY_SALT; $this->_user = CONFIG_OPENMEETINGS_USER;
$this->_serverBaseUrl = CONFIG_OPENMEETINGS_SERVER_BASE_URL; $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;
}
}
} }

@ -31,6 +31,7 @@ class OpenMeetingsGateway
{ {
public $session_id = ""; public $session_id = "";
public $config; public $config;
private $rest;
function __construct() function __construct()
{ {
@ -40,6 +41,14 @@ class OpenMeetingsGateway
if (substr($this->_url, -1, 1) == '/') { if (substr($this->_url, -1, 1) == '/') {
$this->_url = substr($this->_url, 0, -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) function getRestUrl($name)
@ -67,27 +76,26 @@ class OpenMeetingsGateway
*/ */
function loginUser() function loginUser()
{ {
$restService = new OpenMeetingsRestService();
$response = $this->rest->call($this->getRestUrl("UserService") . "getSession", "session_id");
$response = $restService->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)); error_log('Fault (Expect - The request contains an invalid SOAP body) '.print_r($response,1));
} else { } else {
$err = $restService->getError(); $err = $this->rest->getError();
if ($err) { if ($err) {
error_log('Error: ' . $err); error_log('Error: ' . $err);
} else { } else {
$this->session_id = $response; $this->session_id = $response;
$result = $restService->call($this->getRestUrl("UserService") . "loginUser?SID=" . $this->session_id $result = $this->rest->call($this->getRestUrl("UserService") . "loginUser?SID=" . $this->session_id
. "&username=" . urlencode($this->config["adminUser"]) . "&username=" . urlencode(CONFIG_OPENMEETINGS_USER)
. "&userpass=" . urlencode($this->config["adminPass"])); . "&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)); error_log('Fault (Expect - The request contains an invalid SOAP body) '.print_r($result,1));
} else { } else {
$err = $restService->getError(); $err = $this->rest->getError();
if ($err) { if ($err) {
error_log('Error '. $err); error_log('Error '. $err);
} else { } else {
@ -105,12 +113,10 @@ class OpenMeetingsGateway
} }
function updateRoomWithModeration($openmeetings) function updateRoomWithModeration($openmeetings)
{ {
$restService = new OpenMeetingsRestService(); $err = $this->rest->getError();
// echo $restService."<br/>";
$err = $restService->getError();
if ($err) { if ($err) {
error_log('Constructor error: ' . $err); error_log('Constructor error: ' . $err);
error_log('Debug: ' . $restService->getDebug()); error_log('Debug: ' . $this->rest->getDebug());
exit(); exit();
} }
@ -119,16 +125,16 @@ class OpenMeetingsGateway
$isModeratedRoom = true; $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=" . "&room_id=" . $openmeetings->room_id . "&name=" . urlencode($openmeetings->roomname) . "&roomtypes_id="
. urlencode($openmeetings->type) . "&comment=" . urlencode("Created by SOAP-Gateway") . urlencode($openmeetings->type) . "&comment=" . urlencode("Created by SOAP-Gateway")
. "&numberOfPartizipants=" . $openmeetings->max_user . "&ispublic=false" . "&appointment=false" . "&isDemoRoom=false" . "&numberOfPartizipants=" . $openmeetings->max_user . "&ispublic=false" . "&appointment=false" . "&isDemoRoom=false"
. "&demoTime=0" . "&isModeratedRoom=" . $this->var_to_str($isModeratedRoom)); . "&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)); error_log('Fault (Expect - The request contains an invalid SOAP body) '.print_r($result,1));
} else { } else {
$err = $restService->getError(); $err = $this->rest->getError();
if ($err) { if ($err) {
error_log('Error: ' . $err); error_log('Error: ' . $err);
} else { } else {
@ -144,15 +150,14 @@ class OpenMeetingsGateway
*/ */
function setUserObjectAndGenerateRecordingHashByURL($username, $firstname, $lastname, $userId, $systemType, $recording_id) function setUserObjectAndGenerateRecordingHashByURL($username, $firstname, $lastname, $userId, $systemType, $recording_id)
{ {
$restService = new OpenMeetingsRestService(); $result = $this->rest->call($this->getRestUrl("UserService") . 'setUserObjectAndGenerateRecordingHashByURL?SID=' . $this->session_id
$result = $restService->call($this->getRestUrl("UserService") . 'setUserObjectAndGenerateRecordingHashByURL?SID=' . $this->session_id
. '&username=' . urlencode($username) . '&firstname=' . urlencode($firstname) . '&lastname=' . urlencode($lastname) . '&username=' . urlencode($username) . '&firstname=' . urlencode($firstname) . '&lastname=' . urlencode($lastname)
. '&externalUserId=' . $userId . '&externalUserType=' . urlencode($systemType) . '&recording_id=' . $recording_id, 'return'); . '&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)); error_log('Fault (Expect - The request contains an invalid SOAP body) '.print_r($result,1));
} else { } else {
$err = $restService->getError(); $err = $this->rest->getError();
if ($err) { if ($err) {
error_log('Error: '.$err); error_log('Error: '.$err);
} else { } else {
@ -163,25 +168,23 @@ class OpenMeetingsGateway
} }
function setUserObjectAndGenerateRoomHashByURLAndRecFlag($username, $firstname, $lastname, $profilePictureUrl, $email, $userId, $systemType, $room_id, $becomeModerator, $allowRecording) function setUserObjectAndGenerateRoomHashByURLAndRecFlag($username, $firstname, $lastname, $profilePictureUrl, $email, $userId, $systemType, $room_id, $becomeModerator, $allowRecording)
{ {
$restService = new OpenMeetingsRestService(); $err = $this->rest->getError();
// echo $restService."<br/>";
$err = $restService->getError();
if ($err) { if ($err) {
error_log('Constructor error: ' . $err); error_log('Constructor error: ' . $err);
error_log('Debug: ' . $restService->getDebug());; error_log('Debug: ' . $this->rest->getDebug());;
exit(); 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) . "&username=" . urlencode($username) . "&firstname=" . urlencode($firstname) . "&lastname=" . urlencode($lastname)
. "&profilePictureUrl=" . urlencode($profilePictureUrl) . "&email=" . urlencode($email) . "&externalUserId=" . urlencode($userId) . "&profilePictureUrl=" . urlencode($profilePictureUrl) . "&email=" . urlencode($email) . "&externalUserId=" . urlencode($userId)
. "&externalUserType=" . urlencode($systemType) . "&room_id=" . urlencode($room_id) . "&becomeModeratorAsInt=" . $becomeModerator . "&externalUserType=" . urlencode($systemType) . "&room_id=" . urlencode($room_id) . "&becomeModeratorAsInt=" . $becomeModerator
. "&showAudioVideoTestAsInt=1" . "&allowRecording=" . $this->var_to_str($allowRecording)); . "&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)); error_log('Fault (Expect - The request contains an invalid SOAP body) '.print_r($result,1));
} else { } else {
$err = $restService->getError(); $err = $this->rest->getError();
if ($err) { if ($err) {
error_log('Error: '.$err); error_log('Error: '.$err);
} else { } else {
@ -193,22 +196,20 @@ class OpenMeetingsGateway
} }
function deleteRoom($openmeetings) function deleteRoom($openmeetings)
{ {
// echo $client_roomService."<br/>"; $err = $this->rest->getError();
$restService = new OpenMeetingsRestService();
$err = $restService->getError();
if ($err) { if ($err) {
error_log('Constructor error: ' . $err); error_log('Constructor error: ' . $err);
error_log('Debug: ' . $restService->getDebug());; error_log('Debug: ' . $this->rest->getDebug());;
exit(); 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); . "&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)); error_log('Fault (Expect - The request contains an invalid SOAP body) '.print_r($result,1));
} else { } else {
$err = $restService->getError(); $err = $this->rest->getError();
if ($err) { if ($err) {
error_log('Error: '.$err); error_log('Error: '.$err);
} else { } else {
@ -225,25 +226,16 @@ class OpenMeetingsGateway
*/ */
function setUserObjectAndGenerateRoomHash($username, $firstname, $lastname, $profilePictureUrl, $email, $externalUserId, $externalUserType, $room_id, $becomeModeratorAsInt, $showAudioVideoTestAsInt) function setUserObjectAndGenerateRoomHash($username, $firstname, $lastname, $profilePictureUrl, $email, $externalUserId, $externalUserType, $room_id, $becomeModeratorAsInt, $showAudioVideoTestAsInt)
{ {
$restService = new OpenMeetingsRestService(); $result = $this->rest->call($this->getRestUrl("UserService") . "setUserObjectAndGenerateRoomHash?SID=" . $this->session_id
$result = $restService->call($this->getRestUrl("UserService") . "setUserObjectAndGenerateRoomHash?SID=" . $this->session_id
. "&username=" . urlencode($username) . "&firstname=" . urlencode($firstname) . "&lastname=" . urlencode($lastname) . "&username=" . urlencode($username) . "&firstname=" . urlencode($firstname) . "&lastname=" . urlencode($lastname)
. "&profilePictureUrl=" . urlencode($profilePictureUrl) . "&email=" . urlencode($email) . "&externalUserId=" . "&profilePictureUrl=" . urlencode($profilePictureUrl) . "&email=" . urlencode($email) . "&externalUserId="
. urlencode($externalUserId) . "&externalUserType=" . urlencode($externalUserType) . "&room_id=" . $room_id . urlencode($externalUserId) . "&externalUserType=" . urlencode($externalUserType) . "&room_id=" . $room_id
. "&becomeModeratorAsInt=" . $becomeModeratorAsInt . "&showAudioVideoTestAsInt=" . $showAudioVideoTestAsInt); . "&becomeModeratorAsInt=" . $becomeModeratorAsInt . "&showAudioVideoTestAsInt=" . $showAudioVideoTestAsInt);
$err = $restService->getError(); if ($result->getError()) {
if ($err) {
error_log('Constructor error: ' . $err);
error_log('Debug: ' . $restService->getDebug());;
exit();
}
if ($restService->getError()) {
error_log('Fault (Expect - The request contains an invalid SOAP body) '.print_r($result,1)); error_log('Fault (Expect - The request contains an invalid SOAP body) '.print_r($result,1));
} else { } else {
$err = $restService->getError(); $err = $this->rest->getError();
if ($err) { if ($err) {
error_log('Error: '.$err); error_log('Error: '.$err);
} else { } else {
@ -259,10 +251,6 @@ class OpenMeetingsGateway
*/ */
function createRoomWithModAndType($openmeetings) function createRoomWithModAndType($openmeetings)
{ {
global $USER;
$restService = new OpenMeetingsRestService();
$isModeratedRoom = "false"; $isModeratedRoom = "false";
if ($openmeetings->is_moderated_room == 1) { if ($openmeetings->is_moderated_room == 1) {
$isModeratedRoom = "true"; $isModeratedRoom = "true";
@ -274,12 +262,12 @@ class OpenMeetingsGateway
. '&ispublic=false' . '&appointment=false' . '&isDemoRoom=false' . '&demoTime=0' . '&isModeratedRoom=' . $isModeratedRoom . '&ispublic=false' . '&appointment=false' . '&isDemoRoom=false' . '&demoTime=0' . '&isModeratedRoom=' . $isModeratedRoom
. '&externalRoomType=' . urlencode($this->config["moduleKey"]); . '&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)); error_log('Fault (Expect - The request contains an invalid SOAP body) '.print_r($result,1));
} else { } else {
$err = $restService->getError(); $err = $this->rest->getError();
if ($err) { if ($err) {
error_log('Error: '.$err); error_log('Error: '.$err);
} else { } else {
@ -288,18 +276,38 @@ class OpenMeetingsGateway
} }
return - 1; 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 * Get list of available recordings made by this instance
*/ */
function getRecordingsByExternalRooms() 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"]); . "&externalRoomType=" . urlencode($this->config["moduleKey"]);
$result = $restService->call($url, "return"); $result = $this->rest->call($url, "return");
return $result; return $result;
} }
@ -309,12 +317,10 @@ class OpenMeetingsGateway
*/ */
function getRecordingsByExternalUser($id) 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; . "&externalUserId=" . $id;
$result = $restService->call($url, "return"); $result = $this->rest->call($url, "return");
return $result; return $result;
} }

@ -72,21 +72,25 @@ class OpenMeetingsRestService
// Success // Success
break; break;
case 503 : 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.' ); That means: Service unavailable. An internal problem prevented us from returning data to you.' );
return false;
break; break;
case 403 : 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.' ); That means: Forbidden. You do not have permission to access this resource, or are over your rate limit.' );
return false;
break; break;
case 400 : case 400 :
// You may want to fall through here and read the specific XML error // 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. That means: Bad request. The parameters passed to the service did not match as expected.
The exact error is returned in the XML response.' ); The exact error is returned in the XML response.' );
return false;
break; break;
default : 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 // Get the XML from the response, bypassing the header

@ -1,7 +1,17 @@
<?php <?php
class addRoomWithModerationAndExternalType{ /**
// params as defined in WSDL * Definition for the room class
* @package chamilo.plugin.videoconference
*/
namespace Chamilo\Plugin\OpenMeetings;
/**
* Class room
*/
class Room
{
public $SID; public $SID;
public $rooms_id;
public $status;
public $name; public $name;
public $roomtypes_id; public $roomtypes_id;
public $comment; public $comment;
@ -12,4 +22,8 @@ class addRoomWithModerationAndExternalType{
public $demoTime; public $demoTime;
public $isModeratedRoom; public $isModeratedRoom;
public $externalRoomType; public $externalRoomType;
public function __construct()
{
}
} }

@ -1,6 +0,0 @@
<?php
class closeRoom{
public $SID;
public $room_id;
public $status;
}

@ -1,5 +0,0 @@
<?php
class getRoomById{
public $SID;
public $rooms_id;
}

@ -1,5 +0,0 @@
<?php
class getRoomWithCurrentUsersById{
public $SID;
public $rooms_id;
}

@ -1,6 +0,0 @@
<?php
class loginUser{
public $SID;
public $username;
public $userpass;
}

@ -1,10 +0,0 @@
<?php
class setUserObjectAndGenerateRecordingHashByURL {
public $SID;
public $username;
public $firstname;
public $lastname;
public $externalUserId;
public $externalUserType;
public $recording_id;
}

@ -0,0 +1,16 @@
<?php
/**
* Definition of OpenMeetings session class
* @package chamilo.plugin.openmeetings
*/
namespace Chamilo\Plugin\OpenMeetings;
/**
* Class session
*/
class Session
{
public function __construct()
{
}
}

@ -1,7 +1,17 @@
<?php <?php
class setUserObjectAndGenerateRoomHashByURLAndRecFlag{ /**
* Definition of the OpenMeetings user class
* @package chamilo.plugin.openmeetings
*/
namespace Chamilo\Plugin\OpenMeetings;
/**
* Class User
*/
class User
{
public $SID; public $SID;
public $username; public $username;
public $userpass;
public $firstname; public $firstname;
public $lastname; public $lastname;
public $profilePictureUrl; public $profilePictureUrl;
@ -12,4 +22,9 @@ class setUserObjectAndGenerateRoomHashByURLAndRecFlag{
public $becomeModeratorAsInt; public $becomeModeratorAsInt;
public $showAudioVideoTestAsInt; public $showAudioVideoTestAsInt;
public $allowRecording; public $allowRecording;
public $recording_id;
public function __construct()
{
}
} }

@ -74,6 +74,7 @@ $meetings = $om->getCourseMeetings();
if (!empty($meetings)) { if (!empty($meetings)) {
$meetings = array_reverse($meetings); $meetings = array_reverse($meetings);
} }
error_log(__FILE__.':'.__LINE__.': '.print_r($meetings,1));
$users_online = $meetings->participantCount; $users_online = $meetings->participantCount;
//$status = !$meetings->isClosed; //$status = !$meetings->isClosed;

Loading…
Cancel
Save