Plugin: Add mobidico from 1.11.x

pull/4020/head
Julio 3 years ago
parent b8186e33cc
commit 944227ba33
  1. 52
      public/plugin/mobidico/Mobidico.php
  2. 2
      public/plugin/mobidico/README.md
  3. 1
      public/plugin/mobidico/index.php
  4. 4
      public/plugin/mobidico/install.php
  5. 5
      public/plugin/mobidico/lang/english.php
  6. 5
      public/plugin/mobidico/plugin.php
  7. 61
      public/plugin/mobidico/start.php
  8. 11
      public/plugin/mobidico/uninstall.php

@ -0,0 +1,52 @@
<?php
/**
* Class Mobidico.
*/
class Mobidico extends Plugin
{
public $isCoursePlugin = true;
// When creating a new course this settings are added to the course
public $course_settings = [];
/**
* Constructor.
*/
protected function __construct()
{
parent::__construct(
'O.1',
'Julio Montoya',
[
'tool_enable' => 'boolean',
'api_key' => 'text',
'mobidico_url' => 'text',
]
);
}
/**
* @return Mobidico|null
*/
public static function create()
{
static $result = null;
return $result ? $result : $result = new self();
}
/**
* Install.
*/
public function install()
{
}
/**
* Uninstall.
*/
public function uninstall()
{
}
}

@ -0,0 +1,2 @@
Mobidico
========

@ -0,0 +1,4 @@
<?php
//require_once __DIR__.'/config.php';
Mobidico::create()->install();

@ -0,0 +1,5 @@
<?php
// Needed in order to show the plugin title
$strings['plugin_title'] = "Mobidico";
$strings['plugin_comment'] = "Connects to Mobidico service";

@ -0,0 +1,5 @@
<?php
//require_once __DIR__.'/config.php';
$plugin_info = Mobidico::create()->get_info();

@ -0,0 +1,61 @@
<?php
require_once __DIR__.'/../../main/inc/global.inc.php';
$course_plugin = 'mobidico'; //needed in order to load the plugin lang variables
$plugin = Mobidico::create();
if ($plugin->get('tool_enable') !== 'true') {
api_not_allowed(true);
}
$url = $plugin->get('mobidico_url');
$key = $plugin->get('api_key');
$tool_name = get_lang('Videoconference');
$params = [
'chamiloid' => api_get_user_id(),
'API_KEY' => $key,
];
$redirect = '';
try {
$client = new GuzzleHttp\Client();
$response = $client->request(
'POST',
$url.'/app/desktop/php/authenticate.php',
[
'form_params' => $params,
'verify' => false,
]
);
$status = $response->getStatusCode();
if ($status === 200) {
$result = json_decode($response->getBody());
if ($result && isset($result->status)) {
if ($result->status == 'OK') {
$redirect = $url.'/app/index.html?session='.$result->session;
} else {
api_not_allowed(true);
}
}
}
} catch (Exception $e) {
echo $e->getMessage();
}
$htmlHeadXtra[] = '<script>
$(document).ready(function() {
var url = "'.$redirect.'";
var win = window.open(url, "_blank");
win.focus();
});
</script>';
$tpl = new Template('Mobidico');
$content = '';
$tpl->assign('content', $content);
$tpl->display_one_col_template();

@ -0,0 +1,11 @@
<?php
/**
* This script is included by main/admin/settings.lib.php when unselecting a plugin
* and is meant to remove things installed by the install.php script in both
* the global database and the courses tables.
*
* @package chamilo.plugin.bigbluebutton
*/
//require_once __DIR__.'/config.php';
Mobidico::create()->uninstall();
Loading…
Cancel
Save