add save meet

pull/3293/head
Alex Aragón 6 years ago
parent e86da3c670
commit fb149c05c3
  1. 10
      plugin/googlemeet/lang/spanish.php
  2. 112
      plugin/googlemeet/meet.php
  3. 12
      plugin/googlemeet/resources/css/style.css
  4. 1413
      plugin/googlemeet/resources/img/svg/meet_room.svg
  5. 36
      plugin/googlemeet/src/googlemeet_plugin.class.php
  6. 10
      plugin/googlemeet/start.php
  7. 82
      plugin/googlemeet/view/start.tpl

@ -7,4 +7,14 @@ $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'] = '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['AssociateZoomAccount'] = 'Asociar una sala Zoom';
$strings['RemoveAndChangeRoomMeet'] = 'Modificar reunión programada';
$strings['AddMeet'] = 'Registrar reunión Google Meet';
$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";

@ -0,0 +1,112 @@
<?php
/**
* This script initiates a video conference session, calling the Zoom Conector API.
*/
require_once __DIR__.'/../../vendor/autoload.php';
$course_plugin = 'googlemeet'; //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
).'googlemeet/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':
break;
case 'add':
$actionLinks .= Display::url(
Display::return_icon('back.png', get_lang('Back'), [], ICON_SIZE_MEDIUM),
api_get_path(WEB_PLUGIN_PATH).'googlemeet/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('InstantMeetURL'),
$plugin->get_lang('InstantMeetURLHelp'),
],
true,
[
'title' => $plugin->get_lang('InstantMeetURLHelp'),
]
);
$form->addHidden('type_meet', 1);
$form->addButtonSave($plugin->get_lang('Add'));
try {
if ($form->validate()) {
$values = $form->exportValues();
$res = $plugin->saveMeet($values);
}
} 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_self().'?action=list&'.api_get_cidreq()
);
break;
}
}
}
}
if ($isAdmin || $isTeacher) {
$tpl->assign(
'actions',
Display::toolbarAction('toolbar', [$actionLinks])
);
}
$tpl->assign('message', $message);
$content = $tpl->fetch('googlemeet/view/meet.tpl');
$tpl->assign('content', $content);
$tpl->display_one_col_template();

@ -0,0 +1,12 @@
.plugin_logo{
text-align: center;
padding-top: 1rem;
padding-bottom: 1rem;
}
.plugin_logo .img-responsive{
margin: auto;
}
.tools{
margin-bottom: 2rem;
margin-top: 1rem;
}

File diff suppressed because one or more lines are too long

After

Width:  |  Height:  |  Size: 83 KiB

@ -68,19 +68,15 @@ class GoogleMeetPlugin extends Plugin
meet_url VARCHAR(250) NULL,
type_meet INT NOT NULL,
user_id INT NULL NOT NULL,
cd_id INT NULL NOT NULL,
start_time DATETIME NULL,
end_time DATETIME NULL,
session_id INT,
activate INT
)";
Database::query($sql);
$sql = "CREATE TABLE IF NOT EXISTS ".self::TABLE_MEET_COURSES." (
id INT unsigned NOT NULL auto_increment PRIMARY KEY,
c_id INT NULL,
id_room INT NULL
)";
Database::query($sql);
$src1 = api_get_path(SYS_PLUGIN_PATH).'google_meet/resources/img/64/meet.png';
$src2 = api_get_path(SYS_PLUGIN_PATH).'google_meet/resources/img/64/meet_na.png';
$dest1 = api_get_path(SYS_CODE_PATH).'img/icons/64/meet.png';
@ -140,5 +136,29 @@ class GoogleMeetPlugin extends Plugin
}
public function saveMeet($values){
if (!is_array($values) || empty($values['meet_name'])) {
return false;
}
$table = Database::get_main_table(self::TABLE_MEET_LIST);
$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'],
'session_id' => null,
'activate' => 1,
];
$id = Database::insert($table, $params);
if ($id > 0) {
return $id;
}
}
}

@ -26,13 +26,21 @@ $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();
if ($enable) {
if ($isAdmin || $isTeacher || $isStudent) {
}
}
$tpl->assign('url_add_room', $urlAddMeet);
$tpl->assign('is_admin', $isAdmin);
$tpl->assign('is_student', $isStudent);
$tpl->assign('is_teacher', $isTeacher);
$content = $tpl->fetch('googlemeet/view/start.tpl');
$tpl->assign('content', $content);
$tpl->display_one_col_template();

@ -0,0 +1,82 @@
<div class="row">
<div class="col-md-12">
<div class="panel panel-default">
<div class="panel-body">
<div class="plugin_logo">
<img alt="" class="img-responsive" src="{{ _p.web }}plugin/googlemeet/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-primary">
<i class="fa fa-video-camera" aria-hidden="true"></i>
{{ '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 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>
{% 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>
</div>
Loading…
Cancel
Save