|
|
|
|
@ -121,9 +121,9 @@ class ZoomPlugin extends Plugin |
|
|
|
|
/** |
|
|
|
|
* @param $meetingId |
|
|
|
|
* |
|
|
|
|
* @return MeetingInstance[] |
|
|
|
|
* |
|
|
|
|
* @throws Exception |
|
|
|
|
* |
|
|
|
|
* @return MeetingInstance[] |
|
|
|
|
*/ |
|
|
|
|
public function getEndedMeetingInstances($meetingId) |
|
|
|
|
{ |
|
|
|
|
@ -304,65 +304,6 @@ class ZoomPlugin extends Plugin |
|
|
|
|
return $this->jwtClient()->getParticipants($instanceUUID); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* Caches and returns the JWT client instance, initialized with plugin settings. |
|
|
|
|
* |
|
|
|
|
* @return JWTClient object that provides means of communications with the Zoom servers |
|
|
|
|
*/ |
|
|
|
|
protected function jwtClient() |
|
|
|
|
{ |
|
|
|
|
static $jwtClient = null; |
|
|
|
|
if (is_null($jwtClient)) { |
|
|
|
|
$jwtClient = new JWTClient($this->get('apiKey'), $this->get('apiSecret')); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
return $jwtClient; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* Retrieves all meetings of a specific type and linked to current course and session. |
|
|
|
|
* |
|
|
|
|
* @param string $type MEETING_TYPE_LIVE, MEETING_TYPE_SCHEDULED or MEETING_TYPE_UPCOMING |
|
|
|
|
* |
|
|
|
|
* @throws Exception on API error |
|
|
|
|
* |
|
|
|
|
* @return CourseMeetingListItem[] matching meetings |
|
|
|
|
*/ |
|
|
|
|
private function getMeetings($type) |
|
|
|
|
{ |
|
|
|
|
$matchingMeetings = []; |
|
|
|
|
$courseId = api_get_course_int_id(); |
|
|
|
|
$sessionId = api_get_session_id(); |
|
|
|
|
foreach ($this->jwtClient()->getMeetings($type) as $meeting) { |
|
|
|
|
$candidateMeeting = CourseMeetingListItem::fromMeetingListItem($meeting); |
|
|
|
|
if ($candidateMeeting->matches($courseId, $sessionId)) { |
|
|
|
|
$matchingMeetings[] = $candidateMeeting; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
return $matchingMeetings; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* Creates a meeting and returns it. |
|
|
|
|
* |
|
|
|
|
* @param CourseMeeting $meeting a meeting with at least a type and a topic |
|
|
|
|
* |
|
|
|
|
* @throws Exception describing the error (message and code) |
|
|
|
|
* |
|
|
|
|
* @return CourseMeetingInfoGet meeting |
|
|
|
|
*/ |
|
|
|
|
private function createMeeting($meeting) |
|
|
|
|
{ |
|
|
|
|
$meeting->settings->auto_recording = $this->get('enableCloudRecording') |
|
|
|
|
? 'cloud' |
|
|
|
|
: 'local'; |
|
|
|
|
$meeting->settings->registrants_email_notification = false; |
|
|
|
|
$meeting->tagAgenda(); |
|
|
|
|
|
|
|
|
|
return CourseMeetingInfoGet::fromMeetingInfoGet($this->jwtClient()->createMeeting($meeting)); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* @param $meetingId |
|
|
|
|
* |
|
|
|
|
@ -376,11 +317,12 @@ class ZoomPlugin extends Plugin |
|
|
|
|
foreach ($this->jwtClient()->getRegistrants($meetingId) as $registrant) { |
|
|
|
|
$registrants[] = UserMeetingRegistrantListItem::fromMeetingRegistrantListItem($registrant); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
return $registrants; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* @param int $meetingId |
|
|
|
|
* @param int $meetingId |
|
|
|
|
* @param \Chamilo\UserBundle\Entity\User[] $users |
|
|
|
|
* |
|
|
|
|
* @throws Exception |
|
|
|
|
@ -414,7 +356,7 @@ class ZoomPlugin extends Plugin |
|
|
|
|
* Updates meeting registrants list. Adds the missing registrants and removes the extra. |
|
|
|
|
* |
|
|
|
|
* @param int $meetingId meeting identifier |
|
|
|
|
* @param \Chamilo\UserBundle\Entity\User[] $users list of users to be registred |
|
|
|
|
* @param \Chamilo\UserBundle\Entity\User[] $users list of users to be registred |
|
|
|
|
* |
|
|
|
|
* @throws Exception |
|
|
|
|
*/ |
|
|
|
|
@ -462,4 +404,63 @@ class ZoomPlugin extends Plugin |
|
|
|
|
{ |
|
|
|
|
$this->jwtClient()->deleteRecordings($instanceUUID); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* Caches and returns the JWT client instance, initialized with plugin settings. |
|
|
|
|
* |
|
|
|
|
* @return JWTClient object that provides means of communications with the Zoom servers |
|
|
|
|
*/ |
|
|
|
|
protected function jwtClient() |
|
|
|
|
{ |
|
|
|
|
static $jwtClient = null; |
|
|
|
|
if (is_null($jwtClient)) { |
|
|
|
|
$jwtClient = new JWTClient($this->get('apiKey'), $this->get('apiSecret')); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
return $jwtClient; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* Retrieves all meetings of a specific type and linked to current course and session. |
|
|
|
|
* |
|
|
|
|
* @param string $type MEETING_TYPE_LIVE, MEETING_TYPE_SCHEDULED or MEETING_TYPE_UPCOMING |
|
|
|
|
* |
|
|
|
|
* @throws Exception on API error |
|
|
|
|
* |
|
|
|
|
* @return CourseMeetingListItem[] matching meetings |
|
|
|
|
*/ |
|
|
|
|
private function getMeetings($type) |
|
|
|
|
{ |
|
|
|
|
$matchingMeetings = []; |
|
|
|
|
$courseId = api_get_course_int_id(); |
|
|
|
|
$sessionId = api_get_session_id(); |
|
|
|
|
foreach ($this->jwtClient()->getMeetings($type) as $meeting) { |
|
|
|
|
$candidateMeeting = CourseMeetingListItem::fromMeetingListItem($meeting); |
|
|
|
|
if ($candidateMeeting->matches($courseId, $sessionId)) { |
|
|
|
|
$matchingMeetings[] = $candidateMeeting; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
return $matchingMeetings; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* Creates a meeting and returns it. |
|
|
|
|
* |
|
|
|
|
* @param CourseMeeting $meeting a meeting with at least a type and a topic |
|
|
|
|
* |
|
|
|
|
* @throws Exception describing the error (message and code) |
|
|
|
|
* |
|
|
|
|
* @return CourseMeetingInfoGet meeting |
|
|
|
|
*/ |
|
|
|
|
private function createMeeting($meeting) |
|
|
|
|
{ |
|
|
|
|
$meeting->settings->auto_recording = $this->get('enableCloudRecording') |
|
|
|
|
? 'cloud' |
|
|
|
|
: 'local'; |
|
|
|
|
$meeting->settings->registrants_email_notification = false; |
|
|
|
|
$meeting->tagAgenda(); |
|
|
|
|
|
|
|
|
|
return CourseMeetingInfoGet::fromMeetingInfoGet($this->jwtClient()->createMeeting($meeting)); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|