Merge pull request #4363 from AngelFQC/BT19479

Plugin: Zoom: Allow create system announcement - refs BT#19479
pull/4364/head
Nicolas Ducoulombier 3 years ago committed by GitHub
commit bc341edf80
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 37
      main/admin/system_announcements.php
  2. 22
      plugin/zoom/Entity/Meeting.php
  3. 25
      plugin/zoom/README.md
  4. 2
      plugin/zoom/calendar.ajax.php
  5. 31
      plugin/zoom/join_meeting.php
  6. 4
      plugin/zoom/lib/ZoomPlugin.php
  7. 4
      plugin/zoom/view/join.tpl

@ -7,6 +7,9 @@
*/
// Resetting the course id.
use Chamilo\CoreBundle\Entity\SysAnnouncement;
use Chamilo\PluginBundle\Zoom\Meeting;
$cidReset = true;
// Including the global initialization file.
@ -67,6 +70,7 @@ if ($action != 'add' && $action != 'edit') {
/* MAIN CODE */
$show_announcement_list = true;
$action = isset($_REQUEST['action']) ? $_REQUEST['action'] : null;
$type = $_REQUEST['type'] ?? null;
// Form was posted?
if (isset($_POST['action'])) {
@ -153,6 +157,32 @@ if ($action_todo) {
$url = api_get_self().'?id='.intval($_GET['id']);
}
$form = new FormValidator('system_announcement', 'post', $url);
if ('add' === $action && 'zoom_conference' == $type && $meetingId = $_REQUEST['meeting'] ?? 0) {
$plugin = ZoomPlugin::create();
if ($plugin->isEnabled(true)) {
/** @var Meeting $meeting */
$meeting = ZoomPlugin::getMeetingRepository()->findOneBy(['meetingId' => $meetingId]);
$meetingUrl = api_get_path(WEB_PLUGIN_PATH).'zoom/subscription.php?meetingId='.$meeting->getMeetingId();
$endDate = new DateTime($meeting->formattedStartTime);
$endDate->add($meeting->durationInterval);
$values['title'] = $meeting->getTopic();
$values['content'] = '<p>'.$meeting->getAgenda().'</p>'
.'<p>'.$plugin->get_lang('UrlForSelfRegistration').'<br>'.Display::url($meetingUrl, $meetingUrl).'</p>';
$values['range_start'] = $meeting->formattedStartTime;
$values['range_end'] = $endDate->format('Y-m-d H:i');
$values['range'] = "{$values['range_start']} / {$values['range_end']}";
$values['send_mail'] = true;
$values['add_to_calendar'] = true;
$form->addHidden('type', 'zoom_conference');
$form->addHidden('meeting', $meeting->getMeetingId());
}
}
$form->addHeader($form_title);
$form->addText('title', get_lang('Title'), true);
@ -269,6 +299,13 @@ if ($action_todo) {
SystemAnnouncementManager::announcement_for_groups($announcement_id, $groupsToSend);
}
if (isset($meeting)) {
$em = Database::getManager();
$sysAnnouncement = $em->find(SysAnnouncement::class, $announcement_id);
$meeting->setSysAnnouncement($sysAnnouncement);
$em->flush();
}
echo Display::return_message(get_lang('AnnouncementAdded'), 'confirmation');
} else {
$show_announcement_list = false;

@ -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\CoreBundle\Entity\SysAnnouncement;
use Chamilo\CourseBundle\Entity\CGroupInfo;
use Chamilo\PluginBundle\Zoom\API\BaseMeetingTrait;
use Chamilo\PluginBundle\Zoom\API\MeetingInfoGet;
@ -162,12 +163,21 @@ class Meeting
*/
protected $accountEmail;
/**
* @var SysAnnouncement|null
*
* @ORM\OneToOne(targetEntity="Chamilo\CoreBundle\Entity\SysAnnouncement")
* @ORM\JoinColumn(name="sys_announcement_id", referencedColumnName="id", onDelete="SET NULL")
*/
protected $sysAnnouncement;
public function __construct()
{
$this->registrants = new ArrayCollection();
$this->recordings = new ArrayCollection();
$this->activities = new ArrayCollection();
$this->signAttendance = false;
$this->sysAnnouncement = null;
}
/**
@ -616,6 +626,18 @@ class Meeting
return $this->meetingInfoGet->agenda;
}
public function getSysAnnouncement(): ?SysAnnouncement
{
return $this->sysAnnouncement;
}
public function setSysAnnouncement(?SysAnnouncement $sysAnnouncement): Meeting
{
$this->sysAnnouncement = $sysAnnouncement;
return $this;
}
/**
* @throws Exception on unexpected start_time or duration
*/

@ -37,10 +37,16 @@ required to authenticate with JWT. To get them, create a JWT App:
## Changelog
**v0.5**
* Added the ability to create a system announcement.
**v0.4**
Added signed attendance to allow you to configure an attendance sheet where participants register their signature. The
* The creation of webinars is now allowed.
* Added signed attendance to allow you to configure an attendance sheet where participants register their signature. The
signed attendance functionality is similar to that found in the Exercise Signature plugin but does not reuse it.
* Allows you to use multiple accounts and subaccounts to create meetings/webinars
## Meetings - Webinars
@ -77,16 +83,21 @@ For a non-paying Zoom user, this plugin still works but participants will join a
The user that starts the meeting/webinar will be identified as the Zoom account that is defined in the plugin. Socreate
a generic account that works for all the users that start meetings.
# Changelog
# Databace changelog
## v0.4
Please, execute this queries in your database:
* The creation of webinars is now allowed.
* Allows you to use multiple accounts and subaccounts to create meetings/webinars
**Updating to v0.5 from v.0.4**
**Updating to v0.4 from v0.3**
```sql
ALTER TABLE plugin_zoom_meeting
ADD sys_announcement_id INT DEFAULT NULL;
ALTER TABLE plugin_zoom_meeting
ADD CONSTRAINT FK_3448092778FB10C FOREIGN KEY (sys_announcement_id) REFERENCES sys_announcement (id) ON DELETE SET NULL;
CREATE INDEX IDX_3448092778FB10C ON plugin_zoom_meeting (sys_announcement_id);
```
Please, execute this queries in your database:
**Updating to v0.4 from v0.3**
```sql
ALTER TABLE plugin_zoom_meeting

@ -41,7 +41,7 @@ if ($action == 'get_events') {
$schema = $isWebinar ? $conference->getWebinarSchema() : $conference->getMeetingInfoGet();
$endDate = new DateTime($conference->formattedStartTime);
$endDate->sub($conference->durationInterval);
$endDate->add($conference->durationInterval);
return [
'id' => 'meeting_'.$conference->getId(),

@ -38,6 +38,7 @@ if ($meeting->isCourseMeeting()) {
$startJoinURL = '';
$detailsURL = '';
$signature = '';
$btnAnnouncement = '';
$currentUser = api_get_user_entity(api_get_user_id());
$isConferenceManager = $plugin->userIsConferenceManager($meeting);
@ -60,6 +61,35 @@ try {
if ($isConferenceManager) {
$detailsURL = api_get_path(WEB_PLUGIN_PATH).'zoom/meeting.php?meetingId='.$meeting->getMeetingId();
}
if (api_is_platform_admin()) {
$announcementUrl = '';
if ($announcement = $meeting->getSysAnnouncement()) {
$announcementUrl = api_get_path(WEB_CODE_PATH).'admin/system_announcements.php?'
.http_build_query(
[
'action' => 'edit',
'id' => $announcement->getId(),
]
);
} else {
$announcementUrl = api_get_path(WEB_CODE_PATH).'admin/system_announcements.php?'
.http_build_query(
[
'action' => 'add',
'type' => 'zoom_conference',
'meeting' => $meeting->getMeetingId(),
]
);
}
$btnAnnouncement = Display::toolbarButton(
$announcement ? get_lang('EditSystemAnnouncement') : get_lang('AddSystemAnnouncement'),
$announcementUrl,
'bullhorn'
);
}
} catch (Exception $exception) {
Display::addFlash(
Display::return_message($exception->getMessage(), 'warning')
@ -72,6 +102,7 @@ $tpl = new Template($meeting->getMeetingId());
$tpl->assign('meeting', $meeting);
$tpl->assign('start_url', $startJoinURL);
$tpl->assign('details_url', $detailsURL);
$tpl->assign('btn_announcement', $btnAnnouncement);
$tpl->assign('is_conference_manager', $isConferenceManager);
$tpl->assign('signature', $signature);
$content = $tpl->fetch('zoom/view/join.tpl');

@ -53,7 +53,7 @@ class ZoomPlugin extends Plugin
public function __construct()
{
parent::__construct(
'0.4',
'0.5',
'Sébastien Ducoulombier, Julio Montoya, Angel Fernando Quiroz Campos',
[
'tool_enable' => 'boolean',
@ -93,7 +93,7 @@ class ZoomPlugin extends Plugin
*
* @return ZoomPlugin the instance to use
*/
public static function create()
public static function create(): ZoomPlugin
{
static $instance = null;

@ -190,3 +190,7 @@
{{ 'Details'|get_lang }}
</a>
{% endif %}
{% if btn_announcement %}
{{ btn_announcement }}
{% endif %}

Loading…
Cancel
Save