diff --git a/plugin/googlemeet/lang/spanish.php b/plugin/googlemeet/lang/spanish.php index 471c924fd1..437f0bb621 100644 --- a/plugin/googlemeet/lang/spanish.php +++ b/plugin/googlemeet/lang/spanish.php @@ -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"; + diff --git a/plugin/googlemeet/meet.php b/plugin/googlemeet/meet.php new file mode 100644 index 0000000000..eb2b8ccb93 --- /dev/null +++ b/plugin/googlemeet/meet.php @@ -0,0 +1,112 @@ +'; + +$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(); \ No newline at end of file diff --git a/plugin/googlemeet/resources/css/style.css b/plugin/googlemeet/resources/css/style.css new file mode 100644 index 0000000000..16e02a8288 --- /dev/null +++ b/plugin/googlemeet/resources/css/style.css @@ -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; +} \ No newline at end of file diff --git a/plugin/googlemeet/resources/img/svg/meet_room.svg b/plugin/googlemeet/resources/img/svg/meet_room.svg new file mode 100644 index 0000000000..fe12d4e856 --- /dev/null +++ b/plugin/googlemeet/resources/img/svg/meet_room.svg @@ -0,0 +1,1413 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/plugin/googlemeet/src/googlemeet_plugin.class.php b/plugin/googlemeet/src/googlemeet_plugin.class.php index 9a962014b4..fbb5ce984f 100644 --- a/plugin/googlemeet/src/googlemeet_plugin.class.php +++ b/plugin/googlemeet/src/googlemeet_plugin.class.php @@ -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; + } + } } \ No newline at end of file diff --git a/plugin/googlemeet/start.php b/plugin/googlemeet/start.php index 9327a7e35f..649c392d06 100644 --- a/plugin/googlemeet/start.php +++ b/plugin/googlemeet/start.php @@ -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(); \ No newline at end of file diff --git a/plugin/googlemeet/view/start.tpl b/plugin/googlemeet/view/start.tpl index e69de29bb2..1bac81bdcf 100644 --- a/plugin/googlemeet/view/start.tpl +++ b/plugin/googlemeet/view/start.tpl @@ -0,0 +1,82 @@ +
+
+
+
+ + +
+ {% if is_admin or is_teacher %} + + + {{ 'ManageMeetAccounts'|get_plugin_lang('GoogleMeetPlugin') }} + + {% endif %} + {% if is_admin or is_teacher %} + {% if room %} + + + {{ 'RemoveAndChangeRoomMeet'| get_plugin_lang('GoogleMeetPlugin') }} + + {% endif %} + {% endif %} +
+ + + {% if room %} + +
+
+
+
{{ 'MeetingIDZoom'|get_plugin_lang('GoogleMeetPlugin') }}
+
{{ room.room_id }}
+
{{ 'RoomNameZoom'|get_plugin_lang('GoogleMeetPlugin') }}
+
{{ room.room_name }}
+
{{ 'InstantMeetingURL'|get_plugin_lang('GoogleMeetPlugin') }}
+
+ + {{ room.room_url }} + +
+ {% if room.room_pass %} +
{{ 'HostKey'|get_plugin_lang('GoogleMeetPlugin') }}
+
{{ room.room_pass }}
+ {% endif %} + + {% if is_teacher %} + {% if not view_pass %} +
{{ 'AccountEmailZoom'|get_plugin_lang('GoogleMeetPlugin') }}
+
{{ room.zoom_email }}
+
{{ 'Password'|get_lang }}
+
{{ room.zoom_pass }}
+ {% endif %} + {% endif %} +
+ +
+
+ {% else %} + + {% if is_student %} + + {% endif %} + {% endif %} + + {{ form_zoom }} + +
+
+
+
\ No newline at end of file