Minor - Plugins: Zoom - add group support - WIP - BT#17288

pull/3440/head
Julio Montoya 5 years ago
parent 068eb5d4a7
commit 736d5d9c9c
  1. 143
      main/group/group_space.php
  2. 6
      main/inc/ajax/myspace.ajax.php
  3. 8
      main/inc/lib/groupmanager.lib.php
  4. 10
      plugin/zoom/Entity/Meeting.php
  5. 1
      plugin/zoom/endpoint.php
  6. 1
      plugin/zoom/lib/API/BaseMeetingTrait.php
  7. 6
      plugin/zoom/lib/MeetingRepository.php
  8. 74
      plugin/zoom/lib/ZoomPlugin.php
  9. 13
      plugin/zoom/meeting.php
  10. 42
      plugin/zoom/start.php
  11. 8
      src/Chamilo/CourseBundle/Entity/CGroupInfo.php

@ -32,13 +32,11 @@ $interbreadcrumb[] = [
];
/* Ensure all private groups // Juan Carlos Raña Trabado */
$forums_of_groups = get_forums_of_group($current_group);
if (!GroupManager::userHasAccessToBrowse($user_id, $current_group, api_get_session_id())) {
api_not_allowed(true);
}
/* Actions and Action links */
/*
* User wants to register in this group
*/
@ -66,7 +64,6 @@ Display::display_header(
'Group'
);
/* Introduction section (editable by course admin) */
Display::display_introduction_section(TOOL_GROUP);
echo '<div class="actions">';
@ -84,7 +81,7 @@ echo '<a href="'.api_get_path(WEB_CODE_PATH).'group/group.php?'.api_get_cidreq()
*/
$subscribe_group = '';
if (GroupManager::is_self_registration_allowed($user_id, $current_group)) {
$subscribe_group = '<a class="btn btn-default" href="'.api_get_self().'?selfReg=1&group_id='.$current_group['id'].'" onclick="javascript: if(!confirm('."'".addslashes(api_htmlentities(get_lang("ConfirmYourChoice"), ENT_QUOTES))."'".')) return false;">'.
$subscribe_group = '<a class="btn btn-default" href="'.api_get_self().'?selfReg=1&group_id='.$current_group['id'].'" onclick="javascript: if(!confirm('."'".addslashes(api_htmlentities(get_lang('ConfirmYourChoice'), ENT_QUOTES))."'".')) return false;">'.
get_lang('RegIntoGroup').'</a>';
}
@ -93,7 +90,7 @@ if (GroupManager::is_self_registration_allowed($user_id, $current_group)) {
*/
$unsubscribe_group = '';
if (GroupManager :: is_self_unregistration_allowed($user_id, $current_group)) {
$unsubscribe_group = '<a class="btn btn-default" href="'.api_get_self().'?selfUnReg=1" onclick="javascript: if(!confirm('."'".addslashes(api_htmlentities(get_lang("ConfirmYourChoice"), ENT_QUOTES))."'".')) return false;">'.
$unsubscribe_group = '<a class="btn btn-default" href="'.api_get_self().'?selfUnReg=1" onclick="javascript: if(!confirm('."'".addslashes(api_htmlentities(get_lang('ConfirmYourChoice'), ENT_QUOTES))."'".')) return false;">'.
get_lang('StudentUnsubscribe').'</a>';
}
echo '&nbsp;</div>';
@ -116,18 +113,16 @@ if (!empty($current_group['description'])) {
echo '<p>'.Security::remove_XSS($current_group['description']).'</p>';
}
//if (GroupManager::userHasAccessToBrowse($user_id, $this_group, $session_id)) {
// If the user is subscribed to the group or the user is a tutor of the group then
if (api_is_allowed_to_edit(false, true) ||
GroupManager::userHasAccessToBrowse($user_id, $current_group, api_get_session_id())
) {
$actions_array = [];
if (is_array($forums_of_groups)) {
if ($current_group['forum_state'] != GroupManager::TOOL_NOT_AVAILABLE) {
if (GroupManager::TOOL_NOT_AVAILABLE != $current_group['forum_state']) {
foreach ($forums_of_groups as $key => $value) {
if ($value['forum_group_public_private'] == 'public' ||
($value['forum_group_public_private'] == 'private') ||
if ('public' === $value['forum_group_public_private'] ||
('private' === $value['forum_group_public_private']) ||
!empty($user_is_tutor) ||
api_is_allowed_to_edit(false, true)
) {
@ -145,7 +140,7 @@ if (api_is_allowed_to_edit(false, true) ||
}
}
if ($current_group['doc_state'] != GroupManager::TOOL_NOT_AVAILABLE) {
if (GroupManager::TOOL_NOT_AVAILABLE != $current_group['doc_state']) {
// Link to the documents area of this group
$actions_array[] = [
'url' => api_get_path(WEB_CODE_PATH).'document/document.php?'.api_get_cidreq(),
@ -153,7 +148,7 @@ if (api_is_allowed_to_edit(false, true) ||
];
}
if ($current_group['calendar_state'] != GroupManager::TOOL_NOT_AVAILABLE) {
if (GroupManager::TOOL_NOT_AVAILABLE != $current_group['calendar_state']) {
$groupFilter = '';
if (!empty($group_id)) {
$groupFilter = "&type=course&user_id=GROUP:$group_id";
@ -165,14 +160,14 @@ if (api_is_allowed_to_edit(false, true) ||
];
}
if ($current_group['work_state'] != GroupManager::TOOL_NOT_AVAILABLE) {
if (GroupManager::TOOL_NOT_AVAILABLE != $current_group['work_state']) {
// Link to the works area of this group
$actions_array[] = [
'url' => api_get_path(WEB_CODE_PATH).'work/work.php?'.api_get_cidreq(),
'content' => Display::return_icon('work.png', get_lang('GroupWork'), [], 32),
];
}
if ($current_group['announcements_state'] != GroupManager::TOOL_NOT_AVAILABLE) {
if (GroupManager::TOOL_NOT_AVAILABLE != $current_group['announcements_state']) {
// Link to a group-specific part of announcements
$actions_array[] = [
'url' => api_get_path(WEB_CODE_PATH).'announcements/announcements.php?'.api_get_cidreq(),
@ -180,7 +175,7 @@ if (api_is_allowed_to_edit(false, true) ||
];
}
if ($current_group['wiki_state'] != GroupManager::TOOL_NOT_AVAILABLE) {
if (GroupManager::TOOL_NOT_AVAILABLE != $current_group['wiki_state']) {
// Link to the wiki area of this group
$actions_array[] = [
'url' => api_get_path(WEB_CODE_PATH).'wiki/index.php?'.api_get_cidreq().'&action=show&title=index&session_id='.api_get_session_id().'&group_id='.$current_group['id'],
@ -188,44 +183,52 @@ if (api_is_allowed_to_edit(false, true) ||
];
}
if ($current_group['chat_state'] != GroupManager::TOOL_NOT_AVAILABLE) {
if (GroupManager::TOOL_NOT_AVAILABLE != $current_group['chat_state']) {
// Link to the chat area of this group
if (api_get_course_setting('allow_open_chat_window')) {
$actions_array[] = [
'url' => "javascript: void(0);",
'url' => 'javascript: void(0);',
'content' => Display::return_icon('chat.png', get_lang('Chat'), [], 32),
'url_attributes' => [
'onclick' => " window.open('../chat/chat.php?".api_get_cidreq()."&toolgroup=".$current_group['id']."','window_chat_group_".api_get_course_id()."_".api_get_group_id()."','height=380, width=625, left=2, top=2, toolbar=no, menubar=no, scrollbars=yes, resizable=yes, location=no, directories=no, status=no')",
'onclick' => " window.open('../chat/chat.php?".api_get_cidreq().'&toolgroup='.$current_group['id']."','window_chat_group_".api_get_course_id().'_'.api_get_group_id()."','height=380, width=625, left=2, top=2, toolbar=no, menubar=no, scrollbars=yes, resizable=yes, location=no, directories=no, status=no')",
],
];
} else {
$actions_array[] = [
'url' => api_get_path(WEB_CODE_PATH)."chat/chat.php?".api_get_cidreq()."&toolgroup=".$current_group['id'],
'url' => api_get_path(WEB_CODE_PATH).'chat/chat.php?'.api_get_cidreq().'&toolgroup='.$current_group['id'],
'content' => Display::return_icon('chat.png', get_lang('Chat'), [], 32),
];
}
}
$enabled = api_get_plugin_setting('bbb', 'tool_enable');
if ($enabled === 'true') {
if ('true' === $enabled) {
$bbb = new bbb();
if ($bbb->hasGroupSupport()) {
$actions_array[] = [
'url' => api_get_path(WEB_PLUGIN_PATH)."bbb/start.php?".api_get_cidreq(),
'url' => api_get_path(WEB_PLUGIN_PATH).'bbb/start.php?'.api_get_cidreq(),
'content' => Display::return_icon('bbb.png', get_lang('VideoConference'), [], 32),
];
}
}
$enabled = api_get_plugin_setting('zoom', 'tool_enable');
if ('true' === $enabled) {
$actions_array[] = [
'url' => api_get_path(WEB_PLUGIN_PATH).'zoom/start.php?'.api_get_cidreq(),
'content' => Display::return_icon('bbb.png', get_lang('VideoConference'), [], 32),
];
}
if (!empty($actions_array)) {
echo Display::actions($actions_array);
}
} else {
$actions_array = [];
if (is_array($forums_of_groups)) {
if ($current_group['forum_state'] == GroupManager::TOOL_PUBLIC) {
if (GroupManager::TOOL_PUBLIC == $current_group['forum_state']) {
foreach ($forums_of_groups as $key => $value) {
if ($value['forum_group_public_private'] == 'public') {
if ('public' === $value['forum_group_public_private']) {
$actions_array[] = [
'url' => api_get_path(WEB_CODE_PATH).'forum/viewforum.php?cidReq='.api_get_course_id().'&forum='.$value['forum_id'].'&gidReq='.Security::remove_XSS($current_group['id']).'&origin=group',
'content' => Display::return_icon(
@ -240,7 +243,7 @@ if (api_is_allowed_to_edit(false, true) ||
}
}
if ($current_group['doc_state'] == GroupManager::TOOL_PUBLIC) {
if (GroupManager::TOOL_PUBLIC == $current_group['doc_state']) {
// Link to the documents area of this group
$actions_array[] = [
'url' => api_get_path(WEB_CODE_PATH).'document/document.php?'.api_get_cidreq(),
@ -248,7 +251,7 @@ if (api_is_allowed_to_edit(false, true) ||
];
}
if ($current_group['calendar_state'] == GroupManager::TOOL_PUBLIC) {
if (GroupManager::TOOL_PUBLIC == $current_group['calendar_state']) {
$groupFilter = '';
if (!empty($group_id)) {
$groupFilter = "&type=course&user_id=GROUP:$group_id";
@ -260,7 +263,7 @@ if (api_is_allowed_to_edit(false, true) ||
];
}
if ($current_group['work_state'] == GroupManager::TOOL_PUBLIC) {
if (GroupManager::TOOL_PUBLIC == $current_group['work_state']) {
// Link to the works area of this group
$actions_array[] = [
'url' => api_get_path(WEB_CODE_PATH).'work/work.php?'.api_get_cidreq(),
@ -268,7 +271,7 @@ if (api_is_allowed_to_edit(false, true) ||
];
}
if ($current_group['announcements_state'] == GroupManager::TOOL_PUBLIC) {
if (GroupManager::TOOL_PUBLIC == $current_group['announcements_state']) {
// Link to a group-specific part of announcements
$actions_array[] = [
'url' => api_get_path(WEB_CODE_PATH).'announcements/announcements.php?'.api_get_cidreq(),
@ -276,7 +279,7 @@ if (api_is_allowed_to_edit(false, true) ||
];
}
if ($current_group['wiki_state'] == GroupManager::TOOL_PUBLIC) {
if (GroupManager::TOOL_PUBLIC == $current_group['wiki_state']) {
// Link to the wiki area of this group
$actions_array[] = [
'url' => api_get_path(WEB_CODE_PATH).'wiki/index.php?'.api_get_cidreq().'&action=show&title=index&session_id='.api_get_session_id().'&group_id='.$current_group['id'],
@ -284,16 +287,16 @@ if (api_is_allowed_to_edit(false, true) ||
];
}
if ($current_group['chat_state'] == GroupManager::TOOL_PUBLIC) {
if (GroupManager::TOOL_PUBLIC == $current_group['chat_state']) {
// Link to the chat area of this group
if (api_get_course_setting('allow_open_chat_window')) {
$actions_array[] = [
'url' => "javascript: void(0);\" onclick=\"window.open('../chat/chat.php?".api_get_cidreq()."&toolgroup=".$current_group['id']."','window_chat_group_".api_get_course_id()."_".api_get_group_id()."','height=380, width=625, left=2, top=2, toolbar=no, menubar=no, scrollbars=yes, resizable=yes, location=no, directories=no, status=no') \"",
'url' => "javascript: void(0);\" onclick=\"window.open('../chat/chat.php?".api_get_cidreq().'&toolgroup='.$current_group['id']."','window_chat_group_".api_get_course_id().'_'.api_get_group_id()."','height=380, width=625, left=2, top=2, toolbar=no, menubar=no, scrollbars=yes, resizable=yes, location=no, directories=no, status=no') \"",
'content' => Display::return_icon('chat.png', get_lang('Chat'), [], 32),
];
} else {
$actions_array[] = [
'url' => api_get_path(WEB_CODE_PATH)."chat/chat.php?".api_get_cidreq()."&toolgroup=".$current_group['id'],
'url' => api_get_path(WEB_CODE_PATH).'chat/chat.php?'.api_get_cidreq().'&toolgroup='.$current_group['id'],
'content' => Display::return_icon('chat.png', get_lang('Chat'), [], 32),
];
}
@ -309,7 +312,7 @@ if (api_is_allowed_to_edit(false, true) ||
*/
$tutors = GroupManager::get_subscribed_tutors($current_group);
$tutor_info = '';
if (count($tutors) == 0) {
if (0 == count($tutors)) {
$tutor_info = get_lang('GroupNoneMasc');
} else {
$tutor_info .= '<ul class="thumbnails">';
@ -357,7 +360,7 @@ if (api_is_western_name_order()) {
$table->set_header(2, get_lang('FirstName'));
}
if (api_get_setting('show_email_addresses') == 'true' || api_is_allowed_to_edit() == 'true') {
if ('true' == api_get_setting('show_email_addresses') || 'true' == api_is_allowed_to_edit()) {
$table->set_header(3, get_lang('Email'));
$table->set_column_filter(3, 'email_filter');
$table->set_header(4, get_lang('Active'));
@ -396,8 +399,8 @@ function get_number_of_group_users()
// Query
$sql = "SELECT count(iid) AS number_of_users
FROM $table
WHERE
c_id = $course_id AND
WHERE
c_id = $course_id AND
group_id = '".intval($groupInfo['iid'])."'";
$result = Database::query($sql);
$return = Database::fetch_array($result, 'ASSOC');
@ -434,73 +437,73 @@ function get_group_user_data($from, $number_of_items, $column, $direction)
$tableGroup = Database::get_course_table(TABLE_GROUP);
// Query
if (api_get_setting('show_email_addresses') === 'true') {
$sql = "SELECT user.id AS col0,
".(
if ('true' === api_get_setting('show_email_addresses')) {
$sql = 'SELECT user.id AS col0,
'.(
api_is_western_name_order() ?
"user.firstname AS col1,
user.lastname AS col2,"
'user.firstname AS col1,
user.lastname AS col2,'
:
"user.lastname AS col1,
user.firstname AS col2,"
'user.lastname AS col1,
user.firstname AS col2,'
)."
user.email AS col3
, user.active AS col4
FROM $table_user user
FROM $table_user user
INNER JOIN $table_group_user group_rel_user
ON (group_rel_user.user_id = user.id)
INNER JOIN $tableGroup g
ON (group_rel_user.group_id = g.iid)
WHERE
group_rel_user.c_id = $course_id AND
WHERE
group_rel_user.c_id = $course_id AND
g.iid = '".$groupInfo['iid']."'
ORDER BY col$column $direction
ORDER BY col$column $direction
LIMIT $from, $number_of_items";
} else {
if (api_is_allowed_to_edit()) {
$sql = "SELECT DISTINCT
$sql = 'SELECT DISTINCT
u.id AS col0,
".(api_is_western_name_order() ?
"u.firstname AS col1,
u.lastname AS col2,"
'.(api_is_western_name_order() ?
'u.firstname AS col1,
u.lastname AS col2,'
:
"u.lastname AS col1,
u.firstname AS col2,")."
'u.lastname AS col1,
u.firstname AS col2,')."
u.email AS col3
, u.active AS col4
FROM $table_user u
INNER JOIN $table_group_user gu
FROM $table_user u
INNER JOIN $table_group_user gu
ON (gu.user_id = u.id)
INNER JOIN $tableGroup g
ON (gu.group_id = g.iid)
WHERE
g.iid = '".$groupInfo['iid']."' AND
WHERE
g.iid = '".$groupInfo['iid']."' AND
gu.c_id = $course_id
ORDER BY col$column $direction
ORDER BY col$column $direction
LIMIT $from, $number_of_items";
} else {
$sql = "SELECT DISTINCT
$sql = 'SELECT DISTINCT
user.id AS col0,
".(
'.(
api_is_western_name_order() ?
"user.firstname AS col1,
user.lastname AS col2 "
'user.firstname AS col1,
user.lastname AS col2 '
:
"user.lastname AS col1,
user.firstname AS col2 "
'user.lastname AS col1,
user.firstname AS col2 '
)."
, user.active AS col3
FROM $table_user user
FROM $table_user user
INNER JOIN $table_group_user group_rel_user
ON (group_rel_user.user_id = user.id)
INNER JOIN $tableGroup g
ON (group_rel_user.group_id = g.iid)
WHERE
g.iid = '".$groupInfo['iid']."' AND
group_rel_user.c_id = $course_id AND
group_rel_user.user_id = user.id AND
WHERE
g.iid = '".$groupInfo['iid']."' AND
group_rel_user.c_id = $course_id AND
group_rel_user.user_id = user.id AND
g.iid = '".$groupInfo['iid']."'
ORDER BY col$column $direction
ORDER BY col$column $direction
LIMIT $from, $number_of_items";
}
}
@ -573,6 +576,6 @@ function user_name_filter($name, $url_params, $row)
return UserManager::getUserProfileLink($userInfo);
}
if ($origin != 'learnpath') {
if ('learnpath' !== $origin) {
Display::display_footer();
}

@ -2,8 +2,6 @@
/* For licensing terms, see /license.txt */
use ChamiloSession as Session;
/**
* Responses to AJAX calls.
*/
@ -65,7 +63,7 @@ switch ($action) {
}
$total++;
$totalSessionAverage = round($totalSessionAverage/count($courses), 2);
$totalSessionAverage = round($totalSessionAverage / count($courses), 2);
$totalAverage += $totalSessionAverage;
$row++;
@ -83,7 +81,7 @@ switch ($action) {
}
$table->setCellContents(0, 0, get_lang('Global'));
$table->setCellContents(0, 1, round($totalAverage/$total, 2).' %');
$table->setCellContents(0, 1, round($totalAverage / $total, 2).' %');
$result = $table->toHtml();
if ($cacheAvailable) {

@ -1569,9 +1569,9 @@ class GroupManager
}
return self::canUserSubscribe($user_id, $groupInfo);
} else {
return false;
}
return false;
}
/**
@ -1619,8 +1619,8 @@ class GroupManager
return false;
}
$table = Database::get_course_table(TABLE_GROUP_USER);
$group_id = intval($groupInfo['id']);
$user_id = intval($user_id);
$group_id = (int) $groupInfo['id'];
$user_id = (int) $user_id;
$sql = "SELECT 1 FROM $table
WHERE

@ -86,7 +86,7 @@ class Meeting
/**
* @var CGroupInfo
* @ORM\ManyToOne(targetEntity="Chamilo\CourseBundle\Entity\CGroupInfo")
* @ORM\JoinColumn(name="group_id", referencedColumnName="id", nullable=true)
* @ORM\JoinColumn(name="group_id", referencedColumnName="iid", nullable=true)
*/
protected $group;
@ -402,6 +402,14 @@ class Meeting
return null !== $this->course;
}
/**
* @return bool
*/
public function isCourseGroupMeeting()
{
return null !== $this->course && null !== $this->group;
}
/**
* @return bool
*/

@ -6,7 +6,6 @@ use Chamilo\PluginBundle\Zoom\API\RecordingMeeting;
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']) {

@ -28,6 +28,5 @@ trait BaseMeetingTrait
/** @var string description */
public $agenda;
/** @var string description */
public $host_email;
}

@ -187,13 +187,9 @@ class MeetingRepository extends EntityRepository
/**
* Returns either a course's meetings or all course meetings.
*
* @param Course|null $course
* @param Session|null $session
* @param CGroupInfo|null $group
*
* @return ArrayCollection|Collection|Meeting[]
*/
public function courseMeetings($course, $group = null, $session = null)
public function courseMeetings(Course $course, CGroupInfo $group = null, Session $session = null)
{
return $this->matching(
Criteria::create()->where(

@ -634,15 +634,19 @@ class ZoomPlugin extends Plugin
* Generates a form to fast and easily create and start an instant meeting.
* On validation, create it then redirect to it and exit.
*
* @param User $user
* @param Course $course
* @param Session $session
*
* @return FormValidator
*/
public function getCreateInstantMeetingForm($user, $course, $group, $session)
{
$form = new FormValidator('createInstantMeetingForm', 'post', '', '_blank');
public function getCreateInstantMeetingForm(
User $user,
Course $course,
CGroupInfo $group = null,
Session $session = null
) {
$extraUrl = '';
if (!empty($course)) {
$extraUrl = api_get_cidreq();
}
$form = new FormValidator('createInstantMeetingForm', 'post', api_get_self().'?'.$extraUrl, '_blank');
$form->addButton('startButton', $this->get_lang('StartInstantMeeting'), 'video-camera', 'primary');
if ($form->validate()) {
try {
@ -661,17 +665,17 @@ class ZoomPlugin extends Plugin
* Generates a form to schedule a meeting.
* On validation, creates it and redirects to its page.
*
* @param User|null $user
* @param Course|null $course
* @param Session|null $session
*
* @throws Exception
*
* @return FormValidator
*/
public function getScheduleMeetingForm($user, $course = null, $group = null, $session = null)
public function getScheduleMeetingForm(User $user, Course $course = null, CGroupInfo $group = null, Session $session = null)
{
$form = new FormValidator('scheduleMeetingForm');
$extraUrl = '';
if (!empty($course)) {
$extraUrl = api_get_cidreq();
}
$form = new FormValidator('scheduleMeetingForm', 'post', api_get_self().'?'.$extraUrl);
$form->addHeader($this->get_lang('ScheduleAMeeting'));
$startTimeDatePicker = $form->addDateTimePicker('startTime', get_lang('StartTime'));
$form->setRequired($startTimeDatePicker);
@ -743,6 +747,7 @@ class ZoomPlugin extends Plugin
switch ($type) {
case 'everyone':
$user = null;
$group = null;
$course = null;
$session = null;
@ -798,7 +803,7 @@ class ZoomPlugin extends Plugin
);
}
}
api_location('meeting.php?meetingId='.$newMeeting->getMeetingId());
api_location('meeting.php?meetingId='.$newMeeting->getMeetingId().'&'.$extraUrl);
} catch (Exception $exception) {
Display::addFlash(
Display::return_message($exception->getMessage(), 'error')
@ -854,7 +859,8 @@ class ZoomPlugin extends Plugin
public function getStartOrJoinMeetingURL($meeting)
{
$status = $meeting->getMeetingInfoGet()->status;
$currentUser = api_get_user_entity(api_get_user_id());
$userId = api_get_user_id();
$currentUser = api_get_user_entity($userId);
$isGlobal = 'true' === $this->get('enableGlobalConference') && $meeting->isGlobalMeeting();
switch ($status) {
@ -892,22 +898,32 @@ class ZoomPlugin extends Plugin
}
$sessionId = api_get_session_id();
$courseCode = api_get_course_id();
if (empty($sessionId)) {
$isSubscribed = CourseManager::is_user_subscribed_in_course(
$currentUser->getId(),
api_get_course_id(),
$userId,
$courseCode,
false
);
} else {
$isSubscribed = CourseManager::is_user_subscribed_in_course(
$currentUser->getId(),
api_get_course_id(),
$userId,
$courseCode,
true,
api_get_session_id()
$sessionId
);
}
if ($isSubscribed) {
if ($meeting->isCourseGroupMeeting()) {
$groupInfo = GroupManager::get_group_properties($meeting->getGroup()->getIid(), true);
$isInGroup = GroupManager::is_user_in_group($userId, $groupInfo);
if (false === $isInGroup) {
throw new Exception($this->get_lang('YouAreNotRegisteredToThisMeeting'));
}
}
return $this->registerUser($meeting, $currentUser)->getCreatedRegistration()->join_url;
}
@ -1131,16 +1147,12 @@ class ZoomPlugin extends Plugin
}
/**
* @param Meeting $meeting
* @param User $user
* @param bool $andFlush
*
* @throws Exception
* @throws OptimisticLockException
*
* @return Registrant
*/
private function registerUser($meeting, $user, $andFlush = true)
private function registerUser(Meeting $meeting, User $user, $andFlush = true)
{
if (empty($user->getEmail())) {
throw new Exception($this->get_lang('CannotRegisterWithoutEmailAddress'));
@ -1158,6 +1170,7 @@ class ZoomPlugin extends Plugin
->setMeetingRegistrant($meetingRegistrant)
->setCreatedRegistration($meeting->getMeetingInfoGet()->addRegistrant($meetingRegistrant));
Database::getManager()->persist($registrantEntity);
if ($andFlush) {
Database::getManager()->flush($registrantEntity);
}
@ -1269,9 +1282,6 @@ class ZoomPlugin extends Plugin
* Schedules a meeting and returns it.
* set $course, $session and $user to null in order to create a global meeting.
*
* @param User|null $user the current user, for a course meeting or a user meeting
* @param Course|null $course the course, for a course meeting
* @param Session|null $session the session, for a course meeting
* @param DateTime $startTime meeting local start date-time (configure local timezone on your Zoom account)
* @param int $duration in minutes
* @param string $topic short title of the meeting, required
@ -1283,10 +1293,10 @@ class ZoomPlugin extends Plugin
* @return Meeting meeting
*/
private function createScheduleMeeting(
$user,
$course,
$group,
$session,
User $user = null,
Course $course = null,
CGroupInfo $group = null,
Session $session = null,
$startTime,
$duration,
$topic,

@ -25,8 +25,19 @@ $urlExtra = '';
if ($meeting->isCourseMeeting()) {
api_protect_course_script(true);
$this_section = SECTION_COURSES;
$returnURL = 'start.php?'.api_get_cidreq();
$urlExtra = api_get_cidreq();
$returnURL = 'start.php?'.$urlExtra;
if (api_is_in_group()) {
$interbreadcrumb[] = [
'url' => api_get_path(WEB_CODE_PATH).'group/group.php?'.$urlExtra,
'name' => get_lang('Groups'),
];
$interbreadcrumb[] = [
'url' => api_get_path(WEB_CODE_PATH).'group/group_space.php?'.$urlExtra,
'name' => get_lang('GroupSpace').' '.$meeting->getGroup()->getName(),
];
}
}
$logInfo = [

@ -15,12 +15,29 @@ $logInfo = [
];
Event::registerLog($logInfo);
$plugin = ZoomPlugin::create();
$tool_name = $plugin->get_lang('ZoomVideoConferences');
$tpl = new Template($tool_name);
$course = api_get_course_entity();
if (null === $course) {
api_not_allowed(true);
}
$group = api_get_group_entity();
$session = api_get_session_entity();
$plugin = ZoomPlugin::create();
if (api_is_in_group()) {
$interbreadcrumb[] = [
'url' => api_get_path(WEB_CODE_PATH).'group/group.php?'.api_get_cidreq(),
'name' => get_lang('Groups'),
];
$interbreadcrumb[] = [
'url' => api_get_path(WEB_CODE_PATH).'group/group_space.php?'.api_get_cidreq(),
'name' => get_lang('GroupSpace').' '.$group->getName(),
];
}
$tool_name = $plugin->get_lang('ZoomVideoConferences');
$tpl = new Template($tool_name);
$action = isset($_REQUEST['action']) ? $_REQUEST['action'] : '';
$isManager = $plugin->userIsCourseConferenceManager();
@ -28,7 +45,7 @@ if ($isManager) {
switch ($action) {
case 'delete':
$meeting = $plugin->getMeetingRepository()->findOneBy(['meetingId' => $_REQUEST['meetingId']]);
if ($meeting->isCourseMeeting()) {
if ($meeting && $meeting->isCourseMeeting()) {
$plugin->deleteMeeting($meeting, api_get_self().'?'.api_get_cidreq());
}
break;
@ -41,16 +58,19 @@ if ($isManager) {
$plugin->getCreateInstantMeetingForm(
$user,
$course,
$group,
$group,
$session
)->returnForm()
);
$tpl->assign(
'scheduleMeetingForm',
$plugin->getScheduleMeetingForm(
$user,
$course,
$group,
$session
)->returnForm()
);
$tpl->assign('scheduleMeetingForm', $plugin->getScheduleMeetingForm(
$user,
$course,
$group,
$session
)->returnForm());
}
try {

@ -161,6 +161,14 @@ class CGroupInfo
*/
//protected $docAccess;
/**
* @return int
*/
public function getIid()
{
return $this->iid;
}
/**
* Set name.
*

Loading…
Cancel
Save