add list google meet

pull/3293/head
Alex Aragón 6 years ago
parent fb149c05c3
commit 3faf99f2fe
  1. 3
      plugin/googlemeet/lang/spanish.php
  2. 7
      plugin/googlemeet/meets.php
  3. 84
      plugin/googlemeet/resources/css/style.css
  4. 71
      plugin/googlemeet/src/googlemeet_plugin.class.php
  5. 5
      plugin/googlemeet/start.php
  6. 25
      plugin/googlemeet/view/meets.tpl
  7. 91
      plugin/googlemeet/view/start.tpl

@ -8,7 +8,7 @@ $strings['tool_title_help'] = 'Puede cambiar el nombre de la herramienta Google
$strings['google_meet_enabled'] = 'Activar Herramienta Google Meet';
$strings['google_meet_enabled_help'] = 'Escoga si desea activar el plugin en su plataforma Chamilo, esta acción activara una herramienta extra en las herramienta del curso.';
$strings['CourseDoesNotHaveAssociatedAccountMeet'] = 'Este curso no tiene configurado una reunión Google Meet.';
$strings['ManageMeetAccounts'] = 'Programar una reunión Google Meet';
$strings['ManageMeetAccounts'] = 'Agregar una reunión Google Meet';
$strings['AssociateZoomAccount'] = 'Asociar una sala Zoom';
$strings['RemoveAndChangeRoomMeet'] = 'Modificar reunión programada';
$strings['AddMeet'] = 'Registrar reunión Google Meet';
@ -16,5 +16,6 @@ $strings['MeetName'] = 'Nombre de la reunión';
$strings['MeetNameHelp'] = 'Asigna un nombre para la reunión. Ejemplo: Sala 1';
$strings['InstantMeetURL'] = "URL del Meet";
$strings['InstantMeetURLHelp'] = "Es la URL para iniciar una reunión instantánea conn Google Meet";
$strings['AccessMeeting'] = "Accede a la reunión";

@ -76,7 +76,10 @@ if ($enable) {
if ($form->validate()) {
$values = $form->exportValues();
$res = $plugin->saveMeet($values);
if ($res) {
$url = api_get_path(WEB_PLUGIN_PATH).'googlemeet/start.php?'.api_get_cidreq();
header('Location: '.$url);
}
}
} catch (HTML_QuickForm_Error $e) {
echo $e;
@ -107,6 +110,6 @@ if ($isAdmin || $isTeacher) {
}
$tpl->assign('message', $message);
$content = $tpl->fetch('googlemeet/view/meet.tpl');
$content = $tpl->fetch('googlemeet/view/meets.tpl');
$tpl->assign('content', $content);
$tpl->display_one_col_template();

@ -9,4 +9,88 @@
.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 .card-body {
padding: 1rem 1.5rem;
}
.row-meet {
display: flex;
flex-wrap: wrap;
}
.row-meet .col {
max-width: 100%;
flex-basis: 0;
flex-grow: 1;
}
.row-meet .col-auto {
width: auto;
max-width: 100%;
flex: 0 0 auto;
}
.description{
padding-left: 1rem;
padding-right: 1rem;
}
.description .title{
font-size: 1.45rem;
font-weight: 600!important;
color: #32325d;
}
.rounded-circle {
border-radius: 50%!important;
}
.shadow {
box-shadow: 0 0 2rem 0 rgba(136,152,170,.15)!important;
}
.icon {
width: 4rem;
height: 4rem;
}
.icon-shape {
display: inline-flex;
padding: 12px;
text-align: center;
border-radius: 50%;
align-items: center;
justify-content: center;
}
.bg-gradient-green {
background: linear-gradient(87deg,#2dce89 0,#2dcecc 100%)!important;
}
.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 {
float: right;
}

@ -142,14 +142,17 @@ class GoogleMeetPlugin extends Plugin
}
$table = Database::get_main_table(self::TABLE_MEET_LIST);
$idCourse = api_get_course_int_id();
$idUser = api_get_user_id();
$params = [
'meet_name' => $values['meet_name'],
'meet_url' => $values['meet_url'],
'type_meet' => $values['type_meet'],
'user_id' => api_get_user_id(),
'cd_id' => $values['cd_id'],
'start_time' => $values['start_time'],
'end_time' => $values['end_time'],
'user_id' => $idUser,
'cd_id' => $idCourse,
'start_time' => null,
'end_time' => null,
'session_id' => null,
'activate' => 1,
];
@ -161,4 +164,64 @@ class GoogleMeetPlugin extends Plugin
}
}
public function listMeets($idCourse){
$list = [];
$tableMeetList = Database::get_main_table(self::TABLE_MEET_LIST);
$sql = "SELECT * FROM $tableMeetList WHERE cd_id = $idCourse 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(
'edit.png',
get_lang('Edit'),
[],
ICON_SIZE_SMALL
),
'meets.php?action=edit&id_room='.$row['id']
);
$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'],
'type_meet' => $row['type_meet'],
'user_id' => $row['user_id'],
'cd_id' => $row['cd_id'],
'start_time' => $row['start_time'],
'end_time' => $row['end_time'],
'session_id' => $row['session_id'],
'activate' => $active,
'actions' => $action,
];
}
}
return $list;
}
}

@ -26,18 +26,19 @@ $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).'googlemeet/meet.php?action=add&'.api_get_cidreq();
$urlAddMeet = api_get_path(WEB_PLUGIN_PATH).'googlemeet/meets.php?action=add&'.api_get_cidreq();
if ($enable) {
if ($isAdmin || $isTeacher || $isStudent) {
$meets = $plugin->listMeets($courseInfo['real_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);

@ -0,0 +1,25 @@
<div class="row">
<div class="col-md-12">
<div class="panel panel-default">
<div class="panel-body">
{% if form_room %}
{% if is_admin %}
<div class="alert alert-info" role="alert">
{{ 'MessageMeetingAdmin'|get_plugin_lang('ZoomPlugin') }}
</div>
{% endif %}
{% if is_teacher %}
<div class="alert alert-success" role="alert">
{{ 'MessageMeetingTeacher'|get_plugin_lang('ZoomPlugin') }}
</div>
{% endif %}
{{ form_room }}
{% endif %}
</div>
</div>
</div>
</div>

@ -13,69 +13,54 @@
{{ 'ManageMeetAccounts'|get_plugin_lang('GoogleMeetPlugin') }}
</a>
{% endif %}
{% if is_admin or is_teacher %}
{% if room %}
<a href="{{ url_change_room }}" class="btn btn-danger">
<i class="fa fa-trash-o" aria-hidden="true"></i>
{{ 'RemoveAndChangeRoomMeet'| get_plugin_lang('GoogleMeetPlugin') }}
</a>
{% endif %}
{% endif %}
</div>
{% if meets %}
<div class="row">
{% for meet in meets %}
<div class="col-md-4">
<div class="info-meet">
<div class="card card-meet">
<div class="card-body">
<div class="row-meet">
<div class="col-auto">
<div class="icon icon-shape bg-gradient-green text-white rounded-circle shadow">
<i class="fa fa-video-camera" aria-hidden="true"></i>
</div>
</div>
<div class="col">
<div class="description">
<h4 class="title"> {{ meet.meet_name }} </h4>
<a class="btn btn-sm 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">
<div class="btn-group btn-group-xs" role="group" aria-label="...">
<a class="btn btn-sm btn-default" target="_blank" href="{{ meet.meet_url }}">
<i class="fa fa-pencil" aria-hidden="true"></i>
</a>
<a class="btn btn-sm btn-default" target="_blank" href="{{ meet.meet_url }}">
<i class="fa fa-trash-o" aria-hidden="true"></i>
</a>
</div>
</div>
{% if room %}
<div class="alert alert-info" role="alert">
{{ 'CourseDoesNotHaveAssociatedAccountMeet'|get_plugin_lang('GoogleMeetPlugin') }}
</div>
<div class="info-room">
<div class="well">
<dl class="dl-horizontal">
<dt>{{ 'MeetingIDZoom'|get_plugin_lang('GoogleMeetPlugin') }}</dt>
<dd>{{ room.room_id }}</dd>
<dt>{{ 'RoomNameZoom'|get_plugin_lang('GoogleMeetPlugin') }}</dt>
<dd>{{ room.room_name }}</dd>
<dt>{{ 'InstantMeetingURL'|get_plugin_lang('GoogleMeetPlugin') }}</dt>
<dd>
<a href="{{ room.room_url }}" target="_blank">
{{ room.room_url }}
</a>
</dd>
{% if room.room_pass %}
<dt>{{ 'HostKey'|get_plugin_lang('GoogleMeetPlugin') }}</dt>
<dd>{{ room.room_pass }}</dd>
{% endif %}
{% if is_teacher %}
{% if not view_pass %}
<dt>{{ 'AccountEmailZoom'|get_plugin_lang('GoogleMeetPlugin') }}</dt>
<dd>{{ room.zoom_email }}</dd>
<dt>{{ 'Password'|get_lang }}</dt>
<dd>{{ room.zoom_pass }}</dd>
{% endif %}
{% endif %}
</dl>
<div class="text-center">
<a href="{{ room.room_url }}" target="_blank" class="btn btn-success btn-lg">
<i class="fa fa-video-camera" aria-hidden="true"></i>
{{ 'JoinTheMeetingZoom' | get_plugin_lang('GoogleMeetPlugin') }}
</a>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
{% endfor %}
</div>
{% else %}
<div class="alert alert-warning" role="alert">
{{ 'CourseDoesNotHaveAssociatedAccountMeet'|get_plugin_lang('GoogleMeetPlugin') }}
</div>
{% if is_student %}
<div class="alert alert-info" role="alert">
{{ 'MessageMeetingZoom'|get_plugin_lang('GoogleMeetPlugin') }}
</div>
{% endif %}
{% endif %}
{{ form_zoom }}
</div>
</div>
</div>

Loading…
Cancel
Save