Revision: 238
http://hw4mdl.svn.sourceforge.net/hw4mdl/?rev=238&view=rev
Author: trollinger
Date: 2008-02-05 14:47:59 -0800 (Tue, 05 Feb 2008)
Log Message:
-----------
Code cleaning
Modified Paths:
--------------
branches/team/Thomas/moodle/mod/voicetools/css/StyleSheet.css
branches/team/Thomas/moodle/mod/voicetools/getXmlChoicePage.php
branches/team/Thomas/moodle/mod/voicetools/getXmlListPanel.php
branches/team/Thomas/moodle/mod/voicetools/getXmlNewPanel.php
branches/team/Thomas/moodle/mod/voicetools/index.php
branches/team/Thomas/moodle/mod/voicetools/lib.php
branches/team/Thomas/moodle/mod/voicetools/manageAction.php
branches/team/Thomas/moodle/mod/voicetools/manageActionBlock.php
branches/team/Thomas/moodle/mod/voicetools/mod.html
branches/team/Thomas/moodle/mod/voicetools/view.php
branches/team/Thomas/moodle/mod/voicetools/voicerecorder.php
branches/team/Thomas/moodle/mod/voicetools/welcome.php
Modified: branches/team/Thomas/moodle/mod/voicetools/css/StyleSheet.css
===================================================================
--- branches/team/Thomas/moodle/mod/voicetools/css/StyleSheet.css 2008-02-05 22:47:38 UTC (rev 237)
+++ branches/team/Thomas/moodle/mod/voicetools/css/StyleSheet.css 2008-02-05 22:47:59 UTC (rev 238)
@@ -9,11 +9,6 @@
font-size:8px;
}
-*
-{
- margin:0;
- padding:0;
-}
/*general html element*/
input
@@ -144,7 +139,6 @@
background-image: url( "../lib/web/pictures/backgrounds/toolbar.png" );
height: 30px;
width: 100%;
- border-bottom: solid 1px #F0F0F0;
}
.contextBarRight
@@ -278,7 +272,7 @@
.list_archive
{
width:16px;
- border-bottom: solid 1px #F3F3F3;
+ border-bottom: solid 1px #F3F3F3;
}
.list_information
@@ -492,7 +486,6 @@
padding-left:5%;
padding-right:5%;
margin-top:7%;
-
display: block;
height: 247px;
}
@@ -535,7 +528,7 @@
}
*>html .choiceVtonly td {
- height:103px;
+ height:105px;
}
product_choice_left
@@ -586,7 +579,7 @@
/*MessageBar*/
#messageBar
{
- width:99%;
+ width:700px;
}
.message
@@ -596,7 +589,7 @@
bottom:4px;
left:1px;
right:1px;
- height: 20px;
+ height: 25px;
display: block;
}
Modified: branches/team/Thomas/moodle/mod/voicetools/getXmlChoicePage.php
===================================================================
--- branches/team/Thomas/moodle/mod/voicetools/getXmlChoicePage.php 2008-02-05 22:47:38 UTC (rev 237)
+++ branches/team/Thomas/moodle/mod/voicetools/getXmlChoicePage.php 2008-02-05 22:47:59 UTC (rev 238)
@@ -28,64 +28,95 @@
******************************************************************************/
/* $Id: getXmlChoicePage.php 52853 2007-08-24 17:55:26Z thomasr $ */
-global $CFG;
-require_once("../../config.php");
-require_once("lib.php");
-require_once("lib/php/common/WimbaXml.php");
-require_once("lib/php/common/WimbaCommons.php");
-require_once("lib/php/common/WimbaLib.php");
-if (version_compare(PHP_VERSION,'5','>=')) {
- require_once('lib/php/common/domxml-php4-php5.php');
-}
-$createWorkflow = optional_param('createWorkflow', false, PARAM_BOOL); // course
-foreach(getKeysOfGeneralParameters() as $param){
- $value=optional_param($param["value"],$param["default_value"],$param["type"]);
- if($value!=null)
- $params[$param["value"]] = $value;
-}
-
-ini_set('display_errors','off');
-ini_set('log_errors','on');
-require_login($params["enc_course_id"]);
-$xml=new WimbaXml();
-$session=new WimbaMoodleSession($params);
-if($session->error==false)//no error
-{
- /********
- HEADER
- *********/
- $xml->addHeaderElement("lib/web/pictures/items/headerbar-logo.png", "true", "true");
- /********
- SESSION
- *********/
- $xml->CreateInformationElement($session->timeOfLoad,$session->hparams["firstname"],$session->hparams["lastname"],$session->hparams["email"],$session->hparams["role"],$session->hparams["course_id"],$session->signature,"","",$CFG->voicetools_servername);
-
- /************
- INFORMATIONS
- *************/
- $xml->addContextElement(get_string('new_tool','voicetools'));
-
- /***************
- PRODUCTS CHOICE
- ****************/
- $xml->addProductChoice("lib/web/pictures/buttons/new-createvoiceboard.png",get_string('new_board', 'voicetools'),get_string('VoiceBoardDescription', 'voicetools'),"javascript:loadNewSettings('getXmlNewPanel.php','create' ,'voicetools','board','all','".$createWorkflow."')");
-
- $xml->addProductChoice("lib/web/pictures/buttons/new-createvoicepresentation.png",get_string('new_presentation', 'voicetools'),get_string('VoicePresentationDescription', 'voicetools'),"javascript:loadNewSettings('getXmlNewPanel.php','create' ,'voicetools','presentation','all','".$createWorkflow."')");
- $xml->addProductChoice("lib/web/pictures/buttons/new-createpodcaster.png",get_string('new_podcaster', 'voicetools'),get_string('PodcasterDescription', 'voicetools'),"javascript:loadNewSettings('getXmlNewPanel.php','create' ,'voicetools','pc','all','".$createWorkflow."')");//for 3.1
-
- /***************
- VALIDATION BAR
- ****************/
- $actionParameters = array("value"=>get_string('cancel', 'voicetools'),"style"=>"action","action"=>"launchAjaxRequest");
-
- if($createWorkflow=="true")
- $xml->createValidationButtonElement(get_string("validationElement_cancel", "voicetools"), "action", "javascript:redirectToActivity('manageAction.php','redirection','','".$createWorkflow."')", "setting_Cancel");
- else
- $xml->createValidationButtonElement(get_string("validationElement_cancel", "voicetools"), "action", "javascript:launchAjaxRequest('getXmlListPanel.php','',true,'all')", "setting_Cancel");
-
-
-}else{ //bad session
- $xml->setError(get_string ($session->error, 'voicetools'));
-}
-echo $xml->getXml();
+ global $CFG;
+ require_once("../../config.php");
+ require_once("lib.php");
+ require_once("lib/php/common/WimbaXml.php");
+ require_once("lib/php/common/WimbaCommons.php");
+ require_once("lib/php/common/WimbaLib.php");
+ if (version_compare(PHP_VERSION,'5','>=')) {
+ require_once('lib/php/common/domxml-php4-php5.php');
+ }
+
+
+ foreach(getKeysOfGeneralParameters() as $param){
+ $value=optional_param($param["value"],$param["default_value"],$param["type"]);
+ if($value!=null)
+ {
+ $params[$param["value"]] = $value;
+ }
+ }
+
+ require_login($params["enc_course_id"]);
+ $createWorkflow = optional_param('createWorkflow', false, PARAM_BOOL); // course
+ $xml=new WimbaXml();
+ $session=new WimbaMoodleSession($params);
+
+ if($session->error==false)//no error
+ {
+ /********
+ HEADER
+ *********/
+ $xml->addHeaderElement("lib/web/pictures/items/headerbar-logo.png", "true", "true");
+ /********
+ SESSION
+ *********/
+ $xml->CreateInformationElement($session->timeOfLoad,
+ $session->hparams["firstname"],
+ $session->hparams["lastname"],
+ $session->hparams["email"],
+ $session->hparams["role"],
+ $session->hparams["course_id"],
+ $session->signature,"");
+ /************
+ INFORMATIONS
+ *************/
+ $xml->addContextBarElement(get_string('new_tool','voicetools'));
+
+ /***************
+ PRODUCTS CHOICE
+ ****************/
+ $xml->addProductChoice("lib/web/pictures/buttons/new-createvoiceboard.png",
+ get_string('new_board', 'voicetools'),
+ get_string('VoiceBoardDescription', 'voicetools'),
+ "javascript:loadNewSettings('getXmlNewPanel.php','create' ,'voicetools','board','all','".$createWorkflow."')");
+
+
+ $xml->addProductChoice("lib/web/pictures/buttons/new-createvoicepresentation.png",
+ get_string('new_presentation', 'voicetools'),
+ get_string('VoicePresentationDescription', 'voicetools'),
+ "javascript:loadNewSettings('getXmlNewPanel.php','create' ,'voicetools','presentation','all','".$createWorkflow."')");
+
+ $xml->addProductChoice("lib/web/pictures/buttons/new-createpodcaster.png",
+ get_string('new_podcaster', 'voicetools'),
+ get_string('PodcasterDescription', 'voicetools'),
+ "javascript:loadNewSettings('getXmlNewPanel.php','create' ,'voicetools','pc','all','".$createWorkflow."')");//for 3.1
+
+ /***************
+ VALIDATION BAR
+ ****************/
+ $actionParameters = array("value"=>get_string('cancel', 'voicetools'),
+ "style"=>"action",
+ "action"=>"launchAjaxRequest");
+
+ if($createWorkflow==true)
+ {
+ $xml->createValidationButtonElement(get_string("validationElement_cancel", "voicetools"),
+ "action",
+ "javascript:redirectToActivity('manageAction.php','redirection','','".$createWorkflow."')",
+ "setting_Cancel");
+ }
+ else
+ {
+ $xml->createValidationButtonElement(get_string("validationElement_cancel", "voicetools"),
+ "action",
+ "javascript:launchAjaxRequest('getXmlListPanel.php','',true,'all')",
+ "setting_Cancel");
+ }
+
+ }else
+ { //bad session
+ $xml->setError(get_string ($session->error, 'voicetools'));
+ }
+ echo $xml->getXml();
?>
\ No newline at end of file
Modified: branches/team/Thomas/moodle/mod/voicetools/getXmlListPanel.php
===================================================================
--- branches/team/Thomas/moodle/mod/voicetools/getXmlListPanel.php 2008-02-05 22:47:38 UTC (rev 237)
+++ branches/team/Thomas/moodle/mod/voicetools/getXmlListPanel.php 2008-02-05 22:47:59 UTC (rev 238)
@@ -56,11 +56,8 @@
}
require_login($params["enc_course_id"]);
-$session=new WimbaMoodleSession($params);
-$uiManager=new WimbaUI($session);
+$uiManager=new WimbaUI($params);
-
-
if(isset($params["error"]) )
{
$uiManager->setError(get_string ($params["error"], 'voicetools'));
@@ -68,7 +65,7 @@
else
{
//Session Management
- if($session->error==false)//good
+ if($uiManager->getSessionError()==false)//good
{
$message="";
if(!empty($messageProduct) && !empty($messageAction))
@@ -77,7 +74,7 @@
}
else
{ //bad session
- $uiManager->setError(get_string ('error_'.$session->error, 'voicetools'));
+ $uiManager->setError(get_string ('error_'.$uiManager->getError(), 'voicetools'));
}
}
echo $uiManager->getXmlString();
Modified: branches/team/Thomas/moodle/mod/voicetools/getXmlNewPanel.php
===================================================================
--- branches/team/Thomas/moodle/mod/voicetools/getXmlNewPanel.php 2008-02-05 22:47:38 UTC (rev 237)
+++ branches/team/Thomas/moodle/mod/voicetools/getXmlNewPanel.php 2008-02-05 22:47:59 UTC (rev 238)
@@ -1,109 +1,103 @@
-<?php
+<?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 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 Horizon Wimba Moodle Integration; *
-* if not, write to the Free Software Foundation, Inc., *
-* 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA *
-* *
-* Author: Hazan Samy *
-* *
-* Date: October 2006 *
-* *
-******************************************************************************/
+ * *
+ * Copyright (c) 1999-2006 Horizon Wimba, All Rights Reserved. *
+ * *
+ * COPYRIGHT: *
+ * This software is the property of Horizon 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 Horizon Wimba Moodle Integration; *
+ * if not, write to the Free Software Foundation, Inc., *
+ * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA *
+ * *
+ * Author: Hazan Samy *
+ * *
+ * Date: October 2006 *
+ * *
+ ******************************************************************************/
/* $Id: getXmlNewPanel.php 52710 2007-08-20 19:54:04Z thomasr $ */
/// This page is to generate the list of VT
-global $CFG;
-require_once("../../config.php");
-require_once("lib.php");
-require_once("lib/php/vt/WimbaVoicetoolsAPI.php");
-require_once("lib/php/vt/WimbaVoicetools.php");
-require_once("lib/php/common/WimbaCommons.php");
-require_once("lib/php/common/WimbaXml.php");
-require_once("lib/php/common/WimbaUI.php");
-require_once("lib/php/common/WimbaLib.php");
-if (version_compare(PHP_VERSION,'5','>=')) {
- require_once('lib/php/common/domxml-php4-php5.php');
-}
-
-$createWorkflow = optional_param('createWorkflow', false, PARAM_BOOL); // course
-foreach(getKeysOfGeneralParameters() as $param)
-{
- $value=optional_param($param["value"],$param["default_value"],$param["type"]);
- if($value!=null)
- $params[$param["value"]] = $value;
-}
-
-require_login($params["enc_course_id"]);
-$session=new WimbaMoodleSession($params);
-$uiManager=new WimbaUI($session);
-
-if($session->error==false)
-{
- /*******************
- GET URL INFORMATIONS
- ********************/
- $action = optional_param('action', ""); // Course Module ID, or
- $typeProduct = $params['type'];
- add_to_log($session->getCourseId(), "voicetools", "xml", "product" , $typeProduct);
-
- if($action == 'update')
- { //get the information of the resource
- $currentBoard = voicetools_api_get_resource($params["resource_id"]);
-
- if($currentBoard==null || $currentBoard->error==true)
+ global $CFG;
+ require_once("../../config.php");
+ require_once("lib.php");
+ require_once("lib/php/vt/WimbaVoicetoolsAPI.php");
+ require_once("lib/php/vt/WimbaVoicetools.php");
+ require_once("lib/php/common/WimbaCommons.php");
+ require_once("lib/php/common/WimbaXml.php");
+ require_once("lib/php/common/WimbaUI.php");
+ require_once("lib/php/common/WimbaLib.php");
+ if (version_compare(PHP_VERSION,'5','>=')) {
+ require_once('lib/php/common/domxml-php4-php5.php');
+ }
+
+ $createWorkflow = optional_param('createWorkflow', false, PARAM_BOOL); // course
+ foreach(getKeysOfGeneralParameters() as $param)
{
- $uiManager->setError(get_string('problem_vt','voicetools'));
+ $value=optional_param($param["value"],$param["default_value"],$param["type"]);
+ if($value!=null)
+ {
+ $params[$param["value"]] = $value;
+ }
}
- $currentBoardInformations=voicetools_get_voiceboard_Informations($params["resource_id"]);
+ require_login($params["enc_course_id"]);
+ $uiManager=new WimbaUI($params);
- if($currentBoard->error==true)
+ if($uiManager->getSessionError()==false)
{
- $uiManager->setError(get_string('problem_bd','voicetools'));
+ /*******************
+ GET URL INFORMATIONS
+ ********************/
+ $action = optional_param('action', ""); // Course Module ID, or
+ $typeProduct = $params['type'];
+ add_to_log($uiManager->getSession()->getCourseId(), "voicetools", "xml", "product" , $typeProduct);
+
+ if($action == 'update')
+ { //get the information of the resource
+ $currentBoard = voicetools_api_get_resource($params["resource_id"]);
+
+ if($currentBoard==null || $currentBoard->error==true)
+ {
+ $uiManager->setError(get_string('problem_vt','voicetools'));
+ }
+
+ $currentBoardInformations=voicetools_get_voiceboard_Informations($params["resource_id"]);
+ // print_r($currentBoardInformations);
+ if($currentBoard->error==true)
+ {
+ $uiManager->setError(get_string('problem_bd','voicetools'));
+ }
+
+ $uiManager->setCurrentProduct($typeProduct,$currentBoard,$currentBoardInformations);
+
+ }
+ else
+ {
+ $uiManager->setCurrentProduct($typeProduct);
+ }
+
+ $display= $uiManager->getVTSettingsView($action,$createWorkflow);
+
}
+ else
+ {
+ $uiManager->setError(get_string ($uiManager->getSessionError(), 'voicetools'));
+ }
- $uiManager->setCurrentProduct($typeProduct,$currentBoard,$currentBoardInformations);
-
- }
- else
- {
- $uiManager->setCurrentProduct($typeProduct);
- }
-
- $display= $uiManager->getVTSettingsView($action,$createWorkflow);
-
-}
-else
-{
- if($session->error=="session")
- {
- $uiManager->setError(get_string ('session', 'voicetools'));
- }
- else if($session->error=="signature")
- {
- $uiManager->setError(get_string ('signature', 'voicetools'));
- }
-}
-
-echo $uiManager->getXmlString();
+ echo $uiManager->getXmlString();
?>
Modified: branches/team/Thomas/moodle/mod/voicetools/index.php
===================================================================
--- branches/team/Thomas/moodle/mod/voicetools/index.php 2008-02-05 22:47:38 UTC (rev 237)
+++ branches/team/Thomas/moodle/mod/voicetools/index.php 2008-02-05 22:47:59 UTC (rev 238)
@@ -35,7 +35,7 @@
require_once("lib/php/common/WimbaLib.php");
$course_id = optional_param('id', 0, PARAM_INT); // course
-$createWorkflow = optional_param('createWorkflow', false, PARAM_BOOL); // course
+$createWorkflow = optional_param('createWorkflow', "false", PARAM_ALPHA); // course
if (! $course = get_record("course", "id", $course_id)) {
error("Course ID is incorrect");
Modified: branches/team/Thomas/moodle/mod/voicetools/lib.php
===================================================================
--- branches/team/Thomas/moodle/mod/voicetools/lib.php 2008-02-05 22:47:38 UTC (rev 237)
+++ branches/team/Thomas/moodle/mod/voicetools/lib.php 2008-02-05 22:47:59 UTC (rev 238)
@@ -51,40 +51,44 @@
-The api account has to valid
********/
- if(empty($config->servername))
- {
+ if(empty($config->servername))
+ {
error(get_string('wrongconfigurationURLunavailable', 'voicetools'), $_SERVER["HTTP_REFERER"]);
- }
-
- if(empty($config->adminusername))
- {
+ }
+
+ if(empty($config->adminusername))
+ {
error(get_string('emptyAdminUsername', 'voicetools'), $_SERVER["HTTP_REFERER"]);
- }
-
- if(empty($config->adminpassword))
- {
+ }
+
+ if(empty($config->adminpassword))
+ {
error(get_string('emptyAdminPassword', 'voicetools'), $_SERVER["HTTP_REFERER"]);
- }
-
- if ($config->servername{strlen($config->servername)-1} == '/')
- {
+ }
+
+ if ($config->servername{strlen($config->servername)-1} == '/')
+ {
error(get_String('trailingSlash', 'voicetools'), $_SERVER["HTTP_REFERER"]);
- }
-
- if (!preg_match('/^http:\/\//', $config->servername) && !preg_match('/^https:\/\//', $config->servername))
- {
+ }
+
+ if (!preg_match('/^http:\/\//', $config->servername) && !preg_match('/^https:\/\//', $config->servername))
+ {
error(get_String('trailingHttp', 'voicetools'), $_SERVER["HTTP_REFERER"]);
- }
-
- //check if the api account filled is correct and allowed
- $result = voicetools_api_check_documentbase ($config->servername, $config->adminusername,$config->adminpassword,$CFG->wwwroot);
-
- if ($result != "ok") {
- if(get_string($result, 'voicetools' ) == "[[]]")//the error description is not in the bundle
- error($result, 'javascript:history.back();');
- else
- error(get_string($result, 'voicetools' ), 'javascript:history.back();');
- }
+ }
+
+ //check if the api account filled is correct and allowed
+ $result = voicetools_api_check_documentbase ($config->servername, $config->adminusername,$config->adminpassword,$CFG->wwwroot);
+
+ if ($result != "ok")
+ {
+ if(get_string($result, 'voicetools' ) == "[[]]")
+ {//the error description is not in the bundle
+ error($result, 'javascript:history.back();');
+ }
+ else{
+ error(get_string($result, 'voicetools' ), 'javascript:history.back();');
+ }
+ }
}
function voicetools_add_instance($voicetool) {
@@ -104,7 +108,8 @@
return false;
}
- if(isset($voicetool->calendar_event) && $voicetool->calendar_event==true) {
+ if(isset($voicetool->calendar_event) && $voicetool->calendar_event==true)
+ {
voicetools_addCalendarEvent($voicetool);
}
@@ -118,27 +123,32 @@
global $USER;
//get the course_module instance linked to the liveclassroom instance
- if (! $cm = get_coursemodule_from_instance("voicetools", $voicetool->id, $voicetool->course)) {
+ if (! $cm = get_coursemodule_from_instance("voicetools", $voicetool->id, $voicetool->course))
+ {
error("Course Module ID was incorrect");
}
if($voicetool->section != $cm->section)//the scetion has changed
{
//Find the right section in the course_section
- if (!$section = get_record("course_sections", "id", $cm->section)){
+ if (!$section = get_record("course_sections", "id", $cm->section))
+ {
return false;
}
//delete in the course section
- if (! delete_mod_from_section($cm->id, $cm->section)) {
+ if (! delete_mod_from_section($cm->id, $cm->section))
+ {
return false;
}
//update the course module section
- if (! $sectionid = add_mod_to_section($voicetool) ) {
+ if (! $sectionid = add_mod_to_section($voicetool) )
+ {
error("Could not add the new course module to that section");
}
//update the course modules
- if (! set_field("course_modules", "section", $sectionid, "id", $cm->id)) {
+ if (! set_field("course_modules", "section", $sectionid, "id", $cm->id))
+ {
error("Could not update the course module with the correct section");
}
}
@@ -149,11 +159,13 @@
$voicetool->rid=$rid;
$voicetool->name=get_string("$type","voicetools").$voicetool->name;
- if (!$voicetool->id = update_record('voicetools', $voicetool)) {
+ if (!$voicetool->id = update_record('voicetools', $voicetool))
+ {
return false;
}
- if(isset($voicetool->calendar_event) && $voicetool->calendar_event==true) {//no problem
+ if(isset($voicetool->calendar_event) && $voicetool->calendar_event==true)
+ {//no problem
voicetools_addCalendarEvent($voicetool,$voicetool->id );
}
else
@@ -170,11 +182,13 @@
/// this function will permanently delete the instance
/// and any data that depends on it.
$result = true;
- if (! $voicetool = get_record("voicetools", "id", "$id")) {
+ if (! $voicetool = get_record("voicetools", "id", "$id"))
+ {
return false;
}
# Delete any dependent records here #
- if (! $instanceNumber=delete_records("voicetools", "id", "$voicetool->id")) {
+ if (! $instanceNumber=delete_records("voicetools", "id", "$voicetool->id"))
+ {
add_to_log($voicetool->course, "voicetools", "Delete activity",voicetools_send_logs("errorDeleteInstance","voicetoolsId=".$instanceNumber), "Activity ".$voicetool->name." deletion failed");
$result = false;
}
@@ -457,11 +471,12 @@
$tool = get_record('voicetools_resources','rid',$rid);
- if(empty($tool)){
- return NULL;
-
+ if(empty($tool))
+ {
+ return null;
}
- else if($tool == false) {
+ else if($tool == false)
+ {
error( "Response get_board_list : query to database failed");
return "error_moodleDatabase";
}
Modified: branches/team/Thomas/moodle/mod/voicetools/manageAction.php
===================================================================
--- branches/team/Thomas/moodle/mod/voicetools/manageAction.php 2008-02-05 22:47:38 UTC (rev 237)
+++ branches/team/Thomas/moodle/mod/voicetools/manageAction.php 2008-02-05 22:47:59 UTC (rev 238)
@@ -1,6 +1,4 @@
<?php
-
-
/******************************************************************************
* *
* Copyright (c) 1999-2006 Horizon Wimba, All Rights Reserved. *
@@ -40,13 +38,10 @@
require_once ('lib/php/vt/WimbaVoicetoolsAPI.php');
require_once ('lib/php/vt/VtAction.php');
-
-
-
$messageProduct=optional_param("messageProduct","");
$messageAction=optional_param("messageAction","");
$notool=optional_param("novoicetools","false");
-$createWorkflow = optional_param('createWorkflow', $dddddd, PARAM_BOOL); // course
+$createWorkflow = optional_param("createWorkflow", false, PARAM_BOOL); // course
$keys=array_merge(getKeysOfGeneralParameters(),getKeyWimbaVoiceForm());
foreach($keys as $param){
@@ -60,12 +55,15 @@
$vtAction = new vtAction($params);
$session = new WimbaMoodleSession($params);
-$redirectionUrl='welcome.php?id=' . $session->getCourseId() . '&' . $session->url_params . '&time=' . $session->timeOfLoad;
-$urlModuleForm=$CFG->wwwroot.'/course/mod.php?section=0&sesskey='.sesskey().'&id='.$session->getCourseId().'&add=voicetools&rid='.$rid;
+$redirectionUrl='welcome.php?id=' . $session->getCourseId() . '&' .
+ $session->url_params . '&time=' . $session->timeOfLoad;
+$urlModuleForm=$CFG->wwwroot.'/course/mod.php?section=0&sesskey='.sesskey().
+ '&id='.$session->getCourseId().'&add=voicetools&rid=';
+
$messageType = "";
-if ($session->error == false && $session != NULL || $CFG->error==true) {
+if ($session->error == false && $session != NULL ) {
if ($params['action'] == 'launch') {
$session->setCurrentVtUSer($params["type"]);
if ($params["studentView"] == "true") {
@@ -73,10 +71,12 @@
}
$resource = voicetools_api_get_resource($params["resource_id"]);
$result = $vtAction->getVtSession($resource, $session->getVtUser(), $session->getVtUserRigths());
- if ($result != NULL) {
+ if ($result != NULL)
+ {
redirection($CFG->voicetools_servername . '/' . $params["type"] . '?action=display_popup&nid=' . $result->getNid());
}
- else {
+ else
+ {
redirection($redirectionUrl.'&error=problem_vt');
}
}
@@ -103,9 +103,10 @@
if ($result != NULL && $result->error != "error")
{
- $params["resource_id"] = storeResource($result->getRid(), $session->getCourseId(), $params['type'],$params["longname"], $params);
-
- if (empty ($params["resource_id"])) {
+ $params["resource_id"] = storeResource($result->getRid(), $params);
+
+ if (empty ($params["resource_id"]))
+ {
error_log(__FUNCTION__ . " : Problem to add the new resource on the database", TRUE);
redirection($redirectionUrl. '&error=problem_bd');
}
@@ -143,7 +144,7 @@
if ($result != NULL)
{
//create the object to store in the db
- $params["resource_id"] = updateResource($result->getRid(), $session->getCourseId(), $param['type'], $param, $params["resource_id"]);
+ $params["resource_id"] = updateResource($result->getRid(), $params);
if (empty ($params["resource_id"]))
{
@@ -161,25 +162,25 @@
}
elseif ($params['action'] == 'delete')
{
- $result = $vtAction->deleteRessource($params["resource_id"]);
+ $result = $vtAction->deleteResource($params["resource_id"]);
if ($result != NULL && $result->error != "error") { //if no error during the creation
if (! voicetools_delete_all_instance_of_resource($params["resource_id"])) {
notify("Could not delete the activities for the vocietools:". $params["resource_id"]);
}
$messageType = 'delete' . $param["type"];
$messageAction = "deleted";
- $messageProduct = $_GET["type"];
+ $messageProduct = $params["type"];
}
}
- if (isset($createWorkflow) && $createWorkflow == true)
+ if ($createWorkflow == true)
{
if(!isset($result) )
$rid="";
else
$rid=$result->getRid();
- parentRedirection($urlModuleForm);
+ parentRedirection($urlModuleForm.$rid);
}
else
{
Modified: branches/team/Thomas/moodle/mod/voicetools/manageActionBlock.php
===================================================================
--- branches/team/Thomas/moodle/mod/voicetools/manageActionBlock.php 2008-02-05 22:47:38 UTC (rev 237)
+++ branches/team/Thomas/moodle/mod/voicetools/manageActionBlock.php 2008-02-05 22:47:59 UTC (rev 238)
@@ -37,27 +37,23 @@
require_once('lib/php/vt/WimbaVoicetools.php');
require_once('lib/php/vt/WimbaVoicetoolsAPI.php');
global $CFG;
+$action = optional_param("action", "", PARAM_ALPHA); // course
-
-if($_GET['action']=='updateRecorder')
- {
+if($action == 'updateRecorder')
+{
$bId = required_param('block_id', PARAM_SAFEDIR);
- $comment=required_param('comment', PARAM_SAFEDIR);
- $title=required_param('title', PARAM_SAFEDIR);
- $comment=str_replace("\n","<br>",$comment);
-
- $resourceId=voicetools_update_recorder_informations($bId,$comment,$title);
+ $comment = required_param('comment', PARAM_SAFEDIR);
+ $title = required_param('title', PARAM_SAFEDIR);
+ $comment = str_replace("\n","<br>",$comment);
+ $resourceId = voicetools_update_recorder_informations($bId,$comment,$title);
if(empty($resourceId))
{
echo "error.php?error=problem_db";
exit();
}
- print "good";
- exit();
-
+ print "good";
+ exit();
+}
-
-
-
-} ?>
\ No newline at end of file
+?>
\ No newline at end of file
Modified: branches/team/Thomas/moodle/mod/voicetools/mod.html
===================================================================
--- branches/team/Thomas/moodle/mod/voicetools/mod.html 2008-02-05 22:47:38 UTC (rev 237)
+++ branches/team/Thomas/moodle/mod/voicetools/mod.html 2008-02-05 22:47:59 UTC (rev 238)
@@ -51,19 +51,24 @@
$sectionId = optional_param('section', null, PARAM_INT);
/// First we check that form variables have been initialised
-if (!isset($form->name)) {
+if (!isset($form->name))
+{
$form->name = '';
}
-if (!isset($form->type)) {
+if (!isset($form->type))
+{
$form->type = '';
}
-if (!isset($form->intro)) {
+if (!isset($form->intro))
+{
$form->intro = '';
}
-if (!isset($form->descrption)) {
+if (!isset($form->descrption))
+{
$form->descrption = '';
}
-if (!isset($form->section)) {
+if (!isset($form->section))
+{
$form->section = '';
}
$error="";
@@ -74,7 +79,8 @@
if(isset($update)){ //update
//get the information of the activity
- if (! $cmVT = get_record("course_modules", "id", $update)) {
+ if (! $cmVT = get_record("course_modules", "id", $update))
+ {
return false;
}
@@ -114,13 +120,14 @@
$disabledCheckbox="";
$disableAllElements="";
}
-
-
-
+
// Visible to students or not
-if ($form->coursemodule) {
+if ($form->coursemodule)
+{
$visible = get_field('course_modules', 'visible', 'id', $form->coursemodule);
-} else {
+}
+else
+{
$visible = true;
}
@@ -131,7 +138,9 @@
{
$hiddensection = !get_field('course_sections', 'visible', 'id', $form->section);
}
-if ($hiddensection) {
+
+if ($hiddensection)
+{
$visible = false;
}
@@ -145,16 +154,16 @@
?>
-<link rel="STYLESHEET" href="<?php p($CFG->wwwroot) ?>/mod/liveclassroom/css/StyleSheet.css"" type="text/css" />
+<link rel="STYLESHEET" href="<?php p($CFG->wwwroot) ?>/mod/voicetools/css/StyleSheet.css"" type="text/css" />
<style>
-body{
+body
+{
font-size:14px;
}
.content
{
margin:-5px;
}
-
</style>
<script type="text/javascript">
@@ -168,13 +177,20 @@
else var expires = "";
document.cookie = name+"="+value+expires+"; path=/";
}
+
function readCookie(name) {
var nameEQ = name + "=";
var ca = document.cookie.split(';');
- for(var i=0;i < ca.length;i++) {
+ for(var i=0;i < ca.length;i++)
+ {
var c = ca[i];
- while (c.charAt(0)==' ') c = c.substring(1,c.length);
- if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length,c.length);
+ while (c.charAt(0)==' '){
+ c = c.substring(1,c.length);
+ }
+ if (c.indexOf(nameEQ) == 0)
+ {
+ return c.substring(nameEQ.length,c.length);
+ }
}
return null;
}
@@ -185,35 +201,42 @@
function booleanValue(value){
if(value=="false")
+ {
return false;
- else
+ }
+ else
+ {
return true;
+ }
}
function validate(){
- // name can't be null
- if(document.getElementById("name").value == ""){
- alert("Please a name is required.");
- return false;
- }else if(document.getElementById("name").value.length>=255){
- alert("Please choose an activity name that is less than 255 characters.");
- return false;
- }else if(document.getElementById("resource").value=="empty"){
- alert("Please select a Voice Tools.");
- return false;
-
- }
- document.getElementById("form").submit();
+ // name can't be null
+ if(document.getElementById("name").value == "")
+ {
+ alert("Please a name is required.");
+ return false;
+ }
+ else if(document.getElementById("name").value.length>=255)
+ {
+ alert("Please choose an activity name that is less than 255 characters.");
+ return false;
+ }
+ else if(document.getElementById("resource").value=="empty")
+ {
+ alert("Please select a Voice Tools.");
+ return false;
+ }
+
+ document.getElementById("form").submit();
}
function TestNoTool() {
<?php
$listTools = voicetools_get_voicetools_list($course->id);
if($listTools==NULL) { //no voice tools available
- ?>
-
-
+ ?>
document.getElementById("hiddenDiv").style.height=document.documentElement.clientHeight
document.getElementById("hiddenDiv").style.width=document.documentElement.clientWidth
document.getElementById("popup").style.display="block";
@@ -240,64 +263,127 @@
//save the form fields
if(document.getElementById("name")!=null)
+ {
createCookie("name",document.getElementById("name").value);
+ }
+
if(document.getElementById("section")!=null)
- createCookie("section",document.getElementById("section").selectedIndex);
+ {
+ createCookie("section",document.getElementById("section").selectedIndex);
+ }
+
if(document.getElementById("menuvisible")!=null)
- createCookie("menuvisible",document.getElementById("menuvisible").selectedIndex);
-
+ {
+ createCookie("menuvisible",document.getElementById("menuvisible").selectedIndex);
+ }
//calendar
if(document.getElementById("calendar_event")!=null)
- createCookie("calendar_event",document.getElementById("calendar_event").checked);
+ {
+ createCookie("calendar_event",document.getElementById("calendar_event").checked);
+ }
+
if(document.getElementById("start_month")!=null)
- createCookie("start_month",document.getElementById("start_month").selectedIndex);
+ {
+ createCookie("start_month",document.getElementById("start_month").selectedIndex);
+ }
+
if(document.getElementById("start_day")!=null)
- createCookie("start_day",document.getElementById("start_day").selectedIndex);
+ {
+ createCookie("start_day",document.getElementById("start_day").selectedIndex);
+ }
+
if(document.getElementById("start_year")!=null)
- createCookie("start_year",document.getElementById("start_year").selectedIndex);
+ {
+ createCookie("start_year",document.getElementById("start_year").selectedIndex);
+ }
+
if(document.getElementById("start_hr")!=null)
- createCookie("start_hr",document.getElementById("start_hr").selectedIndex);
+ {
+ createCookie("start_hr",document.getElementById("start_hr").selectedIndex);
+ }
+
if(document.getElementById("start_min")!=null)
- createCookie("start_min",document.getElementById("start_min").selectedIndex);
+ {
+ createCookie("start_min",document.getElementById("start_min").selectedIndex);
+ }
+
if(document.getElementById("duration_hr")!=null)
- createCookie("duration_hr",document.getElementById("duration_hr").selectedIndex);
+ {
+ createCookie("duration_hr",document.getElementById("duration_hr").selectedIndex);
+ }
+
if(document.getElementById("duration_min")!=null)
- createCookie("duration_min",document.getElementById("duration_min").selectedIndex);
+ {
+ createCookie("duration_min",document.getElementById("duration_min").selectedIndex);
+ }
+
if(document.getElementById("description")!=null)
+ {
createCookie("description",document.getElementById("description").value);
+ }
-
//manage the availability of the calendar
if(document.getElementById("calendar_event")!=null)
- createCookie("calendar_event_disabled",document.getElementById("calendar_event").disabled);
+ {
+ createCookie("calendar_event_disabled",document.getElementById("calendar_event").disabled);
+ }
+
if(document.getElementById("start_month")!=null)
- createCookie("start_month_disabled",document.getElementById("start_month").disabled);
+ {
+ createCookie("start_month_disabled",document.getElementById("start_month").disabled);
+ }
+
if(document.getElementById("start_day")!=null)
- createCookie("start_day_disabled",document.getElementById("start_day").disabled);
+ {
+ createCookie("start_day_disabled",document.getElementById("start_day").disabled);
+ }
+
if(document.getElementById("start_year")!=null)
- createCookie("start_year_disabled",document.getElementById("start_year").disabled);
+ {
+ createCookie("start_year_disabled",document.getElementById("start_year").disabled);
+ }
+
if(document.getElementById("start_hr")!=null)
- createCookie("start_hr_disabled",document.getElementById("start_hr").disabled);
+ {
+ createCookie("start_hr_disabled",document.getElementById("start_hr").disabled);
+ }
+
if(document.getElementById("start_min")!=null)
- createCookie("start_min_disabled",document.getElementById("start_min").disabled);
+ {
+ createCookie("start_min_disabled",document.getElementById("start_min").disabled);
+ }
if(document.getElementById("duration_hr")!=null)
- createCookie("duration_hr_disabled",document.getElementById("duration_hr").disabled);
+ {
+ createCookie("duration_hr_disabled",document.getElementById("duration_hr").disabled);
+ }
+
if(document.getElementById("duration_min")!=null)
- createCookie("duration_min_disabled",document.getElementById("duration_min").disabled);
+ {
+ createCookie("duration_min_disabled",document.getElementById("duration_min").disabled);
+ }
+
if(document.getElementById("description")!=null)
+ {
createCookie("description_disabled",document.getElementById("description").disabled);
-
+ }
+
location.href = "<?php echo $CFG->wwwroot;?>/mod/voicetools/index.php?id=<?php echo $course_id;?>&createWorkflow=true";
}
+
function hideCalendarEvent(value){
- if(value=="check"){
+ if(value=="check")
+ {
if(document.getElementById("calendar_event").checked==true)
+ {
value="";
+ }
else
+ {
value="disabled";
+ }
+ }
- }
document.getElementById("start_hr").disabled=value ;
document.getElementById("start_min").disabled=value ;
document.getElementById("duration_hr").disabled=value ;
@@ -312,18 +398,28 @@
function change(){
- if(document.getElementById("section").value == 0){
+ if(document.getElementById("section").value == 0)
+ {
hideCalendarEvent("disabled");
document.getElementById("calendar_event").disabled="disabled";
document.getElementById("comment_date").innerHTML="";
- }else{
+ }
+ else
+ {
document.getElementById("calendar_event").disabled="";
- if(document.getElementById("calendar_event").checked==false)
+ if(document.getElementById("calendar_event").checked==false)
+ {
hideCalendarEvent("disabled");
+ }
else
- hideCalendarEvent("");
+ {
+ hideCalendarEvent("");
+ }
- var value=parseInt("<?php echo $course->startdate ?>") + parseInt((document.getElementById("section").value -1) * 604800) + parseInt(document.getElementById("start_day").value) + 3600; //add 3600 for ie
+ var value = parseInt("<?php echo $course->startdate ?>") +
+ parseInt((document.getElementById("section").value -1) * 604800) +
+ parseInt(document.getElementById("start_day").value) + 3600; //add 3600 for ie
+
var date = new Date(value*1000);
document.getElementById("calendar_start").value= value;
document.getElementById("comment_date").innerHTML= (date.getMonth()+1)+"/"+ date.getDate()+"/"+date.getFullYear();
@@ -333,70 +429,90 @@
function FillForm(){
- if(document.getElementById("name")!=null && readCookie("name")!=null){
+ if(document.getElementById("name")!=null && readCookie("name")!=null)
+ {
document.getElementById("name").value=[readCookie("name")];
deleteCookie("name");
}
- if(document.getElementById("section")!=null && readCookie("section")!=null){
+
+ if(document.getElementById("section")!=null && readCookie("section")!=null)
+ {
document.getElementById("section")[readCookie("section")].selected=true;
deleteCookie("section");
}
- if(document.getElementById("menuvisible")!=null && readCookie("menuvisible")!=null){
+
+ if(document.getElementById("menuvisible")!=null && readCookie("menuvisible")!=null)
+ {
document.getElementById("menuvisible")[readCookie("menuvisible")].selected=true;
deleteCookie("menuvisible");
}
- if(document.getElementById("calendar_event")!=null && readCookie("calendar_event")!=null){
+
+ if(document.getElementById("calendar_event")!=null && readCookie("calendar_event")!=null)
+ {
document.getElementById("calendar_event").checked=readCookie("calendar_event");
document.getElementById("calendar_event").disabled=booleanValue(readCookie("calendar_event_disabled"));
deleteCookie("calendar_event");
deleteCookie("calendar_event_disabled");
}
- if(document.getElementById("start_month")!=null && readCookie("start_month")!=null){
+
+ if(document.getElementById("start_month")!=null && readCookie("start_month")!=null)
+ {
document.getElementById("start_month")[readCookie("start_month")].selected=true;
document.getElementById("start_month").disabled=booleanValue(readCookie("start_month_disabled"));
deleteCookie("start_month");
deleteCookie("start_month_disabled");
}
- if(document.getElementById("start_day")!=null && readCookie("start_day")!=null){
+
+ if(document.getElementById("start_day")!=null && readCookie("start_day")!=null)
+ {
document.getElementById("start_day")[readCookie("start_day")].selected=true;
document.getElementById("start_day").disabled=booleanValue(readCookie("start_day_disabled"));
deleteCookie("start_day");
deleteCookie("start_day_disabled");
}
- if(document.getElementById("start_year")!=null && readCookie("start_year")!=null){
+
+ if(document.getElementById("start_year")!=null && readCookie("start_year")!=null)
+ {
document.getElementById("start_year")[readCookie("start_year")].selected=true;
document.getElementById("start_year").disabled=booleanValue(readCookie("start_year_disabled"));
deleteCookie("start_year");
deleteCookie("start_year_disabled");
}
- if(document.getElementById("start_hr")!=null && readCookie("start_hr")!=null){
+ if(document.getElementById("start_hr")!=null && readCookie("start_hr")!=null)
+ {
document.getElementById("start_hr")[readCookie("start_hr")].selected=true;
document.getElementById("start_hr").disabled=booleanValue(readCookie("start_hr_disabled"));
deleteCookie("start_hr");
deleteCookie("start_hr_disabled");
}
- if(document.getElementById("duration_hr")!=null && readCookie("duration_hr")!=null){
+ if(document.getElementById("duration_hr")!=null && readCookie("duration_hr")!=null)
+ {
document.getElementById("duration_hr")[readCookie("duration_hr")].selected=true;
document.getElementById("duration_hr").disabled=booleanValue(readCookie("duration_hr_disabled"));
deleteCookie("duration_hr");
deleteCookie("duration_hr_disabled");
}
- if(document.getElementById("duration_min")!=null && readCookie("duration_min")!=null){
+ if(document.getElementById("duration_min")!=null && readCookie("duration_min")!=null)
+ {
document.getElementById("duration_min")[readCookie("duration_min")].selected=true;
document.getElementById("duration_min").disabled=booleanValue(readCookie("duration_min_disabled"));
deleteCookie("duration_min");
deleteCookie("duration_min_disabled");
}
- if(document.getElementById("start_min")!=null && readCookie("start_min")!=null){
+
+ if(document.getElementById("start_min")!=null && readCookie("start_min")!=null)
+ {
document.getElementById("start_min")[readCookie("start_min")].selected=true;
document.getElementById("start_min").disabled=booleanValue(readCookie("start_min_disabled"));
deleteCookie("start_min");
deleteCookie("start_min_disabled");
}
- if(document.getElementById("description")!=null && readCookie("description")!=null){
+
+ if(document.getElementById("description")!=null && readCookie("description")!=null)
+ {
document.getElementById("description").value=readCookie("description");
document.getElementById("description").disabled=booleanValue(readCookie("description_disabled"));
deleteCookie("description");
@@ -410,7 +526,6 @@
}
window.onload=loadPage;
-
</script>
<title>Wimba</title>
@@ -431,7 +546,7 @@
</tr>
</table>
</div>
- <div id="contextBar" width=700px align=center>
+ <div id="contextBar" width=700px align=center style="border-bottom: solid 1px #D9DEE5;">
<table width=700px align=center>
<tbody>
<tr>
@@ -448,7 +563,7 @@
<table border="0" width="700px" align=center cellpadding="5" cellspacing="0">
<tr valign="top">
<td align="right">
- <font color="red">*</font> <font class="fontCurrent"><?php print_string('activity_name', 'voicetools') ?></font>
+ <font color="red">*</font><font class="fontCurrent"><?php print_string('activity_name', 'voicetools') ?></font>
</td>
<td align="left">
<input type="text" id="name" name="name" size="25" value="<?php echo $name ?>">
Modified: branches/team/Thomas/moodle/mod/voicetools/view.php
===================================================================
--- branches/team/Thomas/moodle/mod/voicetools/view.php 2008-02-05 22:47:38 UTC (rev 237)
+++ branches/team/Thomas/moodle/mod/voicetools/view.php 2008-02-05 22:47:59 UTC (rev 238)
@@ -28,12 +28,10 @@
/* $Id: view.php 52828 2007-08-23 22:12:28Z thomasr $ */
-/// This page prints a particular instance of voicedirect
-/// (Replace voicedirect with the name of your module)
error_reporting(E_ERROR);
require_once('../../config.php');
require_once('lib.php');
-
+//Wimba Library
require_once ("lib/php/common/WimbaLib.php");
require_once('lib/php/vt/WimbaVoicetools.php');
require_once('lib/php/vt/WimbaVoicetoolsAPI.php');
@@ -41,89 +39,50 @@
require_once('lib/php/vt/vtAction.php');
$id = optional_param('id', 0, PARAM_INT); // Course Module ID, or
+$action = optional_param('action', PARAM_ACTION);
-if ((isset($_GET["action"]) && $_GET["action"]!="launchCalendar" ) && $id || !isset($_GET["action"]) ) {
- if (! $cm = get_record("course_modules", "id", $id)) {
- error("Course Module ID was incorrect");
- }
-
- if (! $course = get_record("course", "id", $cm->course)) {
- error("Course is misconfigured");
- }
-
- if (! $voicetool = get_record("voicetools", "id", $cm->instance)) {
- error("Course module is incorrect");
- }
-
+if ((isset($action) && $action!="launchCalendar" ) && $id || !isset($action) ) {
+ if (! $cm = get_record("course_modules", "id", $id)) {
+ error("Course Module ID was incorrect");
+ }
+
+ if (! $course = get_record("course", "id", $cm->course)) {
+ error("Course is misconfigured");
+ }
+
+ if (! $voicetool = get_record("voicetools", "id", $cm->instance)) {
+ error("Course module is incorrect");
+ }
+
} else {
- if (! $voicetool = get_record("voicetools", "id", $id)) {
- error("Course module is incorrect");
- }
- if (! $course = get_record("course", "id", $voicetool->course)) {
- error("Course is misconfigured");
- }
- if (! $cm = get_coursemodule_from_instance("voicetools", $voicetool->id, $course->id)) {
- error("Course Module ID was incorrect");
- }
- }
+ if (! $voicetool = get_record("voicetools", "id", $id)) {
+ error("Course module is incorrect");
+ }
+ if (! $course = get_record("course", "id", $voicetool->course)) {
+ error("Course is misconfigured");
+ }
+ if (! $cm = get_coursemodule_from_instance("voicetools", $voicetool->id, $course->id)) {
+ error("Course Module ID was incorrect");
+ }
+}
require_login($course->id);
-
add_to_log($course->id, "voicetools", "view", "view.php?id=$cm->id", "$voicetool->id");
-
-$session=new WimbaMoodleSession(NULL);
-
-//check the availability of the resource
-$vt_informations=voicetools_get_voicetool_informations($voicetool->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;
-}
-
-
-$resource=voicetools_api_get_resource ($voicetool->rid) ;
-//determinate the role for the wimba tools
-$roleSwitch=isSwitch();//the user have switched his role?
-
-
-
-$role=getRoleForWimbaTools($course->id,$USER->id);
-
-if($resource->error==true){
- error(get_string("problem_vt", "voicetools"), "$CFG->wwwroot/course/view.php?id=$course->id");
-}
-
-$vtAction=new vtAction(NULL);
-$session->setCurrentVtUSer($resource->getType(),$USER->firstname."_".$USER->lastname,$USER->email,$role);
-
-//use a vt user
-
-
-$vtSession=$vtAction->getVtSession($resource,$session->getVtUser(),$session->getVtUserRigths()) ;
-
-
+$servername = $CFG->voicetools_servername;
$strvoicetools = get_string("modulenameplural", "voicetools");
$strvoicetool = get_string("modulename", "voicetools");
-$strname = $voicetool->name;
-
+$sentence1=get_string ('vtpopupshouldappear.1', 'voicetools');
+$sentence2="<a href='javascript:startVoiceBoard ()';>".get_string ('vtpopupshouldappear.2', 'voicetools')."</a>";
+$sentence3=get_string ('vtpopupshouldappear.3', 'voicetools');
+$strLaunchComment=$sentence1.$sentence2.$sentence3;
+
+$completeName=explode(" - ", $voicetool->name);
+$strname=$completeName[1];
+
$navigation = array();
- if ($course->id != SITEID) {
+if ($course->id != SITEID) {
$navigation[$course->shortname] = "$CFG->wwwroot/course/view.php?id=$course->id";
}
$navigation[$strvoicetools] = "$CFG->wwwroot/mod/voicetools/index.php?id=$course->id";
@@ -140,50 +99,55 @@
$breadcrumb = implode(' -> ', $urls);
print_header("$course->shortname: $voicetool->name", "$course->fullname",
-"$breadcrumb",
-"", "", true, update_module_button($cm->id, $course->id, $strvoicetool),
+ $breadcrumb, "", "", true, update_module_button($cm->id, $course->id, $strvoicetool),
navmenu($course, $cm));
-/// Print the main part of the page
+//get the informations related to the Vt resource
+$vtAction=new vtAction();
+$resource=$vtAction->getResource($voicetool->rid) ;
+//check the availability of the resource
+$vtpreview=isVtAvailable($voicetool->rid);
+$roleSwitch=isSwitch();//the user have switched his role?
+//determinate the role for the wimba tools
+$role=getRoleForWimbaTools($course->id,$USER->id);
+
+if($resource->error==true){
+ error(get_string("problem_vt", "voicetools"), "$CFG->wwwroot/course/view.php?id=$course->id");
+}
-$servername = $CFG->voicetools_servername;
+$vtAction=new vtAction(NULL);
+$currentUser=$vtAction->createUser($USER->firstname."_".$USER->lastname,$USER->email);
+$currentUserRights=$vtAction->createUserRights($resource->getType(),$role);
+//get the vt session
+$vtSession=$vtAction->getVtSession($resource,$currentUser,$currentUserRights) ;
+
?>
<script type="text/javascript">
var popup;
function doOpenPopup (url, type)
{
-
popup=window.open (url, type+"_popup", "scrollbars=no,toolbar=no,menubar=no,resizable=yes");
-
}
-
function startVoiceBoard(){
- <?
- if(isset($roleSwitch) && $roleSwitch==true) {
- ?>
- result=window.confirm("<?php echo get_string ('launchstudent', 'voicetools');?>");
- if(result==true) {
- doOpenPopup("<?php echo $servername ?>/<? echo $resource->getType();?>?action=display_popup&nid=<?php echo $vtSession->getNid() ?>","<?php echo $resource->getType()?>");
-
- }
- else
- {
- location.href= document.referrer;
- }
-
- <?}else{
- ?>
- doOpenPopup("<?php echo $servername ?>/<? echo $resource->getType();?>?action=display_popup&nid=<?php echo $vtSession->getNid() ?>","<?php echo $resource->getType()?>");
- <?}?>
+ <? if(isset($roleSwitch) && $roleSwitch==true) { ?>
+ result=window.confirm("<?php echo get_string ('launchstudent', 'voicetools');?>");
+ if(result==true) {
+ doOpenPopup("<?php echo $servername ?>/<? echo $resource->getType();?>?action=display_popup&nid=<?php echo $vtSession->getNid() ?>","<?php echo $resource->getType()?>");
+ }
+ else
+ {
+ location.href= document.referrer;
+ }
+ <? }else{ ?>
+ doOpenPopup("<?php echo $servername ?>/<? echo $resource->getType();?>?action=display_popup&nid=<?php echo $vtSession->getNid() ?>","<?php echo $resource->getType()?>");
+ <? } ?>
}
-
-
+
</script>
-
<link rel="STYLESHEET" href="<?php p($CFG->wwwroot) ?>/mod/voicetools/css/StyleSheet.css"" type="text/css" />
<style>
body{
@@ -191,17 +155,13 @@
}
.middle_panel{
height:315px;
-
}
html>body .middle_panel{
- height:312px;
-
+ height:319px;
}
-
</style>
-
- <div style="border:solid 1px #808080;width:700px;height:400px;margin-left:20%;margin-top:5%">
+<div style="border:solid 1px #808080;width:700px;height:400px;margin-left:20%;margin-top:5%">
<div class="headerBar" id="headerBar">
<table cellpadding="0" cellspacing="0" width=100%>
<tbody>
@@ -215,65 +175,58 @@
</div>
<div class="contextBar" id="contextBar">
<table>
- <tbody>
- <tr>
- <td class="contextBarLeft" align="left">
- <label class="nameElement">
- <?php
- $completeName=explode(" - ", $voicetool->name);
- $name=$completeName[1];
- echo substr($name,0,25);
-
- ?>
- </label>
-
- </td>
- <td class="contextBarRight" align="right">Voice Tools</td>
- </tr>
- </tbody>
- </table>
+ <tbody>
+ <tr>
+ <td class="contextBarLeft" align="left">
+ <label class="nameElement">
+ <?php echo substr($strname,0,25);?>
+ </label>
+ </td>
+ <td class="contextBarRight" align="right">Voice Tools</td>
+ </tr>
+ </tbody>
+ </table>
</div>
- <div >
+ <div>
<table width=100% class="middle_panel">
<tbody>
<tr valign=middle align=center>
- <td>
- <?php if($preview==false){
- echo get_string ('activity_tools_not_available', 'voicetools');
- }else{
- ?>
- <script>
- startVoiceBoard();
- </script>
- <?php echo get_string ('vtpopupshouldappear.1', 'voicetools');?>
- <a href="javascript:startVoiceBoard ('<?php echo "$CFG->wwwroot/course/view.php?id=$course->id" ?>');">
- <?php echo get_string ('vtpopupshouldappear.2', 'voicetools');?>
- </a>
- <?php echo get_string ('vtpopupshouldappear.3', 'voicetools');?>
- <?php }?>
- </td>
+ <td>
+ <?php if($vtpreview==false)
+ ...
[truncated message content] |