Plugins: Zoom - Add group add, meeting activity, refactor code

BT#17288
pull/3433/head
Julio Montoya 5 years ago
parent b4ce57cb4d
commit e435f5220d
  1. 9
      main/inc/lib/api.lib.php
  2. 97
      plugin/zoom/Entity/Meeting.php
  3. 176
      plugin/zoom/Entity/MeetingActivity.php
  4. 18
      plugin/zoom/Entity/Recording.php
  5. 12
      plugin/zoom/Entity/Registrant.php
  6. 30
      plugin/zoom/activity.php
  7. 30
      plugin/zoom/admin.php
  8. 81
      plugin/zoom/endpoint.php
  9. 21
      plugin/zoom/join_meeting.php
  10. 29
      plugin/zoom/lib/MeetingRepository.php
  11. 13
      plugin/zoom/lib/RecordingRepository.php
  12. 6
      plugin/zoom/lib/RegistrantRepository.php
  13. 1084
      plugin/zoom/lib/ZoomPlugin.php
  14. 11
      plugin/zoom/meeting.php
  15. 2
      plugin/zoom/meetings.php
  16. 5
      plugin/zoom/start.php
  17. 28
      plugin/zoom/view/activity.tpl
  18. 62
      plugin/zoom/view/list.tpl
  19. 19
      plugin/zoom/view/meeting.tpl
  20. 62
      plugin/zoom/view/meetings.tpl

@ -2200,6 +2200,15 @@ function api_get_course_entity($courseId = 0)
return Database::getManager()->getRepository('ChamiloCoreBundle:Course')->find($courseId);
}
function api_get_group_entity($id = 0)
{
if (empty($id)) {
$id = api_get_group_id();
}
return Database::getManager()->getRepository('ChamiloCourseBundle:CGroupInfo')->find($id);
}
/**
* @param int $id
*

@ -8,6 +8,7 @@ use Chamilo\CoreBundle\Entity\Course;
use Chamilo\CoreBundle\Entity\CourseRelUser;
use Chamilo\CoreBundle\Entity\Session;
use Chamilo\CoreBundle\Entity\SessionRelCourseRelUser;
use Chamilo\CourseBundle\Entity\CGroupInfo;
use Chamilo\PluginBundle\Zoom\API\MeetingInfoGet;
use Chamilo\PluginBundle\Zoom\API\MeetingListItem;
use Chamilo\PluginBundle\Zoom\API\MeetingSettings;
@ -21,9 +22,9 @@ use Doctrine\ORM\Mapping as ORM;
use Exception;
/**
* Class MeetingEntity.
* Class Meeting.
*
* @ORM\Entity(repositoryClass="Chamilo\PluginBundle\Zoom\MeetingEntityRepository")
* @ORM\Entity(repositoryClass="Chamilo\PluginBundle\Zoom\MeetingRepository")
* @ORM\Table(
* name="plugin_zoom_meeting",
* indexes={
@ -34,7 +35,7 @@ use Exception;
* )
* @ORM\HasLifecycleCallbacks
*/
class MeetingEntity
class Meeting
{
/** @var string meeting type name */
public $typeName;
@ -82,6 +83,13 @@ class MeetingEntity
*/
protected $course;
/**
* @var CGroupInfo
* @ORM\ManyToOne(targetEntity="Chamilo\CourseBundle\Entity\CGroupInfo")
* @ORM\JoinColumn(name="group_id", referencedColumnName="id", nullable=true)
*/
protected $group;
/**
* @var Session
* @ORM\ManyToOne(targetEntity="Chamilo\CoreBundle\Entity\Session")
@ -108,16 +116,24 @@ class MeetingEntity
protected $meetingInfoGet;
/**
* @var RegistrantEntity[]|ArrayCollection
* @var MeetingActivity[]|ArrayCollection
*
* @ORM\OneToMany(targetEntity="MeetingActivity", mappedBy="meeting", cascade={"persist", "remove"})
*
*/
protected $activities;
/**
* @var Registrant[]|ArrayCollection
*
* @ORM\OneToMany(targetEntity="Registrant", mappedBy="meeting", cascade={"persist", "remove"})
*
* @ORM\OneToMany(targetEntity="RegistrantEntity", mappedBy="meeting", cascade={"persist", "remove"}
* )
*/
protected $registrants;
/**
* @var RecordingEntity[]|ArrayCollection
* @ORM\OneToMany(targetEntity="RecordingEntity", mappedBy="meeting", cascade={"persist"}, orphanRemoval=true)
* @var Recording[]|ArrayCollection
* @ORM\OneToMany(targetEntity="Recording", mappedBy="meeting", cascade={"persist"}, orphanRemoval=true)
*/
protected $recordings;
@ -125,6 +141,7 @@ class MeetingEntity
{
$this->registrants = new ArrayCollection();
$this->recordings = new ArrayCollection();
$this->activities = new ArrayCollection();
}
/**
@ -154,7 +171,7 @@ class MeetingEntity
/**
* @param int $meetingId
*
* @return MeetingEntity
* @return Meeting
*/
public function setMeetingId($meetingId)
{
@ -188,7 +205,7 @@ class MeetingEntity
}
/**
* @return RegistrantEntity[]|ArrayCollection
* @return Registrant[]|ArrayCollection
*/
public function getRegistrants()
{
@ -196,13 +213,39 @@ class MeetingEntity
}
/**
* @return RecordingEntity[]|ArrayCollection
* @return Recording[]|ArrayCollection
*/
public function getRecordings()
{
return $this->recordings;
}
/**
* @return MeetingActivity[]|ArrayCollection
*/
public function getActivities()
{
return $this->activities;
}
public function addActivity(MeetingActivity $activity)
{
$activity->setMeeting($this);
$this->activities[] = $activity;
}
/**
* @param MeetingActivity[]|ArrayCollection $activities
*
* @return Meeting
*/
public function setActivities($activities)
{
$this->activities = $activities;
return $this;
}
/**
* @ORM\PostLoad
*
@ -294,19 +337,39 @@ class MeetingEntity
return $this;
}
/**
* @return CGroupInfo
*/
public function getGroup()
{
return $this->group;
}
/**
* @param CGroupInfo $group
*
* @return Meeting
*/
public function setGroup($group)
{
$this->group = $group;
return $this;
}
/**
* @param MeetingListItem $meetingListItem
*
* @throws Exception
*
* @return MeetingEntity
* @return Meeting
*/
public function setMeetingListItem($meetingListItem)
{
if (null === $this->meetingId) {
$this->meetingId = $meetingListItem->id;
} elseif ($this->meetingId != $meetingListItem->id) {
throw new Exception('the MeetingEntity identifier differs from the MeetingListItem identifier');
throw new Exception('the Meeting identifier differs from the MeetingListItem identifier');
}
$this->meetingListItem = $meetingListItem;
@ -318,14 +381,14 @@ class MeetingEntity
*
* @throws Exception
*
* @return MeetingEntity
* @return Meeting
*/
public function setMeetingInfoGet($meetingInfoGet)
{
if (null === $this->meetingId) {
$this->meetingId = $meetingInfoGet->id;
} elseif ($this->meetingId != $meetingInfoGet->id) {
throw new Exception('the MeetingEntity identifier differs from the MeetingInfoGet identifier');
throw new Exception('the Meeting identifier differs from the MeetingInfoGet identifier');
}
$this->meetingInfoGet = $meetingInfoGet;
$this->initializeDisplayableProperties();
@ -439,7 +502,7 @@ class MeetingEntity
public function hasRegisteredUser($user)
{
return $this->getRegistrants()->exists(
function (RegistrantEntity $registrantEntity) use (&$user) {
function (Registrant $registrantEntity) use (&$user) {
return $registrantEntity->getUser() === $user;
}
);
@ -448,7 +511,7 @@ class MeetingEntity
/**
* @param User $user
*
* @return RegistrantEntity|null
* @return Registrant|null
*/
public function getRegistrant($user)
{

@ -0,0 +1,176 @@
<?php
/* For licensing terms, see /license.txt */
namespace Chamilo\PluginBundle\Zoom;
use Chamilo\CoreBundle\Entity\Course;
use Chamilo\CoreBundle\Entity\CourseRelUser;
use Chamilo\CoreBundle\Entity\Session;
use Chamilo\CoreBundle\Entity\SessionRelCourseRelUser;
use Chamilo\CourseBundle\Entity\CGroupInfo;
use Chamilo\PluginBundle\Zoom\API\MeetingInfoGet;
use Chamilo\PluginBundle\Zoom\API\MeetingListItem;
use Chamilo\PluginBundle\Zoom\API\MeetingSettings;
use Chamilo\UserBundle\Entity\User;
use Database;
use DateInterval;
use DateTime;
use DateTimeZone;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\ORM\Mapping as ORM;
use Exception;
/**
* Class Meeting.
*
* @ORM\Entity()
* @ORM\Table(name="plugin_zoom_meeting_activity")
* @ORM\HasLifecycleCallbacks
*/
class MeetingActivity
{
/**
* @var int
* @ORM\Column(type="integer")
* @ORM\Id
* @ORM\GeneratedValue()
*/
protected $id;
/**
* @var Meeting
* @ORM\ManyToOne(targetEntity="Meeting", inversedBy="activities")
* @ORM\JoinColumn(name="meeting_id")
*/
protected $meeting;
/**
* @var string
* @ORM\Column(type="string", name="name", length=255, nullable=false)
*/
protected $name;
/**
* @var string
* @ORM\Column(type="string", name="type", length=255, nullable=false)
*/
protected $type;
/**
* @var string
* @ORM\Column(type="text", name="event", nullable=true)
*/
protected $event;
public function __construct()
{
}
/**
* @return string
*/
public function __toString()
{
return sprintf('Activity %d', $this->id);
}
/**
* @return int
*/
public function getId()
{
return $this->id;
}
/**
* @return Meeting
*/
public function getMeeting()
{
return $this->meeting;
}
/**
* @param Meeting $meeting
*
* @return MeetingActivity
*/
public function setMeeting($meeting)
{
$this->meeting = $meeting;
return $this;
}
/**
* @return string
*/
public function getName()
{
return $this->name;
}
/**
* @param string $name
*
* @return MeetingActivity
*/
public function setName($name)
{
$this->name = $name;
return $this;
}
/**
* @return string
*/
public function getType()
{
return $this->type;
}
/**
* @param string $type
*
* @return MeetingActivity
*/
public function setType($type)
{
$this->type = $type;
return $this;
}
/**
* @return string
*/
public function getEvent()
{
return $this->event;
}
public function getEventDecoded()
{
if (!empty($this->event)) {
return json_decode($this->event);
}
return '';
}
/**
* @param string $event
*
* @return MeetingActivity
*/
public function setEvent($event)
{
$this->event = $event;
return $this;
}
}

@ -15,7 +15,7 @@ use Exception;
/**
* Class RecordingEntity.
*
* @ORM\Entity(repositoryClass="Chamilo\PluginBundle\Zoom\RecordingEntityRepository")
* @ORM\Entity(repositoryClass="Chamilo\PluginBundle\Zoom\RecordingRepository")
* @ORM\Table(
* name="plugin_zoom_recording",
* indexes={
@ -24,7 +24,7 @@ use Exception;
* )
* @ORM\HasLifecycleCallbacks
*/
class RecordingEntity
class Recording
{
/** @var DateTime */
public $startDateTime;
@ -53,8 +53,8 @@ class RecordingEntity
protected $uuid;
/**
* @var MeetingEntity
* @ORM\ManyToOne(targetEntity="MeetingEntity", inversedBy="recordings")
* @var Meeting
* @ORM\ManyToOne(targetEntity="Meeting", inversedBy="recordings")
* @ORM\JoinColumn(name="meeting_id")
*/
protected $meeting;
@ -93,7 +93,7 @@ class RecordingEntity
}
/**
* @return MeetingEntity
* @return Meeting
*/
public function getMeeting()
{
@ -111,7 +111,7 @@ class RecordingEntity
}
/**
* @param MeetingEntity $meeting
* @param Meeting $meeting
*
* @return $this
*/
@ -126,9 +126,9 @@ class RecordingEntity
/**
* @param RecordingMeeting $recordingMeeting
*
* @throws Exception
* @return Recording
*@throws Exception
*
* @return RecordingEntity
*/
public function setRecordingMeeting($recordingMeeting)
{
@ -138,7 +138,7 @@ class RecordingEntity
throw new Exception('the RecordingEntity identifier differs from the RecordingMeeting identifier');
}
if (null === $this->meeting) {
$this->meeting = Database::getManager()->getRepository(MeetingEntity::class)->find($recordingMeeting->id);
$this->meeting = Database::getManager()->getRepository(Meeting::class)->find($recordingMeeting->id);
} elseif ($this->meeting->getId() != $recordingMeeting->id) {
// $this->meeting remains null when the remote RecordingMeeting refers to a deleted meeting.
throw new Exception('The RecordingEntity meeting id differs from the RecordingMeeting meeting id');

@ -14,7 +14,7 @@ use Exception;
/**
* Class RegistrantEntity.
*
* @ORM\Entity(repositoryClass="Chamilo\PluginBundle\Zoom\RegistrantEntityRepository")
* @ORM\Entity(repositoryClass="RegistrantRepository")
* @ORM\Table(
* name="plugin_zoom_registrant",
* indexes={
@ -24,7 +24,7 @@ use Exception;
* )
* @ORM\HasLifecycleCallbacks
*/
class RegistrantEntity
class Registrant
{
/** @var string */
public $fullName;
@ -45,8 +45,8 @@ class RegistrantEntity
protected $user;
/**
* @var MeetingEntity
* @ORM\ManyToOne(targetEntity="MeetingEntity", inversedBy="registrants")
* @var Meeting
* @ORM\ManyToOne(targetEntity="Meeting", inversedBy="registrants")
* @ORM\JoinColumn(name="meeting_id", referencedColumnName="id")
*/
protected $meeting;
@ -87,7 +87,7 @@ class RegistrantEntity
}
/**
* @return MeetingEntity
* @return Meeting
*/
public function getMeeting()
{
@ -95,7 +95,7 @@ class RegistrantEntity
}
/**
* @param MeetingEntity $meeting
* @param Meeting $meeting
*
* @return $this
*/

@ -0,0 +1,30 @@
<?php
/* For license terms, see /license.txt */
use Chamilo\PluginBundle\Zoom\Meeting;
$course_plugin = 'zoom'; // needed in order to load the plugin lang variables
require_once __DIR__.'/config.php';
$plugin = ZoomPlugin::create();
$tool_name = $plugin->get_lang('ZoomVideoConferences');
$tpl = new Template($plugin->get_lang('ZoomVideoConferences'));
$meetingId = isset($_REQUEST['meetingId']) ? (int) $_REQUEST['meetingId'] : 0;
if (empty($meetingId)) {
api_not_allowed(true);
}
$content = '';
/** @var Meeting $meeting */
$meeting = $plugin->getMeetingRepository()->findOneBy(['meetingId' => $meetingId]);
if (null === $meeting) {
api_not_allowed(true);
}
$tpl->assign('actions', $plugin->getToolbar());
$tpl->assign('meeting', $meeting);
$tpl->assign('content', $tpl->fetch('zoom/view/activity.tpl'));
$tpl->display_one_col_template();

@ -1,30 +0,0 @@
<?php
/* For license terms, see /license.txt */
$course_plugin = 'zoom'; // needed in order to load the plugin lang variables
$cidReset = true;
require_once __DIR__.'/config.php';
api_protect_admin_script();
$plugin = ZoomPlugin::create();
$tool_name = $plugin->get_lang('ZoomVideoConferences');
$this_section = SECTION_PLATFORM_ADMIN;
$form = $plugin->getAdminSearchForm();
$startDate = new DateTime($form->getSubmitValue('start'));
$endDate = new DateTime($form->getSubmitValue('end'));
$tpl = new Template($tool_name);
$tpl->assign('meetings', $plugin->getMeetingRepository()->periodMeetings($startDate, $endDate));
if ('true' === $plugin->get('enableCloudRecording')) {
$tpl->assign('recordings', $plugin->getRecordingRepository()->getPeriodRecordings($startDate, $endDate));
}
$tpl->assign('actions', $plugin->getToolbar());
$tpl->assign('search_form', $form->returnForm());
$tpl->assign('type', 'admin');
$tpl->assign('content', $tpl->fetch('zoom/view/list.tpl'));
$tpl->display_one_col_template();

@ -3,9 +3,10 @@
/* For license terms, see /license.txt */
use Chamilo\PluginBundle\Zoom\API\RecordingMeeting;
use Chamilo\PluginBundle\Zoom\MeetingEntity;
use Chamilo\PluginBundle\Zoom\RecordingEntity;
use Chamilo\PluginBundle\Zoom\RegistrantEntity;
use Chamilo\PluginBundle\Zoom\Meeting;
use Chamilo\PluginBundle\Zoom\MeetingActivity;
use Chamilo\PluginBundle\Zoom\Recording;
use Chamilo\PluginBundle\Zoom\Registrant;
use Symfony\Component\HttpFoundation\Response;
if ('POST' !== $_SERVER['REQUEST_METHOD']) {
@ -36,56 +37,63 @@ list($objectType, $action) = explode('.', $decoded->event);
$em = Database::getManager();
$meetingRepository = $em->getRepository(MeetingEntity::class);
$meetingEntity = null;
$meetingRepository = $em->getRepository(Meeting::class);
$meeting = null;
if ($object->id) {
/** @var MeetingEntity $meetingEntity */
$meetingEntity = $meetingRepository->findOneBy(['meetingId' => $object->id]);
/** @var Meeting $meeting */
$meeting = $meetingRepository->findOneBy(['meetingId' => $object->id]);
}
$activity = null;
if ($meeting) {
$activity = new MeetingActivity();
$activity->setName($action);
$activity->setType($objectType);
$activity->setEvent(json_encode($object));
}
switch ($objectType) {
case 'meeting':
$registrantRepository = $em->getRepository(RegistrantEntity::class);
$registrantRepository = $em->getRepository(Registrant::class);
if (null === $meetingEntity) {
if (null === $meeting) {
exit;
}
error_log('Meeting '.$action.' - '.$meetingEntity->getId());
error_log('Meeting '.$action.' - '.$meeting->getId());
error_log(print_r($object, 1));
switch ($action) {
case 'deleted':
$em->remove($meetingEntity);
$em->remove($meeting);
$em->flush();
break;
case 'ended':
case 'started':
$meetingEntity->setStatus($action);
$em->persist($meetingEntity);
$meeting->setStatus($action);
$meeting->addActivity($activity);
$em->persist($meeting);
$em->flush();
break;
case 'participant_joined':
case 'participant_left':
error_log('Participant: #'.$object->participant->id);
error_log(print_r($object->participant, 1));
/*$registrant = $registrantRepository->findOneBy(['meeting' => $meetingEntity, '' => $object->participant->id]);
if (null === $registrant) {
exit;
}*/
$meeting->addActivity($activity);
break;
default:
error_log(sprintf('Event "%s" on %s was unhandled: %s', $action, $objectType, $body));
http_response_code(Response::HTTP_NOT_IMPLEMENTED); // Not Implemented
$meeting->addActivity($activity);
$em->persist($meeting);
$em->flush();
//error_log(sprintf('Event "%s" on %s was unhandled: %s', $action, $objectType, $body));
//http_response_code(Response::HTTP_NOT_IMPLEMENTED); // Not Implemented
break;
}
break;
case 'recording':
$recordingRepository = $em->getRepository(RecordingEntity::class);
$recordingRepository = $em->getRepository(Recording::class);
$recordingEntity = null;
if ($object->uuid) {
$recordingEntity = $recordingRepository->findBy(['uuid' => $object->uuid, 'meeting' => $meetingEntity]);
$recordingEntity = $recordingRepository->findBy(['uuid' => $object->uuid, 'meeting' => $meeting]);
}
error_log("Recording: $action");
@ -93,33 +101,42 @@ switch ($objectType) {
switch ($action) {
case 'completed':
$recording = new RecordingEntity();
$recording = new Recording();
$recording->setRecordingMeeting(RecordingMeeting::fromObject($object));
$recording->setMeeting($meetingEntity);
$recording->setMeeting($meeting);
$meeting->addActivity($activity);
$em->persist($meeting);
$em->persist($recording);
$em->flush();
break;
case 'recovered':
if (null === $recordingEntity) {
/*if (null === $recordingEntity) {
$em->persist(
(new RecordingEntity())->setRecordingMeeting(RecordingMeeting::fromObject($object))
(new Recording())->setRecordingMeeting(RecordingMeeting::fromObject($object))
);
$em->flush();
}
}*/
break;
case 'trashed':
case 'deleted':
$meeting->addActivity($activity);
$em->persist($meeting);
if (null !== $recordingEntity) {
$em->remove($recordingEntity);
$em->flush();
}
$em->flush();
break;
default:
error_log(sprintf('Event "%s" on %s was unhandled: %s', $action, $objectType, $body));
http_response_code(501); // Not Implemented
$meeting->addActivity($activity);
$em->persist($meeting);
$em->flush();
//error_log(sprintf('Event "%s" on %s was unhandled: %s', $action, $objectType, $body));
//http_response_code(501); // Not Implemented
break;
}
break;
default:
error_log(sprintf('Event "%s" on %s was unhandled: %s', $action, $objectType, $body));
http_response_code(501); // Not Implemented
break;
}

@ -2,7 +2,7 @@
/* For license terms, see /license.txt */
use Chamilo\PluginBundle\Zoom\MeetingEntity;
use Chamilo\PluginBundle\Zoom\Meeting;
require_once __DIR__.'/config.php';
@ -15,26 +15,30 @@ if (empty($meetingId)) {
}
$plugin = ZoomPlugin::create();
Display::display_header($plugin->get_title());
echo $plugin->getToolbar();
/** @var MeetingEntity $meeting */
$content = '';
/** @var Meeting $meeting */
$meeting = $plugin->getMeetingRepository()->findOneBy(['meetingId' => $meetingId]);
try {
if (null === $meeting) {
throw new Exception($plugin->get_lang('Meeting not found'));
}
if ($meeting->isCourseMeeting()) {
api_protect_course_script(true);
}
$startJoinURL = $plugin->getStartOrJoinMeetingURL($meeting);
echo $meeting->getIntroduction();
$content .= $meeting->getIntroduction();
if (!empty($startJoinURL)) {
echo Display::url($plugin->get_lang('EnterMeeting'), $startJoinURL, ['class' => 'btn btn-primary']);
$content .= Display::url($plugin->get_lang('EnterMeeting'), $startJoinURL, ['class' => 'btn btn-primary']);
} else {
//echo Display::return_message($plugin->get_lang('ConferenceNotStarted'), 'warning');
}
if ($plugin->userIsConferenceManager($meeting)) {
echo '&nbsp;'.Display::url(
$content .= '&nbsp;'.Display::url(
get_lang('Details'),
api_get_path(WEB_PLUGIN_PATH).'zoom/meeting.php?meetingId='.$meeting->getMeetingId(),
['class' => 'btn btn-default']
@ -46,4 +50,7 @@ try {
);
}
Display::display_header($plugin->get_title());
echo $plugin->getToolbar();
echo $content;
Display::display_footer();

@ -5,6 +5,7 @@ namespace Chamilo\PluginBundle\Zoom;
use Chamilo\CoreBundle\Entity\Course;
use Chamilo\CoreBundle\Entity\Session;
use Chamilo\CourseBundle\Entity\CGroupInfo;
use Chamilo\PageBundle\Entity\User;
use DateTime;
use Doctrine\Common\Collections\ArrayCollection;
@ -14,9 +15,9 @@ use Doctrine\ORM\EntityRepository;
use Doctrine\ORM\QueryBuilder;
/**
* Class MeetingEntityRepository.
* Class MeetingRepository.
*/
class MeetingEntityRepository extends EntityRepository
class MeetingRepository extends EntityRepository
{
/**
* Retrieves information about meetings having a start_time between two dates.
@ -24,7 +25,7 @@ class MeetingEntityRepository extends EntityRepository
* @param DateTime $startDate
* @param DateTime $endDate
*
* @return MeetingEntity[]
* @return Meeting[]
*/
public function periodMeetings($startDate, $endDate)
{
@ -40,7 +41,7 @@ class MeetingEntityRepository extends EntityRepository
}
/**
* @return ArrayCollection|Collection|MeetingEntity[]
* @return ArrayCollection|Collection|Meeting[]
*/
public function globalMeetings()
{
@ -55,7 +56,7 @@ class MeetingEntityRepository extends EntityRepository
}
/**
* @return ArrayCollection|Collection|MeetingEntity[]
* @return ArrayCollection|Collection|Meeting[]
*/
public function unfinishedGlobalMeetings()
{
@ -134,7 +135,7 @@ class MeetingEntityRepository extends EntityRepository
/**
* @param User|null $user
*
* @return MeetingEntity[]
* @return Meeting[]
*/
public function unfinishedUserMeetings($user = null)
{
@ -160,7 +161,7 @@ class MeetingEntityRepository extends EntityRepository
* @param DateTime $end
* @param User $user
*
* @return ArrayCollection|Collection|MeetingEntity[]
* @return ArrayCollection|Collection|Meeting[]
*/
public function periodUserMeetings($start, $end, $user = null)
{
@ -186,18 +187,18 @@ class MeetingEntityRepository extends EntityRepository
/**
* Returns either a course's meetings or all course meetings.
*
* @param Course|null $course
* @param Session|null $session
* @param Course|null $course
* @param Session|null $session
* @param CGroupInfo|null $group
*
* @return ArrayCollection|Collection|MeetingEntity[]
* @return ArrayCollection|Collection|Meeting[]
*/
public function courseMeetings($course = null, $session = null)
public function courseMeetings($course, $group = null, $session = null)
{
return $this->matching(
Criteria::create()->where(
null === $course
? Criteria::expr()->neq('course', null)
: Criteria::expr()->andX(
Criteria::expr()->andX(
Criteria::expr()->eq('group', $group),
Criteria::expr()->eq('course', $course),
Criteria::expr()->eq('session', $session)
)

@ -11,14 +11,15 @@ use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\ORM\EntityRepository;
/**
* Class RecordingEntityRepository.
* Class RecordingRepository.
*/
class RecordingEntityRepository extends EntityRepository
class RecordingRepository extends EntityRepository
{
public function getPeriodRecordings($startDate, $endDate)
{
$matching = [];
foreach ($this->findAll() as $candidate) {
$all = $this->findAll();
foreach ($all as $candidate) {
if ($candidate->startDateTime >= $startDate && $candidate->startDateTime <= $endDate) {
$matching[] = $candidate;
}
@ -32,7 +33,7 @@ class RecordingEntityRepository extends EntityRepository
*
* @param User $user
*
* @return ArrayCollection|Collection|RecordingEntity[]
* @return ArrayCollection|Collection|Recording[]
*/
/*public function userRecordings($user)
{
@ -40,7 +41,7 @@ class RecordingEntityRepository extends EntityRepository
Criteria::create()->where(
Criteria::expr()->in(
'meeting',
$this->getEntityManager()->getRepository(MeetingEntity::class)->userMeetings($user)->toArray()
$this->getEntityManager()->getRepository(Meeting::class)->userMeetings($user)->toArray()
)
)
);
@ -51,7 +52,7 @@ class RecordingEntityRepository extends EntityRepository
* @param DateTime $end
* @param User $user
*
* @return ArrayCollection|RecordingEntity[]
* @return ArrayCollection|Recording[]
*/
/*public function getPeriodUserRecordings($start, $end, $user = null)
{

@ -12,21 +12,21 @@ use Doctrine\ORM\EntityRepository;
/**
* Class RegistrantEntityRepository.
*/
class RegistrantEntityRepository extends EntityRepository
class RegistrantRepository extends EntityRepository
{
/**
* Returns the upcoming meeting registrations for the given user.
*
* @param User $user
*
* @return array|RegistrantEntity[]
* @return array|Registrant[]
*/
public function meetingsComingSoonRegistrationsForUser($user)
{
$start = new DateTime();
$end = new DateTime();
$end->add(new DateInterval('P7D'));
$meetings = $this->getEntityManager()->getRepository(MeetingEntity::class)->periodMeetings($start, $end);
$meetings = $this->getEntityManager()->getRepository(Meeting::class)->periodMeetings($start, $end);
return $this->findBy(['meeting' => $meetings, 'user' => $user]);
}

File diff suppressed because it is too large Load Diff

@ -2,7 +2,7 @@
/* For license terms, see /license.txt */
use Chamilo\PluginBundle\Zoom\MeetingEntity;
use Chamilo\PluginBundle\Zoom\Meeting;
require_once __DIR__.'/config.php';
@ -12,7 +12,7 @@ if (empty($meetingId)) {
}
$plugin = ZoomPlugin::create();
/** @var MeetingEntity $meeting */
/** @var Meeting $meeting */
$meeting = $plugin->getMeetingRepository()->findOneBy(['meetingId' => $meetingId]);
if (null === $meeting) {
@ -46,17 +46,14 @@ if ($plugin->userIsConferenceManager($meeting)) {
$tpl->assign('editMeetingForm', $plugin->getEditMeetingForm($meeting)->returnForm());
$tpl->assign('deleteMeetingForm', $plugin->getDeleteMeetingForm($meeting, $returnURL)->returnForm());
if (false === $meeting->isGlobalMeeting()) {
if (false === $meeting->isGlobalMeeting() && false == $meeting->isCourseMeeting()) {
if ('true' === $plugin->get('enableParticipantRegistration') && $meeting->requiresRegistration()) {
$tpl->assign('registerParticipantForm', $plugin->getRegisterParticipantForm($meeting)->returnForm());
$tpl->assign('registrants', $meeting->getRegistrants());
}
}
if ('true' === $plugin->get('enableCloudRecording') &&
$meeting->hasCloudAutoRecordingEnabled()
// && 'finished' === $meeting->status
) {
if ('true' === $plugin->get('enableCloudRecording') && $meeting->hasCloudAutoRecordingEnabled()) {
$tpl->assign('fileForm', $plugin->getFileForm($meeting)->returnForm());
$tpl->assign('recordings', $meeting->getRecordings());
}

@ -23,5 +23,5 @@ $tpl->assign('allow_recording', 'true' === $plugin->get('enableCloudRecording'))
$tpl->assign('actions', $plugin->getToolbar());
$tpl->assign('search_form', $form->returnForm());
$tpl->assign('schedule_form', $scheduleForm->returnForm());
$tpl->assign('content', $tpl->fetch('zoom/view/list.tpl'));
$tpl->assign('content', $tpl->fetch('zoom/view/meetings.tpl'));
$tpl->display_one_col_template();

@ -19,6 +19,7 @@ $plugin = ZoomPlugin::create();
$tool_name = $plugin->get_lang('ZoomVideoConferences');
$tpl = new Template($tool_name);
$course = api_get_course_entity();
$group = api_get_group_entity();
$session = api_get_session_entity();
$action = isset($_REQUEST['action']) ? $_REQUEST['action'] : '';
@ -39,12 +40,14 @@ if ($plugin->userIsCourseConferenceManager()) {
$plugin->getCreateInstantMeetingForm(
$user,
$course,
$group,
$session
)->returnForm()
);
$tpl->assign('scheduleMeetingForm', $plugin->getScheduleMeetingForm(
$user,
$course,
$group,
$session
)->returnForm());
}
@ -52,7 +55,7 @@ if ($plugin->userIsCourseConferenceManager()) {
try {
$tpl->assign(
'scheduledMeetings',
$plugin->getMeetingRepository()->courseMeetings($course, $session)
$plugin->getMeetingRepository()->courseMeetings($course, $group, $session)
);
} catch (Exception $exception) {
Display::addFlash(

@ -0,0 +1,28 @@
<h4>
{{ meeting.typeName }} {{ meeting.meetingId }}
</h4>
<table class="table">
<thead>
<tr>
<th>{{ 'Name'|get_plugin_lang('ZoomPlugin') }}</th>
<th>{{ 'Type'|get_lang }}</th>
<th>{{ 'Event'|get_lang }} </th>
</tr>
</thead>
<tbody>
{% for activity in meeting.activities %}
<tr>
<td>
{{ activity.name }}
</td>
<td>
{{ activity.type }}
</td>
<td>
{{ activity.eventDecoded }}
</td>
</tr>
{% endfor %}
</tbody>
</table>

@ -1,62 +0,0 @@
{% import "default/document/recycle.tpl" as macro %}
{{ schedule_form }}
{{ search_form }}
{% if meetings %}
<h4>{{ 'MeetingsFound'|get_plugin_lang('ZoomPlugin') }}: </h4>
<table class="table table-hover table-striped">
<thead>
<tr>
<th>{{ 'Topic'|get_plugin_lang('ZoomPlugin') }}</th>
<th>{{ 'StartTime'|get_lang }}</th>
<th>{{ 'ForEveryone'|get_plugin_lang('ZoomPlugin') }}</th>
{# <th>{{ 'Course'|get_lang }}</th>#}
{# <th>{{ 'Session'|get_lang }}</th>#}
{% if allow_recording %}
<th>{{ 'Recordings'|get_plugin_lang('ZoomPlugin') }}</th>
{% endif %}
<th></th>
</tr>
</thead>
<tbody>
{% for meeting in meetings %}
<tr>
<td>{{ meeting.meetingInfoGet.topic }}</td>
<td>{{ meeting.formattedStartTime }}</td>
<td>{{ meeting.user ? 'No' : 'Yes' }}</td>
{# <td>{{ meeting.course ? meeting.course : '-' }}</td>#}
{# <td>{{ meeting.session ? meeting.session : '-' }}</td>#}
<td>
{% if allow_recording and meeting.recordings.count > 0 %}
{% for recording in meeting.recordings %}
<dl>
<dt>
{{ recording.formattedStartTime }} ({{ recording.formattedDuration }})
</dt>
<dd>
<ul>
{% for file in recording.recordingMeeting.recording_files %}
<li>
<a href="{{ file.play_url }}" target="_blank">
{{ file.recording_type }}.{{ file.file_type }}
({{ macro.bytesToSize(file.file_size) }})
</a>
</li>
{% endfor %}
</ul>
</dd>
</dl>
{% endfor %}
{% endif %}
</td>
<td>
<a class="btn btn-primary" href="meeting.php?meetingId={{ meeting.meetingId }}">
{{ 'Details'|get_lang }}
</a>
</td>
</tr>
{% endfor %}
</tbody>
</table>
{% endif %}

@ -2,22 +2,27 @@
{{ meeting.typeName }} {{ meeting.meetingId }} ({{ meeting.meetingInfoGet.status }})
</h4>
<div class="btn-group" role="group">
{% if meeting.meetingInfoGet.status != 'finished' %}
<p>
<a class="btn btn-primary" href="join_meeting.php?meetingId={{ meeting.meetingId }}">
{{ 'ViewMeeting'|get_plugin_lang('ZoomPlugin') }}
</a>
</p>
{% endif %}
{% if isConferenceManager and meeting.status == 'waiting' %}
<p>
<a href="{{ meeting.meetingInfoGet.start_url }}" target="_blank">
{{ 'StartMeeting'|get_plugin_lang('ZoomPlugin') }}
{% if isConferenceManager %}
{% if meeting.status == 'waiting' %}
<a class="btn btn-primary" href="{{ meeting.meetingInfoGet.start_url }}" target="_blank">
{{ 'StartMeeting'|get_plugin_lang('ZoomPlugin') }}
</a>
{% endif %}
<a class="btn btn-default" href="activity.php?meetingId={{ meeting.meetingId }}">
{{ 'Activity'|get_plugin_lang('ZoomPlugin') }}
</a>
</p>
{% endif %}
</div>
{% if currentUserJoinURL %}
{#<p>#}
{# <a href="{{ currentUserJoinURL }}" target="_blank">#}

@ -0,0 +1,62 @@
{% import "default/document/recycle.tpl" as macro %}
{{ schedule_form }}
{{ search_form }}
{% if meetings %}
<h4>{{ 'MeetingsFound'|get_plugin_lang('ZoomPlugin') }}: </h4>
<table class="table table-hover table-striped">
<thead>
<tr>
<th>{{ 'Topic'|get_plugin_lang('ZoomPlugin') }}</th>
<th>{{ 'StartTime'|get_lang }}</th>
<th>{{ 'ForEveryone'|get_plugin_lang('ZoomPlugin') }}</th>
{# <th>{{ 'Course'|get_lang }}</th>#}
{# <th>{{ 'Session'|get_lang }}</th>#}
{% if allow_recording %}
<th>{{ 'Recordings'|get_plugin_lang('ZoomPlugin') }}</th>
{% endif %}
<th></th>
</tr>
</thead>
<tbody>
{% for meeting in meetings %}
<tr>
<td>{{ meeting.meetingInfoGet.topic }}</td>
<td>{{ meeting.formattedStartTime }}</td>
<td>{{ meeting.user ? 'No' : 'Yes' }}</td>
{# <td>{{ meeting.course ? meeting.course : '-' }}</td>#}
{# <td>{{ meeting.session ? meeting.session : '-' }}</td>#}
<td>
{% if allow_recording and meeting.recordings.count > 0 %}
{% for recording in meeting.recordings %}
<dl>
<dt>
{{ recording.formattedStartTime }} ({{ recording.formattedDuration }})
</dt>
<dd>
<ul>
{% for file in recording.recordingMeeting.recording_files %}
<li>
<a href="{{ file.play_url }}" target="_blank">
{{ file.recording_type }}.{{ file.file_type }}
({{ macro.bytesToSize(file.file_size) }})
</a>
</li>
{% endfor %}
</ul>
</dd>
</dl>
{% endfor %}
{% endif %}
</td>
<td>
<a class="btn btn-primary" href="meeting.php?meetingId={{ meeting.meetingId }}">
{{ 'Details'|get_lang }}
</a>
</td>
</tr>
{% endfor %}
</tbody>
</table>
{% endif %}
Loading…
Cancel
Save