/** * Constructor (generates a connection to the API and the Chamilo settings * required for the connection to the video conference server) */ public function __construct() { global $_configuration; // initialize video server settings from global settings $plugin = \OpenMeetingsPlugin::create(); $om_plugin = $plugin->get('tool_enable'); $om_host = $plugin->get('host'); $om_user = $plugin->get('user'); $om_pass = $plugin->get('pass'); $accessUrl = api_get_access_url($_configuration['access_url']); $this->externalType = substr($accessUrl['url'], strpos($accessUrl['url'], '://') + 3, -1); if (strcmp($this->externalType, 'localhost') == 0) { $this->externalType = substr(api_get_path(WEB_PATH), strpos(api_get_path(WEB_PATH), '://') + 3, -1); } $this->externalType = 'chamilolms.' . $this->externalType; $this->table = \Database::get_main_table('plugin_openmeetings'); if ($om_plugin) { $user_info = api_get_user_info(); $this->user_complete_name = $user_info['complete_name']; $this->user = $om_user; $this->pass = $om_pass; $this->url = $om_host; // Setting OM api define('CONFIG_OPENMEETINGS_USER', $this->user); define('CONFIG_OPENMEETINGS_PASS', $this->pass); define('CONFIG_OPENMEETINGS_SERVER_URL', $this->url); $this->gateway = new \OpenMeetingsGateway($this->url, $this->user, $this->pass); $this->plugin_enabled = $om_plugin; // The room has a name composed of C + course ID + '-' + session ID $this->chamiloCourseId = api_get_course_int_id(); $this->chamiloSessionId = api_get_session_id(); $this->roomName = 'C' . $this->chamiloCourseId . '-' . $this->chamiloSessionId; $return = $this->gateway->loginUser(); if ($return == 0) { $msg = 'Could not initiate session with server through OpenMeetingsGateway::loginUser()'; error_log(__FILE__ . '+' . __LINE__ . ': ' . $msg); die($msg); } $this->sessionId = $this->gateway->sessionId; } }
<?php /** * This script initiates a videoconference session, calling the BigBlueButton API * @package chamilo.plugin.bigbluebutton */ /** * Initialization */ $course_plugin = 'openmeetings'; //needed in order to load the plugin lang variables require_once dirname(__FILE__).'/config.php'; $plugin = \OpenMeetingsPlugin::create(); $tool_name = $plugin->get_lang('Videoconference'); $tpl = new Template($tool_name); $om = new Chamilo\Plugin\OpenMeetings\OpenMeetings(); $action = isset($_GET['action']) ? $_GET['action'] : null; $teacher = $om->isTeacher(); api_protect_course_script(true); $message = null; if ($teacher) { switch ($action) { case 'add_to_calendar': $course_info = api_get_course_info(); $agenda = new Agenda(); $agenda->type = 'course'; $id = intval($_GET['id']); $title = sprintf(get_lang('VideoConferenceXCourseX'), $id, $course_info['name']);