Actualización
18
plugin/google_meet/README.md
Normal file
@@ -0,0 +1,18 @@
|
||||
Google Meet plugin
|
||||
============================
|
||||
This plugin allows you to have videoconference rooms in each course using Google Meet.
|
||||
This is only a light integration, meaning you will still need to go to Google Meet and
|
||||
have a Google account in order to create a meeting *and* students will need to be
|
||||
connected to their Google account to connect. However, we believe there is still value
|
||||
in making this plugin available for our community at large.
|
||||
|
||||
# Changelog
|
||||
|
||||
## Version 1.1 - 2020-11-29
|
||||
|
||||
Add sessions management
|
||||
|
||||
## Version 1.0 - 2020-07-09
|
||||
|
||||
Initial release. Includes the possibility to create meetings manually, through
|
||||
a link to https://meet.google.com/
|
||||
10
plugin/google_meet/config.php
Normal file
@@ -0,0 +1,10 @@
|
||||
<?php
|
||||
/**
|
||||
* Config the plugin.
|
||||
*
|
||||
* @author Alex Aragón Calixto <alex.aragon@tunqui.pe>
|
||||
*
|
||||
* @package chamilo.plugin.google_meet
|
||||
*/
|
||||
require_once __DIR__.'/../../main/inc/global.inc.php';
|
||||
require_once 'src/google_meet_plugin.class.php';
|
||||
10
plugin/google_meet/install.php
Normal file
@@ -0,0 +1,10 @@
|
||||
<?php
|
||||
/* For licensing terms, see /license.txt */
|
||||
/**
|
||||
* Config the plugin.
|
||||
*
|
||||
* @package chamilo.plugin.google_meet
|
||||
*/
|
||||
require_once __DIR__.'/config.php';
|
||||
|
||||
GoogleMeetPlugin::create()->install();
|
||||
22
plugin/google_meet/lang/english.php
Normal file
@@ -0,0 +1,22 @@
|
||||
<?php
|
||||
/* For licensing terms, see /license.txt */
|
||||
|
||||
$strings['plugin_title'] = 'Google Meet';
|
||||
$strings['plugin_comment'] = 'Google Meet is the videoconference system from Google.';
|
||||
$strings['tool_title'] = 'Tool name';
|
||||
$strings['tool_title_help'] = 'You can change the tool name to something else than "Google Meet". For example: Videoconference';
|
||||
$strings['google_meet_enabled'] = 'Enable the Google Meet tool';
|
||||
$strings['google_meet_enabled_help'] = 'Choose whether you want to enable this tool. This will make a new tool available on the homepage of every course.';
|
||||
$strings['CourseDoesNotHaveAccountGoogleMeet'] = 'This course does not have a meeting configured.';
|
||||
$strings['ManageMeetAccounts'] = 'Add a new Google Meet meeting';
|
||||
$strings['AddMeet'] = 'Register a new meeting';
|
||||
$strings['EditMeet'] = 'Edit meeting';
|
||||
$strings['MeetName'] = 'Name of the meeting';
|
||||
$strings['MeetNameHelp'] = 'Assign a name for the meeting (e.g. Room 1 - Strategy)';
|
||||
$strings['GoogleMeetURL'] = 'Meeting URL';
|
||||
$strings['GoogleMeetURLHelp'] = 'This is the URL to start a new instant meeting with Google Meet. If you do not have a meeting URL yet, <a href="%s" target="_blank">click here</a> to create one, then save the URL and put it in this field.';
|
||||
$strings['AccessMeeting'] = 'Access the meeting';
|
||||
$strings['MeetingDescription'] = 'Description';
|
||||
$strings['MeetingDescriptionHelp'] = '(Optional) Add a short description for the meeting.';
|
||||
$strings['MeetColor'] = 'Color of Meet';
|
||||
$strings['MeetColorHelp'] = '(Optional)';
|
||||
22
plugin/google_meet/lang/french.php
Normal file
@@ -0,0 +1,22 @@
|
||||
<?php
|
||||
/* For licensing terms, see /license.txt */
|
||||
|
||||
$strings['plugin_title'] = 'Google Meet';
|
||||
$strings['plugin_comment'] = 'Google Meet est le système de vidéoconférence de Google.';
|
||||
$strings['tool_title'] = "Nom de l'outil";
|
||||
$strings['tool_title_help'] = 'Vous pouvez modifier le nom de cet outil dans les cours à autre chose que "Google Meet". Par exemple: Vidéoconférence';
|
||||
$strings['google_meet_enabled'] = "Activer l'outil";
|
||||
$strings['google_meet_enabled_help'] = "Choisissez si vous souhaitez activer/désactiver cet outil. L'activer rendra un nouvel outil disponible sur la page principale de chaque cours.";
|
||||
$strings['CourseDoesNotHaveAccountGoogleMeet'] = "Ce cours n'a encore aucune réunion configurée.";
|
||||
$strings['ManageMeetAccounts'] = 'Ajouter une nouvelle réunion Google Meet';
|
||||
$strings['AddMeet'] = 'Enregistrer une nouvelle réunion';
|
||||
$strings['EditMeet'] = 'Éditer la réunion';
|
||||
$strings['MeetName'] = 'Titre de la réunion';
|
||||
$strings['MeetNameHelp'] = 'Assignez-lui un nom (ex: Salle 1 - Stratégie)';
|
||||
$strings['GoogleMeetURL'] = 'URL de la réunion';
|
||||
$strings['GoogleMeetURLHelp'] = 'Il s\'agit de l\'URL de démarrage de la réunion sur Google Meet. Si vous n\'avez pas encore d\'URL, <a href="%s" target="_blank">cliquez ici</a> pour en créer une, puis copiez son URL et collez-la dans ce champs.';
|
||||
$strings['AccessMeeting'] = 'Accéder à la réunion';
|
||||
$strings['MeetingDescription'] = 'Description';
|
||||
$strings['MeetingDescriptionHelp'] = '(Optionnel) Ajouter une brève description.';
|
||||
$strings['MeetColor'] = 'Couleur de la réunion';
|
||||
$strings['MeetColorHelp'] = '(Optionnel)';
|
||||
22
plugin/google_meet/lang/spanish.php
Normal file
@@ -0,0 +1,22 @@
|
||||
<?php
|
||||
/* For licensing terms, see /license.txt */
|
||||
|
||||
$strings['plugin_title'] = 'Google Meet';
|
||||
$strings['plugin_comment'] = 'Google Meet es el sistema de videoconferencia de Google.';
|
||||
$strings['tool_title'] = 'Nombre de la herramienta';
|
||||
$strings['tool_title_help'] = 'Puede cambiar el nombre de la herramienta Google Meet. Ejemplo: Videoconferencia';
|
||||
$strings['google_meet_enabled'] = 'Activar herramienta Google Meet';
|
||||
$strings['google_meet_enabled_help'] = 'Escoja si desea activar el plugin en esta plataforma. Esta acción activará una herramienta extra en la página principal del curso.';
|
||||
$strings['CourseDoesNotHaveAccountGoogleMeet'] = 'Este curso no tiene configurado una reunión Google Meet.';
|
||||
$strings['ManageMeetAccounts'] = 'Agregar una reunión Google Meet';
|
||||
$strings['AddMeet'] = 'Registrar reunión Google Meet';
|
||||
$strings['EditMeet'] = 'Editar reunión Google Meet';
|
||||
$strings['MeetName'] = 'Nombre de la reunión';
|
||||
$strings['MeetNameHelp'] = 'Asigne un nombre para la reunión. Ejemplo: Sala 1';
|
||||
$strings['GoogleMeetURL'] = 'URL del Meet';
|
||||
$strings['GoogleMeetURLHelp'] = 'Es la URL para iniciar una reunión instantánea con Google Meet. Si no tiene una URL de reunión todavía, <a href=\"%s\" target=\"_blank\">haga clic aquí</a> para crear una, luego guarde la URL y colóquela en el campo arriba.';
|
||||
$strings['AccessMeeting'] = 'Acceder a la reunión';
|
||||
$strings['MeetingDescription'] = 'Descripción';
|
||||
$strings['MeetingDescriptionHelp'] = '(Opcional) Añada una breve descripción sobre la reunión.';
|
||||
$strings['MeetColor'] = 'Color de Meet';
|
||||
$strings['MeetColorHelp'] = '(Opcional)';
|
||||
226
plugin/google_meet/meets.php
Normal file
@@ -0,0 +1,226 @@
|
||||
<?php
|
||||
/**
|
||||
* This script initiates a video conference session, c the Google Meet.
|
||||
*/
|
||||
require_once __DIR__.'/../../vendor/autoload.php';
|
||||
|
||||
$course_plugin = 'google_meet'; //needed in order to load the plugin lang variables
|
||||
require_once __DIR__.'/config.php';
|
||||
|
||||
$htmlHeadXtra[] = '<link rel="stylesheet" type="text/css" href="'.api_get_path(
|
||||
WEB_PLUGIN_PATH
|
||||
).'google_meet/resources/css/style.css"/>';
|
||||
|
||||
$plugin = GoogleMeetPlugin::create();
|
||||
|
||||
$userId = api_get_user_id();
|
||||
$tool_name = $plugin->get_lang('tool_title');
|
||||
$tpl = new Template($tool_name);
|
||||
|
||||
$isAdmin = api_is_platform_admin();
|
||||
$isTeacher = api_is_teacher();
|
||||
$message = null;
|
||||
|
||||
$action = isset($_GET['action']) ? $_GET['action'] : null;
|
||||
$enable = $plugin->get('google_meet_enabled') == 'true';
|
||||
$actionLinks = '';
|
||||
|
||||
if ($enable) {
|
||||
if ($isAdmin || $isTeacher) {
|
||||
if ($action) {
|
||||
switch ($action) {
|
||||
case 'delete':
|
||||
$idMeet = isset($_GET['id_meet']) ? $_GET['id_meet'] : null;
|
||||
$res = $plugin->deleteMeet($idMeet);
|
||||
if ($res) {
|
||||
$url = api_get_path(WEB_PLUGIN_PATH).'google_meet/start.php?'.api_get_cidreq();
|
||||
header('Location: '.$url);
|
||||
}
|
||||
|
||||
break;
|
||||
case 'add':
|
||||
$actionLinks .= Display::url(
|
||||
Display::return_icon('back.png', get_lang('Back'), [], ICON_SIZE_MEDIUM),
|
||||
api_get_path(WEB_PLUGIN_PATH).'google_meet/start.php?'.api_get_cidreq()
|
||||
);
|
||||
//create form
|
||||
$form = new FormValidator(
|
||||
'add_meet',
|
||||
'post',
|
||||
api_get_self().'?action='.Security::remove_XSS($_GET['action']).'&'.api_get_cidreq()
|
||||
);
|
||||
|
||||
$form->addHeader(get_lang('AddMeet'));
|
||||
$form->addText(
|
||||
'meet_name',
|
||||
[
|
||||
$plugin->get_lang('MeetName'),
|
||||
$plugin->get_lang('MeetNameHelp'),
|
||||
],
|
||||
true,
|
||||
[
|
||||
'title' => $plugin->get_lang('MeetNameHelp'),
|
||||
]
|
||||
);
|
||||
|
||||
$form->addText(
|
||||
'meet_url',
|
||||
[
|
||||
$plugin->get_lang('GoogleMeetURL'),
|
||||
sprintf($plugin->get_lang('GoogleMeetURLHelp'), GoogleMeetPlugin::GOOGLE_MEET_URL),
|
||||
],
|
||||
true,
|
||||
[
|
||||
'title' => sprintf($plugin->get_lang('GoogleMeetURLHelp'), GoogleMeetPlugin::GOOGLE_MEET_URL),
|
||||
]
|
||||
);
|
||||
|
||||
try {
|
||||
$form->addElement(
|
||||
'color',
|
||||
'meet_color',
|
||||
[
|
||||
$plugin->get_lang('MeetColor'),
|
||||
$plugin->get_lang('MeetColorHelp'),
|
||||
],
|
||||
[
|
||||
'value' => '#1CC88A',
|
||||
]
|
||||
);
|
||||
} catch (HTML_QuickForm_Error $e) {
|
||||
echo $e;
|
||||
}
|
||||
|
||||
$form->addHtmlEditor(
|
||||
'meet_description',
|
||||
[
|
||||
$plugin->get_lang('MeetingDescription'),
|
||||
$plugin->get_lang('MeetingDescriptionHelp'),
|
||||
],
|
||||
false,
|
||||
false,
|
||||
[
|
||||
'ToolbarSet' => 'Minimal',
|
||||
]
|
||||
);
|
||||
|
||||
$form->addHidden('type_meet', 1);
|
||||
|
||||
$form->addButtonSave($plugin->get_lang('Add'));
|
||||
|
||||
if (!empty($defaults)) {
|
||||
$form->setDefaults($defaults);
|
||||
}
|
||||
|
||||
try {
|
||||
if ($form->validate()) {
|
||||
$values = $form->exportValues();
|
||||
$res = $plugin->saveMeet($values);
|
||||
if ($res) {
|
||||
$url = api_get_path(WEB_PLUGIN_PATH).'google_meet/start.php?'.api_get_cidreq();
|
||||
header('Location: '.$url);
|
||||
}
|
||||
}
|
||||
} catch (HTML_QuickForm_Error $e) {
|
||||
echo $e;
|
||||
}
|
||||
|
||||
$tpl->assign('form_room', $form->returnForm());
|
||||
|
||||
break;
|
||||
case 'edit':
|
||||
$actionLinks .= Display::url(
|
||||
Display::return_icon('back.png', get_lang('Back'), [], ICON_SIZE_MEDIUM),
|
||||
api_get_path(WEB_PLUGIN_PATH).'google_meet/start.php?'.api_get_cidreq()
|
||||
);
|
||||
|
||||
$idMeet = isset($_GET['id_meet']) ? (int) $_GET['id_meet'] : 0;
|
||||
$dataMeet = $plugin->getMeet($idMeet);
|
||||
|
||||
//create form
|
||||
$form = new FormValidator(
|
||||
'edit_meet',
|
||||
'post',
|
||||
api_get_self().'?action='.Security::remove_XSS($_GET['action']).'&'.api_get_cidreq()
|
||||
);
|
||||
|
||||
$form->addHeader(get_lang('EditMeet'));
|
||||
|
||||
$form->addText(
|
||||
'meet_name',
|
||||
[
|
||||
$plugin->get_lang('MeetName'),
|
||||
$plugin->get_lang('MeetNameHelp'),
|
||||
],
|
||||
true,
|
||||
[
|
||||
'title' => $plugin->get_lang('MeetNameHelp'),
|
||||
]
|
||||
);
|
||||
|
||||
$form->addText(
|
||||
'meet_url',
|
||||
[
|
||||
$plugin->get_lang('GoogleMeetURL'),
|
||||
sprintf($plugin->get_lang('GoogleMeetURLHelp'), GoogleMeetPlugin::GOOGLE_MEET_URL),
|
||||
],
|
||||
true,
|
||||
[
|
||||
'title' => sprintf($plugin->get_lang('GoogleMeetURLHelp'), GoogleMeetPlugin::GOOGLE_MEET_URL),
|
||||
]
|
||||
);
|
||||
$form->addElement(
|
||||
'color',
|
||||
'meet_color',
|
||||
[
|
||||
$plugin->get_lang('MeetColor'),
|
||||
$plugin->get_lang('MeetColorHelp'),
|
||||
]
|
||||
);
|
||||
$form->addHtmlEditor(
|
||||
'meet_description',
|
||||
[
|
||||
$plugin->get_lang('MeetingDescription'),
|
||||
$plugin->get_lang('MeetingDescriptionHelp'),
|
||||
],
|
||||
false,
|
||||
false,
|
||||
[
|
||||
'ToolbarSet' => 'Minimal',
|
||||
]
|
||||
);
|
||||
|
||||
$form->addHidden('id', $idMeet);
|
||||
$form->addButtonSave($plugin->get_lang('Save'));
|
||||
|
||||
$form->setDefaults($dataMeet);
|
||||
|
||||
if ($form->validate()) {
|
||||
$values = $form->exportValues();
|
||||
$res = $plugin->updateMeet($values);
|
||||
|
||||
if ($res) {
|
||||
$url = api_get_path(WEB_PLUGIN_PATH).'google_meet/start.php?'.api_get_cidreq();
|
||||
header('Location: '.$url);
|
||||
}
|
||||
}
|
||||
|
||||
$tpl->assign('form_room', $form->returnForm());
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ($isAdmin || $isTeacher) {
|
||||
$tpl->assign(
|
||||
'actions',
|
||||
Display::toolbarAction('toolbar', [$actionLinks])
|
||||
);
|
||||
}
|
||||
|
||||
$tpl->assign('message', $message);
|
||||
$content = $tpl->fetch('google_meet/view/meets.tpl');
|
||||
$tpl->assign('content', $content);
|
||||
$tpl->display_one_col_template();
|
||||
4
plugin/google_meet/plugin.php
Normal file
@@ -0,0 +1,4 @@
|
||||
<?php
|
||||
|
||||
require_once __DIR__.'/config.php';
|
||||
$plugin_info = GoogleMeetPlugin::create()->get_info();
|
||||
148
plugin/google_meet/resources/css/style.css
Normal file
@@ -0,0 +1,148 @@
|
||||
.plugin_logo{
|
||||
text-align: center;
|
||||
padding-top: 1rem;
|
||||
padding-bottom: 1rem;
|
||||
}
|
||||
.plugin_logo .img-responsive{
|
||||
margin: auto;
|
||||
}
|
||||
.tools{
|
||||
margin-bottom: 2rem;
|
||||
margin-top: 1rem;
|
||||
}
|
||||
.card{
|
||||
position: relative;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
min-width: 0;
|
||||
word-wrap: break-word;
|
||||
border: 1px solid rgba(0,0,0,.05);
|
||||
border-radius: .375rem;
|
||||
background-color: #fff;
|
||||
background-clip: border-box;
|
||||
}
|
||||
.card-meet{
|
||||
margin-bottom: 30px;
|
||||
border: 0;
|
||||
box-shadow: 0 0 2rem 0 rgba(136,152,170,.15);
|
||||
}
|
||||
.card-meet:hover{
|
||||
border-left: .25rem solid #cdcdcd !important;
|
||||
}
|
||||
.card-meet .card-body {
|
||||
padding: 1rem 1.5rem;
|
||||
}
|
||||
.row-meet {
|
||||
display: block;
|
||||
}
|
||||
|
||||
.description{
|
||||
padding-left: 1rem;
|
||||
padding-right: 1rem;
|
||||
padding-top: 2rem;
|
||||
font-size: 12px;
|
||||
color: #666666;
|
||||
display: grid;
|
||||
}
|
||||
.description .title{
|
||||
font-size: 1.45rem;
|
||||
font-weight: 600!important;
|
||||
color: #32325d;
|
||||
overflow:hidden;
|
||||
white-space:nowrap;
|
||||
text-overflow: ellipsis;
|
||||
width: 100%;
|
||||
display: inline-block;
|
||||
}
|
||||
.description .text{
|
||||
display: grid;
|
||||
padding-bottom: 1rem;
|
||||
}
|
||||
.rounded-circle {
|
||||
border-radius: 50%!important;
|
||||
}
|
||||
.shadow {
|
||||
box-shadow: 0 0 2rem 0 rgba(136,152,170,.15)!important;
|
||||
}
|
||||
.icon {
|
||||
width: 5rem;
|
||||
height: 5rem;
|
||||
}
|
||||
.icon-shape {
|
||||
display: inline-flex;
|
||||
padding: 12px;
|
||||
text-align: center;
|
||||
border-radius: 50%;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
position: absolute;
|
||||
right: 40%;
|
||||
top: -20px;
|
||||
}
|
||||
.icon-shape .fa{
|
||||
font-size: 20px;
|
||||
}
|
||||
|
||||
.text-white {
|
||||
color: #fff!important;
|
||||
}
|
||||
.btn-meet{
|
||||
color: #fff;
|
||||
border-color: #5e72e4;
|
||||
background-color: #5e72e4;
|
||||
box-shadow: 0 4px 6px rgba(50,50,93,.11), 0 1px 3px rgba(0,0,0,.08);
|
||||
}
|
||||
.btn-meet:hover {
|
||||
color: #fff;
|
||||
border-color: #5e72e4;
|
||||
background-color: #5e72e4;
|
||||
}
|
||||
.btn:hover {
|
||||
transform: translateY(-1px);
|
||||
box-shadow: 0 7px 14px rgba(50,50,93,.1), 0 3px 6px rgba(0,0,0,.08);
|
||||
}
|
||||
.float-right {
|
||||
position: absolute;
|
||||
top: 5px;
|
||||
right: 5px;
|
||||
}
|
||||
.btn-add-meet{
|
||||
color: #fff;
|
||||
border-color: #1cc88a;
|
||||
background-color: #1cc88a;
|
||||
font-weight: bold;
|
||||
}
|
||||
.btn-add-meet:hover {
|
||||
color: #fff;
|
||||
border-color: #17a673;
|
||||
background-color: #169b6b;
|
||||
}
|
||||
.meet-list{
|
||||
display: grid;
|
||||
grid-template-columns: repeat(3, 1fr);
|
||||
}
|
||||
.meet-list .meet-item{
|
||||
margin: 10px;
|
||||
}
|
||||
.meet-list .meet-item .card-meet{
|
||||
min-height: 220px;
|
||||
}
|
||||
@media (min-width: 768px) and (max-width: 979px) {
|
||||
.meet-list {
|
||||
display: grid;
|
||||
grid-template-columns: repeat(2, 1fr);
|
||||
}
|
||||
}
|
||||
@media (max-width: 767px) {
|
||||
.meet-list {
|
||||
display: grid;
|
||||
grid-template-columns: repeat(2, 1fr);
|
||||
}
|
||||
}
|
||||
/* Landscape phones and down */
|
||||
@media (max-width: 480px) {
|
||||
.meet-list {
|
||||
display: grid;
|
||||
grid-template-columns: repeat(1, 1fr);
|
||||
}
|
||||
}
|
||||
BIN
plugin/google_meet/resources/img/22/google_meet.png
Normal file
|
After Width: | Height: | Size: 4.9 KiB |
BIN
plugin/google_meet/resources/img/22/google_meet_na.png
Normal file
|
After Width: | Height: | Size: 3.6 KiB |
BIN
plugin/google_meet/resources/img/32/google_meet.png
Normal file
|
After Width: | Height: | Size: 3.0 KiB |
BIN
plugin/google_meet/resources/img/32/google_meet_na.png
Normal file
|
After Width: | Height: | Size: 2.3 KiB |
BIN
plugin/google_meet/resources/img/64/google_meet.png
Normal file
|
After Width: | Height: | Size: 2.6 KiB |
BIN
plugin/google_meet/resources/img/64/google_meet_na.png
Normal file
|
After Width: | Height: | Size: 2.1 KiB |
304
plugin/google_meet/resources/img/svg/googlemeet.svg
Normal file
@@ -0,0 +1,304 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<svg
|
||||
xmlns:dc="http://purl.org/dc/elements/1.1/"
|
||||
xmlns:cc="http://creativecommons.org/ns#"
|
||||
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
|
||||
xmlns:svg="http://www.w3.org/2000/svg"
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
xmlns:xlink="http://www.w3.org/1999/xlink"
|
||||
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
|
||||
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
|
||||
width="124"
|
||||
height="124"
|
||||
viewBox="0 0 124 124"
|
||||
version="1.1"
|
||||
preserveAspectRatio="xMidYMid"
|
||||
id="svg68"
|
||||
sodipodi:docname="meet.svg"
|
||||
inkscape:version="0.92.5 (0.92.5+68)">
|
||||
<metadata
|
||||
id="metadata72">
|
||||
<rdf:RDF>
|
||||
<cc:Work
|
||||
rdf:about="">
|
||||
<dc:format>image/svg+xml</dc:format>
|
||||
<dc:type
|
||||
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
|
||||
<dc:title></dc:title>
|
||||
</cc:Work>
|
||||
</rdf:RDF>
|
||||
</metadata>
|
||||
<sodipodi:namedview
|
||||
pagecolor="#ffffff"
|
||||
bordercolor="#666666"
|
||||
borderopacity="1"
|
||||
objecttolerance="10"
|
||||
gridtolerance="10"
|
||||
guidetolerance="10"
|
||||
inkscape:pageopacity="0"
|
||||
inkscape:pageshadow="2"
|
||||
inkscape:window-width="1920"
|
||||
inkscape:window-height="1016"
|
||||
id="namedview70"
|
||||
showgrid="false"
|
||||
inkscape:zoom="3.5336739"
|
||||
inkscape:cx="54.820641"
|
||||
inkscape:cy="49.666357"
|
||||
inkscape:window-x="0"
|
||||
inkscape:window-y="27"
|
||||
inkscape:window-maximized="1"
|
||||
inkscape:current-layer="svg68" />
|
||||
<defs
|
||||
id="defs37">
|
||||
<linearGradient
|
||||
inkscape:collect="always"
|
||||
id="linearGradient950">
|
||||
<stop
|
||||
style="stop-color:#007266;stop-opacity:1;"
|
||||
offset="0"
|
||||
id="stop946" />
|
||||
<stop
|
||||
style="stop-color:#007266;stop-opacity:0;"
|
||||
offset="1"
|
||||
id="stop948" />
|
||||
</linearGradient>
|
||||
<linearGradient
|
||||
x1="71.77459"
|
||||
y1="187.32983"
|
||||
x2="206.34541"
|
||||
y2="53.078278"
|
||||
id="linearGradient-1"
|
||||
gradientTransform="matrix(0.35264551,0,0,0.40800991,10.373845,5.6478575)"
|
||||
gradientUnits="userSpaceOnUse">
|
||||
<stop
|
||||
stop-color="#058B7E"
|
||||
offset="0%"
|
||||
id="stop2" />
|
||||
<stop
|
||||
stop-color="#058D80"
|
||||
offset="0%"
|
||||
id="stop4" />
|
||||
<stop
|
||||
stop-color="#058D7F"
|
||||
offset="100%"
|
||||
id="stop6" />
|
||||
</linearGradient>
|
||||
<path
|
||||
d="M 127.68269,0 C 57.165748,0 0,55.790933 0,124.61227 0,193.43392 57.165748,249.22453 127.68269,249.22453 l 0.27148,46.91374 c 65.60585,-37.27075 128,-87.01882 128,-171.526 C 255.95417,55.790933 198.19994,0 127.68269,0 Z"
|
||||
id="path-2"
|
||||
inkscape:connector-curvature="0" />
|
||||
<filter
|
||||
x="-0.0040000002"
|
||||
y="-0.003"
|
||||
width="1.008"
|
||||
height="1.007"
|
||||
filterUnits="objectBoundingBox"
|
||||
id="filter-3">
|
||||
<feOffset
|
||||
dx="0"
|
||||
dy="2"
|
||||
in="SourceAlpha"
|
||||
result="shadowOffsetInner1"
|
||||
id="feOffset10" />
|
||||
<feComposite
|
||||
in="shadowOffsetInner1"
|
||||
in2="SourceAlpha"
|
||||
operator="arithmetic"
|
||||
k2="-1"
|
||||
k3="1"
|
||||
result="shadowInnerInner1"
|
||||
id="feComposite12"
|
||||
k1="0"
|
||||
k4="0" />
|
||||
<feColorMatrix
|
||||
values="0 0 0 0 1 0 0 0 0 1 0 0 0 0 1 0 0 0 0.2 0"
|
||||
type="matrix"
|
||||
in="shadowInnerInner1"
|
||||
id="feColorMatrix14" />
|
||||
</filter>
|
||||
<path
|
||||
d="M 127.68269,0 C 57.165748,0 0,55.790933 0,124.61227 0,193.43392 57.165748,249.22453 127.68269,249.22453 l 0.27148,46.91374 c 65.60585,-37.27075 128,-87.01882 128,-171.526 C 255.95417,55.790933 198.19994,0 127.68269,0 Z"
|
||||
id="path-4"
|
||||
inkscape:connector-curvature="0" />
|
||||
<filter
|
||||
x="-0.0040000002"
|
||||
y="-0.003"
|
||||
width="1.008"
|
||||
height="1.007"
|
||||
filterUnits="objectBoundingBox"
|
||||
id="filter-5">
|
||||
<feOffset
|
||||
dx="0"
|
||||
dy="-2"
|
||||
in="SourceAlpha"
|
||||
result="shadowOffsetInner1"
|
||||
id="feOffset18" />
|
||||
<feComposite
|
||||
in="shadowOffsetInner1"
|
||||
in2="SourceAlpha"
|
||||
operator="arithmetic"
|
||||
k2="-1"
|
||||
k3="1"
|
||||
result="shadowInnerInner1"
|
||||
id="feComposite20"
|
||||
k1="0"
|
||||
k4="0" />
|
||||
<feColorMatrix
|
||||
values="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.1 0"
|
||||
type="matrix"
|
||||
in="shadowInnerInner1"
|
||||
id="feColorMatrix22" />
|
||||
</filter>
|
||||
<path
|
||||
d="M 127.68269,0 C 57.165748,0 0,55.790933 0,124.61227 0,193.43392 57.165748,249.22453 127.68269,249.22453 l 0.27148,46.91374 c 65.60585,-37.27075 128,-87.01882 128,-171.526 C 255.95417,55.790933 198.19994,0 127.68269,0 Z"
|
||||
id="path-6"
|
||||
inkscape:connector-curvature="0" />
|
||||
<linearGradient
|
||||
x1="119.3371"
|
||||
y1="153.50986"
|
||||
x2="236.07732"
|
||||
y2="282.50131"
|
||||
id="linearGradient-8"
|
||||
gradientTransform="scale(1.1271732,0.88717512)"
|
||||
gradientUnits="userSpaceOnUse">
|
||||
<stop
|
||||
stop-color="#000000"
|
||||
offset="0%"
|
||||
id="stop26" />
|
||||
<stop
|
||||
stop-color="#D8D8D8"
|
||||
stop-opacity="0"
|
||||
offset="100%"
|
||||
id="stop28" />
|
||||
</linearGradient>
|
||||
<path
|
||||
d="m 55.580192,128.1054 v 34.23858 c 0,9.03901 7.395555,16.43457 16.434567,16.43457 h 85.016021 c 9.03901,0 16.43457,-7.39556 16.43457,-16.43457 v -21.62283 l 33.65926,33.65925 v -46.275 z"
|
||||
id="path-9"
|
||||
inkscape:connector-curvature="0" />
|
||||
<filter
|
||||
x="-0.0099999998"
|
||||
y="-0.029999999"
|
||||
width="1.026"
|
||||
height="1.118"
|
||||
filterUnits="objectBoundingBox"
|
||||
id="filter-10">
|
||||
<feOffset
|
||||
dx="1"
|
||||
dy="3"
|
||||
in="SourceAlpha"
|
||||
result="shadowOffsetOuter1"
|
||||
id="feOffset32" />
|
||||
<feColorMatrix
|
||||
values="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.1 0"
|
||||
type="matrix"
|
||||
in="shadowOffsetOuter1"
|
||||
id="feColorMatrix34" />
|
||||
</filter>
|
||||
<mask
|
||||
id="mask-7"
|
||||
fill="white">
|
||||
<use
|
||||
xlink:href="#path-6"
|
||||
id="use49"
|
||||
x="0"
|
||||
y="0"
|
||||
width="100%"
|
||||
height="100%" />
|
||||
</mask>
|
||||
<linearGradient
|
||||
inkscape:collect="always"
|
||||
xlink:href="#linearGradient950"
|
||||
id="linearGradient952"
|
||||
x1="80.086624"
|
||||
y1="68.221016"
|
||||
x2="96.365685"
|
||||
y2="82.936577"
|
||||
gradientUnits="userSpaceOnUse" />
|
||||
</defs>
|
||||
<g
|
||||
id="g1001"
|
||||
inkscape:export-filename="/var/www/chamilo11/plugin/google_meet/resources/img/64/meet.png"
|
||||
inkscape:export-xdpi="49.548386"
|
||||
inkscape:export-ydpi="49.548386">
|
||||
<rect
|
||||
y="0"
|
||||
x="0"
|
||||
height="124"
|
||||
width="124"
|
||||
id="rect967"
|
||||
style="opacity:0;fill:#008072;fill-opacity:1;stroke:none;stroke-width:1.63019824;stroke-linecap:round;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:1.63019823, 3.26039649000000020;stroke-dashoffset:0;stroke-opacity:1;paint-order:stroke fill markers" />
|
||||
<g
|
||||
id="g965">
|
||||
<path
|
||||
sodipodi:type="inkscape:offset"
|
||||
inkscape:radius="2.4982965"
|
||||
inkscape:original="M 58.519531 2.5976562 C 30.857908 2.5976562 8.4335938 24.483979 8.4335938 51.480469 C 8.4335938 78.477082 30.857908 100.36133 58.519531 100.36133 L 58.626953 118.76367 C 84.362106 104.14351 108.83594 84.630032 108.83594 51.480469 C 108.83594 24.483979 86.181276 2.5976563 58.519531 2.5976562 z "
|
||||
style="fill:#008072;fill-opacity:1;stroke-width:0.39226919"
|
||||
id="path918"
|
||||
d="m 58.519531,0.09960937 c -28.979418,0 -52.5839841,23.00091563 -52.5839841,51.38085963 0,27.558721 22.2758971,49.977491 50.0996091,51.255861 l 0.09375,16.04101 a 2.4985463,2.4985463 0 0 0 3.732422,2.15821 c 12.986903,-7.37787 25.778983,-16.0384 35.414063,-27.236331 9.635079,-11.197929 16.058589,-25.02915 16.058589,-42.21875 0,-28.394155 -23.834915,-51.38085952 -52.814449,-51.38085963 z"
|
||||
transform="matrix(0.96698632,0,0,0.96698632,2.218741,3.1352548)" />
|
||||
<g
|
||||
style="fill:#000000;fill-opacity:1"
|
||||
id="g43"
|
||||
transform="matrix(0.37931894,0,0,0.37931894,10.373845,5.6478575)">
|
||||
<use
|
||||
height="100%"
|
||||
width="100%"
|
||||
y="0"
|
||||
x="0"
|
||||
style="filter:url(#filter-3)"
|
||||
id="use41"
|
||||
xlink:href="#path-2" />
|
||||
</g>
|
||||
<use
|
||||
xlink:href="#path-4"
|
||||
id="use45"
|
||||
style="fill:#000000;fill-opacity:1;filter:url(#filter-5)"
|
||||
x="0"
|
||||
y="0"
|
||||
width="100%"
|
||||
height="100%"
|
||||
transform="matrix(0.37931894,0,0,0.37931894,10.373845,5.6478575)" />
|
||||
<path
|
||||
style="fill:url(#linearGradient-1);stroke-width:0.37931895"
|
||||
inkscape:connector-curvature="0"
|
||||
id="path39"
|
||||
d="m 58.806308,5.6478575 c -26.748411,0 -48.432463,21.1625575 -48.432463,47.2677945 0,26.105355 21.684052,47.267788 48.432463,47.267788 l 0.102978,17.79527 c 24.885541,-14.1375 48.552824,-33.007884 48.552824,-65.063058 0,-26.105237 -21.907273,-47.2677945 -48.655802,-47.2677945 z" />
|
||||
<path
|
||||
style="opacity:0.269;fill:url(#linearGradient952);fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
|
||||
d="m 88.940144,36.637807 18.455166,15.623824 c 0.4451,32.017835 -20.288725,47.22501 -34.949462,57.730289 L 35.939932,72.778522 83.199528,49.856203 Z"
|
||||
id="path944"
|
||||
inkscape:connector-curvature="0"
|
||||
sodipodi:nodetypes="cccccc" />
|
||||
<g
|
||||
id="g916"
|
||||
transform="matrix(0.96698632,0,0,0.96698632,2.218741,3.1352548)">
|
||||
<g
|
||||
transform="matrix(0.39226919,0,0,0.39226919,8.433526,2.598385)"
|
||||
id="g62">
|
||||
<use
|
||||
xlink:href="#path-9"
|
||||
id="use58"
|
||||
style="fill:#000000;fill-opacity:1;filter:url(#filter-10)"
|
||||
x="0"
|
||||
y="0"
|
||||
width="100%"
|
||||
height="100%" />
|
||||
<use
|
||||
xlink:href="#path-9"
|
||||
id="use60"
|
||||
style="fill:#f6f6f6;fill-rule:evenodd"
|
||||
x="0"
|
||||
y="0"
|
||||
width="100%"
|
||||
height="100%" />
|
||||
</g>
|
||||
<path
|
||||
d="M 89.682141,52.850186 V 34.646356 L 76.47865,47.821703 v -8.402255 c 0,-3.54585 -2.90105,-6.446774 -6.446775,-6.446774 H 36.68271 c -3.545726,0 -6.446775,2.900924 -6.446775,6.446774 v 13.430738 z"
|
||||
id="path64"
|
||||
inkscape:connector-curvature="0"
|
||||
style="fill:#e2e2e2;stroke-width:0.39226919" />
|
||||
</g>
|
||||
</g>
|
||||
</g>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 10 KiB |
1413
plugin/google_meet/resources/img/svg/meet_room.svg
Normal file
|
After Width: | Height: | Size: 83 KiB |
396
plugin/google_meet/src/google_meet_plugin.class.php
Normal file
@@ -0,0 +1,396 @@
|
||||
<?php
|
||||
|
||||
/* For licensing terms, see /license.txt */
|
||||
|
||||
/**
|
||||
* Plugin class for the Google Meet plugin.
|
||||
*
|
||||
* @author Alex Aragón Calixto <alex.aragon@tunqui.pe>
|
||||
*/
|
||||
class GoogleMeetPlugin extends Plugin
|
||||
{
|
||||
public const TABLE_MEET_LIST = 'plugin_google_meet_room';
|
||||
public const SETTING_TITLE = 'tool_title';
|
||||
public const SETTING_ENABLED = 'google_meet_enabled';
|
||||
public const GOOGLE_MEET_URL = 'https://meet.google.com/';
|
||||
|
||||
public $isCoursePlugin = true;
|
||||
|
||||
protected function __construct()
|
||||
{
|
||||
parent::__construct(
|
||||
'1.0',
|
||||
'
|
||||
Alex Aragón Calixto',
|
||||
[
|
||||
self::SETTING_ENABLED => 'boolean',
|
||||
self::SETTING_TITLE => 'text',
|
||||
]
|
||||
);
|
||||
|
||||
$this->isAdminPlugin = true;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getTitle()
|
||||
{
|
||||
$title = $this->get(self::SETTING_TITLE);
|
||||
|
||||
if (!empty($title)) {
|
||||
return $title;
|
||||
}
|
||||
|
||||
return $this->get_title();
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function get_name()
|
||||
{
|
||||
return 'google_meet';
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a plugin instance.
|
||||
*
|
||||
* @return GoogleMeetPlugin
|
||||
*/
|
||||
public static function create()
|
||||
{
|
||||
static $result = null;
|
||||
|
||||
return $result ? $result : $result = new self();
|
||||
}
|
||||
|
||||
/**
|
||||
* This method creates the tables required to this plugin and copies icons
|
||||
* to the right places.
|
||||
*/
|
||||
public function install()
|
||||
{
|
||||
$sql = "CREATE TABLE IF NOT EXISTS ".self::TABLE_MEET_LIST." (
|
||||
id INT unsigned NOT NULL auto_increment PRIMARY KEY,
|
||||
meet_name VARCHAR(250) NULL,
|
||||
meet_url VARCHAR(250) NULL,
|
||||
meet_description VARCHAR(250) NULL,
|
||||
meet_color VARCHAR(7) NULL,
|
||||
type_meet INT NOT NULL,
|
||||
start_time DATETIME NULL,
|
||||
end_time DATETIME NULL,
|
||||
c_id INT NULL NOT NULL,
|
||||
session_id INT,
|
||||
activate INT
|
||||
)";
|
||||
|
||||
Database::query($sql);
|
||||
|
||||
// Copy icons into the main/img/icons folder
|
||||
$iconName = 'google_meet';
|
||||
$iconsList = [
|
||||
'64/'.$iconName.'.png',
|
||||
'64/'.$iconName.'_na.png',
|
||||
'32/'.$iconName.'.png',
|
||||
'32/'.$iconName.'_na.png',
|
||||
'22/'.$iconName.'.png',
|
||||
'22/'.$iconName.'_na.png',
|
||||
];
|
||||
$sourceDir = api_get_path(SYS_PLUGIN_PATH).'google_meet/resources/img/';
|
||||
$destinationDir = api_get_path(SYS_CODE_PATH).'img/icons/';
|
||||
foreach ($iconsList as $icon) {
|
||||
$src = $sourceDir.$icon;
|
||||
$dest = $destinationDir.$icon;
|
||||
copy($src, $dest);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* This method drops the plugin tables and icons.
|
||||
*/
|
||||
public function uninstall()
|
||||
{
|
||||
$this->deleteCourseToolLinks();
|
||||
|
||||
$tablesToBeDeleted = [
|
||||
self::TABLE_MEET_LIST,
|
||||
];
|
||||
|
||||
foreach ($tablesToBeDeleted as $tableToBeDeleted) {
|
||||
$table = Database::get_main_table($tableToBeDeleted);
|
||||
$sql = "DROP TABLE IF EXISTS $table";
|
||||
Database::query($sql);
|
||||
}
|
||||
$dest1 = api_get_path(SYS_CODE_PATH).'img/icons/64/google_meet.png';
|
||||
$dest2 = api_get_path(SYS_CODE_PATH).'img/icons/64/google_meet_na.png';
|
||||
if (file_exists($dest1)) {
|
||||
@unlink($dest1);
|
||||
}
|
||||
if (file_exists($dest2)) {
|
||||
@unlink($dest2);
|
||||
}
|
||||
|
||||
$this->manageTab(false);
|
||||
|
||||
// Remove icons from the main/img/icons folder
|
||||
$iconName = 'google_meet';
|
||||
$iconsList = [
|
||||
'64/'.$iconName.'.png',
|
||||
'64/'.$iconName.'_na.png',
|
||||
'32/'.$iconName.'.png',
|
||||
'32/'.$iconName.'_na.png',
|
||||
'22/'.$iconName.'.png',
|
||||
'22/'.$iconName.'_na.png',
|
||||
];
|
||||
$destinationDir = api_get_path(SYS_CODE_PATH).'img/icons/';
|
||||
foreach ($iconsList as $icon) {
|
||||
$dest = $destinationDir.$icon;
|
||||
if (is_file($dest)) {
|
||||
@unlink($dest);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*
|
||||
* @return GoogleMeetPlugin
|
||||
*/
|
||||
public function performActionsAfterConfigure()
|
||||
{
|
||||
$em = Database::getManager();
|
||||
|
||||
$this->deleteCourseToolLinks();
|
||||
|
||||
if ('true' === $this->get(self::SETTING_ENABLED)) {
|
||||
$courses = $em->createQuery('SELECT c.id FROM ChamiloCoreBundle:Course c')->getResult();
|
||||
|
||||
foreach ($courses as $course) {
|
||||
$this->createLinkToCourseTool($this->getTitle(), $course['id']);
|
||||
}
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function saveMeet($values)
|
||||
{
|
||||
if (!is_array($values) || empty($values['meet_name'])) {
|
||||
return false;
|
||||
}
|
||||
$table = Database::get_main_table(self::TABLE_MEET_LIST);
|
||||
|
||||
$courseId = api_get_course_int_id();
|
||||
$sessionId = api_get_session_id();
|
||||
$url = self::filterUrl($values['meet_url']);
|
||||
if (!isset($values['type_meet'])) {
|
||||
$values['type_meet'] = 1;
|
||||
}
|
||||
|
||||
$params = [
|
||||
'meet_name' => $values['meet_name'],
|
||||
'meet_url' => $url,
|
||||
'type_meet' => $values['type_meet'],
|
||||
'meet_description' => $values['meet_description'],
|
||||
'meet_color' => $values['meet_color'],
|
||||
'c_id' => $courseId,
|
||||
'start_time' => null,
|
||||
'end_time' => null,
|
||||
'session_id' => $sessionId,
|
||||
'activate' => 1,
|
||||
];
|
||||
|
||||
$id = Database::insert($table, $params);
|
||||
|
||||
if ($id > 0) {
|
||||
return $id;
|
||||
}
|
||||
}
|
||||
|
||||
public function listMeets($courseId, $sessionId = 0)
|
||||
{
|
||||
$list = [];
|
||||
$tableMeetList = Database::get_main_table(self::TABLE_MEET_LIST);
|
||||
$courseId = (int) $courseId;
|
||||
$sessionId = (int) $sessionId;
|
||||
|
||||
$sql = "SELECT * FROM $tableMeetList WHERE c_id = $courseId AND session_id = $sessionId AND activate = 1";
|
||||
|
||||
$result = Database::query($sql);
|
||||
|
||||
if (Database::num_rows($result) > 0) {
|
||||
while ($row = Database::fetch_array($result)) {
|
||||
$action = Display::url(
|
||||
Display::return_icon(
|
||||
'delete.png',
|
||||
get_lang('Delete'),
|
||||
[],
|
||||
ICON_SIZE_SMALL
|
||||
),
|
||||
'meets.php?action=delete&id_room='.$row['id'],
|
||||
[
|
||||
'onclick' => 'javascript:if(!confirm('."'".
|
||||
addslashes(api_htmlentities(get_lang("ConfirmYourChoice")))
|
||||
."'".')) return false;',
|
||||
]
|
||||
);
|
||||
$active = Display::return_icon('accept.png', null, [], ICON_SIZE_TINY);
|
||||
if (intval($row['activate']) != 1) {
|
||||
$active = Display::return_icon('error.png', null, [], ICON_SIZE_TINY);
|
||||
}
|
||||
|
||||
$list[] = [
|
||||
'id' => $row['id'],
|
||||
'meet_name' => $row['meet_name'],
|
||||
'meet_url' => $row['meet_url'],
|
||||
'meet_description' => $row['meet_description'],
|
||||
'meet_color' => $row['meet_color'],
|
||||
'type_meet' => $row['type_meet'],
|
||||
'c_id' => $row['c_id'],
|
||||
'start_time' => $row['start_time'],
|
||||
'end_time' => $row['end_time'],
|
||||
'session_id' => $row['session_id'],
|
||||
'activate' => $active,
|
||||
'actions' => $action,
|
||||
];
|
||||
}
|
||||
}
|
||||
|
||||
return $list;
|
||||
}
|
||||
|
||||
public function getMeet($idMeet)
|
||||
{
|
||||
if (empty($idMeet)) {
|
||||
return false;
|
||||
}
|
||||
$meet = [];
|
||||
$tableMeetList = Database::get_main_table(self::TABLE_MEET_LIST);
|
||||
$idMeet = (int) $idMeet;
|
||||
$sql = "SELECT * FROM $tableMeetList WHERE id = $idMeet";
|
||||
|
||||
$result = Database::query($sql);
|
||||
if (Database::num_rows($result) > 0) {
|
||||
while ($row = Database::fetch_array($result)) {
|
||||
$meet = [
|
||||
'id' => $row['id'],
|
||||
'meet_name' => $row['meet_name'],
|
||||
'meet_url' => $row['meet_url'],
|
||||
'meet_description' => $row['meet_description'],
|
||||
'meet_color' => $row['meet_color'],
|
||||
'type_meet' => $row['type_meet'],
|
||||
'c_id' => $row['c_id'],
|
||||
'start_time' => $row['start_time'],
|
||||
'end_time' => $row['end_time'],
|
||||
'session_id' => $row['session_id'],
|
||||
'activate' => $row['activate'],
|
||||
];
|
||||
}
|
||||
}
|
||||
|
||||
return $meet;
|
||||
}
|
||||
|
||||
public function updateMeet($values)
|
||||
{
|
||||
if (!is_array($values) || empty($values['meet_name'])) {
|
||||
return false;
|
||||
}
|
||||
$table = Database::get_main_table(self::TABLE_MEET_LIST);
|
||||
|
||||
$courseId = api_get_course_int_id();
|
||||
$sessionId = api_get_session_id();
|
||||
$url = self::filterUrl($values['meet_url']);
|
||||
if (!isset($values['type_meet'])) {
|
||||
$values['type_meet'] = 1;
|
||||
}
|
||||
|
||||
$params = [
|
||||
'meet_name' => $values['meet_name'],
|
||||
'meet_url' => $url,
|
||||
'type_meet' => $values['type_meet'],
|
||||
'meet_description' => $values['meet_description'],
|
||||
'meet_color' => $values['meet_color'],
|
||||
'c_id' => $courseId,
|
||||
'start_time' => null,
|
||||
'end_time' => null,
|
||||
'session_id' => $sessionId,
|
||||
'activate' => 1,
|
||||
];
|
||||
|
||||
Database::update(
|
||||
$table,
|
||||
$params,
|
||||
[
|
||||
'id = ?' => [
|
||||
$values['id'],
|
||||
],
|
||||
]
|
||||
);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Delete a given meeting.
|
||||
*
|
||||
* @param int $idMeet Chamilo's internal ID of the meeting
|
||||
*
|
||||
* @return bool True on success, false on failure
|
||||
*/
|
||||
public function deleteMeet($idMeet)
|
||||
{
|
||||
if (empty($idMeet)) {
|
||||
return false;
|
||||
}
|
||||
$idMeet = (int) $idMeet;
|
||||
$tableMeetList = Database::get_main_table(self::TABLE_MEET_LIST);
|
||||
$sql = "DELETE FROM $tableMeetList WHERE id = $idMeet";
|
||||
$result = Database::query($sql);
|
||||
|
||||
if (Database::affected_rows($result) != 1) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Delete links to the tool from the c_tool table.
|
||||
*/
|
||||
private function deleteCourseToolLinks()
|
||||
{
|
||||
Database::getManager()
|
||||
->createQuery('DELETE FROM ChamiloCourseBundle:CTool t WHERE t.category = :category AND t.link LIKE :link')
|
||||
->execute(['category' => 'plugin', 'link' => 'google_meet/start.php%']);
|
||||
}
|
||||
|
||||
/**
|
||||
* Do a bit of prevention on the meeting URL format.
|
||||
*
|
||||
* @param string $url The URL received from the user
|
||||
*
|
||||
* @return string Reformatted URL
|
||||
*/
|
||||
private function filterUrl($url)
|
||||
{
|
||||
if (!empty($url)) {
|
||||
if (preg_match('#^'.self::GOOGLE_MEET_URL.'#', $url)) {
|
||||
// The URL starts with the right Google Meet protocol and domain, do nothing
|
||||
} elseif (preg_match('#^'.substr(self::GOOGLE_MEET_URL, 8).'#', $url)) {
|
||||
// The URL starts with meet.google.com without the protocol. Add it
|
||||
$url = 'https://'.$url;
|
||||
} else {
|
||||
// We assume it's just the meeting code. Add the full Google Meet prefix
|
||||
if (substr($url, 0, 1) === '/') {
|
||||
// Remove prefixing slash, if any
|
||||
$url = substr($url, 1);
|
||||
}
|
||||
$url = self::GOOGLE_MEET_URL.$url;
|
||||
}
|
||||
}
|
||||
|
||||
return $url;
|
||||
}
|
||||
}
|
||||
44
plugin/google_meet/start.php
Normal file
@@ -0,0 +1,44 @@
|
||||
<?php
|
||||
/**
|
||||
* This script initiates a video conference session, calling the Google Meet.
|
||||
*/
|
||||
require_once __DIR__.'/../../vendor/autoload.php';
|
||||
|
||||
$course_plugin = 'google_meet'; //needed in order to load the plugin lang variables
|
||||
require_once __DIR__.'/config.php';
|
||||
|
||||
$htmlHeadXtra[] = '<link rel="stylesheet" type="text/css" href="'.api_get_path(
|
||||
WEB_PLUGIN_PATH
|
||||
).'google_meet/resources/css/style.css"/>';
|
||||
|
||||
$plugin = GoogleMeetPlugin::create();
|
||||
|
||||
$tool_name = $plugin->get_lang('plugin_title');
|
||||
$tpl = new Template($tool_name);
|
||||
$message = null;
|
||||
$userId = api_get_user_id();
|
||||
|
||||
$courseInfo = api_get_course_info();
|
||||
$isTeacher = api_is_teacher();
|
||||
$isAdmin = api_is_platform_admin();
|
||||
$isStudent = api_is_student();
|
||||
|
||||
$action = isset($_GET['action']) ? $_GET['action'] : null;
|
||||
$enable = $plugin->get('google_meet_enabled') == 'true';
|
||||
|
||||
$urlAddMeet = api_get_path(WEB_PLUGIN_PATH).'google_meet/meets.php?action=add&'.api_get_cidreq();
|
||||
|
||||
if ($enable) {
|
||||
if ($isAdmin || $isTeacher || $isStudent) {
|
||||
$meets = $plugin->listMeets($courseInfo['real_id'], api_get_session_id());
|
||||
}
|
||||
}
|
||||
|
||||
$tpl->assign('url_add_room', $urlAddMeet);
|
||||
$tpl->assign('meets', $meets);
|
||||
$tpl->assign('is_admin', $isAdmin);
|
||||
$tpl->assign('is_student', $isStudent);
|
||||
$tpl->assign('is_teacher', $isTeacher);
|
||||
$content = $tpl->fetch('google_meet/view/home.tpl');
|
||||
$tpl->assign('content', $content);
|
||||
$tpl->display_one_col_template();
|
||||
4
plugin/google_meet/uninstall.php
Normal file
@@ -0,0 +1,4 @@
|
||||
<?php
|
||||
/* For licensing terms, see /license.txt */
|
||||
require_once __DIR__.'/config.php';
|
||||
GoogleMeetPlugin::create()->uninstall();
|
||||
70
plugin/google_meet/view/home.tpl
Normal file
@@ -0,0 +1,70 @@
|
||||
<div class="row">
|
||||
<div class="col-md-12">
|
||||
<div class="meets">
|
||||
<div class="">
|
||||
<div class="plugin_logo">
|
||||
<img alt="" class="img-responsive" src="{{ _p.web_plugin }}google_meet/resources/img/svg/meet_room.svg">
|
||||
</div>
|
||||
<div class="tools text-center">
|
||||
{% if is_admin or is_teacher %}
|
||||
<a href="{{ url_add_room }}" class="btn btn-success btn-add-meet">
|
||||
<i class="fa fa-video-camera" aria-hidden="true"></i>
|
||||
{{ 'ManageMeetAccounts'|get_plugin_lang('GoogleMeetPlugin') }}
|
||||
</a>
|
||||
{% endif %}
|
||||
</div>
|
||||
{% if meets %}
|
||||
<div class="meet-list">
|
||||
{% for meet in meets %}
|
||||
<div class="meet-item">
|
||||
<div class="info-meet">
|
||||
<div class="card card-meet" style="border-left: .25rem solid {{ meet.meet_color }}; background: {{ meet.meet_color }}14">
|
||||
<div class="card-body">
|
||||
<div class="row-meet">
|
||||
<div class="card-info">
|
||||
<div style="background: {{ meet.meet_color }}" class="icon icon-shape text-white rounded-circle shadow">
|
||||
<i class="fa fa-video-camera" aria-hidden="true"></i>
|
||||
</div>
|
||||
<div class="description">
|
||||
<h4 class="title" title="{{ meet.meet_name }}"> {{ meet.meet_name }} </h4>
|
||||
<div class="text">
|
||||
{{ meet.meet_description }}
|
||||
</div>
|
||||
<a class="btn btn-sm btn-block btn-meet" target="_blank" href="{{ meet.meet_url }}">
|
||||
<i class="fa fa-share" aria-hidden="true"></i>
|
||||
{{ 'AccessMeeting'|get_plugin_lang('GoogleMeetPlugin') }}
|
||||
</a>
|
||||
</div>
|
||||
<div class="float-right">
|
||||
{% if is_admin or is_teacher %}
|
||||
<div class="btn-group btn-group-xs" role="group" aria-label="...">
|
||||
<a class="btn btn-sm btn-default" href="meets.php?action=edit&id_meet={{ meet.id }}&{{ _p.web_cid_query }}">
|
||||
<i class="fa fa-pencil" aria-hidden="true"></i>
|
||||
</a>
|
||||
<a class="btn btn-sm btn-default"
|
||||
onclick="javascript:if(!confirm('{{ 'AreYouSureToDelete' | get_lang }}')) return false;"
|
||||
href="meets.php?action=delete&id_meet={{ meet.id }}&{{ _p.web_cid_query }}">
|
||||
<i class="fa fa-trash-o" aria-hidden="true"></i>
|
||||
</a>
|
||||
</div>
|
||||
{% endif %}
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{% endfor %}
|
||||
</div>
|
||||
|
||||
{% else %}
|
||||
<div class="alert alert-warning" role="alert">
|
||||
{{ 'CourseDoesNotHaveAccountGoogleMeet'|get_plugin_lang('GoogleMeetPlugin') }}
|
||||
</div>
|
||||
{% endif %}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
15
plugin/google_meet/view/meets.tpl
Normal file
@@ -0,0 +1,15 @@
|
||||
<div class="row">
|
||||
<div class="col-md-12">
|
||||
<div class="panel panel-default">
|
||||
<div class="panel-body">
|
||||
|
||||
{% if form_room %}
|
||||
|
||||
{{ form_room }}
|
||||
|
||||
{% endif %}
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||