parent
0103e23aea
commit
e86da3c670
@ -0,0 +1,11 @@ |
||||
|
||||
<?php |
||||
/** |
||||
* Config the plugin. |
||||
* |
||||
* @author Alex Aragón Calixto <alex.aragon@tunqui.pe> |
||||
* |
||||
* @package chamilo.plugin.googlemeet |
||||
*/ |
||||
require_once __DIR__.'/../../main/inc/global.inc.php'; |
||||
require_once 'src/googlemeet_plugin.class.php'; |
||||
@ -0,0 +1,10 @@ |
||||
<?php |
||||
/* For licensing terms, see /license.txt */ |
||||
/** |
||||
* Config the plugin. |
||||
* |
||||
* @package chamilo.plugin.googlemeet |
||||
*/ |
||||
require_once __DIR__.'/config.php'; |
||||
|
||||
GoogleMeetPlugin::create()->install(); |
||||
@ -0,0 +1,10 @@ |
||||
<?php |
||||
/* For licensing terms, see /license.txt */ |
||||
|
||||
$strings['plugin_title'] = 'Hangouts Meet'; |
||||
$strings['plugin_comment'] = 'Google Hangouts Meet es el sistema de videoconferencia de Google, Conformado por a la app de Hangouts Meet y el Hardware de videoconferencia.'; |
||||
$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.'; |
||||
|
||||
@ -0,0 +1,4 @@ |
||||
<?php |
||||
|
||||
require_once __DIR__.'/config.php'; |
||||
$plugin_info = GoogleMeetPlugin::create()->get_info(); |
||||
|
After Width: | Height: | Size: 2.6 KiB |
|
After Width: | Height: | Size: 2.1 KiB |
|
After Width: | Height: | Size: 10 KiB |
@ -0,0 +1,144 @@ |
||||
<?php |
||||
/** |
||||
* Plugin class for the Google Meet plugin. |
||||
* |
||||
* @package chamilo.plugin.googlemeet |
||||
* |
||||
* @author Alex Aragón Calixto <alex.aragon@tunqui.pe> |
||||
*/ |
||||
|
||||
class GoogleMeetPlugin extends Plugin |
||||
{ |
||||
|
||||
const TABLE_MEET_COURSES = 'plugin_meet_courses'; |
||||
const TABLE_MEET_LIST = 'plugin_meet_room'; |
||||
const SETTING_TITLE = 'tool_title'; |
||||
const SETTING_ENABLED = 'google_meet_enabled'; |
||||
|
||||
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 getToolTitle() |
||||
{ |
||||
$title = $this->get(self::SETTING_TITLE); |
||||
|
||||
if (!empty($title)) { |
||||
return $title; |
||||
} |
||||
|
||||
return $this->get_title(); |
||||
} |
||||
|
||||
/** |
||||
* @return GoogleMeetPlugin |
||||
*/ |
||||
public static function create() |
||||
{ |
||||
static $result = null; |
||||
|
||||
return $result ? $result : $result = new self(); |
||||
} |
||||
|
||||
|
||||
/** |
||||
* This method creates the tables required to this plugin. |
||||
*/ |
||||
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, |
||||
type_meet INT NOT NULL, |
||||
user_id INT NULL NOT NULL, |
||||
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'; |
||||
$dest2 = api_get_path(SYS_CODE_PATH).'img/icons/64/meet_na.png'; |
||||
|
||||
copy($src1, $dest1); |
||||
copy($src2, $dest2); |
||||
} |
||||
|
||||
/** |
||||
* This method drops the plugin tables. |
||||
*/ |
||||
public function uninstall() |
||||
{ |
||||
$this->deleteCourseToolLinks(); |
||||
|
||||
$tablesToBeDeleted = [ |
||||
self::TABLE_MEET_COURSES, |
||||
self::TABLE_MEET_LIST, |
||||
]; |
||||
|
||||
foreach ($tablesToBeDeleted as $tableToBeDeleted) { |
||||
$table = Database::get_main_table($tableToBeDeleted); |
||||
$sql = "DROP TABLE IF EXISTS $table"; |
||||
Database::query($sql); |
||||
} |
||||
|
||||
$this->manageTab(false); |
||||
|
||||
} |
||||
|
||||
/** |
||||
* @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->getToolTitle(), $course['id']); |
||||
} |
||||
} |
||||
|
||||
return $this; |
||||
} |
||||
|
||||
private function deleteCourseToolLinks() |
||||
{ |
||||
Database::getManager() |
||||
->createQuery('DELETE FROM ChamiloCourseBundle:CTool t WHERE t.category = :category AND t.link LIKE :link') |
||||
->execute(['category' => 'plugin', 'link' => 'zoom/start.php%']); |
||||
} |
||||
|
||||
|
||||
|
||||
} |
||||
@ -0,0 +1,38 @@ |
||||
<?php |
||||
/** |
||||
* This script initiates a video conference session, calling the Google Meet. |
||||
*/ |
||||
require_once __DIR__.'/../../vendor/autoload.php'; |
||||
|
||||
$course_plugin = 'zoom'; //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(); |
||||
|
||||
$tool_name = $plugin->get_lang('tool_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'; |
||||
|
||||
if ($enable) { |
||||
if ($isAdmin || $isTeacher || $isStudent) { |
||||
|
||||
} |
||||
} |
||||
|
||||
|
||||
$content = $tpl->fetch('googlemeet/view/start.tpl'); |
||||
$tpl->assign('content', $content); |
||||
$tpl->display_one_col_template(); |
||||
@ -0,0 +1,5 @@ |
||||
|
||||
<?php |
||||
/* For licensing terms, see /license.txt */ |
||||
require_once __DIR__.'/config.php'; |
||||
GoogleMeetPlugin::create()->uninstall(); |
||||
Loading…
Reference in new issue