|
|
|
@ -26,10 +26,12 @@ class bbb |
|
|
|
public $logoutUrl = ''; |
|
|
|
public $logoutUrl = ''; |
|
|
|
public $pluginEnabled = false; |
|
|
|
public $pluginEnabled = false; |
|
|
|
public $enableGlobalConference = false; |
|
|
|
public $enableGlobalConference = false; |
|
|
|
|
|
|
|
public $enableGlobalConferencePerUser = false; |
|
|
|
public $isGlobalConference = false; |
|
|
|
public $isGlobalConference = false; |
|
|
|
public $groupSupport = false; |
|
|
|
public $groupSupport = false; |
|
|
|
public $table; |
|
|
|
public $userSupport = false; |
|
|
|
public $accessUrl = 1; |
|
|
|
public $accessUrl = 1; |
|
|
|
|
|
|
|
public $userId = 0; |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* Constructor (generates a connection to the API and the Chamilo settings |
|
|
|
* Constructor (generates a connection to the API and the Chamilo settings |
|
|
|
@ -37,8 +39,9 @@ class bbb |
|
|
|
* @param string $host |
|
|
|
* @param string $host |
|
|
|
* @param string $salt |
|
|
|
* @param string $salt |
|
|
|
* @param bool $isGlobalConference |
|
|
|
* @param bool $isGlobalConference |
|
|
|
|
|
|
|
* @param int $isGlobalPerUser |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
public function __construct($host = '', $salt = '', $isGlobalConference = false) |
|
|
|
public function __construct($host = '', $salt = '', $isGlobalConference = false, $isGlobalPerUser = 0) |
|
|
|
{ |
|
|
|
{ |
|
|
|
// Initialize video server settings from global settings |
|
|
|
// Initialize video server settings from global settings |
|
|
|
$plugin = BBBPlugin::create(); |
|
|
|
$plugin = BBBPlugin::create(); |
|
|
|
@ -50,20 +53,24 @@ class bbb |
|
|
|
|
|
|
|
|
|
|
|
$this->logoutUrl = $this->getListingUrl(); |
|
|
|
$this->logoutUrl = $this->getListingUrl(); |
|
|
|
$this->table = Database::get_main_table('plugin_bbb_meeting'); |
|
|
|
$this->table = Database::get_main_table('plugin_bbb_meeting'); |
|
|
|
|
|
|
|
$this->enableGlobalConference = (bool) $plugin->get('enable_global_conference'); |
|
|
|
$this->enableGlobalConference = $plugin->get('enable_global_conference'); |
|
|
|
|
|
|
|
$this->isGlobalConference = (bool) $isGlobalConference; |
|
|
|
$this->isGlobalConference = (bool) $isGlobalConference; |
|
|
|
|
|
|
|
|
|
|
|
$columns = Database::listTableColumns($this->table); |
|
|
|
$columns = Database::listTableColumns($this->table); |
|
|
|
|
|
|
|
|
|
|
|
$this->groupSupport = isset($columns['group_id']) ? true : false; |
|
|
|
$this->groupSupport = isset($columns['group_id']) ? true : false; |
|
|
|
|
|
|
|
$this->userSupport = isset($columns['user_id']) ? true : false; |
|
|
|
$this->accessUrl = api_get_current_access_url_id(); |
|
|
|
$this->accessUrl = api_get_current_access_url_id(); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if ($this->userSupport && !empty($isGlobalPerUser)) { |
|
|
|
|
|
|
|
$this->enableGlobalConferencePerUser = (bool) $plugin->get('enable_global_conference_per_user'); |
|
|
|
|
|
|
|
$this->userId = $isGlobalPerUser; |
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
$this->enableGlobalConferencePerUser = false; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
if ($this->groupSupport) { |
|
|
|
if ($this->groupSupport) { |
|
|
|
// Plugin check |
|
|
|
// Plugin check |
|
|
|
$this->groupSupport = (bool) $plugin->get('enable_conference_in_course_groups'); |
|
|
|
$this->groupSupport = (bool) $plugin->get('enable_conference_in_course_groups'); |
|
|
|
|
|
|
|
|
|
|
|
if ($this->groupSupport) { |
|
|
|
if ($this->groupSupport) { |
|
|
|
|
|
|
|
|
|
|
|
// Platform check |
|
|
|
// Platform check |
|
|
|
@ -105,7 +112,15 @@ class bbb |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
public function isGlobalConferenceEnabled() |
|
|
|
public function isGlobalConferenceEnabled() |
|
|
|
{ |
|
|
|
{ |
|
|
|
return (bool) $this->enableGlobalConference; |
|
|
|
return $this->enableGlobalConference; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
|
|
|
* @return bool |
|
|
|
|
|
|
|
*/ |
|
|
|
|
|
|
|
public function isGlobalConferencePerUserEnabled() |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
return $this->enableGlobalConferencePerUser; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
@ -181,8 +196,14 @@ class bbb |
|
|
|
$params['group_id'] = api_get_group_id(); |
|
|
|
$params['group_id'] = api_get_group_id(); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
$courseCode = is_null($courseCode) ? '' : $courseCode; |
|
|
|
if ($this->isGlobalConferencePerUserEnabled()) { |
|
|
|
$params['attendee_pw'] = isset($params['moderator_pw']) ? $params['moderator_pw'] : $courseCode; |
|
|
|
$currentUserId = api_get_user_id(); |
|
|
|
|
|
|
|
if ($this->userId === $currentUserId) { |
|
|
|
|
|
|
|
$params['user_id'] = $this->userId; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$params['attendee_pw'] = isset($params['moderator_pw']) ? $params['moderator_pw'] : $this->getUserMeetingPassword(); |
|
|
|
$attendeePassword = $params['attendee_pw']; |
|
|
|
$attendeePassword = $params['attendee_pw']; |
|
|
|
$params['moderator_pw'] = isset($params['moderator_pw']) ? $params['moderator_pw'] : $this->getModMeetingPassword(); |
|
|
|
$params['moderator_pw'] = isset($params['moderator_pw']) ? $params['moderator_pw'] : $this->getModMeetingPassword(); |
|
|
|
$moderatorPassword = $params['moderator_pw']; |
|
|
|
$moderatorPassword = $params['moderator_pw']; |
|
|
|
@ -485,6 +506,9 @@ class bbb |
|
|
|
public function getMeetings() |
|
|
|
public function getMeetings() |
|
|
|
{ |
|
|
|
{ |
|
|
|
$pass = $this->getUserMeetingPassword(); |
|
|
|
$pass = $this->getUserMeetingPassword(); |
|
|
|
|
|
|
|
$isGlobal = $this->isGlobalConference(); |
|
|
|
|
|
|
|
$isGlobalPerUser = $this->isGlobalConferencePerUserEnabled(); |
|
|
|
|
|
|
|
|
|
|
|
$courseId = api_get_course_int_id(); |
|
|
|
$courseId = api_get_course_int_id(); |
|
|
|
$sessionId = api_get_session_id(); |
|
|
|
$sessionId = api_get_session_id(); |
|
|
|
|
|
|
|
|
|
|
|
@ -508,6 +532,15 @@ class bbb |
|
|
|
); |
|
|
|
); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if ($isGlobalPerUser) { |
|
|
|
|
|
|
|
$conditions = array( |
|
|
|
|
|
|
|
'where' => array( |
|
|
|
|
|
|
|
'user_id = ? AND access_url = ?' => |
|
|
|
|
|
|
|
array($this->userId, $this->accessUrl) |
|
|
|
|
|
|
|
) |
|
|
|
|
|
|
|
); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
$meetingList = Database::select( |
|
|
|
$meetingList = Database::select( |
|
|
|
'*', |
|
|
|
'*', |
|
|
|
$this->table, |
|
|
|
$this->table, |
|
|
|
@ -804,6 +837,11 @@ class bbb |
|
|
|
return $this->getModMeetingPassword(); |
|
|
|
return $this->getModMeetingPassword(); |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if ($this->isGlobalConferencePerUserEnabled()) { |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return 'url_'.$this->userId.'_'.api_get_current_access_url_id(); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
if ($this->isGlobalConference()) { |
|
|
|
if ($this->isGlobalConference()) { |
|
|
|
|
|
|
|
|
|
|
|
return 'url_'.api_get_current_access_url_id(); |
|
|
|
return 'url_'.api_get_current_access_url_id(); |
|
|
|
@ -819,6 +857,11 @@ class bbb |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
public function getModMeetingPassword() |
|
|
|
public function getModMeetingPassword() |
|
|
|
{ |
|
|
|
{ |
|
|
|
|
|
|
|
if ($this->isGlobalConferencePerUserEnabled()) { |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return 'url_'.$this->userId.'_'.api_get_current_access_url_id().'_mod'; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
if ($this->isGlobalConference()) { |
|
|
|
if ($this->isGlobalConference()) { |
|
|
|
|
|
|
|
|
|
|
|
return 'url_'.api_get_current_access_url_id().'_mod'; |
|
|
|
return 'url_'.api_get_current_access_url_id().'_mod'; |
|
|
|
@ -860,6 +903,18 @@ class bbb |
|
|
|
), |
|
|
|
), |
|
|
|
); |
|
|
|
); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if ($this->isGlobalConferencePerUserEnabled()) { |
|
|
|
|
|
|
|
$conditions = array( |
|
|
|
|
|
|
|
'where' => array( |
|
|
|
|
|
|
|
'user_id = ? AND status = 1 AND access_url = ?' => array( |
|
|
|
|
|
|
|
$this->userId, |
|
|
|
|
|
|
|
$this->accessUrl |
|
|
|
|
|
|
|
), |
|
|
|
|
|
|
|
), |
|
|
|
|
|
|
|
); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
$meetingData = Database::select( |
|
|
|
$meetingData = Database::select( |
|
|
|
'*', |
|
|
|
'*', |
|
|
|
$this->table, |
|
|
|
$this->table, |
|
|
|
@ -893,7 +948,7 @@ class bbb |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* Deletes a previous recording of a meeting |
|
|
|
* Deletes a previous recording of a meeting |
|
|
|
* @param int integral ID of the recording |
|
|
|
* @param int $id ID of the recording |
|
|
|
* @return array ? |
|
|
|
* @return array ? |
|
|
|
* @assert () === false |
|
|
|
* @assert () === false |
|
|
|
* @todo Also delete links and agenda items created from this recording |
|
|
|
* @todo Also delete links and agenda items created from this recording |
|
|
|
@ -901,6 +956,7 @@ class bbb |
|
|
|
public function deleteRecord($id) |
|
|
|
public function deleteRecord($id) |
|
|
|
{ |
|
|
|
{ |
|
|
|
if (empty($id)) { |
|
|
|
if (empty($id)) { |
|
|
|
|
|
|
|
|
|
|
|
return false; |
|
|
|
return false; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@ -925,7 +981,7 @@ class bbb |
|
|
|
|
|
|
|
|
|
|
|
$result = $this->api->deleteRecordingsWithXmlResponseArray($recordingParams); |
|
|
|
$result = $this->api->deleteRecordingsWithXmlResponseArray($recordingParams); |
|
|
|
|
|
|
|
|
|
|
|
if (!empty($result) && isset($result['deleted']) && $result['deleted'] == 'true') { |
|
|
|
if (!empty($result) && isset($result['deleted']) && $result['deleted'] === 'true') { |
|
|
|
Database::delete( |
|
|
|
Database::delete( |
|
|
|
$this->table, |
|
|
|
$this->table, |
|
|
|
array('id = ?' => array($id)) |
|
|
|
array('id = ?' => array($id)) |
|
|
|
@ -937,7 +993,7 @@ class bbb |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* Creates a link in the links tool from the given videoconference recording |
|
|
|
* Creates a link in the links tool from the given videoconference recording |
|
|
|
* @param int ID of the item in the plugin_bbb_meeting table |
|
|
|
* @param int $id ID of the item in the plugin_bbb_meeting table |
|
|
|
* @param string Hash identifying the recording, as provided by the API |
|
|
|
* @param string Hash identifying the recording, as provided by the API |
|
|
|
* @return mixed ID of the newly created link, or false on error |
|
|
|
* @return mixed ID of the newly created link, or false on error |
|
|
|
* @assert (null, null) === false |
|
|
|
* @assert (null, null) === false |
|
|
|
@ -970,6 +1026,7 @@ class bbb |
|
|
|
$params['url'] = $url; |
|
|
|
$params['url'] = $url; |
|
|
|
$params['title'] = $meetingData['meeting_name']; |
|
|
|
$params['title'] = $meetingData['meeting_name']; |
|
|
|
$id = $link->save($params); |
|
|
|
$id = $link->save($params); |
|
|
|
|
|
|
|
|
|
|
|
return $id; |
|
|
|
return $id; |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
@ -1030,7 +1087,14 @@ class bbb |
|
|
|
|
|
|
|
|
|
|
|
if (empty($courseInfo)) { |
|
|
|
if (empty($courseInfo)) { |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if ($this->isGlobalConferencePerUserEnabled()) { |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return 'global=1&user_id='.$this->userId; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if ($this->isGlobalConference()) { |
|
|
|
if ($this->isGlobalConference()) { |
|
|
|
|
|
|
|
|
|
|
|
return 'global=1'; |
|
|
|
return 'global=1'; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@ -1045,7 +1109,13 @@ class bbb |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
public function getCurrentVideoConferenceName() |
|
|
|
public function getCurrentVideoConferenceName() |
|
|
|
{ |
|
|
|
{ |
|
|
|
|
|
|
|
if ($this->isGlobalConferencePerUserEnabled()) { |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return 'url_'.$this->userId.'_'.api_get_current_access_url_id(); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
if ($this->isGlobalConference()) { |
|
|
|
if ($this->isGlobalConference()) { |
|
|
|
|
|
|
|
|
|
|
|
return 'url_'.api_get_current_access_url_id(); |
|
|
|
return 'url_'.api_get_current_access_url_id(); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|