parent
							
								
									ad5b66254e
								
							
						
					
					
						commit
						d142001f8f
					
				| 
		 After Width: | Height: | Size: 47 KiB  | 
| 
		 After Width: | Height: | Size: 64 KiB  | 
| 
		 After Width: | Height: | Size: 64 KiB  | 
| 
		 After Width: | Height: | Size: 64 KiB  | 
@ -0,0 +1,11 @@ | 
				
			||||
<?php | 
				
			||||
/* For licensing terms, see /license.txt */ | 
				
			||||
 | 
				
			||||
/* bbb parameters that will be registered in the course settings */ | 
				
			||||
 | 
				
			||||
require_once '../../main/inc/global.inc.php'; | 
				
			||||
require_once api_get_path(LIBRARY_PATH).'plugin.class.php'; | 
				
			||||
 | 
				
			||||
require_once 'lib/om_integration.lib.php'; | 
				
			||||
require_once 'lib/om_integration_api.php'; | 
				
			||||
require_once 'lib/om_integration_plugin.class.php'; | 
				
			||||
@ -0,0 +1,10 @@ | 
				
			||||
<?php | 
				
			||||
/** | 
				
			||||
 * This script is included by the course_home.php script (indirectly) and is | 
				
			||||
 * used to show the link to the plugin from inside the course's tools list | 
				
			||||
 * @package chamilo.plugin.bigbluebutton | 
				
			||||
 */ | 
				
			||||
/** | 
				
			||||
 * Display course tool title | 
				
			||||
 */ | 
				
			||||
echo "Videoconference"; | 
				
			||||
@ -0,0 +1,3 @@ | 
				
			||||
<?php | 
				
			||||
 | 
				
			||||
?> | 
				
			||||
@ -0,0 +1,12 @@ | 
				
			||||
<?php | 
				
			||||
/** | 
				
			||||
 * This script is included by main/admin/settings.lib.php and generally | 
				
			||||
 * includes things to execute in the main database (settings_current table) | 
				
			||||
 * @package chamilo.plugin.bigbluebutton | 
				
			||||
 */ | 
				
			||||
/** | 
				
			||||
 * Initialization | 
				
			||||
 */ | 
				
			||||
 | 
				
			||||
require_once dirname(__FILE__).'/config.php'; | 
				
			||||
om_integrationPlugin::create()->install(); | 
				
			||||
@ -0,0 +1,55 @@ | 
				
			||||
<?php | 
				
			||||
/** | 
				
			||||
 * | 
				
			||||
 * @copyright (c) 2012 University of Geneva | 
				
			||||
 * @license GNU General Public License - http://www.gnu.org/copyleft/gpl.html | 
				
			||||
 * @author Laurent Opprecht <laurent@opprecht.info> | 
				
			||||
 */ | 
				
			||||
 | 
				
			||||
//Needed in order to show the plugin title | 
				
			||||
$strings['plugin_title']        = "Videoconference"; | 
				
			||||
$strings['plugin_comment']      = "Add a videoconference room in a Chamilo course using BigBlueButton (BBB)"; | 
				
			||||
 | 
				
			||||
$strings['Videoconference']     = "Videoconference"; | 
				
			||||
$strings['MeetingOpened']       = "Meeting opened"; | 
				
			||||
$strings['MeetingClosed']       = "Meeting closed"; | 
				
			||||
$strings['MeetingClosedComment'] = "If you have asked for your sessions to be recorded, the recording will be available in the list below when it has been completely generated."; | 
				
			||||
$strings['CloseMeeting']        = "Close meeting"; | 
				
			||||
 | 
				
			||||
$strings['VideoConferenceXCourseX']             = "Videoconference #%s course %s"; | 
				
			||||
$strings['VideoConferenceAddedToTheCalendar']   = "Videoconference added to the calendar"; | 
				
			||||
$strings['VideoConferenceAddedToTheLinkTool']   = "Videoconference added to the link tool"; | 
				
			||||
 | 
				
			||||
$strings['GoToTheVideoConference']   = "Go to the videoconference"; | 
				
			||||
 | 
				
			||||
$strings['Records']             = "Recording"; | 
				
			||||
$strings['Meeting']             = "Meeting"; | 
				
			||||
 | 
				
			||||
$strings['ViewRecord']          = "View recording"; | 
				
			||||
$strings['CopyToLinkTool']      = "Copy to link tool"; | 
				
			||||
 | 
				
			||||
$strings['EnterConference']     = "Enter the videoconference"; | 
				
			||||
$strings['RecordList']          = "Recording list"; | 
				
			||||
$strings['ServerIsNotRunning']  = "Videoconference server is not running"; | 
				
			||||
$strings['ServerIsNotConfigured']  = "Videoconference server is not configured"; | 
				
			||||
 | 
				
			||||
$strings['XUsersOnLine']        = "%s user(s) online"; | 
				
			||||
 | 
				
			||||
$strings['host'] = 'BigBlueButton host'; | 
				
			||||
$strings['host_help'] = 'This is the name of the server where your BigBlueButton server is running. Might be localhost, an IP address (e.g. 192.168.13.54) or a domain name (e.g. my.video.com).'; | 
				
			||||
 | 
				
			||||
$strings['salt'] = 'BigBlueButton salt'; | 
				
			||||
$strings['salt_help'] = 'This is the security key of your BigBlueButton server, which will allow your server to authentify the Chamilo installation. Refer to the BigBlueButton documentation to locate it. Try bbb-conf --salt'; | 
				
			||||
 | 
				
			||||
$strings['tool_enable'] = 'BigBlueButton videoconference tool enabled'; | 
				
			||||
$strings['tool_enable_help'] = "Choose whether you want to enable the BigBlueButton videoconference tool. | 
				
			||||
    Once enabled, it will show as an additional course tool in all courses' homepage, and teachers will be able to launch a conference at any time. Students will not be able to launch a conference, only join one. If you don't have a BigBlueButton server, please <a target=\"_blank\" href=\"http://bigbluebutton.org/\">set one up</a> or ask the Chamilo official providers for a quote. BigBlueButton is a free (as in freedom *and* beer), but its installation requires a set of technical skills that might not be immediately available to all. You can install it on your own or seek professional help to assist you or do it for you. This help, however, will generate a certain cost. In the pure logic of the free software, we offer you the tools to make your work easier and recommend professionals (the Chamilo Official Providers) that will be able to help you if this were too difficult.<br />"; | 
				
			||||
 | 
				
			||||
$strings['big_blue_button_welcome_message'] = 'Welcome message'; | 
				
			||||
$strings['big_blue_button_record_and_store'] = 'Record and store sessions'; | 
				
			||||
 | 
				
			||||
$strings['plugin_tool_bbb'] = 'Video'; | 
				
			||||
 | 
				
			||||
$strings['ThereAreNotRecordingsForTheMeetings'] = 'There are not recording for the meeting sessions'; | 
				
			||||
$strings['NoRecording'] = 'No recording'; | 
				
			||||
 | 
				
			||||
@ -0,0 +1,48 @@ | 
				
			||||
<?php /* License: see /license.txt */ | 
				
			||||
//Needed in order to show the plugin title | 
				
			||||
$strings['plugin_title']        = "Vidéoconférence"; | 
				
			||||
$strings['plugin_comment']      = "Ajoutez un espace de vidéoconférences aux cours de Chamilo avec BigBlueButton (BBB)"; | 
				
			||||
 | 
				
			||||
$strings['Videoconference']     = "Vidéoconférence"; | 
				
			||||
$strings['MeetingOpened']       = "Session ouverte"; | 
				
			||||
$strings['MeetingClosed']       = "Session fermée"; | 
				
			||||
$strings['MeetingClosedComment'] = "Si vous avez demandé l'enregistrement des sessions de conférence, cet enregistrement apparaîtra dans la liste ci-dessous dans quelques instants."; | 
				
			||||
$strings['CloseMeeting']        = "Fermer la session"; | 
				
			||||
 | 
				
			||||
$strings['VideoConferenceXCourseX']             = "Vidéoconférence #%s, cours %s"; | 
				
			||||
$strings['VideoConferenceAddedToTheCalendar']   = "Vidéoconférence ajoutée au calendrier"; | 
				
			||||
$strings['VideoConferenceAddedToTheLinkTool']   = "Vidéoconférence ajoutée comme lien. Vous pouvez éditer et publier le lien sur la page principale du cours depuis l'outil liens."; | 
				
			||||
 | 
				
			||||
$strings['GoToTheVideoConference']   = "Entrer dans la salle de conférence"; | 
				
			||||
 | 
				
			||||
$strings['Records']             = "Enregistrement"; | 
				
			||||
$strings['Meeting']             = "Salle de conférence"; | 
				
			||||
 | 
				
			||||
$strings['ViewRecord']          = "Voir l'enregistrement"; | 
				
			||||
$strings['CopyToLinkTool']      = "Ajouter comme lien du cours"; | 
				
			||||
 | 
				
			||||
$strings['EnterConference']     = "Entrer dans la salle de conférence"; | 
				
			||||
$strings['RecordList']          = "Liste des enregistrements"; | 
				
			||||
$strings['ServerIsNotRunning']  = "Le serveur de vidéoconférence ne fonctionne pas"; | 
				
			||||
$strings['ServerIsNotConfigured']  = "Le serveur de vidéoconférence n'est pas configuré correctement"; | 
				
			||||
 | 
				
			||||
$strings['XUsersOnLine']        = "%s utilisateurs dans la salle"; | 
				
			||||
 | 
				
			||||
$strings['host'] = 'Hôte de BigBlueButton'; | 
				
			||||
$strings['host_help'] = "C'est le nom du serveur où le serveur de vidéoconférence a été habilité. Cela peut être localhost, une adresse IP (du genre 192.168.13.54) ou un nom de domaine (du genre ma.video.com)."; | 
				
			||||
 | 
				
			||||
$strings['salt'] = 'Clef BigBlueButton'; | 
				
			||||
$strings['salt_help'] = "C'est la clef de sécurité de votre serveur BigBlueButton (appelée 'salt' en anglais) qui permet à votre serveur de vérifier l'identité de votre installation de Chamilo et ainsi l'autoriser à se connecter. Veuillez vous référer à la documentation de BigBlueButton pour la localiser, ou utilisez la commande 'bbb-conf --salt' si vous disposez d'un accès en ligne de commande au serveur de vidéoconférence."; | 
				
			||||
 | 
				
			||||
$strings['tool_enable'] = 'Outil de vidéoconférence BigBlueButton activé'; | 
				
			||||
$strings['tool_enable_help'] = "Choisissez si vous souhaitez activer l'outil de vidéoconférence BigBlueButton. | 
				
			||||
    Une fois activé, il apparaîtra comme un outil additionnel sur toutes les pages principales de cours, et les enseignants pourront démarrer une conférence à n'importe quel moment. Les étudiants ne pourront pas lancer de nouvelle session de conférence, seulement se joindre à une session existante. Si vous ne disposez pas d'un serveur de vidéoconférence BigBlueButton, veuillez <a target=\"_blank\" href=\"http://bigbluebutton.org/\">en installer un</a> avant de poursuivre, ou demander un devis à l'un des fournisseurs officiels de Chamilo. BigBlueButton est un outil de logiciel libre (et gratuit), mais son installation pourrait présenter une certaine complexité et demander des compétences qui ne sont peut-être pas à la portée de tous. Vous pouvez l'installer vous-même à partir de la documentation (disponible publiquement) de BigBlueButton, ou recherchez un soutien professionnel. Ce soutien pourrait générer certains coûts (au moins le temps de la personne qui vous assiste dans l'opération). Dans le plus pur esprit du logiciel libre, nous vous fournissons les outils pour simplifier votre travail dans la mesure de nos possibilités, et nous vous recommandons des professionnels (les fournisseurs officiels de Chamilo) pour vous venir en aide au cas où ceux-ci seraient insuffisants.<br />"; | 
				
			||||
 | 
				
			||||
$strings['big_blue_button_welcome_message'] = 'Message de bienvenue de BigBlueButton'; | 
				
			||||
$strings['big_blue_button_record_and_store'] = 'Enregistrer les sessions de vidéoconférence'; | 
				
			||||
 | 
				
			||||
$strings['plugin_tool_bbb'] = 'Vidéo'; | 
				
			||||
 | 
				
			||||
$strings['ThereAreNotRecordingsForTheMeetings'] = 'Aucun enregistrement disponible'; | 
				
			||||
$strings['NoRecording'] = "Pas d'enregistrement"; | 
				
			||||
 | 
				
			||||
@ -0,0 +1,51 @@ | 
				
			||||
<?php /* License: see /license.txt */ | 
				
			||||
//Needed in order to show the plugin title | 
				
			||||
$strings['plugin_title']        = "Videoconferencias 'OpenMeetings'"; | 
				
			||||
$strings['plugin_comment']      = "Añade una sala de videoconferencia en los cursos de Chamilo con OpenMeetings (om)"; | 
				
			||||
 | 
				
			||||
$strings['Videoconference']     = "VideoconferenciaOM"; | 
				
			||||
$strings['MeetingOpened']       = "Sala abierta"; | 
				
			||||
$strings['MeetingClosed']       = "Sala cerrada"; | 
				
			||||
$strings['MeetingClosedComment'] = "Si ha pedido grabar la sesión de videoconferencia en los parámetros del curso, esta grabación aparecerá en la lista siguiente una vez generada."; | 
				
			||||
$strings['CloseMeeting']        = "Cerrar sala"; | 
				
			||||
 | 
				
			||||
$strings['VideoConferenceXCourseX']             = "Videoconferencia #%s, curso %s"; | 
				
			||||
$strings['VideoConferenceAddedToTheCalendar']   = "Videoconferencia añadida al calendario"; | 
				
			||||
$strings['VideoConferenceAddedToTheLinkTool']   = "Videoconferencia añadida como enlace. Puede editar y publicar el enlace en la página principal del curso desde la herramienta de enlace."; | 
				
			||||
 | 
				
			||||
$strings['GoToTheVideoConference']   = "Ir a la videoconferencia"; | 
				
			||||
 | 
				
			||||
$strings['Records']             = "Grabación"; | 
				
			||||
$strings['Meeting']             = "Sala de conferencia"; | 
				
			||||
 | 
				
			||||
$strings['ViewRecord']          = "Ver grabación"; | 
				
			||||
$strings['CopyToLinkTool']      = "Añadir como enlace del curso"; | 
				
			||||
 | 
				
			||||
$strings['EnterConference']     = "Entrar a la videoconferencia"; | 
				
			||||
$strings['RecordList']          = "Lista de grabaciones"; | 
				
			||||
$strings['ServerIsNotRunning']  = "El servidor de videoconferencia no está funcionando"; | 
				
			||||
$strings['ServerIsNotConfigured']  = "El servidor de videoconferencia no está configurado correctamente"; | 
				
			||||
 | 
				
			||||
$strings['XUsersOnLine']        = "%s usuario(s) en la sala"; | 
				
			||||
 | 
				
			||||
$strings['host'] = 'Host de OpenMeetings'; | 
				
			||||
$strings['host_help'] = 'Este es el nombre del servidor donde su servidor OpenMeetings está corriendo. Puede ser localhost, una dirección IP (ej: 192.168.13.54) o un nombre de dominio (ej: mi.video.com).'; | 
				
			||||
 | 
				
			||||
$strings['user'] = 'Usuario'; | 
				
			||||
$strings['user_help'] = 'Ingrese el usuario con el cual de conectará al servidor OpenMeetings'; | 
				
			||||
 | 
				
			||||
$strings['pass'] = 'Clave OpenMeetings'; | 
				
			||||
$strings['pass_help'] = 'Esta es la llave de seguridad de su servidor OpenMeetings (llamada "salt" en inglés), que permitirá a su servidor de autentifica la instalación de Chamilo (como autorizada). Refiérese a la documentación de OpenMeetings para ubicarla, o use el comando "bbb-conf --salt" si tiene acceso al servidor en línea de comando.'; | 
				
			||||
 | 
				
			||||
$strings['tool_enable'] = 'Herramienta de videoconferencia OpenMeetings activada'; | 
				
			||||
$strings['tool_enable_help'] = "Escoja si desea activar la herramienta de videoconferencia OpenMeetings. | 
				
			||||
    Una vez activada, se mostrará como una herramienta adicional en todas las páginas principales de cursos, y los profesores podrán iniciar una conferencia en cualquier momento. Los estudiantes no podrían lanzar una conferencia, solo juntarse a una existente. Si no tiene un servidor de videoconferencia OpenMeetings, por favor <a target=\"_blank\" href=\"http://bigbluebutton.org/\">configure uno</a> antes de seguir, o pida una cotización a uno de los proveedores oficiales de Chamilo. OpenMeetings es una herramienta de software libre (y gratuita), pero su instalación requiere de competencias que quizás no sean inmediatamente disponibles para todos. Puede instalarla usted mismo o buscar ayuda profesional. Esta ayuda podría no obstante generar algunos costos (por lo menos el tiempo de la persona quien lo ayude). En el puro espíritu del software libre, le ofrecemos las herramientas para hacer su trabajo más simple, en la medida de nuestras posibilidades, y le recomendamos profesionales (los proveedores oficiales de Chamilo) para ayudarlo en caso esto fuera demasiado complicado.<br />"; | 
				
			||||
 | 
				
			||||
$strings['big_blue_button_welcome_message'] = 'Mensaje de bienvenida de '; | 
				
			||||
$strings['big_blue_button_record_and_store'] = 'Grabar las sesiones de videoconferencia'; | 
				
			||||
 | 
				
			||||
$strings['plugin_tool_bbb'] = 'Video'; | 
				
			||||
 | 
				
			||||
$strings['ThereAreNotRecordingsForTheMeetings'] = 'No hay grabaciones de sesiones de videoconferencia'; | 
				
			||||
$strings['NoRecording'] = 'No hay grabación'; | 
				
			||||
 | 
				
			||||
@ -0,0 +1,185 @@ | 
				
			||||
<?php | 
				
			||||
include_once 'services/getSession/getSession.class.php'; | 
				
			||||
include_once 'services/loginUser/loginUser.class.php'; | 
				
			||||
include_once 'services/addRoomWithModerationAndExternalType/addRoomWithModerationAndExternalType.class.php'; | 
				
			||||
/** | 
				
			||||
 * Open Meetings-Chamilo connector class | 
				
			||||
 */ | 
				
			||||
class om_integration { | 
				
			||||
 | 
				
			||||
    var $url; | 
				
			||||
    var $salt; | 
				
			||||
    var $api; | 
				
			||||
    var $user_complete_name = null; | 
				
			||||
    var $protocol = 'http://'; | 
				
			||||
    var $debug = false; | 
				
			||||
    var $logout_url = null; | 
				
			||||
    var $plugin_enabled = false; | 
				
			||||
    var $sessionId = ""; | 
				
			||||
 | 
				
			||||
    /** | 
				
			||||
     * Constructor (generates a connection to the API and the Chamilo settings | 
				
			||||
     * required for the connection to the videoconference server) | 
				
			||||
     */ | 
				
			||||
    function __construct() { | 
				
			||||
 | 
				
			||||
        // initialize video server settings from global settings | 
				
			||||
        $plugin = om_integrationPlugin::create(); | 
				
			||||
 | 
				
			||||
        $om_plugin = $plugin->get('tool_enable'); | 
				
			||||
        $om_host   = $plugin->get('host'); | 
				
			||||
        $om_user   = $plugin->get('user'); | 
				
			||||
        $om_pass   = $plugin->get('pass'); | 
				
			||||
 | 
				
			||||
        $this->table = Database::get_main_table('plugin_om_meeting'); | 
				
			||||
         | 
				
			||||
        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_OMUSER_SALT', $this->user); | 
				
			||||
            define('CONFIG_OMPASS_SALT', $this->pass); | 
				
			||||
            define('CONFIG_OMSERVER_BASE_URL', $this->url); | 
				
			||||
 | 
				
			||||
            $this->api = new OpenMeetings(); | 
				
			||||
            $this->plugin_enabled = $om_plugin; | 
				
			||||
        } | 
				
			||||
    } | 
				
			||||
    /** | 
				
			||||
     * Checks whether a user is teacher in the current course | 
				
			||||
     * @return bool True if the user can be considered a teacher in this course, false otherwise | 
				
			||||
     */ | 
				
			||||
    function is_teacher() { | 
				
			||||
        return api_is_course_admin() || api_is_coach() || api_is_platform_admin(); | 
				
			||||
    } | 
				
			||||
    /** | 
				
			||||
     * Login the user with OM Server | 
				
			||||
     * @return bool True if the user is correct and false when is incorrect | 
				
			||||
     */ | 
				
			||||
    function loginUser() { | 
				
			||||
      try{   | 
				
			||||
        $objGetSession = new getSession(); | 
				
			||||
        $objloginUser = new loginUser(); | 
				
			||||
        $urlWsdl = CONFIG_OMSERVER_BASE_URL . "/services/UserService?wsdl"; | 
				
			||||
	$omServices = new SoapClient( $urlWsdl ); | 
				
			||||
        //Verifying if there is already an active session | 
				
			||||
        $gsFun = $omServices->getSession($objGetSession); | 
				
			||||
        $objloginUser->SID = $this->sessionId = $gsFun->return->session_id; | 
				
			||||
        $objloginUser->username = CONFIG_OMUSER_SALT; | 
				
			||||
        $objloginUser->userpass = CONFIG_OMPASS_SALT; | 
				
			||||
         | 
				
			||||
        $luFn = $omServices->loginUser($objloginUser); | 
				
			||||
        | 
				
			||||
        if ( $luFn->return > 0 ) | 
				
			||||
         return true; | 
				
			||||
       else  | 
				
			||||
         return false; | 
				
			||||
      }catch( SoapFault $e){ | 
				
			||||
          echo "<h1>Warning</h1> | 
				
			||||
                <p>We have detected some problems </br> | 
				
			||||
                Fault: {$e->faultstring}</p>"; | 
				
			||||
          return false; | 
				
			||||
      } | 
				
			||||
    } | 
				
			||||
    /* | 
				
			||||
     * Creating a Room for the meeting | 
				
			||||
    * @return bool True if the user is correct and false when is incorrect | 
				
			||||
    */ | 
				
			||||
    function create_meeting( $params ) { | 
				
			||||
        //$id = Database::insert($this->table, $params); | 
				
			||||
      try{     | 
				
			||||
        $objAddRoom = new addRoomWithModerationAndExternalType(); | 
				
			||||
        $roomtypes_id = $isModerated = ( $this->is_teacher() ) ? 1 : 2 ; | 
				
			||||
        $params['c_id'] = api_get_course_int_id(); | 
				
			||||
        $course_name = 'COURSE_ID_' . $params['c_id'] .'_NAME_' . $params['meeting_name']; | 
				
			||||
        $urlWsdl = CONFIG_OMSERVER_BASE_URL . "/services/RoomService?wsdl"; | 
				
			||||
 | 
				
			||||
        $params['id'] = $objAddRoom->SID = $this->sessionId; | 
				
			||||
        $objAddRoom->name = $course_name; | 
				
			||||
        $objAddRoom->roomtypes_id = $roomtypes_id; | 
				
			||||
        $objAddRoom->comment = 'Curso: ' . $params['meeting_name'] . ' </br>Plugin for Chamilo'; | 
				
			||||
        $objAddRoom->numberOfPartizipants = 4; | 
				
			||||
        $objAddRoom->ispublic = true; | 
				
			||||
        $objAddRoom->appointment = false; | 
				
			||||
        $objAddRoom->isDemoRoom = false; | 
				
			||||
        $objAddRoom->demoTime = false; | 
				
			||||
        $objAddRoom->isModeratedRoom = $isModerated; | 
				
			||||
        $objAddRoom->externalRoomType = 'Chamilo'; | 
				
			||||
         | 
				
			||||
        $omServices = new SoapClient( $urlWsdl ); | 
				
			||||
        $adFun = $omServices->addRoomWithModerationAndExternalType( $objAddRoom ); | 
				
			||||
         | 
				
			||||
        //Database::insert($this->table, $params); | 
				
			||||
         | 
				
			||||
        //if( $adFun->return > -1 ) | 
				
			||||
         //   $this->join_meeting($meeting_name); | 
				
			||||
         | 
				
			||||
        return $adFun->return; | 
				
			||||
      }catch( SoapFault $e){ | 
				
			||||
          echo "<h1>Warning</h1> | 
				
			||||
                <p>We have detected some problems </br> | 
				
			||||
                Fault: {$e->faultstring}</p>"; | 
				
			||||
          return -1; | 
				
			||||
      } | 
				
			||||
          | 
				
			||||
    } | 
				
			||||
    /** | 
				
			||||
     * Returns a meeting "join" URL | 
				
			||||
     * @param string The name of the meeting (usually the course code) | 
				
			||||
     * @return mixed The URL to join the meeting, or false on error | 
				
			||||
     * @todo implement moderator pass | 
				
			||||
     * @assert ('') === false | 
				
			||||
     * @assert ('abcdefghijklmnopqrstuvwxyzabcdefghijklmno') === false | 
				
			||||
     */ | 
				
			||||
    function join_meeting($meetingid) { | 
				
			||||
        if (empty($meeting_name)) { return false; } | 
				
			||||
        $pass = $this->get_user_meeting_password(); | 
				
			||||
        $meeting_data = Database::select('*', $this->table, array('where' => array('meeting_name = ? AND status = 1 ' => $meeting_name)), 'first'); | 
				
			||||
        if (empty($meeting_data)) { | 
				
			||||
            if ($this->debug) error_log("meeting does not exist: $meeting_name "); | 
				
			||||
            return false; | 
				
			||||
        } | 
				
			||||
 | 
				
			||||
        $meeting_is_running_info = $this->api->isMeetingRunningWithXmlResponseArray($meeting_data['id']); | 
				
			||||
        $meeting_is_running = $meeting_is_running_info['running'] == 'true' ? true : false; | 
				
			||||
 | 
				
			||||
        if ($this->debug) error_log("meeting is running: ".$meeting_is_running); | 
				
			||||
 | 
				
			||||
        $params = array( | 
				
			||||
			'meetingId' => $meeting_data['id'],	//	-- REQUIRED - The unique id for the meeting | 
				
			||||
			'password' => $this->get_mod_meeting_password()		//	-- REQUIRED - The moderator password for the meeting | 
				
			||||
		); | 
				
			||||
 | 
				
			||||
        $meeting_info_exists = $this->get_meeting_info($params); | 
				
			||||
 | 
				
			||||
        if (isset($meeting_is_running) && $meeting_info_exists) { | 
				
			||||
            $joinParams = array( | 
				
			||||
                'meetingId' => $meeting_data['id'],	//	-- REQUIRED - A unique id for the meeting | 
				
			||||
                'username' => $this->user_complete_name,	//-- REQUIRED - The name that will display for the user in the meeting | 
				
			||||
                'password' => $pass,			//-- REQUIRED - The attendee or moderator password, depending on what's passed here | 
				
			||||
                //'createTime' => api_get_utc_datetime(),			//-- OPTIONAL - string. Leave blank ('') unless you set this correctly. | 
				
			||||
                'userID' => api_get_user_id(),				//-- OPTIONAL - string | 
				
			||||
                'webVoiceConf' => ''	//	-- OPTIONAL - string | 
				
			||||
            ); | 
				
			||||
            $url = $this->api->getJoinMeetingURL($joinParams); | 
				
			||||
            $url = $this->protocol.$url; | 
				
			||||
        } else { | 
				
			||||
            $url = $this->logout_url; | 
				
			||||
        } | 
				
			||||
        if ($this->debug) error_log("return url :".$url); | 
				
			||||
        return $url; | 
				
			||||
    } | 
				
			||||
    /** | 
				
			||||
     * Checks if the videoconference server is running. | 
				
			||||
     * Function currently disabled (always returns 1) | 
				
			||||
     * @return bool True if server is running, false otherwise | 
				
			||||
     * @assert () === false | 
				
			||||
     */ | 
				
			||||
    function is_server_running() { | 
				
			||||
        return true; | 
				
			||||
    } | 
				
			||||
} | 
				
			||||
@ -0,0 +1,19 @@ | 
				
			||||
<?php | 
				
			||||
class OpenMeetings { | 
				
			||||
 | 
				
			||||
	private $_securitySalt; | 
				
			||||
	private $_omServerBaseUrl; | 
				
			||||
 | 
				
			||||
	/* ___________ General Methods for the BigBlueButton Class __________ */ | 
				
			||||
 | 
				
			||||
	function __construct() { | 
				
			||||
	/* | 
				
			||||
	Establish just our basic elements in the constructor: | 
				
			||||
	*/ | 
				
			||||
		// BASE CONFIGS - set these for your BBB server in config.php and they will | 
				
			||||
		// simply flow in here via the constants: | 
				
			||||
		$this->_securitySalt 		= CONFIG_SECURITY_SALT; | 
				
			||||
		$this->_omServerBaseUrl 	= CONFIG_SERVER_BASE_URL; | 
				
			||||
	} | 
				
			||||
 | 
				
			||||
} | 
				
			||||
@ -0,0 +1,77 @@ | 
				
			||||
<?php | 
				
			||||
 | 
				
			||||
class om_integrationPlugin extends Plugin | 
				
			||||
{ | 
				
			||||
    public $is_course_plugin = true; | 
				
			||||
 | 
				
			||||
    //When creating a new course this settings are added to the course | 
				
			||||
    public $course_settings = array( | 
				
			||||
                    array('name' => 'om_button_record_and_store', 'type' => 'checkbox') | 
				
			||||
    ); | 
				
			||||
 | 
				
			||||
    static function create() { | 
				
			||||
        static $result = null; | 
				
			||||
        return $result ? $result : $result = new self(); | 
				
			||||
    } | 
				
			||||
 | 
				
			||||
    protected function __construct() { | 
				
			||||
        parent::__construct('2.0', 'Francis Gonzales', array('tool_enable' => 'boolean', 'host' =>'text', 'user' => 'text', 'pass' => 'text')); | 
				
			||||
    } | 
				
			||||
 | 
				
			||||
    function install() { | 
				
			||||
        $table = Database::get_main_table('plugin_om_meeting'); | 
				
			||||
        $sql = "CREATE TABLE IF NOT EXISTS $table ( | 
				
			||||
                id INT unsigned NOT NULL auto_increment PRIMARY KEY, | 
				
			||||
                c_id INT unsigned NOT NULL DEFAULT 0, | 
				
			||||
                meeting_name VARCHAR(255) NOT NULL DEFAULT '', | 
				
			||||
                attendee_pw VARCHAR(255) NOT NULL DEFAULT '', | 
				
			||||
                moderator_pw VARCHAR(255) NOT NULL DEFAULT '', | 
				
			||||
                record INT NOT NULL DEFAULT 0, | 
				
			||||
                status INT NOT NULL DEFAULT 0, | 
				
			||||
                created_at VARCHAR(255) NOT NULL, | 
				
			||||
                closed_at VARCHAR(255) NOT NULL, | 
				
			||||
                calendar_id INT DEFAULT 0, | 
				
			||||
                welcome_msg VARCHAR(255) NOT NULL DEFAULT '')"; | 
				
			||||
        Database::query($sql); | 
				
			||||
 | 
				
			||||
        //Installing course settings | 
				
			||||
        $this->install_course_fields_in_all_courses(); | 
				
			||||
    } | 
				
			||||
 | 
				
			||||
    function uninstall() { | 
				
			||||
        $t_settings = Database::get_main_table(TABLE_MAIN_SETTINGS_CURRENT); | 
				
			||||
        $t_options = Database::get_main_table(TABLE_MAIN_SETTINGS_OPTIONS); | 
				
			||||
        $t_tool = Database::get_course_table(TABLE_TOOL_LIST); | 
				
			||||
 | 
				
			||||
        //New settings | 
				
			||||
 | 
				
			||||
        $sql = "DELETE FROM $t_settings WHERE variable = 'om_integration_tool_enable'"; | 
				
			||||
        Database::query($sql); | 
				
			||||
        $sql = "DELETE FROM $t_settings WHERE variable = 'om_integration_pass'"; | 
				
			||||
        Database::query($sql); | 
				
			||||
        $sql = "DELETE FROM $t_settings WHERE variable = 'om_integration_user'"; | 
				
			||||
        Database::query($sql); | 
				
			||||
        $sql = "DELETE FROM $t_settings WHERE variable = 'om_integration_host'"; | 
				
			||||
        Database::query($sql); | 
				
			||||
 | 
				
			||||
        //Old settings deleting just in case | 
				
			||||
        $sql = "DELETE FROM $t_settings WHERE variable = 'om_plugin'"; | 
				
			||||
        Database::query($sql); | 
				
			||||
        $sql = "DELETE FROM $t_options WHERE variable  = 'om_plugin'"; | 
				
			||||
        Database::query($sql); | 
				
			||||
//        $sql = "DELETE FROM $t_settings WHERE variable = 'bbb_plugin_host'"; | 
				
			||||
//        Database::query($sql); | 
				
			||||
//        $sql = "DELETE FROM $t_settings WHERE variable = 'bbb_plugin_salt'"; | 
				
			||||
//        Database::query($sql); | 
				
			||||
 | 
				
			||||
        //hack to get rid of Database::query warning (please add c_id...) | 
				
			||||
        $sql = "DELETE FROM $t_tool WHERE name = 'videoconference' AND c_id = c_id"; | 
				
			||||
        Database::query($sql); | 
				
			||||
 | 
				
			||||
        $sql = "DROP TABLE IF EXISTS plugin_om_meeting"; | 
				
			||||
        Database::query($sql); | 
				
			||||
 | 
				
			||||
        //Deleting course settings | 
				
			||||
        $this->uninstall_course_fields_in_all_courses(); | 
				
			||||
    } | 
				
			||||
} | 
				
			||||
@ -0,0 +1,14 @@ | 
				
			||||
<?php | 
				
			||||
class addRoomWithModerationAndExternalType{ | 
				
			||||
    public $SID; | 
				
			||||
    public $name; | 
				
			||||
    public $roomtypes_id; | 
				
			||||
    public $comment; | 
				
			||||
    public $numberOfPartizapants; | 
				
			||||
    public $ispublic; | 
				
			||||
    public $appointment; | 
				
			||||
    public $isDemoRoom; | 
				
			||||
    public $demoTime; | 
				
			||||
    public $isModeratedRoom; | 
				
			||||
    public $externalRoomType; | 
				
			||||
} | 
				
			||||
@ -0,0 +1,4 @@ | 
				
			||||
<?php | 
				
			||||
class getSession{ | 
				
			||||
 | 
				
			||||
} | 
				
			||||
@ -0,0 +1,6 @@ | 
				
			||||
<?php | 
				
			||||
class loginUser{ | 
				
			||||
    public $SID; | 
				
			||||
    public $username; | 
				
			||||
    public $userpass; | 
				
			||||
} | 
				
			||||
@ -0,0 +1,97 @@ | 
				
			||||
<?php | 
				
			||||
/** | 
				
			||||
 * This script initiates a videoconference session, calling the BigBlueButton API | 
				
			||||
 * @package chamilo.plugin.bigbluebutton | 
				
			||||
 */ | 
				
			||||
/** | 
				
			||||
 * Initialization | 
				
			||||
 */ | 
				
			||||
 | 
				
			||||
$course_plugin = 'om_integration'; //needed in order to load the plugin lang variables | 
				
			||||
require_once dirname(__FILE__).'/config.php'; | 
				
			||||
$plugin = om_integrationPlugin::create(); | 
				
			||||
$tool_name = $plugin->get_lang('Videoconference'); | 
				
			||||
$tpl = new Template($tool_name); | 
				
			||||
 | 
				
			||||
$bbb = new om_integration(); | 
				
			||||
$action = isset($_GET['action']) ? $_GET['action'] : null; | 
				
			||||
 | 
				
			||||
$teacher = $bbb->is_teacher(); | 
				
			||||
 | 
				
			||||
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']); | 
				
			||||
            $content = Display::url(get_lang('GoToTheVideoConference'), $_GET['url']); | 
				
			||||
 | 
				
			||||
            $event_id = $agenda->add_event($_REQUEST['start'], null, 'true', null, $title, $content, array('everyone')); | 
				
			||||
            if (!empty($event_id)) { | 
				
			||||
                $message = Display::return_message(get_lang('VideoConferenceAddedToTheCalendar'), 'success'); | 
				
			||||
            } else { | 
				
			||||
                $message = Display::return_message(get_lang('Error'), 'error'); | 
				
			||||
            } | 
				
			||||
            break; | 
				
			||||
        case 'copy_record_to_link_tool': | 
				
			||||
            $result = $bbb->copy_record_to_link_tool($_GET['id'], $_GET['record_id']); | 
				
			||||
            if ($result) { | 
				
			||||
                $message = Display::return_message(get_lang('VideoConferenceAddedToTheLinkTool'), 'success'); | 
				
			||||
            } else { | 
				
			||||
                $message = Display::return_message(get_lang('Error'), 'error'); | 
				
			||||
            } | 
				
			||||
            break; | 
				
			||||
        case 'delete_record': | 
				
			||||
            $bbb->delete_record($_GET['id']); | 
				
			||||
            if ($result) { | 
				
			||||
                $message = Display::return_message(get_lang('Deleted'), 'success'); | 
				
			||||
            } else { | 
				
			||||
                $message = Display::return_message(get_lang('Error'), 'error'); | 
				
			||||
            } | 
				
			||||
            break; | 
				
			||||
        case 'end': | 
				
			||||
            $bbb->end_meeting($_GET['id']); | 
				
			||||
            $message = Display::return_message(get_lang('MeetingClosed').'<br />'.get_lang('MeetingClosedComment'), 'success', false); | 
				
			||||
            break; | 
				
			||||
        case 'publish': | 
				
			||||
            //$result = $bbb->publish_meeting($_GET['id']); | 
				
			||||
            break; | 
				
			||||
        case 'unpublish': | 
				
			||||
            //$result = $bbb->unpublish_meeting($_GET['id']); | 
				
			||||
            break; | 
				
			||||
        default: | 
				
			||||
            break; | 
				
			||||
    } | 
				
			||||
} | 
				
			||||
 | 
				
			||||
$meetings = $bbb->get_course_meetings(); | 
				
			||||
if (!empty($meetings)) { | 
				
			||||
    $meetings = array_reverse($meetings); | 
				
			||||
} | 
				
			||||
$users_online   = $bbb->get_users_online_in_current_room(); | 
				
			||||
$status         = $bbb->is_server_running(); | 
				
			||||
$meeting_exists = $bbb->meeting_exists(api_get_course_id()); | 
				
			||||
$show_join_button = false; | 
				
			||||
if ($meeting_exists || $teacher) { | 
				
			||||
    $show_join_button = true; | 
				
			||||
} | 
				
			||||
 | 
				
			||||
$tpl->assign('allow_to_edit', $teacher); | 
				
			||||
$tpl->assign('meetings', $meetings); | 
				
			||||
$conference_url = api_get_path(WEB_PLUGIN_PATH).'om_integration/start.php?launch=1&'.api_get_cidreq(); | 
				
			||||
$tpl->assign('conference_url', $conference_url); | 
				
			||||
$tpl->assign('users_online', $users_online); | 
				
			||||
$tpl->assign('bbb_status', $status); | 
				
			||||
$tpl->assign('show_join_button', $show_join_button); | 
				
			||||
 | 
				
			||||
//$tpl->assign('actions', $actions); | 
				
			||||
$tpl->assign('message', $message); | 
				
			||||
$listing_tpl = 'om_integration/listing.tpl'; | 
				
			||||
$content = $tpl->fetch($listing_tpl); | 
				
			||||
$tpl->assign('content', $content);$tpl->display_one_col_template(); | 
				
			||||
@ -0,0 +1,65 @@ | 
				
			||||
<div class ="row"> | 
				
			||||
 | 
				
			||||
{% if bbb_status == true %} | 
				
			||||
  {% if show_join_button == true %} | 
				
			||||
    <div class ="span12" style="text-align:center"> | 
				
			||||
        <a href="{{ conference_url }}" target="_blank" class="btn btn-primary btn-large"> | 
				
			||||
            {{ 'EnterConference'|get_lang }} | 
				
			||||
        </a> | 
				
			||||
        <span id="users_online" class="label label-warning">{{ 'XUsersOnLine'| get_lang | format(users_online) }} </span> | 
				
			||||
    </div> | 
				
			||||
  {% endif %} | 
				
			||||
 | 
				
			||||
    <div class ="span12"> | 
				
			||||
        <div class="page-header"> | 
				
			||||
            <h2>{{ 'RecordList'|get_lang }}</h2> | 
				
			||||
        </div> | 
				
			||||
 | 
				
			||||
        <table class="table"> | 
				
			||||
            <tr> | 
				
			||||
                <th>#</th> | 
				
			||||
                <th>{{ 'CreatedAt'|get_lang }}</th> | 
				
			||||
                <th>{{ 'Status'|get_lang }}</th> | 
				
			||||
                <th>{{ 'Records'|get_lang }}</th> | 
				
			||||
 | 
				
			||||
                {% if allow_to_edit  %} | 
				
			||||
                    <th>{{ 'Actions'|get_lang }}</th> | 
				
			||||
                {% endif %} | 
				
			||||
 | 
				
			||||
            </tr> | 
				
			||||
            {% for meeting in meetings %} | 
				
			||||
            <tr> | 
				
			||||
                <td>{{ meeting.id }}</td> | 
				
			||||
                <td>{{ meeting.created_at }}</td> | 
				
			||||
                <td> | 
				
			||||
                    {% if meeting.status == 1 %} | 
				
			||||
                        <span class="label label-success">{{ 'MeetingOpened'|get_lang }}</span> | 
				
			||||
                    {% else %} | 
				
			||||
                        <span class="label label-info">{{ 'MeetingClosed'|get_lang }}</span> | 
				
			||||
                    {% endif %} | 
				
			||||
                </td> | 
				
			||||
                <td> | 
				
			||||
                    {% if meeting.record == 1 %} | 
				
			||||
                        {# Record list #} | 
				
			||||
                        {{ meeting.show_links }} | 
				
			||||
                    {% endif %} | 
				
			||||
                </td> | 
				
			||||
 | 
				
			||||
                {% if allow_to_edit %} | 
				
			||||
                    <td> | 
				
			||||
                    {% if meeting.status == 1 %} | 
				
			||||
                        <a class="btn" href="{{ meeting.end_url }} "> {{ 'CloseMeeting'|get_lang }}</a> | 
				
			||||
                    {% endif %} | 
				
			||||
                    </td> | 
				
			||||
                {% endif %} | 
				
			||||
 | 
				
			||||
            </tr> | 
				
			||||
            {% endfor %} | 
				
			||||
        </table> | 
				
			||||
    </div> | 
				
			||||
{% else %} | 
				
			||||
    <div class ="span12" style="text-align:center"> | 
				
			||||
        {{ 'ServerIsNotRunning' | return_message('warning') }} | 
				
			||||
    </div> | 
				
			||||
{% endif %} | 
				
			||||
</div> | 
				
			||||
@ -0,0 +1,4 @@ | 
				
			||||
<?php | 
				
			||||
 | 
				
			||||
require_once dirname(__FILE__).'/config.php'; | 
				
			||||
$plugin_info = om_integrationPlugin::create()->get_info(); | 
				
			||||
@ -0,0 +1 @@ | 
				
			||||
This plugin will create a link in existing and new courses for the teachers to start a videoconference room with Open Meeting, as well as the administration settings to configure this tool. | 
				
			||||
@ -0,0 +1,57 @@ | 
				
			||||
<?php | 
				
			||||
/** | 
				
			||||
 * This script initiates a videoconference session, calling the BigBlueButton API | 
				
			||||
 * @package chamilo.plugin.bigbluebutton | 
				
			||||
 */ | 
				
			||||
/** | 
				
			||||
 * Initialization | 
				
			||||
 */ | 
				
			||||
 | 
				
			||||
$course_plugin = 'om_integration'; //needed in order to load the plugin lang variables | 
				
			||||
require_once dirname(__FILE__).'/config.php'; | 
				
			||||
$tool_name = get_lang('Videoconference'); | 
				
			||||
$tpl = new Template($tool_name); | 
				
			||||
$om = new om_integration(); | 
				
			||||
 | 
				
			||||
if ($om->plugin_enabled) { | 
				
			||||
    if ($om->is_server_running()) { | 
				
			||||
 | 
				
			||||
        if (isset($_GET['launch']) && $_GET['launch'] == 1) { | 
				
			||||
 | 
				
			||||
            $meeting_params = array(); | 
				
			||||
            $meeting_params['meeting_name'] = api_get_course_id(); | 
				
			||||
 | 
				
			||||
            if (false/*$om->meeting_exists($meeting_params['meeting_name'])*/) { | 
				
			||||
                $url = $om->join_meeting($meeting_params['meeting_name']); | 
				
			||||
                if ($url) { | 
				
			||||
                    header('location: '.$url); | 
				
			||||
                    exit; | 
				
			||||
                } else { | 
				
			||||
                    $url = $om->create_meeting($meeting_params); | 
				
			||||
                    header('location: '.$url); | 
				
			||||
                    exit; | 
				
			||||
                } | 
				
			||||
            } else { | 
				
			||||
                if ( $om->is_teacher() && $om->loginUser()) { | 
				
			||||
                    $url = $om->create_meeting($meeting_params); | 
				
			||||
                    header('location: '.$url); | 
				
			||||
                    exit; | 
				
			||||
                } else { | 
				
			||||
                    $url = 'listing.php'; | 
				
			||||
                    header('location: '.$url); | 
				
			||||
                    exit; | 
				
			||||
                } | 
				
			||||
            } | 
				
			||||
        } else { | 
				
			||||
            $url = 'listing.php'; | 
				
			||||
            header('location: '.$url); | 
				
			||||
            exit; | 
				
			||||
        } | 
				
			||||
    } else { | 
				
			||||
        $message = Display::return_message(get_lang('ServerIsNotRunning'), 'warning'); | 
				
			||||
    } | 
				
			||||
} else { | 
				
			||||
    $message = Display::return_message(get_lang('ServerIsNotConfigured'), 'warning'); | 
				
			||||
} | 
				
			||||
$tpl->assign('message', $message); | 
				
			||||
$tpl->display_one_col_template(); | 
				
			||||
@ -0,0 +1,13 @@ | 
				
			||||
<?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 | 
				
			||||
 */ | 
				
			||||
/** | 
				
			||||
 * Queries | 
				
			||||
 */ | 
				
			||||
require_once dirname(__FILE__).'/config.php'; | 
				
			||||
BBBPlugin::create()->uninstall(); | 
				
			||||
					Loading…
					
					
				
		Reference in new issue