Minor - Plugin: zoom refactor format code BT#17288

pull/3425/head
Julio Montoya 5 years ago
parent 14e9fc6a89
commit e0306ef963
  1. 2
      plugin/zoom/Entity/RegistrantEntity.php
  2. 19
      plugin/zoom/lib/ZoomPlugin.php
  3. 4
      plugin/zoom/meeting.php
  4. 5
      plugin/zoom/start.php

@ -166,7 +166,7 @@ class RegistrantEntity
);
}
public function joinUrl()
public function getJoinUrl()
{
if (!$this->createdRegistration) {
return '';

@ -783,16 +783,21 @@ class ZoomPlugin extends Plugin
}
/**
* @param Course $course
*
* @return bool whether the logged-in user can manage conferences in this context, that is either
* the current course or session coach, the platform admin or the current course admin
*/
public function userIsCourseConferenceManager($course)
public function userIsCourseConferenceManager()
{
return api_is_coach()
|| api_is_platform_admin()
|| api_get_course_id() && api_is_course_admin();
if (api_is_coach() || api_is_platform_admin()) {
return true;
}
if (api_get_course_id() && api_is_course_admin()) {
return true;
}
return false;
}
/**
@ -959,6 +964,10 @@ class ZoomPlugin extends Plugin
return $this->registerUser($meeting, $currentUser)->getCreatedRegistration()->join_url;
}
if ($meeting->isCourseMeeting() && $this->userIsCourseConferenceManager()) {
return $meeting->getMeetingInfoGet()->start_url;
}
if ('true' === $this->get('enableParticipantRegistration')) {
//if ('true' === $this->get('enableParticipantRegistration') && $meeting->requiresRegistration()) {
// the participant must be registered

@ -64,8 +64,8 @@ if ($plugin->userIsConferenceManager($meeting)) {
$userId = api_get_user_id();
try {
foreach ($meeting->getRegistrants() as $registrant) {
if ($registrant->userId == $userId) {
$tpl->assign('currentUserJoinURL', $registrant->join_url);
if ($registrant->getUser()->getId() == $userId) {
$tpl->assign('currentUserJoinURL', $registrant->getJoinUrl());
break;
}
}

@ -22,12 +22,13 @@ $course = api_get_course_entity();
$session = api_get_session_entity();
$action = isset($_REQUEST['action']) ? $_REQUEST['action'] : '';
if ($plugin->userIsCourseConferenceManager($course)) {
if ($plugin->userIsCourseConferenceManager()) {
switch ($action) {
case 'delete':
$meeting = $plugin->getMeetingRepository()->findOneBy(['meetingId' => $_REQUEST['meetingId']]);
if ($meeting->isCourseMeeting()) {
$plugin->deleteMeeting($meeting, api_get_self().'?'.api_get_cidreq());
}
break;
}

Loading…
Cancel
Save