[Hw4mdl-svn] SF.net SVN: hw4mdl: [226] branches/team/Thomas
Brought to you by:
jhlinder,
trollinger
From: <tro...@us...> - 2008-01-16 14:49:46
|
Revision: 226 http://hw4mdl.svn.sourceforge.net/hw4mdl/?rev=226&view=rev Author: trollinger Date: 2008-01-16 06:49:35 -0800 (Wed, 16 Jan 2008) Log Message: ----------- Change the structure of my branche to be similar to trunk Added Paths: ----------- branches/team/Thomas/integrations_common/ branches/team/Thomas/integrations_common/php/ branches/team/Thomas/integrations_common/php/common/ branches/team/Thomas/integrations_common/php/common/WimbaCommons.php branches/team/Thomas/integrations_common/php/common/WimbaLib.php branches/team/Thomas/integrations_common/php/common/WimbaUI.php branches/team/Thomas/integrations_common/php/common/WimbaXml.php branches/team/Thomas/integrations_common/php/common/XmlArchive.php branches/team/Thomas/integrations_common/php/common/XmlOrphanedArchive.php branches/team/Thomas/integrations_common/php/common/XmlResource.php branches/team/Thomas/integrations_common/php/common/XmlRoom.php branches/team/Thomas/integrations_common/php/common/domxml-php4-php5.php branches/team/Thomas/integrations_common/php/lc/ branches/team/Thomas/integrations_common/php/lc/LCAction.php branches/team/Thomas/integrations_common/php/lc/LCRoom.php branches/team/Thomas/integrations_common/php/lc/LCUser.php branches/team/Thomas/integrations_common/php/lc/PrefixUtil.php branches/team/Thomas/integrations_common/php/lc/lcapi.php branches/team/Thomas/integrations_common/php/vt/ branches/team/Thomas/integrations_common/php/vt/WimbaVoicetools.php branches/team/Thomas/integrations_common/php/vt/WimbaVoicetoolsAPI.php branches/team/Thomas/integrations_common/web/ branches/team/Thomas/integrations_common/web/js/ branches/team/Thomas/integrations_common/web/js/ajax.js branches/team/Thomas/integrations_common/web/js/ajaxslt/ branches/team/Thomas/integrations_common/web/js/ajaxslt/AUTHORS branches/team/Thomas/integrations_common/web/js/ajaxslt/COPYING branches/team/Thomas/integrations_common/web/js/ajaxslt/README branches/team/Thomas/integrations_common/web/js/ajaxslt/dom.js branches/team/Thomas/integrations_common/web/js/ajaxslt/util.js branches/team/Thomas/integrations_common/web/js/ajaxslt/xmltoken.js branches/team/Thomas/integrations_common/web/js/ajaxslt/xpath.js branches/team/Thomas/integrations_common/web/js/ajaxslt/xslt.js branches/team/Thomas/integrations_common/web/js/constants.js branches/team/Thomas/integrations_common/web/js/dojo/ branches/team/Thomas/integrations_common/web/js/dojo/LICENSE branches/team/Thomas/integrations_common/web/js/dojo/README branches/team/Thomas/integrations_common/web/js/dojo/build.txt branches/team/Thomas/integrations_common/web/js/dojo/dojo.js branches/team/Thomas/integrations_common/web/js/dojo/iframe_history.html branches/team/Thomas/integrations_common/web/js/dojo/src/ branches/team/Thomas/integrations_common/web/js/dojo/src/io/ branches/team/Thomas/integrations_common/web/js/dojo/src/io/BrowserIO.js branches/team/Thomas/integrations_common/web/js/dojo/src/io/IframeIO.js branches/team/Thomas/integrations_common/web/js/dojo/src/io/RepubsubIO.js branches/team/Thomas/integrations_common/web/js/dojo/src/io/RhinoIO.js branches/team/Thomas/integrations_common/web/js/dojo/src/io/ScriptSrcIO.js branches/team/Thomas/integrations_common/web/js/dojo/src/io/XhrIframeProxy.js branches/team/Thomas/integrations_common/web/js/dojo/src/io/__package__.js branches/team/Thomas/integrations_common/web/js/dojo/src/io/cometd.js branches/team/Thomas/integrations_common/web/js/dojo/src/io/common.js branches/team/Thomas/integrations_common/web/js/dojo/src/io/cookie.js branches/team/Thomas/integrations_common/web/js/dojo/src/io/xip_client.html branches/team/Thomas/integrations_common/web/js/dojo/src/io/xip_server.html branches/team/Thomas/integrations_common/web/js/hwCommons.js branches/team/Thomas/integrations_common/web/js/manageXml.js branches/team/Thomas/integrations_common/web/js/pngfix.js branches/team/Thomas/integrations_common/web/js/verifForm.js branches/team/Thomas/integrations_common/web/js/xmldom.js branches/team/Thomas/integrations_common/web/js/xsl/ branches/team/Thomas/integrations_common/web/js/xsl/wimba.xsl branches/team/Thomas/integrations_common/web/pictures/ branches/team/Thomas/integrations_common/web/pictures/backgrounds/ branches/team/Thomas/integrations_common/web/pictures/backgrounds/filterbar.png branches/team/Thomas/integrations_common/web/pictures/backgrounds/headerbar.png branches/team/Thomas/integrations_common/web/pictures/backgrounds/toolbar.png branches/team/Thomas/integrations_common/web/pictures/buttons/ branches/team/Thomas/integrations_common/web/pictures/buttons/angel.gif branches/team/Thomas/integrations_common/web/pictures/buttons/general-cancel.png branches/team/Thomas/integrations_common/web/pictures/buttons/general-create.png branches/team/Thomas/integrations_common/web/pictures/buttons/general-empty-over.png branches/team/Thomas/integrations_common/web/pictures/buttons/general-empty.png branches/team/Thomas/integrations_common/web/pictures/buttons/general-saveall.png branches/team/Thomas/integrations_common/web/pictures/buttons/headerbar-logo.png branches/team/Thomas/integrations_common/web/pictures/buttons/listitem-available.png branches/team/Thomas/integrations_common/web/pictures/buttons/listitem-hide.png branches/team/Thomas/integrations_common/web/pictures/buttons/listitem-information-16_12.png branches/team/Thomas/integrations_common/web/pictures/buttons/listitem-show.png branches/team/Thomas/integrations_common/web/pictures/buttons/listitem-unavailable.png branches/team/Thomas/integrations_common/web/pictures/buttons/new-createpodcaster.png branches/team/Thomas/integrations_common/web/pictures/buttons/new-createroom.png branches/team/Thomas/integrations_common/web/pictures/buttons/new-createvoiceboard.png branches/team/Thomas/integrations_common/web/pictures/buttons/new-createvoicepresentation.png branches/team/Thomas/integrations_common/web/pictures/buttons/searchfield.gif branches/team/Thomas/integrations_common/web/pictures/buttons/tab.gif branches/team/Thomas/integrations_common/web/pictures/buttons/tab_disabled.gif branches/team/Thomas/integrations_common/web/pictures/buttons/tab_over.gif branches/team/Thomas/integrations_common/web/pictures/buttons/tab_select.gif branches/team/Thomas/integrations_common/web/pictures/buttons/titlebar-edit.png branches/team/Thomas/integrations_common/web/pictures/buttons/titlebar-save.png branches/team/Thomas/integrations_common/web/pictures/buttons/toolbar-activities-disabled.png branches/team/Thomas/integrations_common/web/pictures/buttons/toolbar-activities-enabled.png branches/team/Thomas/integrations_common/web/pictures/buttons/toolbar-activities.png branches/team/Thomas/integrations_common/web/pictures/buttons/toolbar-availability-disabled.png branches/team/Thomas/integrations_common/web/pictures/buttons/toolbar-availability.png branches/team/Thomas/integrations_common/web/pictures/buttons/toolbar-content-disabled.png branches/team/Thomas/integrations_common/web/pictures/buttons/toolbar-content-enabled.png branches/team/Thomas/integrations_common/web/pictures/buttons/toolbar-content.png branches/team/Thomas/integrations_common/web/pictures/buttons/toolbar-delete-disabled.png branches/team/Thomas/integrations_common/web/pictures/buttons/toolbar-delete-enabled.png branches/team/Thomas/integrations_common/web/pictures/buttons/toolbar-delete.png branches/team/Thomas/integrations_common/web/pictures/buttons/toolbar-launch-disabled.png branches/team/Thomas/integrations_common/web/pictures/buttons/toolbar-launch-enabled.png branches/team/Thomas/integrations_common/web/pictures/buttons/toolbar-launch.png branches/team/Thomas/integrations_common/web/pictures/buttons/toolbar-new-enabled.png branches/team/Thomas/integrations_common/web/pictures/buttons/toolbar-new.png branches/team/Thomas/integrations_common/web/pictures/buttons/toolbar-newboard-disabled.png branches/team/Thomas/integrations_common/web/pictures/buttons/toolbar-newboard.png branches/team/Thomas/integrations_common/web/pictures/buttons/toolbar-newroom-disabled.png branches/team/Thomas/integrations_common/web/pictures/buttons/toolbar-poll-disabled.png branches/team/Thomas/integrations_common/web/pictures/buttons/toolbar-poll-enabled.png branches/team/Thomas/integrations_common/web/pictures/buttons/toolbar-poll.png branches/team/Thomas/integrations_common/web/pictures/buttons/toolbar-schedule-disabled.png branches/team/Thomas/integrations_common/web/pictures/buttons/toolbar-schedule-enabled.png branches/team/Thomas/integrations_common/web/pictures/buttons/toolbar-schedule.png branches/team/Thomas/integrations_common/web/pictures/buttons/toolbar-settings-disabled.png branches/team/Thomas/integrations_common/web/pictures/buttons/toolbar-settings-enabled.png branches/team/Thomas/integrations_common/web/pictures/buttons/toolbar-settings.png branches/team/Thomas/integrations_common/web/pictures/buttons/x_round-16_14.png branches/team/Thomas/integrations_common/web/pictures/buttons/x_squared.png branches/team/Thomas/integrations_common/web/pictures/items/ branches/team/Thomas/integrations_common/web/pictures/items/category-collapsed.png branches/team/Thomas/integrations_common/web/pictures/items/category-expanded.png branches/team/Thomas/integrations_common/web/pictures/items/filter-enabled-left.png branches/team/Thomas/integrations_common/web/pictures/items/filter-enabled-middle.png branches/team/Thomas/integrations_common/web/pictures/items/filter-enabled-right.png branches/team/Thomas/integrations_common/web/pictures/items/filter-rollover-left.png branches/team/Thomas/integrations_common/web/pictures/items/filter-rollover-middle.png branches/team/Thomas/integrations_common/web/pictures/items/filter-rollover-right.png branches/team/Thomas/integrations_common/web/pictures/items/filterbar-separator.png branches/team/Thomas/integrations_common/web/pictures/items/filterbar_example.html branches/team/Thomas/integrations_common/web/pictures/items/headerbar-logo.png branches/team/Thomas/integrations_common/web/pictures/items/headerbar-searchfield-left.png branches/team/Thomas/integrations_common/web/pictures/items/headerbar-searchfield-middl.png branches/team/Thomas/integrations_common/web/pictures/items/headerbar-searchfield-middle.png branches/team/Thomas/integrations_common/web/pictures/items/headerbar-searchfield-right.png branches/team/Thomas/integrations_common/web/pictures/items/headerbar-voice_recorder_ic.png branches/team/Thomas/integrations_common/web/pictures/items/headerbar-voice_recorder_icon.png branches/team/Thomas/integrations_common/web/pictures/items/headerbar-wimba_podcaster_i.png branches/team/Thomas/integrations_common/web/pictures/items/headerbar-wimba_podcaster_icon.png branches/team/Thomas/integrations_common/web/pictures/items/headerbar-wimbapodcaster.png branches/team/Thomas/integrations_common/web/pictures/items/listitem-Podcastericon.png branches/team/Thomas/integrations_common/web/pictures/items/listitem-VoiceBoardicon.png branches/team/Thomas/integrations_common/web/pictures/items/listitem-VoicePresentationicon.png branches/team/Thomas/integrations_common/web/pictures/items/listitem-archiveicon-selected.jpg branches/team/Thomas/integrations_common/web/pictures/items/listitem-archiveicon.jpg branches/team/Thomas/integrations_common/web/pictures/items/listitem-available.jpg branches/team/Thomas/integrations_common/web/pictures/items/listitem-available.png branches/team/Thomas/integrations_common/web/pictures/items/listitem-boardicon.png branches/team/Thomas/integrations_common/web/pictures/items/listitem-hide.png branches/team/Thomas/integrations_common/web/pictures/items/listitem-liveclassroomicon.gif branches/team/Thomas/integrations_common/web/pictures/items/listitem-liveclassroomicon.jpg branches/team/Thomas/integrations_common/web/pictures/items/listitem-liveclassroomicon.png branches/team/Thomas/integrations_common/web/pictures/items/listitem-orphanedarchiveicon.png branches/team/Thomas/integrations_common/web/pictures/items/listitem-pcicon.png branches/team/Thomas/integrations_common/web/pictures/items/listitem-presentationicon.png branches/team/Thomas/integrations_common/web/pictures/items/listitem-show.png branches/team/Thomas/integrations_common/web/pictures/items/listitem-subitem-selected.jpg branches/team/Thomas/integrations_common/web/pictures/items/listitem-subitem.jpg branches/team/Thomas/integrations_common/web/pictures/items/listitem-subitem.png branches/team/Thomas/integrations_common/web/pictures/items/listitem-unavailable.jpg branches/team/Thomas/integrations_common/web/pictures/items/listitem-unavailable.png branches/team/Thomas/integrations_common/web/pictures/items/listitem-voicerecordericon.png branches/team/Thomas/integrations_common/web/pictures/items/listitem-voicetoolsicon.gif branches/team/Thomas/integrations_common/web/pictures/items/listitem-wimbapodcaster.png branches/team/Thomas/integrations_common/web/pictures/items/liveclassroom.png branches/team/Thomas/integrations_common/web/pictures/items/messagelabel-info.png branches/team/Thomas/integrations_common/web/pictures/items/more-link.png branches/team/Thomas/integrations_common/web/pictures/items/phone_60.png branches/team/Thomas/integrations_common/web/pictures/items/space-16px.png branches/team/Thomas/integrations_common/web/pictures/items/space-16x16px.png branches/team/Thomas/integrations_common/web/pictures/items/space-18px.png branches/team/Thomas/integrations_common/web/pictures/items/space-24px.png branches/team/Thomas/integrations_common/web/pictures/items/space-32px.png branches/team/Thomas/integrations_common/web/pictures/items/space-44px.png branches/team/Thomas/integrations_common/web/pictures/items/tab-selected.gif branches/team/Thomas/integrations_common/web/pictures/items/tab-unselected.gif branches/team/Thomas/integrations_common/web/pictures/items/toolbar-separator.png branches/team/Thomas/integrations_common/web/pictures/items/warning.png branches/team/Thomas/integrations_common/web/pictures/items/wheel-03.gif branches/team/Thomas/integrations_common/web/pictures/items/wheel.gif branches/team/Thomas/integrations_common/web/pictures/items/window-left.png branches/team/Thomas/integrations_common/web/pictures/items/window-middle.png branches/team/Thomas/integrations_common/web/pictures/items/window-right.png branches/team/Thomas/integrations_common/web/pictures/items/window200_left.png branches/team/Thomas/integrations_common/web/pictures/items/window200_middle.png branches/team/Thomas/integrations_common/web/pictures/items/window200_right.png branches/team/Thomas/integrations_common/web/pictures/items/x_normal.gif branches/team/Thomas/integrations_common/web/pictures/items/x_normal.png branches/team/Thomas/integrations_common/web/pictures/items/x_over.gif branches/team/Thomas/integrations_common/web/pictures/items/x_over.png Removed Paths: ------------- branches/team/Thomas/moodle/mod/liveclassroom/js/ branches/team/Thomas/moodle/mod/liveclassroom/lib/ branches/team/Thomas/moodle/mod/liveclassroom/pictures/ branches/team/Thomas/moodle/mod/voicetools/js/ branches/team/Thomas/moodle/mod/voicetools/lib/ branches/team/Thomas/moodle/mod/voicetools/pictures/ Added: branches/team/Thomas/integrations_common/php/common/WimbaCommons.php =================================================================== --- branches/team/Thomas/integrations_common/php/common/WimbaCommons.php (rev 0) +++ branches/team/Thomas/integrations_common/php/common/WimbaCommons.php 2008-01-16 14:49:35 UTC (rev 226) @@ -0,0 +1,660 @@ +<?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 * +* * +******************************************************************************/ + +/* $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; + + + 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)."&"; + } + } + + 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"; + + } + // / 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"); + + } + 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 ""; + +} + +} + + +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"); + } + //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"); + } + + + $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"])); + } + + + 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"); + } + //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"); + } + + + $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: branches/team/Thomas/integrations_common/php/common/WimbaLib.php =================================================================== --- branches/team/Thomas/integrations_common/php/common/WimbaLib.php (rev 0) +++ branches/team/Thomas/integrations_common/php/common/WimbaLib.php 2008-01-16 14:49:35 UTC (rev 226) @@ -0,0 +1,347 @@ +<?php +/** + * Returns the keys of the general parameters passed by GET or POST + */ +function getKeysOfGeneralParameters(){ + + return array( + array("value"=>"enc_courseId","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_BOOL,"default_value"=>null), + array("value"=>"createWorkflow","type"=>PARAM_BOOL,"default_value"=>null), + + ); + +} + + +function getKeyWimbaClassroomForm(){ + + + return array ( + array("value"=>"longname","type"=>PARAM_CLEAN,"default_value"=>null), + array("value"=>"description","type"=>PARAM_CLEAN,"default_value"=>null), + 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"=>"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_INT,"default_value"=>-1) + ) ; +} + + +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 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 + //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"])) + { + $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"]); + } + 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"])); + + + + + } + else + { + $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"]); + } + 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"])); + } + else + { + $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"; + } + // $voicetools->id=$id; + + return voicetools_update_element($voicetools); + +} + +?> Added: branches/team/Thomas/integrations_common/php/common/WimbaUI.php =================================================================== --- branches/team/Thomas/integrations_common/php/common/WimbaUI.php (rev 0) +++ branches/team/Thomas/integrations_common/php/common/WimbaUI.php 2008-01-16 14:49:35 UTC (rev 226) @@ -0,0 +1,1913 @@ +<?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 = "") { + + $this->session = $session; + $this->api = $api; + + $this->xml = new WimbaXml(); + $this->currentTab = $currentIdtab; + if($api!=null) + { + $this->prefix=$api->getPrefix(); + } + } + + function setCurrentProduct($product, $object = NULL, $objectInformations = NULL) { + $this->product = $product; + $this->currentObject = $object; + + if($this->currentObject == null) + $this->id=$this->session->getCourseId() . rand(); + + if ($product == "liveclassroom") { + if ($this->currentObject != null && $this->currentObject->isArchive()) { + $this->isArchive = "true"; + } + if ($this->currentObject == null || $this->currentObject != null && $this->api->isStudentAdmin($this->currentObject->getRoomId(), $this->session->getCourseId() . "_S") == "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 = $objectInformations; + + 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 ($object != null && $objectInformations != null) { + + //for php 4-> object->object doesn't work + $this->currentObjectOptions = $object->getOptions(); + $this->currentObjectAudioFormat = $this->currentObjectOptions->getAudioFormat(); + + } + } + } + + //Manage the general display of the different pages + 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["courseId"], $this->session->signature, "", "", "", ""); + /******** + HEADER + *********/ + if($this->session->isInstructor()){ + $this->xml->addHeaderElement("pictures/items/headerbar-logo.png", "false", "true"); + }else{ + $this->xml->addHeaderElement("pictures/items/headerbar-logo.png", "false", "false"); + + } + /******** + MENU + *********/ + $this->xml->addButtonElement("all", "all", "disabled", "pictures/buttons/toolbar-launch", get_string('toolbar_launch', 'liveclassroom'), "javascript:LaunchElement('doAction.php','liveclassroom');"); + if($this->session->isInstructor()){ + $this->xml->addButtonElement("instructor", "all", "disabled", '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", "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", "pictures/buttons/toolbar-content", get_string('toolbar_content', 'liveclassroom'), "javascript:openContent('doAction.php');"); + $this->xml->addButtonElement("instructor", "all", "disabled", "pictures/buttons/toolbar-poll", get_string('toolbar_reports', 'liveclassroom'), "javascript:openReport('doAction.php');"); + $this->xml->addSpaceElement("10px", "instructor"); + $this->xml->addButtonElement("instructor", "all", "disabled", "pictures/buttons/toolbar-settings", get_string('toolbar_settings', 'liveclassroom'), "javascript:editSettings('generateSettings.php','all');"); + $this->xml->addButtonElement("instructor", "all", "disabled", "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", "Live classroom", "liveclassroom",$rooms , get_string('list_no_liveclassrooms', 'liveclassroom')); + else { + //problem to get the vt resource + $this->xml->setError(get_string("error_connection_lc", "liveclassroom")); + + } + + + + return $this->xml->getXml(); + } + + + + function getVTPrincipalView($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["courseId"], $this->session->signature, "", "", "", ""); + /******** + HEADER + *********/ + if($this->session->isInstructor()){ + $this->xml->addHeaderElement("pictures/items/headerbar-logo.png", "false", "true"); + }else{ + $this->xml->addHeaderElement("pictures/items/headerbar-logo.png", "false", "false"); + + } + /******** + MENU + *********/ + $this->xml->addButtonElement("all", "all", "disabled", "pictures/buttons/toolbar-launch", get_string('toolbar_launch', 'voicetools'), "javascript:LaunchElement('manageAction.php','voicetools');"); + if($this->session->isInstructor()){ + $this->xml->addButtonElement("instructor", "all", "disabled", 'pictures/buttons/toolbar-activities', get_string('toolbar_activity', 'voicetools'), "doOpenAddActivity('../../course/mod.php','section=0&sesskey=" . sesskey() . "&add=voicetools')"); + $this->xml->addButtonElement("instructor", "all", "enabled", "pictures/buttons/toolbar-new", get_string('toolbar_new', 'voicetools'), "javascript:launchAjaxRequest('getXmlChoicePage.php','create' ,'true','all')"); + $this->xml->addSpaceElement("150px", "instructor"); + $this->xml->addButtonElement("instructor", "all", "disabled", "pictures/buttons/toolbar-settings", get_string('toolbar_settings', 'voicetools'), "javascript:editSettings('getXmlNewPanel.php','all');"); + $this->xml->addButtonElement("instructor", "all", "disabled", "pictures/buttons/toolbar-delete", get_string('toolbar_delete', 'voicetools'), "javascript:deleteResource('manageAction.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 + *********/ + + $resources = $this->getListVoiceTools(); + + if ($resources != null) { + $this->xml->addProduct("voicetools", "productType", "Voice Board", "board", $resources["board"], get_string('list_no_boards', 'voicetools')); + $this->xml->addProduct("voicetools", "productType", "Voice Presentation", "presentation", $resources["presentation"], get_string('list_no_presentations', 'voicetools')); + $this->xml->addProduct("voicetools", "productType", "Podcaster", "pc", $resources["pc"], get_string('list_no_pcs', 'voicetools')); + } + else { + //problem to get the vt resource + $this->xml->setError(get_string("error_connection_vt", "voicetools")); + + } + if (isset ($message) && $message!="") { + $this->xml->addMessage($message); + } + return $this->xml->getXml(); + } + + function setError($error) { + + $this->xml->setError($error); + return $this->xml->getXml(); + } + + function getListVoiceTools() { + //get the list of the boards + $list = voicetools_get_voicetools_list($this->session->hparams["courseId"]); + + $vtResources = voicetools_api_get_resources($list["rid"]); + + if ($vtResources == null) { + + return null; + + } + $board = array (); + $presentation = array (); + $podcaster = array (); + $allVt = array (); + if (isset ($vtResources)) + $ressources = $vtResources->getResources(); + + for ($i = 0; $i < count($ressources); $i++) { + $resource = $vtResources->getResource($i); + + $rid = $resource->getRid(); + if ($list["info"][$rid]->availability == "0") { + $preview = false; + } + elseif ($list["info"][$rid]->start_date == -1 && $list["info"][$rid]->end_date == -1) { + $preview = true; + } + elseif ($list["info"][$rid]->start_date == -1 && time() <= $list["info"][$rid]->end_date) { + $preview = true; + } + elseif ($list["info"][$rid]->start_date < time() && $list["info"][$rid]->end_date == -1) { + $preview = true; + } + elseif ($list["info"][$rid]->start_date < time() && time() < $list["info"][$rid]->end_date) { + $preview = true; + } + else { + $preview = false; + } + + $xmlResource = new XmlResource($rid, $resource->getTitle(), $preview, "manageAction.php", $this->session->url_params . "&time=" . time() . "&action=launch"); + $xmlResource->setTooltipAvailability(get_string("tooltipVT_" . $preview . "_student", "voicetools")); + if ($this->session->isInstructor() || !$this->session->isInstructor() && $preview == true) { + if ($resource->getType() == "board") { + $xmlResource->setType("board"); + $board[$resource->getTitle() . $resource->getRid()] = $xmlResource; + } + elseif ($resource->getType() == "presentation") { + $xmlResource->setType("presentation"); + $presentation[$resource->getTitle() . $resource->getRid()] = $xmlResource; + } + elseif ($resource->getType() == "pc") { + $xmlResource->setType("pc"); + $podcaster[$resource->getTitle() . $resource->getRid()] = $xmlResource; + } + } + } + $allVt["board"] = $board; + $allVt["presentation"] = $presentation; + $allVt["pc"] = $podcaster; + return $allVt; + } + + function getLCSettingsView($update, $createWorkflow) { + + /******** + 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["courseId"], $this->session->signature, "", "", $CFG->voicetools_servername, ""); + /******** + HEADER + *********/ + $this->xml->addHeaderElement("pictures/items/headerbar-logo.png", "true", "true"); + + if($update=="update"){ + + $this->xml->addContextElement(get_string("contextbar_settings", "liveclassroom"), get_string("general_" . $this->product, "liveclassroom"), $this->currentObject->getLongname(), ""); + }else{ + + $this->xml->addContextElement(get_string("contextbar_settings", "liveclassroom"), get_string("general_" . $this->product, "liveclassroom"), get_string("contextbar_new_" . $this->product, "liveclassroom"), ""); + + } + + + /******** + * Settings tabs + */ + $this->createLcInfoPanel(); + $this->createLcMediaPanel(); + $this->createLcFeaturesPanel(); + $this->createLcChatPanel(); + $this->createLcAccessPanel(); + if ($update == "update" && $this->currentObject != null && !$this->currentObject->isArchive()) { + $this->createLcAdvancedPanel(); + } + $this->xml->createValidationButtonElement(get_string("validationElement_ok", "liveclassroom"), "actionHide", "javascript:launchAjaxRequest('generateListRooms.php','',true,'all')", "advanced_Ok"); + + if ($createWorkflow == "true") + $this->xml->createValidationButtonElement(get_string("validationElement_cancel", "liveclassroom"), "action", "javascript:redirectToActivity('doAction.php','redirection','','" . $createWorkflow . "')", "setting_Cancel"); + else + $this->xml->createValidationButtonElement(get_string("validationElement_cancel", "liveclassroom"), "action", "javascript:launchAjaxRequest('generateListRooms.php','',true,'all')", "setting_Cancel"); + if ($update != "update") { + $this->xml->createValidationButtonElement(get_string("validationElement_create", "liveclassroom"), "action", "javascript:submitForm('doAction.php','create','".$this->id."','" . $createWorkflow . "')", "setting_Create"); + } + else { + $this->xml->createValidationButtonElement(get_string("validationElement_saveAll", "liveclassroom"), "action", "javascript:submitForm('doAction.php','update','".$this->currentObject->getRoomId()."')", "setting_Save"); + } + return $this->xml->getXml(); + } + + function getVTSettingsView($update, $createWorkflow) { + //list_dir("pictures",$pictures);//list the directory + /******** + 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["courseId"], $this->session->signature, "", "", "", ""); + /******** + HEADER + *********/ + $this->xml->addHeaderElement("pictures/items/headerbar-logo.png", "true", "true"); + if($update=="update"){ + $this->xml->addContextElement(get_string("contextbar_settings", "voicetools"), get_string("general_" . $this->product, "voicetools"), $this->currentObject->getTitle(), ""); + + }else{ + $this->xml->addContextElement(get_string("contextbar_settings", "voicetools"), get_string("general_" . $this->product, "voicetools"), get_string("contextbar_new_" . $this->product, "voicetools"), ""); + } + + /******** + * Settings tabs + */ + if ($this->product == "board") { + $this->createGeneralInfoPanelStart(); + $this->createGeneralInfoPanelEnd(); + $this->createVBInfoPanel(); + //Media settings + $this->createVBVPMediaPanel(); + $this->createVBFeaturesPanel(); + $this->createVTAccessPanel(); + } + elseif ($this->product == "presentation") { + $this->createGeneralInfoPanelStart(); + $this->createGeneralInfoPanelEnd(); + $this->createVPInfoPanel(); + //Media settings + $this->createVBVPMediaPanel(); + $this->createVTAccessPanel(); + } + elseif ($this->product == "pc") { + $this->createGeneralInfoPanelStart(); + $thi... [truncated message content] |