[Hw4mdl-svn] SF.net SVN: hw4mdl: [257] trunk
Brought to you by:
jhlinder,
trollinger
|
From: <tro...@us...> - 2008-03-13 19:57:50
|
Revision: 257
http://hw4mdl.svn.sourceforge.net/hw4mdl/?rev=257&view=rev
Author: trollinger
Date: 2008-03-13 12:57:22 -0700 (Thu, 13 Mar 2008)
Log Message:
-----------
Merge my branche to trunk
Modified Paths:
--------------
trunk/integrations_common/php/common/WimbaCommons.php
trunk/integrations_common/php/common/WimbaUI.php
trunk/integrations_common/php/common/WimbaXml.php
trunk/integrations_common/php/common/XmlArchive.php
trunk/integrations_common/php/common/XmlOrphanedArchive.php
trunk/integrations_common/php/common/XmlResource.php
trunk/integrations_common/php/common/XmlRoom.php
trunk/integrations_common/php/lc/LCAction.php
trunk/integrations_common/php/lc/LCRoom.php
trunk/integrations_common/php/lc/LCUser.php
trunk/integrations_common/php/lc/PrefixUtil.php
trunk/integrations_common/php/lc/lcapi.php
trunk/integrations_common/php/vt/WimbaVoicetools.php
trunk/integrations_common/php/vt/WimbaVoicetoolsAPI.php
trunk/integrations_common/web/js/ajax.js
trunk/integrations_common/web/js/constants.js
trunk/integrations_common/web/js/hwCommons.js
trunk/integrations_common/web/js/verifForm.js
trunk/integrations_common/web/js/xsl/wimba.xsl
trunk/moodle/mod/liveclassroom/backuplib.php
trunk/moodle/mod/liveclassroom/config.html
trunk/moodle/mod/liveclassroom/css/StyleSheet.css
trunk/moodle/mod/liveclassroom/doAction.php
trunk/moodle/mod/liveclassroom/generateListRooms.php
trunk/moodle/mod/liveclassroom/generateSettings.php
trunk/moodle/mod/liveclassroom/index.php
trunk/moodle/mod/liveclassroom/lang/en/liveclassroom.php
trunk/moodle/mod/liveclassroom/lang/en_utf8/liveclassroom.php
trunk/moodle/mod/liveclassroom/lib.php
trunk/moodle/mod/liveclassroom/logs.php
trunk/moodle/mod/liveclassroom/mod.html
trunk/moodle/mod/liveclassroom/reports.php
trunk/moodle/mod/liveclassroom/version.php
trunk/moodle/mod/liveclassroom/view.php
trunk/moodle/mod/liveclassroom/welcome.php
trunk/moodle/mod/voicetools/config.html
trunk/moodle/mod/voicetools/error.php
trunk/moodle/mod/voicetools/getXmlChoicePage.php
trunk/moodle/mod/voicetools/getXmlListPanel.php
trunk/moodle/mod/voicetools/getXmlNewPanel.php
trunk/moodle/mod/voicetools/index.php
trunk/moodle/mod/voicetools/lang/en/voicetools.php
trunk/moodle/mod/voicetools/lang/en_utf8/voicetools.php
trunk/moodle/mod/voicetools/lib.php
trunk/moodle/mod/voicetools/logs.php
trunk/moodle/mod/voicetools/manageAction.php
trunk/moodle/mod/voicetools/manageActionBlock.php
trunk/moodle/mod/voicetools/mod.html
trunk/moodle/mod/voicetools/version.php
trunk/moodle/mod/voicetools/view.php
trunk/moodle/mod/voicetools/voicerecorder.php
trunk/moodle/mod/voicetools/welcome.php
Added Paths:
-----------
trunk/integrations_common/php/common/WimbaLib.php
trunk/integrations_common/php/vt/VtAction.php
Modified: trunk/integrations_common/php/common/WimbaCommons.php
===================================================================
--- trunk/integrations_common/php/common/WimbaCommons.php 2008-03-13 19:51:41 UTC (rev 256)
+++ trunk/integrations_common/php/common/WimbaCommons.php 2008-03-13 19:57:22 UTC (rev 257)
@@ -1,895 +1,179 @@
<?php
/******************************************************************************
-* *
-* Copyright (c) 1999-2006 Horizon Wimba, All Rights Reserved. *
-* *
-* COPYRIGHT: *
-* This software is the property of Horizon Wimba. *
-* You can redistribute it and/or mdify it under the terms of *
-* the GNU General Public License as published by the *
-* Free Software Foundation. *
-* *
-* WARRANTIES: *
-* This software is distributed in the hope that it will be useful, *
-* but WITHOUT ANY WARRANTY; without even the implied warranty of *
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
-* GNU General Public License for more details. *
-* *
-* You should have received a copy of the GNU General Public License *
-* along with the Horizon Wimba Moodle Integration; *
-* if not, write to the Free Software Foundation, Inc., *
-* 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA *
-* *
-* Author: Thomas Rollinger *
-* *
-* Date: 3th March 2007 *
-* *
-******************************************************************************/
+ * *
+ * Copyright (c) 1999-2008 Wimba, All Rights Reserved. *
+ * *
+ * COPYRIGHT: *
+ * This software is the property of Wimba. *
+ * You can redistribute it and/or modify it under the terms of *
+ * the GNU General Public License as published by the *
+ * Free Software Foundation. *
+ * *
+ * WARRANTIES: *
+ * This software is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+ * GNU General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU General Public License *
+ * along with the Wimba Moodle Integration; *
+ * if not, write to the Free Software Foundation, Inc., *
+ * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA *
+ * *
+ * Author: Thomas Rollinger *
+ * *
+ * Date: January 2007 *
+ * *
+ ******************************************************************************/
/* $Id: WimbaVoicetoolsAPI.php 45764 2007-02-28 22:04:25Z thomasr $ */
class WimbaMoodleSession{
- var $hparams=array();
- var $url_params;
- var $signature="";
- var $currentVtUser ;
- var $currentVtUserRigths;
- var $timeOfLoad;
- var $error=false;
- var $request;
+ var $hparams=array();
+ var $url_params;
+ var $signature="";
+ var $currentVtUser ;
+ var $currentVtUserRigths;
+ var $timeOfLoad;
+ var $error=false;
+ var $request;
- function WimbaMoodleSession($parameters=NULL){
-
-
- $this->timeOfLoad = time();
- $signature="";
- $this->request=$parameters;
- if (($this->timeOfLoad - $parameters["time"] <= 1800) && ($this->timeOfLoad - $parameters["time"] >= 0))
- {//30 min
- ksort($parameters);
- foreach ($parameters as $key => $value)
- {
-
-
- if (strstr($key, 'enc_'))//param use to signature
- {
- //put this params in a map to use after more easily and to sort
- if( $value=="")
- $this->hparams[substr($key,4)] ="";
- else
- $this->hparams[substr($key,4)] =rawurldecode($value);
- // echo $value."<br>";
- $signature .= rawurldecode($value);
-
- $this->url_params .= "enc_".substr($key,4)."=".rawurlencode($value)."&";
+ function WimbaMoodleSession($parameters=NULL){
+ $this->timeOfLoad = time();
+ $signature="";
+ $this->request=$parameters;
+ if (($this->timeOfLoad - $parameters["time"] <= 1800) && ($this->timeOfLoad - $parameters["time"] >= 0))
+ {//30 min
+ ksort($parameters);
+ foreach ($parameters as $key => $value)
+ {
+ if (strstr($key, 'enc_'))//param use to signature
+ {
+ if( $value=="")
+ {
+ $this->hparams[substr($key,4)] ="";
+ }
+ else
+ {
+ $this->hparams[substr($key,4)] =rawurldecode($value);
+ }
+ $signature .= rawurldecode($value);
+ $this->url_params .= "enc_".substr($key,4)."=".rawurlencode($value)."&";
+ }
+ }
+
+ if ($parameters["signature"] != md5($signature))//good signatureature
+ {
+ $this->error="signature";
+ }
+ $this->signature=md5($signature);
+ $this->url_params .="signature=".rawurlencode($this->signature);
}
- }
-
- if ($parameters["signature"] != md5($signature))//good signatureature
- {
-
- $this->error="signature";
-
- }
- $this->signature=md5($signature);
-
- $this->url_params .="signature=".rawurlencode($this->signature);
+ else//session time out
+ {
+ $this->error="session";
+ }
}
- else//session time out
- {
- $this->error="session";
-
- }
- // / print_r($this->hparams) ;
- }
- function getCourseId(){
-
- if(isset($this->hparams["courseId"]))
- return $this->hparams["courseId"];
- else
- return null;
- }
-
- function getLcCurrentUser(){
- if($this->isInstructor())
- return $this->getCourseId()."_T";
- else
- return $this->getCourseId()."_S";
- }
-
- function setCurrentVtUSer($product,$screenName="",$email="",$role=""){
- $this->currentVtUser = new VtUser(NULL);
- $this->currentVtUserRigths = new VtRights(NULL);
- if($screenName=="")
- $this->currentVtUser->setScreenName($this->hparams["firstname"]."_".$this->hparams["lastname"]);
- else
- $this->currentVtUser->setScreenName($screenName);
-
- if($email=="")
- $this->currentVtUser->setEmail ($this->hparams["email"]);
- else{
- $this->currentVtUser->setEmail ( $email);
-
- }
-
-
- if (($role!="" && $role=="Instructor") || ($role=="" && $this->hparams["role"]=="Instructor")) {
- $this->setVtUserRigths($product,"instructor");
+ function getCourseId(){
+ if(isset($this->hparams["course_id"]))
+ {
+ return $this->hparams["course_id"];
+ }
+ return null;
}
- else {
-
- $this->setVtUserRigths($product,"student");
- }
-
- }
- function getVtUser(){
- return $this->currentVtUser;
- }
- function getVtUserRigths(){
- return $this->currentVtUserRigths;
-
- }
- function setVtUserRigths($product,$role){
-
- $this->currentVtUserRigths->setProfile ( 'moodle.'.$product.'.'.$role);
- if($product=="presentation")
- $this->currentVtUserRigths->add("reply_message");
- }
-
- function isInstructor(){
-
- if($this->hparams["role"]!=null && $this->hparams["role"]=="Instructor"){
- return true;
- }
- return false;
- }
-
-
-
- function getFirstname(){
-
- if(isset($this->hparams["firstname"]) ){
- return $this->hparams["firstname"];
- }
- return "";
-
-}
-
- function getLastname(){
-
- if(isset($this->hparams["lastname"]) ){
- return $this->hparams["lastname"];
- }
- return "";
-
-}
-
-}
-function isSwitch(){
- global $USER;
-
- if((isset($USER->studentview) && $USER->studentview==1) || (!empty($USER->switchrole)) ) {
- return true;
- }
- return false;
-
-
-}
-function getRoleForWimbaTools($courseId,$userId){
- global $CFG;
- global $USER;
- $role="";
- if(strstr($CFG->release,"1.7")) {
- $context = get_context_instance(CONTEXT_COURSE, $courseId) ;
- }
-
- //the role of the current user is switched
- //the role of the current user is switched
- if((isset($USER->studentview) && $USER->studentview==1)||(isset($context) && isset($USER->switchrole) && !empty($USER->switchrole) && $USER->switchrole[$context->id]>3)) {
- $role='StudentBis';
- } else{
-
-
- if(isstudent($courseId)) { //Student
- $role='Student';
- }
- else if (isadmin() || isteacher($courseId, $USER->id)) { // Admin, Teacher
- $role='Instructor';
- }
-
- if(strstr($CFG->release,"1.7")) { // 1.7.* version
- if (iscreator()) { // Course Creator
- $role='Instructor';
- }
- else if (!isteacheredit($courseId)) { // Non-editing Teacher
- $role='Student';
- }
- }
-
- }
-
- return $role;
-}
-
-/*
-* Give the parameters with the signature md5 to give to the frame
-* @param $courseid : the id of the current course
-* return a string with all the parameters to give to the url
-*/
-function get_url_params($courseid) {
-
- global $USER;
- global $CFG;
-
- $role=getRoleForWimbaTools($courseid,$USER->id);
- $signature = md5($courseid.$USER->email.$USER->firstname.$USER->lastname.$role);
- $url_params = "enc_courseId=".rawurlencode($courseid).
- "&enc_email=".rawurlencode($USER->email).
- "&enc_firstname=".rawurlencode($USER->firstname).
- "&enc_lastname=".rawurlencode($USER->lastname).
- "&enc_role=".rawurlencode($role).
- "&signature=".rawurlencode($signature);
- return $url_params;
-}
-
-
-/* list the element of the pictures directory
-* return a String wich contains the pictures separated by a ,
-*/
-function list_dir($name,&$s) {
-
- if ($dir = opendir($name)) {
-
- while($file = readdir($dir)) {
-
-
- if(is_dir($name."/".$file) && !in_array($file, array(".",".."))) {
-
- list_dir($name."/".$file,$s);
- }
- else if($file!="." && $file !="..") {
- $s.=$file.";";
- }
-
- }
-
- closedir($dir);
- }
-
-
-}
-
-function storeResource($rid,$courseId,$type,$name,$params=NULL){
- $voicetools->rid=$rid;
- $voicetools->course= $courseId;
- $voicetools->name= $name;
- $voicetools->type=$type;
- if($params!=null){
-
- if(isset($params["accessAvailable"]))
+ function getLcCurrentUser(){
+ if($this->isInstructor())
{
- $voicetools->availability=1;
+ return $this->getCourseId()."_T";
}
- else
- {
- $voicetools->availability=0;
- }
- if(isset($params["start_date"]) && $params["start_date"]=="true"){
- if($params["start_hr"]=="--")
- {
- $start_hr=0;
- }
- else
- {
- $start_hr=intval($params["start_hr"]);
- }
- if($params["start_min"]=="--")
- {
- $start_min=0;
- }
- else
- {
- $start_min=intval($params["start_min"]);
- }
- $voicetools->start_date= mktime($start_hr, $start_min,0, intval($params["start_month"]),intval($params["start_day"]), intval($params["start_year"]));
-
+ return $this->getCourseId()."_S";
+ }
-
-
- }
- else
+ function setCurrentVtUSer($product,$screenName="",$email="",$role=""){
+ $this->currentVtUser = new VtUser(NULL);
+ $this->currentVtUserRigths = new VtRights(NULL);
+
+ if($screenName=="")
{
- $voicetools->start_date=-1;
- }
- if(isset($params["end_date"]) && $params["end_date"]=="true"){
- if($params["end_hr"]=="--")
- {
- $end_hr=0;
- }
- else
- {
- $end_hr=intval($params["end_hr"]);
- }
- if($params["end_min"]=="--")
- {
- $end_min=0;
- }
- else
- {
- $end_min=intval($params["start_min"]);
- }
-
- $voicetools->end_date=mktime($end_hr, $end_min,0, intval($params["end_month"]),intval( $params["end_day"]), intval($params["end_year"]));
- }
- else
- {
- $voicetools->end_date="-1";
- }
- }
-
- return voicetools_store_new_element($voicetools);
-
-}
-function updateResource($rid,$courseId,$type,$params){
-
- $voicetools->rid=$rid;
- $voicetools->course= $courseId;
- $voicetools->type=$type;
- if(isset($params["accessAvailable"]))
- {
- $voicetools->availability=1;
- }
- else
- {
- $voicetools->availability=0;
- }
-
- if(isset($params["start_date"]) && $params["start_date"]=="true"){
-
- if($params["start_hr"]=="--")
- {
- $start_hr=0;
- }else
- {
- $start_hr=intval($params["start_hr"]);
+ $this->currentVtUser->setScreenName($this->hparams["firstname"]."_".$this->hparams["lastname"]);
}
- if($params["start_min"]=="--")
- {
- $start_min=0;
- }
else
- {
- $start_min=intval($params["start_min"]);
+ {
+ $this->currentVtUser->setScreenName($screenName);
}
- $voicetools->start_date=mktime($start_hr, $start_min,0, intval($params["start_month"]), intval($params["start_day"]), intval($params["start_year"]));
- }
- else
- {
- $voicetools->start_date=-1;
- }
- if(isset($params["end_date"]) && $params["end_date"]=="true"){
- if($params["end_hr"]=="--")
+
+ if($email=="")
{
- $end_hr=0;
+ $this->currentVtUser->setEmail ($this->hparams["email"]);
}
else
{
- $end_hr=intval($params["end_hr"]);
- }
- if($params["end_min"]=="--")
+ $this->currentVtUser->setEmail ( $email);
+ }
+
+
+ if (($role!="" && $role=="Instructor") || ($role=="" && $this->hparams["role"]=="Instructor"))
{
- $end_min=0;
+ $this->setVtUserRigths($product,"instructor");
}
- else
- {
- $end_min=intval($params["start_min"]);
+ else
+ {
+ $this->setVtUserRigths($product,"student");
}
- $voicetools->end_date=mktime($end_hr, $end_min,0, intval($params["end_month"]), intval($params["end_day"]), intval($params["end_year"]));
- }
- else
- {
- $voicetools->end_date="-1";
- }
- // $voicetools->id=$id;
-
- return voicetools_update_element($voicetools);
+
+ }
-}
-
-
-
-
-
-
-class vtAction{
-
- var $params;
-
- function vtAction($params){
- $this->params=$params;
-
- }
- /**************
- VOICE BOARD
- *****************/
- /*
- * This function creates a voice board on the vt server
- * params : elements of the form
- */
- function createBoard(){
- $ressource = new vtResource(NULL);
- $audio = new vtAudioFormat(NULL);
- $options = new VtOptions(NULL);
- // Info
- $ressource->setType("board"); //Voice Baord
- if (isset($this->params["description"]))
- {
- $ressource->setDescription(stripslashes($this->params["description"]));
- }
-
- if (isset($this->params["longname"]))
- {
- $ressource->setTitle(stripslashes($this->params["longname"]));
- }
-
- if ($this->params["led"] == "student")
- {
-
- $options->setFilter("false");
- if (isset($this->params["show_compose"]))
- {
- $options->setShowCompose("true");
- }
- else{
- $options->setShowCompose("false");
- }
- }
- else
- {
- $options->setFilter("true");
- $options->setShowCompose("false");
- }
-
- //Media
-
- if(isset($this->params["audio_format"]))
- {
- $audio->setName($this->params["audio_format"]);
- }
- //message length
- if(isset($this->params["max_length"]))
- {
- $options->setMaxLength($this->params["max_length"]);
- }
-
- //Features
-
- //short message titles
- if(isset($this->params["short_title"]))
- {
- $options->setShortTitle("true");
- }
- else
- {
- $options->setShortTitle("false");
+ function getVtUser(){
+ return $this->currentVtUser;
}
- //chronological order
- if(isset($this->params["chrono_order"]))
- {
- $options->setChronoOrder("true");
+
+ function getVtUserRigths(){
+ return $this->currentVtUserRigths;
}
- else
- {
- $options->setChronoOrder("false");
- }
-
- //forward message
- if(isset($this->params["show_forward"]))
- {
- $options->setShowForward("true");
- }
- else
- {
- $options->setShowForward("false");
- }
-
-
- $options->setAudioFormat($audio);
- $ressource->setOptions($options);
- //create the resource on the vt server
- $result = voicetools_api_create_resource($ressource->getResource());
- if(VTAPI_DEBUG) {
- error_log (__FUNCTION__ ." : Board Created , rid=".$result->getRid(), TRUE);
- }
- return $result;
-
- }
- /*
- * This function modifies a voice board on the vt server
- * params : elements of the form
- */
- function modifyBoard($id){
-
- $ressource = new vtResource(NULL);
- $audio = new vtAudioFormat(NULL);
- $options = new VtOptions(NULL);
- // Info
- $ressource->setType("board"); //Voice Baord
- if (isset($this->params["description"]))
- {
- $ressource->setDescription(stripslashes($this->params["description"]));
+ function setVtUserRigths($product,$role){
+ $this->currentVtUserRigths->setProfile ( 'moodle.'.$product.'.'.$role);
+ if($product=="presentation")
+ {
+ $this->currentVtUserRigths->add("reply_message");
+ }
}
-
-
- if (isset($this->params["longname"]))
- {
- $ressource->setTitle(stripslashes($this->params["longname"]));
+
+ function isInstructor(){
+ if($this->hparams["role"]!=null && $this->hparams["role"]=="Instructor")
+ {
+ return true;
+ }
+ return false;
}
- if ($this->params["led"] == "student")
- {
-
- $options->setFilter("false");
- if (isset($this->params["show_compose"]))
- {
- $options->setShowCompose("true");
- }
- else{
- $options->setShowCompose("false");
- }
- }
- else
- {
- $options->setFilter("true");
- $options->setShowCompose("false");
- }
-
- //Media
-
- if(isset($this->params["audio_format"]))
- {
- $audio->setName($this->params["audio_format"]);
- }
- //message length
- if(isset($this->params["max_length"]))
- {
- $options->setMaxLength($this->params["max_length"]);
- }
-
- //Features
-
- //short message titles
- if(isset($this->params["short_title"]))
- {
- $options->setShortTitle("true");
- }
- else
- {
- $options->setShortTitle("false");
+ function getFirstname(){
+
+ if(isset($this->hparams["firstname"]))
+ {
+ return $this->hparams["firstname"];
+ }
+ return "";
}
- //chronological order
- if(isset($this->params["chrono_order"]))
- {
- $options->setChronoOrder("true");
- }
- else
- {
- $options->setChronoOrder("false");
- }
-
- //forward message
- if(isset($this->params["show_forward"]))
- {
- $options->setShowForward("true");
- }
- else
- {
- $options->setShowForward("false");
+
+ function getLastname(){
+
+ if(isset($this->hparams["lastname"]))
+ {
+ return $this->hparams["lastname"];
+ }
+ return "";
}
-
-
- $options->setAudioFormat($audio);
- $ressource->setOptions($options);
- //update
- $ressource->setRid($id);
-
- //create the resource on the vt server
- $result = voicetools_api_modify_resource($ressource->getResource());
- return $result;
-
- }
-
- /****************
- VOICE PRESENTATION
- ****************/
- /*
- * This function creates a voice presentation the vt server
- * params : elements of the form(constructor)
- */
- function createPresentation(){
-
- $ressource = new vtResource(NULL);
- $audio = new vtAudioFormat(NULL);
- $options = new VtOptions(NULL);
- // Info
- $ressource->setType("presentation"); //Voice Baord
- if (isset($this->params["description"]))
- {
- $ressource->setDescription(stripslashes($this->params["description"]));
- }
-
- if (isset($this->params["longname"]))
- {
- $ressource->setTitle(stripslashes($this->params["longname"]));
- }
-
- if(isset($this->params["filter"]))
- {
- $options->setFilter("true");
- }
- else
- {
- $options->setFilter("false");
- }
- //slides comments private
- if(isset($this->params["show_reply"]))
- {
- $options->setShowReply("true");
- }
- else
- {
- $options->setShowReply("false");
- }
-
- //Media
- if(isset($this->params["audio_format"]))
- {
- $audio->setName($this->params["audio_format"]);
- }
- //message length
- if(isset($this->params["max_length"]))
- {
- $options->setMaxLength($this->params["max_length"]);
- }
-
-
- $options->setAudioFormat($audio);
- $ressource->setOptions($options);
-
- //create the resource on the vt server
- $result = voicetools_api_create_resource($ressource->getResource());
- return $result;
- }
-
- /*
- * This function modifies a voice presentation the vt server
- * params : elements of the form(constructor)
- */
- function modifyPresentation($id){
-
- $ressource = new vtResource(NULL);
- $audio = new vtAudioFormat(NULL);
- $options = new VtOptions(NULL);
- // Info
- $ressource->setType("presentation"); //Voice Presentation
- if (isset($this->params["description"]))
- {
- $ressource->setDescription(stripslashes($this->params["description"]));
- }
-
- if (isset($this->params["longname"]))
- {
- $ressource->setTitle(stripslashes($this->params["longname"]));
- }
-
- if(isset($this->params["filter"]))
- {
- $options->setFilter("true");
- }
- else
- {
- $options->setFilter("false");
- }
- //slides comments private
- if(isset($this->params["show_reply"]))
- {
- $options->setShowReply("true");
- }
- else
- {
- $options->setShowReply("false");
- }
-
- //Media
- if(isset($this->params["audio_format"]))
- {
- $audio->setName($this->params["audio_format"]);
- }
- //message length
- if(isset($this->params["max_length"]))
- {
- $options->setMaxLength($this->params["max_length"]);
- }
-
-
- $options->setAudioFormat($audio);
- $ressource->setOptions($options);
- $ressource->setRid($id);
- //create the resource on the vt server
- $result = voicetools_api_modify_resource($ressource->getResource());
- return $result;
-
-
- }
-
- /********
- Podcaster
- **********/
- /*
- * This function creates a podcaster the vt server
- * params : elements of the form(constructor)
- */
- function createPodcaster(){
-
- $ressource = new vtResource(NULL);
- $audio = new vtAudioFormat(NULL);
- $options = new VtOptions(NULL);
-
- // Info
- $ressource->setType("pc");//Podcaster
- if (isset($this->params["description"]))
- {
- $ressource->setDescription(stripslashes($this->params["description"]));
- }
-
- if (isset($this->params["longname"]))
- {
- $ressource->setTitle(stripslashes($this->params["longname"]));
- }
- if(isset($this->params["show_compose"]))
- {
- $options->setShowCompose("true");
- }
- else
- {
- $options->setShowCompose("false");
- }
-
- //Media
- if(isset($this->params["audio_format"]))
- {
- $audio->setName($this->params["audio_format"]);
- }
-
- if(isset($this->params["delay"]))
- {
- $options->setDelay($this->params["delay"]); //no delay
- }
-
- //Features
- if(isset($this->params["short_title"]))
- {
- $options->setShortTitle("true");
- }
- else{
- $options->setShortTitle("false");
- }
- $options->setMaxLength(1200); //set to 20 min
- $options->setAudioFormat($audio);
- $ressource->setOptions($options);
-
- //create the resource on the vt server
- $result = voicetools_api_create_resource($ressource->getResource());
- return $result;
- }
- /*
- * This function modifies a podcaster the vt server
- * params : elements of the form(constructor)
- */
- function modifyPodcaster($id){
- $ressource = new vtResource(NULL);
- $audio = new vtAudioFormat(NULL);
- $options = new VtOptions(NULL);
+}
- // Info
- $ressource->setType("pc");//Podcaster
- if (isset($this->params["description"]))
- {
- $ressource->setDescription(stripslashes($this->params["description"]));
- }
- if (isset($this->params["longname"]))
- {
- $ressource->setTitle(stripslashes($this->params["longname"]));
- }
- if(isset($this->params["show_compose"]))
- {
- $options->setShowCompose("true");
- }
- else
- {
- $options->setShowCompose("false");
- }
- //Media
- if(isset($this->params["audio_format"]))
- {
- $audio->setName($this->params["audio_format"]);
- }
- if(isset($this->params["delay"]))
- {
- $options->setDelay($this->params["delay"]); //no delay
- }
- //Features
- if(isset($this->params["short_title"]))
- {
- $options->setShortTitle("true");
- }
- else{
- $options->setShortTitle("false");
- }
- $options->setMaxLength(1200); //set to 20 min
- $options->setAudioFormat($audio);
- $ressource->setOptions($options);
-
- $ressource->setRid($id);
- //create the resource on the vt server
- $result = voicetools_api_modify_resource($ressource->getResource());
-
- return $result;
- }
- /********
- Recorder
- **********/
- /*
- * This function creates a recorder the vt server
- * params : blocks' id
- */
- function createRecorder(){
-
- $ressource = new vtResource(NULL);
- $audio = new vtAudioFormat(NULL);
- $options = new VtOptions(NULL);
-
- // Info
- $ressource->setType("recorder");
-
-
- $options->setMaxLength(1200); //set to 20 min
- $options->setAudioFormat($audio);
- $ressource->setOptions($options);
-
- //create the resource on the vt server
- $result = voicetools_api_create_resource($ressource->getResource());
-
- return $result;
- }
-
- function deleteRessource($rid)
- {
- $result = voicetools_api_delete_resource($rid);
- return $result;
- }
-
- function getVtSession($resource,$user,$rights,$message=null)
- {
- if($message!=null)
- return voicetools_api_create_session ($user->getUser(),$resource->getResource(),$rights->getRights(),$message->getMessage()) ;
- else
- return voicetools_api_create_session ($user->getUser(),$resource->getResource(),$rights->getRights()) ;
-
- }
-
-
-}
-
?>
\ No newline at end of file
Added: trunk/integrations_common/php/common/WimbaLib.php
===================================================================
--- trunk/integrations_common/php/common/WimbaLib.php (rev 0)
+++ trunk/integrations_common/php/common/WimbaLib.php 2008-03-13 19:57:22 UTC (rev 257)
@@ -0,0 +1,442 @@
+<?php
+
+define('WIMBA_INFO', 'info');
+define('WIMBA_WARN', 'warn');
+define('WIMBA_ERROR', 'error');
+define('WIMBA_DEBUG', 'debug');
+define('WIMBA_DIR', $CFG->dataroot . "/wimba");
+/**
+ * Returns the keys of the general parameters passed by GET or POST
+ */
+
+function getKeysOfGeneralParameters()
+{
+ return array(
+ array("value" => "enc_course_id", "type" => PARAM_INT, "default_value" => null),
+ array("value" => "enc_email", "type" => PARAM_CLEAN, "default_value" => null),
+ array("value" => "enc_firstname", "type" => PARAM_ALPHANUM, "default_value" => null),
+ array("value" => "enc_lastname", "type" => PARAM_ALPHANUM, "default_value" => null),
+ array("value" => "enc_role", "type" => PARAM_ALPHA, "default_value" => null),
+ array("value" => "time", "type" => PARAM_INT, "default_value" => null),
+ array("value" => "signature", "type" => PARAM_ALPHANUM, "default_value" => null),
+ array("value" => "product", "type" => PARAM_ALPHA, "default_value" => null),
+ array("value" => "type", "type" => PARAM_ALPHA, "default_value" => null),
+ array("value" => "studentView", "type" => PARAM_ALPHA, "default_value" => "false"),
+ array("value" => "createWorkflow", "type" => PARAM_BOOL, "default_value" => false),
+ array("value" => "action", "type" => PARAM_ALPHA, "default_value" => null),
+ array("value" => "resource_id", "type" => PARAM_CLEAN, "default_value" => "0"),
+ array("value" => "error", "type" => PARAM_CLEAN, "default_value" => ""),
+ );
+}
+
+function getKeyWimbaClassroomForm()
+{
+ return array (
+ array("value" => "longname", "type" => PARAM_CLEAN, "default_value" => null),
+ array("value" => "description", "type" => PARAM_CLEAN, "default_value" => ""),
+ array("value" => "led", "type" => PARAM_ALPHA, "default_value" => "instructor"),
+ array("value" => "hms_two_way_enabled", "type" => PARAM_BOOL, "default_value" => "0"),
+ array("value" => "enable_student_video_on_startup", "type" => PARAM_BOOL, "default_value" => "0"),
+ array("value" => "hms_simulcast_restricted", "type" => PARAM_BOOL, "default_value" => "0"),
+ array("value" => "video_bandwidth", "type" => PARAM_CLEAN, "default_value" => "medium"),
+ array("value" => "status_appear", "type" => PARAM_BOOL, "default_value" => "0"),
+ array("value" => "enabled_breakoutrooms", "type" => PARAM_BOOL, "default_value" => "0"),
+ array("value" => "archiveEnabled", "type" => PARAM_BOOL, "default_value" => "0"),
+ array("value" => "enabled_student_eboard", "type" => PARAM_BOOL, "default_value" => "0"),
+ array("value" => "enabled_students_breakoutrooms", "type" => PARAM_BOOL, "default_value" => "0"),
+ array("value" => "enabled_students_mainrooms", "type" => PARAM_BOOL, "default_value" => "0"),
+ array("value" => "enabled_status", "type" => PARAM_BOOL, "default_value" => "0"),
+ array("value" => "appshareEnabled", "type" => PARAM_BOOL, "default_value" => "0"),
+ array("value" => "pptEnabled", "type" => PARAM_BOOL, "default_value" => "0"),
+ array("value" => "chatEnabled", "type" => PARAM_BOOL, "default_value" => "0"),
+ array("value" => "privateChatEnabled", "type" => PARAM_BOOL, "default_value" => "0"),
+ array("value" => "accessAvailable", "type" => PARAM_BOOL, "default_value" => "0"),
+ array("value" => "privateChatEnabled", "type" => PARAM_BOOL, "default_value" => "0"),
+ array("value" => "userlimit", "type" => PARAM_BOOL, "default_value" => "0"),
+ array("value" => "userlimitValue", "type" => PARAM_INT, "default_value" => -1)
+ ) ;
+}
+
+function getKeyWimbaVoiceForm()
+{
+ return array (
+ array("value" => "longname", "type" => PARAM_CLEAN, "default_value" => ""),
+ array("value" => "description", "type" => PARAM_CLEAN, "default_value" => "dd"),
+ array("value" => "led", "type" => PARAM_ALPHA, "default_value" => "student"),
+
+ array("value" => "audio_format", "type" => PARAM_CLEAN, "default_value" => "medium"),
+ array("value" => "max_length", "type" => PARAM_INT, "default_value" => "0"),
+ array("value" => "delay", "type" => PARAM_INT, "default_value" => "0"),
+
+ array("value" => "short_title", "type" => PARAM_ALPHA, "default_value" => "false"),
+ array("value" => "chrono_order", "type" => PARAM_ALPHA, "default_value" => "false"),
+ array("value" => "show_reply", "type" => PARAM_ALPHA, "default_value" => "false"),
+ array("value" => "show_forward", "type" => PARAM_ALPHA, "default_value" => "false"),
+ array("value" => "show_compose", "type" => PARAM_ALPHA, "default_value" => "false"),
+ array("value" => "filter", "type" => PARAM_ALPHA, "default_value" => "false"),
+
+ array("value" => "accessAvailable", "type" => PARAM_BOOL, "default_value" => "0"),
+ array("value" => "start_date", "type" => PARAM_ALPHA, "default_value" => "false"),
+ array("value" => "start_month", "type" => PARAM_ALPHANUM, "default_value" => "0"),
+ array("value" => "start_day", "type" => PARAM_ALPHANUM, "default_value" => "0"),
+ array("value" => "start_year", "type" => PARAM_ALPHANUM, "default_value" => "0"),
+ array("value" => "start_hr", "type" => PARAM_ALPHANUM, "default_value" => "0"),
+ array("value" => "start_min", "type" => PARAM_ALPHANUM, "default_value" => "0"),
+ array("value" => "end_date", "type" => PARAM_ALPHA, "default_value" => "false"),
+ array("value" => "end_month", "type" => PARAM_ALPHANUM, "default_value" => "0"),
+ array("value" => "end_day", "type" => PARAM_ALPHANUM, "default_value" => "0"),
+ array("value" => "end_year", "type" => PARAM_ALPHANUM, "default_value" => "0"),
+ array("value" => "end_hr", "type" => PARAM_ALPHANUM, "default_value" => "0"),
+ array("value" => "end_min", "type" => PARAM_ALPHANUM, "default_value" => "0"),
+ );
+}
+
+function getListOfWeeks($course, $current)
+{
+ $i = 1;
+ $weekdate = $course->startdate; // this should be 0:00 Monday of that week
+ $weekdate += 7200; // Add two hours to avoid possible DST problems
+ $weekofseconds = 604800;
+ $course->enddate = $course->startdate + ($weekofseconds * $course->numsections);
+ $string = '<OPTION selected value=0>Week 0 : Introduction section</OPTION>';
+
+ while ($weekdate < $course->enddate)
+ {
+ $nextweekdate = $weekdate + ($weekofseconds);
+ $weekday = userdate($weekdate, '%d %b') ;
+ $endweekday = userdate($weekdate + 518400, '%d %b');
+ if ($current == $i)
+ {
+ $string .= '<OPTION selected value=' . $i . '>' . "Week " . $i . " : " . $weekday . ' - ' . $endweekday . '</OPTION>';
+ }
+ else
+ {
+ $string .= '<OPTION value=' . $i . '>' . "Week " . $i . " : " . $weekday . ' - ' . $endweekday . '</OPTION>';
+ }
+ $i++;
+ $weekdate = $nextweekdate;
+ }
+ return $string;
+}
+
+function getListOfTopics($course, $current)
+{
+ $section = 0;
+ while ($section <= $course->numsections)
+ {
+ if (!$thissection = get_record('course_sections', 'course', $course->id, 'section', $section))
+ {
+ notify('Error getting course_sections!');
+ }
+ $desc = format_text($thissection->summary, FORMAT_MOODLE, null, $course->id);
+ $descTxt = txt($desc);
+ $minidesc = substr($descTxt, 0, 20);
+
+ if (($thissection->summary != null) && (strlen($descTxt) > 20))
+ {
+ $minidesc .= "...";
+ }
+ else if ($thissection->summary == null)
+ {
+ $minidesc = "Topic";
+ }
+
+ if ($current == $section)
+ {
+ echo '<OPTION selected value=' . $section . '>' . $section . ". " . $minidesc . '</OPTION>';
+ }
+ else
+ {
+ echo '<OPTION value=' . $section . '>' . $section . ". " . $minidesc . '</OPTION>';
+ }
+ $section++;
+ }
+}
+
+function redirection($url)
+{
+ header('Location:' . $url);
+ exit ();
+}
+function parentRedirection($url)
+{
+ echo '<script> window.top.location="' . $url . '"; </script>';
+ exit ();
+}
+
+function manage_error($errno, $error, $file, $line, $context)
+{
+ global $error_wimba;
+ if ($errno == E_USER_ERROR or $errno == E_ERROR)
+ {
+ wimba_add_log(WIMBA_ERROR,"general",$error ." in ".$file." line ".$line);
+ $error_wimba = true;
+ }
+ else if ($errno < E_USER_NOTICE)
+ {
+ wimba_add_log(WIMBA_DEBUG,"general",$error ." in ".$file." line ".$line);
+ }
+
+}
+
+function txt($string)
+{
+ $result = str_replace("<br />", "" , $string);
+ $result = str_replace("<p>", "" , $result);
+ $result = str_replace("</p>", "" , $result);
+ return $result;
+}
+
+function isSwitch()
+{
+ global $USER;
+
+ if ((isset($USER->studentview) && $USER->studentview == 1) || (!empty($USER->switchrole)))
+ {
+ return true;
+ }
+ return false;
+}
+
+function getRoleForWimbaTools($courseId, $userId)
+{
+ global $CFG;
+ global $USER;
+ $role = "";
+ if (strstr($CFG->release, "1.7"))
+ {
+ $context = get_context_instance(CONTEXT_COURSE, $courseId) ;
+ }
+ // the role of the current user is switched
+ if ((isset($USER->studentview) && $USER->studentview == 1) ||
+ (isset($context) && isset($USER->switchrole) && !empty($USER->switchrole) && $USER->switchrole[$context->id] > 3))
+ {
+ $role = 'StudentBis';
+ }
+ else
+ {
+ if (isstudent($courseId))
+ { // Student
+ $role = 'Student';
+ }
+ else if (isadmin() || isteacher($courseId, $USER->id))
+ { // Admin, Teacher
+ $role = 'Instructor';
+ }
+
+ if (strstr($CFG->release, "1.7"))
+ { // 1.7.* version
+ if (iscreator())
+ { // Course Creator
+ $role = 'Instructor';
+ }
+ else if (!isteacheredit($courseId))
+ { // Non-editing Teacher
+ $role = 'Student';
+ }
+ }
+ }
+ return $role;
+}
+
+/*
+ * Give the parameters with the signature md5 to give to the frame
+ * @param $courseid : the id of the current course
+ * return a string with all the parameters to give to the url
+ */
+function get_url_params($courseid)
+{
+ global $USER;
+ global $CFG;
+
+ $role = getRoleForWimbaTools($courseid, $USER->id);
+ $signature = md5($courseid . $USER->email . $USER->firstname . $USER->lastname . $role);
+ $url_params = "enc_course_id=" . rawurlencode($courseid) . "&enc_email=" . rawurlencode($USER->email) . "&enc_firstname=" . rawurlencode($USER->firstname) . "&enc_lastname=" . rawurlencode($USER->lastname) . "&enc_role=" . rawurlencode($role) . "&signature=" . rawurlencode($signature);
+ return $url_params;
+}
+
+/* list the element of the pictures directory
+ * return a String wich contains the pictures separated by a ,
+ */
+function list_dir($name, &$s)
+{
+ if ($dir = opendir($name))
+ {
+ while ($file = readdir($dir))
+ {
+ if (is_dir($name . "/" . $file) && !in_array($file, array(".", "..")))
+ {
+ list_dir($name . "/" . $file, $s);
+ }
+ else if ($file != "." && $file != "..")
+ {
+ $s .= $file . ";";
+ }
+ }
+ closedir($dir);
+ }
+}
+
+function storeResource($rid,$course_id, $params)
+{
+
+ $voicetools = new Object();
+ $voicetools->rid = $rid;
+ $voicetools->course = $course_id;
+ if(isset($params["name"]))
+ {
+ $voicetools->name = $params["name"];
+ }
+ $voicetools->type = $params["type"];
+
+ if ($params != null)
+ {
+ $voicetools->availability = $params["accessAvailable"];
+ if ($params["start_date"] == "true")
+ {
+ $start_hr = intval($params["start_hr"]);
+ $start_min = intval($params["start_min"]);
+ $start_month = intval($params["start_month"]);
+ $start_day = intval($params["start_day"]);
+ $start_year = intval($params["start_year"]);
+ $voicetools->start_date = mktime($start_hr, $start_min, 0, $start_month, $start_day, $start_year);
+ }
+ else
+ {
+ $voicetools->start_date = -1;
+ }
+
+ if ($params["end_date"] == "true") {
+ $end_hr = intval($params["end_hr"]);
+ $end_min = intval($params["end_min"]);
+ $end_month = intval($params["end_month"]);
+ $end_day = intval($params["end_day"]);
+ $end_year = intval($params["end_year"]);
+ $voicetools->end_date = mktime($end_hr, $end_min, 0, $end_month, $end_day, $end_year);
+ }
+ else
+ {
+ $voicetools->end_date = -1;
+ }
+ }
+ return voicetools_store_new_element($voicetools);
+}
+
+function updateResource($rid,$course_id, $params)
+{
+ $voicetools = new Object();
+ $voicetools->rid = $rid;
+ $voicetools->course = $course_id;
+ $voicetools->type = $params["type"];
+ $voicetools->availability = $params["accessAvailable"];
+
+ if ($params["start_date"] == "true")
+ {
+ $start_hr = intval($params["start_hr"]);
+ $start_min = intval($params["start_min"]);
+ $start_month = intval($params["start_month"]);
+ $start_day = intval($params["start_day"]);
+ $start_year = intval($params["start_year"]);
+ $voicetools->start_date = mktime($start_hr, $start_min, 0, $start_month, $start_day, $start_year);
+ }
+ else
+ {
+ $voicetools->start_date = -1;
+ }
+
+ if ($params["end_date"] == "true") {
+ $end_hr = intval($params["end_hr"]);
+ $end_min = intval($params["end_min"]);
+ $end_month = intval($params["end_month"]);
+ $end_day = intval($params["end_day"]);
+ $end_year = intval($params["end_year"]);
+ $voicetools->end_date = mktime($end_hr, $end_min, 0, $end_month, $end_day, $end_year);
+ }
+ else
+ {
+ $voicetools->end_date = -1;
+ }
+ return voicetools_update_element($voicetools);
+}
+
+function isVtAvailable($rid)
+{
+ $preview = false;
+ $vt_informations = voicetools_get_voicetool_informations($rid);
+
+ if ($vt_informations != null && $vt_informations->availability == 0)
+ {
+ $preview = false;
+ }
+ elseif ($vt_informations != null && $vt_informations->start_date == -1 && $vt_informations->end_date == -1)
+ {
+ $preview = true;
+ }
+ elseif ($vt_informations != null && $vt_informations->start_date == -1 && time() <= $vt_informations->end_date)
+ {
+ $preview = true;
+ }
+ elseif ($vt_informations != null && $vt_informations->start_date < time() && $vt_informations->end_date == -1)
+ {
+ $preview = true;
+ }
+ elseif ($vt_informations != null && $vt_informations->start_date < time() && time() < $vt_informations->end_date)
+ {
+ $preview = true;
+ }
+ else {
+ $preview = false;
+ }
+
+ return $preview;
+}
+
+/**Add logs in moodledata
+ * param : the level og the log ('info', 'warn','error' or 'debug'), the message to display on the log
+ * return : void, store the log in MOODLEDATADIR/wimba/logs/LEVEL
+ */
+function wimba_add_log($level,$product,$message){
+
+//Set the log level values.
+$level_values = array(
+ WIMBA_DEBUG => 1,
+ WIMBA_INFO => 2,
+ WIMBA_WARN => 3,
+ WIMBA_ERROR => 4
+);
+ global $CFG;
+
+ $log_product = $product."_log_level";
+
+ if(!isset($CFG->$log_product)){
+ $CFG->$log_product=2;//default to Info
+ }
+//Write on the logs only if the configured level allows it.
+ if ($product=="general" || $level_values[$level] >= $CFG->$log_product){
+
+ // Gets the site shortname
+ $site = get_record('course','id',SITEID);
+
+ //Computes the timestamp corresponding to the day (at 00:00:00).
+ $today_timestamp = @mktime(0, 0, 0, date("m"), date("d"), date("Y"));
+
+ //If it doesn't exist, create the log folder'
+ @mkdir(WIMBA_DIR, 0700);
+
+ @mkdir(WIMBA_DIR . "/" . $product, 0700);
+
+ $wimba_logs= WIMBA_DIR . "/" . $product . "/logs";
+ @mkdir($wimba_logs, 0700);
+
+ //Computes the log filename. Space characters are replaced by unerscore, to have a correct filename.
+ $file = $wimba_logs."/".str_replace(' ','_',$site->shortname)."-".$today_timestamp."-wimba.log";
+
+ //Writes the message in the log, and close it
+ $fh = @fopen($file, "a");
+ @fwrite($fh,gmdate("Y-m-d H:i:s")." ".strtoupper($level)." ".$product." - ".$message."\n");
+ @fclose($fh);
+ }
+}
+
+
+?>
Modified: trunk/integrations_common/php/common/WimbaUI.php
===================================================================
--- trunk/integrations_common/php/common/WimbaUI.php 2008-03-13 19:51:41 UTC (rev 256)
+++ trunk/integrations_common/php/common/WimbaUI.php 2008-03-13 19:57:22 UTC (rev 257)
@@ -1,1913 +1,2909 @@
<?php
class WimbaUI {
- var $session;
- var $api;
- var $xml;
- var $currentObject;
- var $isArchive = "false";
- var $lectureRoom;
- var $discussionRoom;
- var $isLectureRoom;
- var $disabledSetting;
- var $currentTab;
- //for vt
- var $currentObjectInformations = NULL;
- var $currentObjectOptions = NULL;
- var $currentObjectAudioFormat = NULL;
- var $startSelect = false;
- var $endSelect = false;
- var $prefix;
- var $id;
-
- function WimbaUI($session, $api = NULL, $currentIdtab = "") {
+
+ var $session;
+ var $api;
+ var $xml;
+ var $currentObject;
+ var $isArchive = "false";
+ var $lectureRoom;
+ var $discussionRoom;
+ var $isLectureRoom;
+ var $disabledSetting;
+ var $currentTab;
+ //for vt
+ var $currentObjectInformations = NULL;
+ var $currentObjectOptions = NULL;
+ var $currentObjectAudioFormat = NULL;
+ var $startSelect = false;
+ var $endSelect = false;
+ var $prefix;
+ var $id;
+
+ function WimbaUI($session_params, $api = NULL, $currentIdtab = "")
+ {
+ $this->session = new WimbaMoodleSession($session_params);
+ $this->api = $api;
+ $this->xml = new WimbaXml();
+ $this->currentTab = $currentIdtab;
+
+ if($api!=null)
+ {
+ $this->prefix=$api->getPrefix();
+ }
+ }
+
+ /**
+ * Configure different parmaters used to generate the xml according to the current product
+ * @param product : the product which will be display (liveclassroom or voicetools)
+ * @param $serverInformations : contains the informations get from the server
+ * @param $databaseInformations : contains the informations get from the database
+ */
+ function setCurrentProduct($product, $serverInformations = NULL, $databaseInformations= NULL)
+ {
- $this->session = $session;
- $this->api = $api;
+
+ $this->product = $product;
+ $this->currentObject = $serverInformations;
+
+
+ if($this->currentObject == null)
+ {
+ $this->id=$this->session->getCourseId() . rand();
+ }
+
+ if ($product == "liveclassroom")
+ {
+ if(isset($this->currentObject))
+ $roomId=$this->currentObject->getRoomId();
+
+ if ($this->currentObject != null && $this->currentObject->isArchive())
+ {
+ $this->isArchive = "true";
+ }
+
+ $courseId=$this->session->getCourseId() . "_S";
+ $isStudentAdmin= $this->api->isStudentAdmin($roomId, $courseId);
+
+ if ($this->currentObject == null
+ || $this->currentObject != null && $isStudentAdmin == "false")
+ {
+ $this->lectureRoom = "activeSetting";
+ $this->discussionRoom = "hiddenSetting";
+ $this->disabledSetting = "activeSetting";
+ $this->isLectureRoom = true;
+ }
+ else
+ {
+ $this->lectureRoom = "hiddenSetting";
+ $this->discussionRoom = "activeSetting";
+ $this->disabledSetting = "disabledSetting";
+ $this->isLectureRoom = false;
+ }
+ }
+ else
+ {
+ //data of the database
+ $this->currentObjectInformations = $databaseInformations;
+ if ($this->currentObjectInformations != null
+ && $this->currentObjectInformations->start_date != -1)
+ {
+ $this->startSelect = true;
+ }
+
+ if ( $this->currentObjectInformations != null
+ && $this->currentObjectInformations->end_date != -1 )
+ {
+ $this->endSelect = true;
+ }
+
+ if (isset($this->currentObject)
+ && isset($this->currentObjectInformations)) {
+ //for php 4-> object->object doesn't work
+ $this->currentObjectOptions = $this->currentObject->getOptions();
+ $this->currentObjectAudioFormat = $this->currentObjectOptions->getAudioFormat();
+ }
+ }
+ }
+
+ /**
+ * Add the necessary elements to the current xml object to render the principal view of the lc component
+ * @param message : eventual information message displayed at the bottom of the component
+ */
+ function getLCPrincipalView($message) {
+ /********
+ SESSION
+ *********/
+ $this->xml->CreateInformationElement(
+ $this->session->timeOfLoad,
+ $this->session->hparams["firstname"],
+ $this->session->hparams["lastname"],
+ $this->session->hparams["email"],
+ $this->session->hparams["role"],
+ $this->session->hparams["course_id"],
+ $this->session->signature,
+ "");
+
+ /********
+ HEADER
+ *********/
+ if($this->session->isInstructor())
+ {
+ $this->xml->addHeaderElement("lib/web/pictures/items/headerbar-logo.png", "false", "true");
+ }
+ else
+ {
+ $this->xml->addHeaderElement("lib/web/pictures/items/headerbar-logo.png", "false", "false");
+ }
+ /********
+ MENU
+ *********/
+ $this->xml->addButtonElement(
+ "all",
+ "all",
+ "disabled",
+ "lib/web/pictures/buttons/toolbar-launch",
+ get_string('toolbar_launch', 'liveclassroom'),
+ "javascript:LaunchElement('doAction.php','liveclassroom');");
- $this->xml = new WimbaXml();
- $this->currentTab = $currentIdtab;
- if($api!=null)
- {
- $this->prefix=$api->getPrefix();
- }
- }
+ if($this->session->isInstructor())
+ {
+ $this->xml->addButtonElement(
+ "instructor",
+ "all",
+ "disabled",
+ 'lib/web/pictures/buttons/toolbar-activities',
+ get_string('toolbar_activity', 'liveclassroom'),
+ "doOpenAddActivity('../../course/mod.php','section=0&sesskey=" . sesskey() . "&add=liveclassroom')");
+
+ $this->xml->addButtonElement(
+ "instructor",
+ "all",
+ "enabled",
+ "lib/web/pictures/buttons/toolbar-new",
+ get_string('toolbar_new', 'liveclassroom'),
+ "javascript:loadNewSettings('generateSettings.php','create','liveclassroom' ,'liveclassroom','all')");
+
+ $this->xml->addSpaceElement("20px", "instructor");
+
+ $this->xml->addButtonElement(
+ "instructor",
+ "all",
+ "disabled",
+ "lib/web/pictures/buttons/toolbar-content",
+ get_string('toolbar_content', 'liveclassroom'),
+ "javascript:openContent('doAction.php');");
+
+ $this->xml->addButtonElement(
+ "instructor",
+ "all",
+ "disabled",
+ "lib/web/pictures/buttons/toolbar-poll",
+ get_string('toolbar_reports', 'liveclassroom'),
+ "javascript:openReport('doAction.php');");
+
+ $this->xml->addSpaceElement("10px", "instructor");
+
+ $this->xml->addButtonElement(
+ "instructor",
+ "all",
+ "disabled",
+ "lib/web/pictures/buttons/toolbar-settings",
+ get_string('toolbar_settings', 'liveclassroom'),
+ "javascript:editSettings('generateSettings.php','all');");
+
+ $this->xml->addButtonElement(
+ "instructor",
+ "all",
+ "disabled",
+ "lib/web/pictures/buttons/toolbar-delete",
+ get_string('toolbar_delete', 'liveclassroom'),
+ "javascript:deleteResource('doAction.php');");
+
+ $this->xml->addSpaceElement("50px", "instructor");
+ }
+ else
+ {
+ $this->xml->addSpaceElement("300px", "instructor");
+ }
+
+ if (strpos($_SERVER['HTTP_USER_AGENT'], 'Safari'))
+ {
+ $this->xml->addSearchElement("all", "Safari");
+ }
+ else
+ {
+ $this->xml->addSearchElement("all", "other");
+ }
+
+ //MESSAGE BAR
+ if (isset ($message) && $message!="")
+ {
+ $this->xml->addMessage($message);
+ }
+
+ $rooms=$this->getListLiveClassroom();
+
+ if($rooms!=false || $rooms==null)
+ {
+ $this->xml->addProduct(
+ "liveclassroom",
+ "productType",
+ "Liv...
[truncated message content] |