Revision: 243
http://hw4mdl.svn.sourceforge.net/hw4mdl/?rev=243&view=rev
Author: trollinger
Date: 2008-02-14 15:22:21 -0800 (Thu, 14 Feb 2008)
Log Message:
-----------
-add more log
-fix minor issue
-Refactoring
Modified Paths:
--------------
branches/team/Thomas/moodle/mod/voicetools/config.html
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/lang/en/voicetools.php
branches/team/Thomas/moodle/mod/voicetools/lang/en_utf8/voicetools.php
branches/team/Thomas/moodle/mod/voicetools/lang/fr/voicetools.php
branches/team/Thomas/moodle/mod/voicetools/lang/fr_utf8/voicetools.php
branches/team/Thomas/moodle/mod/voicetools/lib.php
branches/team/Thomas/moodle/mod/voicetools/manageAction.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/config.html
===================================================================
--- branches/team/Thomas/moodle/mod/voicetools/config.html 2008-02-14 23:21:43 UTC (rev 242)
+++ branches/team/Thomas/moodle/mod/voicetools/config.html 2008-02-14 23:22:21 UTC (rev 243)
@@ -1,35 +1,47 @@
<?php
if(isset($CFG->voicetools_servername))
-$servername=$CFG->voicetools_servername;
+{
+ $servername=$CFG->voicetools_servername;
+}
else
-$servername="";
+{
+ $servername="";
+}
if(isset($CFG->voicetools_adminusername))
-$adminusername=$CFG->voicetools_adminusername;
+{
+ $adminusername=$CFG->voicetools_adminusername;
+}
else
-$adminusername="";
+{
+ $adminusername="";
+}
if(isset($CFG->voicetools_adminpassword))
-$adminpassword=$CFG->voicetools_adminpassword;
+{
+ $adminpassword=$CFG->voicetools_adminpassword;
+}
else
-$adminpassword="";
+{
+ $adminpassword="";
+}
?>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
- <title>Voice Tools Server Configuration </title>
-
+ <title>Voice Tools Server Configuration </title>
</head>
+
<style>
- .label_settings
+.label_settings
{
font-family: Verdana, Arial, Helvetica, sans-serif;
font-size:12px;
text-align:right;
}
- .comment
+.comment
{
font-family: Verdana, Arial, Helvetica, sans-serif;
font-size:10px;
@@ -44,6 +56,7 @@
vertical-align: middle;
}
</style>
+
<body>
<form method="post" action="module.php" name="form">
<input type="hidden" name="sesskey" value="<?php echo $USER->sesskey ?>">
@@ -52,7 +65,7 @@
<table cellpadding="9" cellspacing="0" width=800px>
<tr>
<td width="2%">
- <img src="<?php echo $CFG->wwwroot;?>/mod/voicetools/pictures/items/voice_tools.png" border="0" />
+ <img src="<?php echo $CFG->wwwroot;?>/mod/voicetools/lib/web/pictures/items/voice_tools.png" border="0" />
</td>
<td align="left" class="page_title">
<?php print_string('serverconfiguration', 'voicetools')?>
@@ -115,9 +128,25 @@
<?php p(VOICETOOLS_MODULE_VERSION) ?>
</td>
</tr>
+ <tr>
+ <td align="right">
+ <label class="label_settings"><?php echo get_string("loglevel", "voicetools");?></label>
+ </td>
+ <td align="left">
+ <select size="1" name="log_level">
+ <option value=1 <?php if (@$CFG->voicetools_log_level == 1) echo "selected"; ?>>DEBUG</option>
+ <option value=2 <?php if (!isset($CFG->voicetools_log_level) || @$CFG->voicetools_log_level == 2) echo "selected"; ?>>INFO</option>
+ <option value=3 <?php if (@$CFG->voicetools_log_level == 3) echo "selected"; ?>>WARN</option>
+ <option value=4 <?php if (@$CFG->voicetools_log_level == 4) echo "selected"; ?>>ERROR</option>
+ </select>
+ <a href=<?php echo $CFG->wwwroot."/mod/voicetools/log.php?action=list"; ?> onclick="document.forms['logs_form'].submit();"><?php echo get_string("viewlogs", "voicetools");?></a>
+ </form>
+ </td>
+ </tr>
</table>
</td>
</tr>
+
<tr>
<td colspan="3" align="center">
<input type="submit" value="<?php print_string('savechanges') ?>" />
Modified: branches/team/Thomas/moodle/mod/voicetools/css/StyleSheet.css
===================================================================
--- branches/team/Thomas/moodle/mod/voicetools/css/StyleSheet.css 2008-02-14 23:21:43 UTC (rev 242)
+++ branches/team/Thomas/moodle/mod/voicetools/css/StyleSheet.css 2008-02-14 23:22:21 UTC (rev 243)
@@ -577,9 +577,9 @@
/*MessageBar*/
-#messageBar
+#message
{
- width:700px;
+ width:699px;
}
.message
@@ -696,7 +696,7 @@
font-size: 12px;
}
-div.advancedPopup {
+div.advancedPopup,div.informationPopup {
position:absolute;
left:0px;
top:0px;
@@ -706,9 +706,18 @@
font-family:Verdana;
padding: 2px;
margin: 2px;
+
+ display:none;
+}
+
+div.advancedPopup {
left: 15%;
+ top: 20%;
+}
+
+div.informationPopup {
+ left: 40%;
top: 30%;
- display:none;
}
div.window-left {
@@ -737,7 +746,7 @@
top:0px;
width:10px;
height:150px;
- background-image: url( "../pictures/items/window-right.png" );
+ background-image: url( "../lib/web/pictures/items/window-right.png" );
background-repeat:none;
}
Modified: branches/team/Thomas/moodle/mod/voicetools/getXmlChoicePage.php
===================================================================
--- branches/team/Thomas/moodle/mod/voicetools/getXmlChoicePage.php 2008-02-14 23:21:43 UTC (rev 242)
+++ branches/team/Thomas/moodle/mod/voicetools/getXmlChoicePage.php 2008-02-14 23:22:21 UTC (rev 243)
@@ -28,95 +28,112 @@
******************************************************************************/
/* $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');
- }
+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');
+}
+
+set_error_handler("manage_error");
+
+foreach(getKeysOfGeneralParameters() as $param){
+ $value=optional_param($param["value"],$param["default_value"],$param["type"]);
+ if($value!=null)
+ {
+ $params[$param["value"]] = $value;
+ }
+}
+
+wimba_add_log(WIMBA_DEBUG,WV,"getXmlListPanel : parameters \n" . print_r($params,true));
+
+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."')");
- foreach(getKeysOfGeneralParameters() as $param){
- $value=optional_param($param["value"],$param["default_value"],$param["type"]);
- if($value!=null)
- {
- $params[$param["value"]] = $value;
- }
- }
+
+ $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."')");
- require_login($params["enc_course_id"]);
- $createWorkflow = optional_param('createWorkflow', false, PARAM_BOOL); // course
- $xml=new WimbaXml();
- $session=new WimbaMoodleSession($params);
+ $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
- 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."')");
-
+ /***************
+ VALIDATION BAR
+ ****************/
+ $actionParameters = array("value"=>get_string('cancel', 'voicetools'),
+ "style"=>"action",
+ "action"=>"launchAjaxRequest");
- $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'));
+ 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
+ wimba_add_log(WIMBA_ERROR,WV,"getChoicePanel : ". get_string ($session->error, 'voicetools'));
+ $xml->setError(get_string ($session->error, 'voicetools'));
+}
+
+wimba_add_log(WIMBA_DEBUG,WV,"getChoicePanel : xml generated \n". $xml->getXml());
+
+if(isset($error_wimba))//error fatal was detected
+{
+ $uiManager->setError(get_string ('error_display', 'voicetools'));
+}
+else
+{
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-14 23:21:43 UTC (rev 242)
+++ branches/team/Thomas/moodle/mod/voicetools/getXmlListPanel.php 2008-02-14 23:22:21 UTC (rev 243)
@@ -46,6 +46,8 @@
require_once('lib/php/common/domxml-php4-php5.php');
}
+set_error_handler("manage_error");
+
$messageProduct=optional_param("messageProduct","");
$messageAction=optional_param("messageAction","");
@@ -58,24 +60,41 @@
require_login($params["enc_course_id"]);
$uiManager=new WimbaUI($params);
-if(isset($params["error"]) )
+wimba_add_log(WIMBA_DEBUG,WV,"getXmlListPanel : parameters \n" . print_r($params,true));
+
+if(isset($params["error"]))
{
+ wimba_add_log(WIMBA_ERROR,WV,"getXmlListPanel : ". get_string ($params["error"], 'voicetools'));
$uiManager->setError(get_string ($params["error"], 'voicetools'));
}
else
{
//Session Management
- if($uiManager->getSessionError()==false)//good
- {
- $message="";
- if(!empty($messageProduct) && !empty($messageAction))
- $message=get_string("message_".$messageProduct."_start", "voicetools")." ".get_string("message_".$messageAction."_end","voicetools");
- $uiManager->getVTPrincipalView($message);
- }
- else
- { //bad session
- $uiManager->setError(get_string ('error_'.$uiManager->getError(), 'voicetools'));
- }
+ if($uiManager->getSessionError()==false)//good
+ {
+ $message="";
+ if(!empty($messageProduct) && !empty($messageAction))
+ {
+ $message=get_string("message_".$messageProduct."_start", "voicetools")." ".
+ get_string("message_".$messageAction."_end","voicetools");
+ }
+ $uiManager->getVTPrincipalView($message);
+ }
+ else
+ { //bad session
+ wimba_add_log(WIMBA_ERROR,WV,"getXmlListPanel : ". get_string ('error_'.$uiManager->getError(), 'voicetools'));
+ $uiManager->setError(get_string ('error_'.$uiManager->getError(), 'voicetools'));
+ }
}
-echo $uiManager->getXmlString();
+
+wimba_add_log(WIMBA_DEBUG,WV,"getXmlListPanel : xml generated \n". $uiManager->getXmlString());
+
+if(isset($error_wimba))//error fatal was detected
+{
+ $uiManager->setError(get_string ('error_display', 'voicetools'));
+}
+else
+{
+ echo $uiManager->getXmlString();
+}
?>
\ No newline at end of file
Modified: branches/team/Thomas/moodle/mod/voicetools/getXmlNewPanel.php
===================================================================
--- branches/team/Thomas/moodle/mod/voicetools/getXmlNewPanel.php 2008-02-14 23:21:43 UTC (rev 242)
+++ branches/team/Thomas/moodle/mod/voicetools/getXmlNewPanel.php 2008-02-14 23:22:21 UTC (rev 243)
@@ -31,73 +31,85 @@
/// 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');
+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');
+}
+
+set_error_handler("manage_error");
+
+$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;
}
+}
+wimba_add_log(WIMBA_DEBUG,WV,"getXmlListPanel : parameters \n" . print_r($params,true));
+require_login($params["enc_course_id"]);
+
+$uiManager=new WimbaUI($params);
+if($uiManager->getSessionError()==false)
+{
+ /*******************
+ GET URL INFORMATIONS
+ ********************/
+ $action = optional_param('action', ""); // Course Module ID, or
+ $typeProduct = $params['type'];
- $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)
+ if($action == 'update')
+ { //get the information of the resource
+ $currentBoard = voicetools_api_get_resource($params["resource_id"]);
+
+ if($currentBoard==null || $currentBoard->error==true)
{
- $params[$param["value"]] = $value;
+ wimba_add_log(WIMBA_ERROR,WV,"getXmlNewPanel : ". get_string('problem_vt','voicetools'));
+ $uiManager->setError(get_string('problem_vt','voicetools'));
}
- }
- require_login($params["enc_course_id"]);
- $uiManager=new WimbaUI($params);
-
- if($uiManager->getSessionError()==false)
- {
- /*******************
- 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
+ $currentBoardInformations=voicetools_get_voiceboard_Informations($params["resource_id"]);
+ // print_r($currentBoardInformations);
+ if($currentBoard->error==true)
{
- $uiManager->setCurrentProduct($typeProduct);
+ wimba_add_log(WIMBA_ERROR,WV,"getXmlNewPanel : ". get_string('problem_bd','voicetools'));
+ $uiManager->setError(get_string('problem_bd','voicetools'));
}
- $display= $uiManager->getVTSettingsView($action,$createWorkflow);
+ $uiManager->setCurrentProduct($typeProduct,$currentBoard,$currentBoardInformations);
}
else
{
- $uiManager->setError(get_string ($uiManager->getSessionError(), 'voicetools'));
+ $uiManager->setCurrentProduct($typeProduct);
}
+ $display= $uiManager->getVTSettingsView($action,$createWorkflow);
+
+}
+else
+{
+ wimba_add_log(WIMBA_ERROR,WV,"getXmlNewPanel : ". get_string ('error_'.$uiManager->getError(), 'voicetools'));
+ $uiManager->setError(get_string ('error_'.$uiManager->getSessionError(), 'voicetools'));
+}
+wimba_add_log(WIMBA_DEBUG,WV,"getXmlListPanel : parameters \n" . $uiManager->getXmlString());
+
+if(isset($error_wimba))//error fatal was detected
+{
+ $uiManager->setError(get_string ('error_display', 'voicetools'));
+}
+else
+{
echo $uiManager->getXmlString();
+}
?>
Modified: branches/team/Thomas/moodle/mod/voicetools/index.php
===================================================================
--- branches/team/Thomas/moodle/mod/voicetools/index.php 2008-02-14 23:21:43 UTC (rev 242)
+++ branches/team/Thomas/moodle/mod/voicetools/index.php 2008-02-14 23:22:21 UTC (rev 243)
@@ -35,21 +35,21 @@
require_once("lib/php/common/WimbaLib.php");
$course_id = optional_param('id', 0, PARAM_INT); // course
-$createWorkflow = optional_param('createWorkflow', "false", PARAM_ALPHA); // course
+$createWorkflow = optional_param('createWorkflow', false, PARAM_BOOL); // course
-if (! $course = get_record("course", "id", $course_id)) {
- error("Course ID is incorrect");
+if (! $course = get_record("course", "id", $course_id))
+{
+ error("Course ID is incorrect");
}
require_login($course->id);
-add_to_log($course->id, "voicetool", "view all", "index.php?id=$course->id", "");
-
$strvoicetools = get_string("modulenameplural", "voicetools");
$strvoicetool = get_string("modulename", "voicetools");
$navigation = array();
-if ($course->id != SITEID) {
+if ($course->id != SITEID)
+{
$navigation[$course->shortname] = "$CFG->wwwroot/course/view.php?id=$course->id";
}
$navigation[$strvoicetools] = "";
@@ -70,7 +70,10 @@
$url_params = get_url_params($course->id);
//create the url which all the parameters needed
-$url="welcome.php?id=".$course->id."&".$url_params."&time=".time()."&createWorkflow=".$createWorkflow;
+$url="welcome.php?id=".$course->id.
+ "&".$url_params.
+ "&time=".time().
+ "&createWorkflow=".$createWorkflow;
?>
<br>
Modified: branches/team/Thomas/moodle/mod/voicetools/lang/en/voicetools.php
===================================================================
--- branches/team/Thomas/moodle/mod/voicetools/lang/en/voicetools.php 2008-02-14 23:21:43 UTC (rev 242)
+++ branches/team/Thomas/moodle/mod/voicetools/lang/en/voicetools.php 2008-02-14 23:22:21 UTC (rev 243)
@@ -54,6 +54,9 @@
$string['Invalid account/secret'] = 'The account/password you entered is not acknowledged by the server. Please, click Continue and verify the values you entered match with the values in the Voice Tools Server.';
$string['integrationversion'] = 'Integration Version';
$string['vtversion'] = 'Voice Tools Version';
+$string['loglevel'] = 'Set Log Level:';
+$string['viewlogs'] = 'View Logs...';
+
$string["launch_calendar"]="Launch the Voice ";
$string["voicetoolstype"]="Associated Voice Tool:";
$string["activity_name"]="Activity Name:";
Modified: branches/team/Thomas/moodle/mod/voicetools/lang/en_utf8/voicetools.php
===================================================================
--- branches/team/Thomas/moodle/mod/voicetools/lang/en_utf8/voicetools.php 2008-02-14 23:21:43 UTC (rev 242)
+++ branches/team/Thomas/moodle/mod/voicetools/lang/en_utf8/voicetools.php 2008-02-14 23:22:21 UTC (rev 243)
@@ -54,6 +54,9 @@
$string['Invalid account/secret'] = 'The account/password you entered is not acknowledged by the server. Please, click Continue and verify the values you entered match with the values in the Voice Tools Server.';
$string['integrationversion'] = 'Integration Version';
$string['vtversion'] = 'Voice Tools Version';
+$string['loglevel'] = 'Set Log Level:';
+$string['viewlogs'] = 'View Logs...';
+
$string["launch_calendar"]="Launch the Voice ";
$string["voicetoolstype"]="Associated Voice Tool:";
$string["activity_name"]="Activity Name:";
@@ -107,7 +110,7 @@
$string['private_comment']='Student cannot view other student\'s discussion threads';
$string['comment_slide']= "Student can comment the slides";
$string['private_slide']= "Make slide comments private";
- $string['private_slide_comment']= "Students cannot view other student's comments";
+$string['private_slide_comment']= "Students cannot view other student's comments";
$string['view_other_thread']="Student can view other student\'s discussion threads" ;
$string['post_delay']= "Podcast auto-published after : ";
@@ -156,10 +159,10 @@
$string['presentation'] = 'Voice Presentation - ';
$string['VoicePresentation'] = 'Voice Presentation';
$string['voicepresentations'] = 'Voice Presentations';
- $string['podcaster'] = 'Wimba Podcaster';
- $string['Podcaster'] = 'Wimba Podcaster';
- $string['podcasters'] = 'Podcasters';
- $string['pc'] = 'Podcaster - ';
+$string['podcaster'] = 'Wimba Podcaster';
+$string['Podcaster'] = 'Wimba Podcaster';
+$string['podcasters'] = 'Podcasters';
+$string['pc'] = 'Podcaster - ';
$string['settings']="Settings";
$string['archivesession'] = 'Archive Sessions';
$string['new']="New";
@@ -423,7 +426,6 @@
$string['tooltipVT_1_student'] = "Available to students";
$string['configuration_test_vt_failed_sentence_start1'] = "The test of your Voice Tools server configuration settings was unsuccessful.";
$string['configuration_test_vt_successful_sentence'] = "The test of your Voice Tools server configuration settings was successful.
-
The configuration settings have been saved.";
$string['configuration_test_vtfailedAccount'] = "Please check the account name and the password s and retry.";
$string['configuration_test_vtfailedConnection'] = "Please check the Voice Tools Server Url parameters and retry.";
Modified: branches/team/Thomas/moodle/mod/voicetools/lang/fr/voicetools.php
===================================================================
--- branches/team/Thomas/moodle/mod/voicetools/lang/fr/voicetools.php 2008-02-14 23:21:43 UTC (rev 242)
+++ branches/team/Thomas/moodle/mod/voicetools/lang/fr/voicetools.php 2008-02-14 23:22:21 UTC (rev 243)
@@ -43,6 +43,9 @@
$string['integrationversion'] = 'Version du module d\'Integration';
$string['emptyAdminUsername'] = 'Nom d\'Utilisateur Administrateur vide';
$string['emptyAdminPassword'] = 'Mot de Passe Administrateur vide';
+$string['loglevel'] = 'Choisissez de niveau de Log:';
+$string['viewlogs'] = 'Voir les Logs...';
+
$string['unlimited'] = 'Unlimited';
$string['wrongconfigurationURLunavailable'] = 'Configuration incorrecte, l\'URL n\'est pas disponible. Plus d\'information est disponible dans les journaux d\'erreurs';
$string['wrongconfigurationURLincorrect'] = 'Configuration incorrecte, l\'URL est incorrecte. Plus d\'information est disponible dans les journaux d\'erreurs';
Modified: branches/team/Thomas/moodle/mod/voicetools/lang/fr_utf8/voicetools.php
===================================================================
--- branches/team/Thomas/moodle/mod/voicetools/lang/fr_utf8/voicetools.php 2008-02-14 23:21:43 UTC (rev 242)
+++ branches/team/Thomas/moodle/mod/voicetools/lang/fr_utf8/voicetools.php 2008-02-14 23:22:21 UTC (rev 243)
@@ -43,6 +43,9 @@
$string['integrationversion'] = 'Version du module d\'Integration';
$string['emptyAdminUsername'] = 'Nom d\'Utilisateur Administrateur vide';
$string['emptyAdminPassword'] = 'Mot de Passe Administrateur vide';
+$string['loglevel'] = 'Choisissez de niveau de Log:';
+$string['viewlogs'] = 'Voir les Logs...';
+
$string['unlimited'] = 'Unlimited';
$string['wrongconfigurationURLunavailable'] = 'Configuration incorrecte, l\'URL n\'est pas disponible. Plus d\'information est disponible dans les journaux d\'erreurs';
$string['wrongconfigurationURLincorrect'] = 'Configuration incorrecte, l\'URL est incorrecte. Plus d\'information est disponible dans les journaux d\'erreurs';
Modified: branches/team/Thomas/moodle/mod/voicetools/lib.php
===================================================================
--- branches/team/Thomas/moodle/mod/voicetools/lib.php 2008-02-14 23:21:43 UTC (rev 242)
+++ branches/team/Thomas/moodle/mod/voicetools/lib.php 2008-02-14 23:22:21 UTC (rev 243)
@@ -28,14 +28,20 @@
/* $Id: lib.php 56815 2007-12-04 15:08:45Z thomasr $ */
/// Library of functions and constants for module voicetools
+if (!function_exists('getKeysOfGeneralParameters')) {
+ require_once('lib/php/common/WimbaLib.php');
+}
require_once($CFG->libdir.'/datalib.php');
require_once($CFG->dirroot.'/course/lib.php');
require_once('lib/php/vt/WimbaVoicetoolsAPI.php');
-require_once('lib/php/common/WimbaCommons.php');
+
+
+
define("VOICETOOLS_MODULE_VERSION", "3.1.2");
-$VOICETOOLS_LOGS = "logs.php"; //file use to the logs
+define("WV", "voicetools");
+
/**
* Validate the data in passed in the configuration page
* @param $config - the information from the form mod.html
@@ -53,27 +59,32 @@
if(empty($config->servername))
{
+ wimba_add_log(WIMBA_ERROR,WV,get_string('wrongconfigurationURLunavailable', 'voicetools'));
error(get_string('wrongconfigurationURLunavailable', 'voicetools'), $_SERVER["HTTP_REFERER"]);
}
if(empty($config->adminusername))
{
- error(get_string('emptyAdminUsername', 'voicetools'), $_SERVER["HTTP_REFERER"]);
+ wimba_add_log(WIMBA_ERROR,WV,get_string('emptyAdminUsername', 'voicetools'));
+ error(get_string('emptyAdminUsername', 'voicetools'), $_SERVER["HTTP_REFERER"]);
}
if(empty($config->adminpassword))
{
- error(get_string('emptyAdminPassword', 'voicetools'), $_SERVER["HTTP_REFERER"]);
+ wimba_add_log(WIMBA_ERROR,WV,get_string('emptyAdminPassword', 'voicetools'));
+ error(get_string('emptyAdminPassword', 'voicetools'), $_SERVER["HTTP_REFERER"]);
}
if ($config->servername{strlen($config->servername)-1} == '/')
{
- error(get_String('trailingSlash', 'voicetools'), $_SERVER["HTTP_REFERER"]);
+ wimba_add_log(WIMBA_ERROR,WV,get_String('trailingSlash', 'voicetools'));
+ error(get_String('trailingSlash', 'voicetools'), $_SERVER["HTTP_REFERER"]);
}
-
+
if (!preg_match('/^http:\/\//', $config->servername) && !preg_match('/^https:\/\//', $config->servername))
{
- error(get_String('trailingHttp', 'voicetools'), $_SERVER["HTTP_REFERER"]);
+ wimba_add_log(WIMBA_ERROR,WV,get_String('trailingHttp', 'voicetools'));
+ error(get_String('trailingHttp', 'voicetools'), $_SERVER["HTTP_REFERER"]);
}
//check if the api account filled is correct and allowed
@@ -83,12 +94,18 @@
{
if(get_string($result, 'voicetools' ) == "[[]]")
{//the error description is not in the bundle
+ wimba_add_log(WIMBA_ERROR,WV,$result);
error($result, 'javascript:history.back();');
}
else{
+ wimba_add_log(WIMBA_ERROR,WV,get_String($result, 'voicetools'));
error(get_string($result, 'voicetools' ), 'javascript:history.back();');
}
}
+ //to make sure that all the necessary module are installed
+ wimba_add_log(WIMBA_INFO,WV,"php info :\n" .print_r(get_loaded_extensions(),true));
+
+ wimba_add_log(WIMBA_INFO,WV,"The module is well configured");
}
function voicetools_add_instance($voicetool) {
@@ -97,6 +114,8 @@
/// will create a new instance and return the id number
/// of the new instance.
global $USER;
+ print_r($voicetool);
+
//get the resource information(type and id)
list($rid, $type) = explode(";", $voicetool->resource);
@@ -104,7 +123,9 @@
$voicetool->rid=$rid;
$voicetool->name=get_string("$type","voicetools").$voicetool->name;
- if (!$voicetool->id = insert_record('voicetools', $voicetool)) {
+ if (!$voicetool->id = insert_record('voicetools', $voicetool))
+ {
+ wimba_add_log(WIMBA_ERROR,WV,"Problem to add a new instance");
return false;
}
@@ -112,7 +133,10 @@
{
voicetools_addCalendarEvent($voicetool);
}
-
+
+ wimba_add_log(WIMBA_INFO,WV,"Add Instance".$voicetool->id);
+ //for the debug
+ wimba_add_log(WIMBA_DEBUG,WV,print_r($voicetool, true ));
return $voicetool->id;
}
@@ -120,166 +144,177 @@
/// Given an object containing all the necessary data,
/// (defined by the form in mod.html) this function
/// will update an existing instance with new data.
- global $USER;
+ global $USER;
+
+ //get the course_module instance linked to the liveclassroom instance
+ if (! $cm = get_coursemodule_from_instance("voicetools", $voicetool->instance, $voicetool->course))
+ {
+ wimba_add_log(WIMBA_ERROR,WV,"Problem to update the instance : ".$voicetool->instance);
+ 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))
+ {
+ return false;
+ }
+ //delete in the course section
+ if (! delete_mod_from_section($cm->id, $cm->section))
+ {
+ return false;
+ }
+
+ //update the course module section
+ if (! $sectionid = add_mod_to_section($voicetool) )
+ {
+ wimba_add_log(WIMBA_ERROR,WV,"Problem to update the instance : ".$voicetool->instance);
+ 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))
+ {
+ wimba_add_log(WIMBA_ERROR,WV,"Problem to update the instance : ".$voicetool->instance);
+ error("Could not update the course module with the correct section");
+ }
+ }
- //get the course_module instance linked to the liveclassroom instance
- 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))
- {
- return false;
- }
- //delete in the course section
- if (! delete_mod_from_section($cm->id, $cm->section))
- {
- return false;
- }
-
- //update the course module section
- 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))
- {
- error("Could not update the course module with the correct section");
- }
- }
-
- list($rid, $type) = explode(";", $voicetool->resource);
- $voicetool->timemodified = time();
- $voicetool->id = $voicetool->instance;
- $voicetool->rid=$rid;
- $voicetool->name=get_string("$type","voicetools").$voicetool->name;
-
- if (!$voicetool->id = update_record('voicetools', $voicetool))
- {
+ list($rid, $type) = explode(";", $voicetool->resource);
+ $voicetool->timemodified = time();
+ $voicetool->id = $voicetool->instance;
+ $voicetool->rid=$rid;
+ $voicetool->name=get_string("$type","voicetools").$voicetool->name;
+
+ if (!$voicetool->id = update_record('voicetools', $voicetool))
+ {
return false;
- }
-
- if(isset($voicetool->calendar_event) && $voicetool->calendar_event==true)
- {//no problem
- voicetools_addCalendarEvent($voicetool,$voicetool->id );
- }
- else
- {
- voicetools_deleteCalendarEvent($voicetool->id );
- }
-
- return $voicetool->id ;
+ }
+
+ if(isset($voicetool->calendar_event) && $voicetool->calendar_event==true)
+ {//no problem
+ voicetools_addCalendarEvent($voicetool,$voicetool->id );
+ }
+ else
+ {
+ voicetools_deleteCalendarEvent($voicetool->id );
+ }
+
+ wimba_add_log(WIMBA_INFO,WV,"Update of the instance : ".$voicetool->id);
+ return $voicetool->id ;
}
function voicetools_delete_instance($id) {
- /// Given an ID of an instance of this module,
- /// this function will permanently delete the instance
- /// and any data that depends on it.
- $result = true;
- if (! $voicetool = get_record("voicetools", "id", "$id"))
- {
- return false;
- }
- # Delete any dependent records here #
- 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;
- }
-
- voicetools_deleteCalendarEvent("$voicetool->id");
- // delete the related calendar event
+ /// Given an ID of an instance of this module,
+ /// this function will permanently delete the instance
+ /// and any data that depends on it.
+ $result = true;
+ if (! $voicetool = get_record("voicetools", "id", $id))
+ {
+ return false;
+ }
+ # Delete any dependent records here #
+ if (! $instanceNumber=delete_records("voicetools", "id", $voicetool->id))
+ {
+ wimba_add_log(WIMBA_ERROR,WV,"Problem to delete the instance : ".$voicetool->id);
+ $result = false;
+ }
+
+ voicetools_deleteCalendarEvent($voicetool->id);
+ // delete the related calendar event
- return $result;
+ return $result;
}
function voicetools_addCalendarEvent($activity_informations){
- global $CFG;
-
- //get some complementary of the resource
- $resource=get_record('voicetools_resources','rid',$activity_informations->rid);
-
- $event = new Object();
- $event->name = $activity_informations->name;
- $event->description = $activity_informations->description."<br><a href=".$CFG->wwwroot."/mod/voicetools/view.php?id=".$activity_informations->id."&action=launchCalendar target=_self >".get_string("launch_calendar","voicetools").$resource->type." ...</a>";
- $event->format = 1;
- $event->userid = 0;
- $event->courseid = $activity_informations->course; //course event
- $event->groupid = 0;
- $event->modulename = 'voicetools';
- $event->instance = $activity_informations->id;
- $event->eventtype = '';
- $event->visible = 1;
- $event->timemodified = time();
-
- if($activity_informations->course_format !="weeks" && $activity_informations->course_format !="weekscss")
- {//tppics or social
- $event->timestart = mktime($activity_informations->start_hr,$activity_informations->start_min,0,$activity_informations->start_month,$activity_informations->start_day,$activity_informations->start_year);
- if( $event->timestart < time())
- {
- error(get_string("date_error","voicetools"),$_SERVER["HTTP_REFERER"]);
- }
- }
- else
- {
- $event->timestart = mktime($activity_informations->start_hr,$activity_informations->start_min,0,date('m',$activity_informations->calendar_start),date('d',$activity_informations->calendar_start),date('Y',$activity_informations->calendar_start));
- }
-
- $duration = $informations->duration_hr*3600 + $informations->duration_min*60;
- if ($duration < 0)
- {
- $event->timeduration = 0;
- }
- else
- {
- $event->timeduration = $duration;
- }
-
- if(!$oldEvent=get_record('event','instance',$activity_informations->id)) //old event exsit
- {
- $event->id = $oldEvent->id ;
- $result=update_record('event', $event);
- }
- else
- {
- $result = insert_record('event', $event);
- }
- return $result;
+ global $CFG;
+ //get some complementary of the resource
+ $resource=get_record('voicetools_resources','rid',$activity_informations->rid);
+
+ $event = new Object();
+ $event->name = $activity_informations->name;
+ $event->description = $activity_informations->description."<br><a href=".$CFG->wwwroot."/mod/voicetools/view.php?id=".$activity_informations->id."&action=launchCalendar target=_self >".get_string("launch_calendar","voicetools").$resource->type." ...</a>";
+ $event->format = 1;
+ $event->userid = 0;
+ $event->courseid = $activity_informations->course; //course event
+ $event->groupid = 0;
+ $event->modulename = 'voicetools';
+ $event->instance = $activity_informations->id;
+ $event->eventtype = '';
+ $event->visible = 1;
+ $event->timemodified = time();
+
+ if($activity_informations->course_format !="weeks" && $activity_informations->course_format !="weekscss")
+ {//tppics or social
+ $event->timestart = mktime($activity_informations->start_hr,$activity_informations->start_min,0,$activity_informations->start_month,$activity_informations->start_day,$activity_informations->start_year);
+ if( $event->timestart < time())
+ {
+ error(get_string("date_error","voicetools"),$_SERVER["HTTP_REFERER"]);
+ }
+ }
+ else
+ {
+ $event->timestart = mktime($activity_informations->start_hr,$activity_informations->start_min,0,date('m',$activity_informations->calendar_start),date('d',$activity_informations->calendar_start),date('Y',$activity_informations->calendar_start));
+ }
+
+ $duration = $activity_informations->duration_hr*3600 + $activity_informations->duration_min*60;
+ if ($duration < 0)
+ {
+ $event->timeduration = 0;
+ }
+ else
+ {
+ $event->timeduration = $duration;
+ }
+
+ wimba_add_log(WIMBA_DEBUG,WV,"Add calendar event\n".print_r($event, true ));
+
+ $oldEvent=get_record('event','instance',$activity_informations->id);
+ if(!empty($oldEvent) && $oldEvent!=false) //old event exsit
+ {
+ $event->id = $oldEvent->id ;
+ $result=update_record('event', $event);
+ }
+ else
+ {
+ $result = insert_record('event', $event);
+ }
+
+ return $result;
}
function voicetools_deleteCalendarEvent($instanceNumber){
/// Basic event record for the database.
- global $CFG;
-
- if(!$event=get_record('event','instance',$instanceNumber)){
- return false;
- }
- $result=delete_records("event", "id", $event->id);
+ global $CFG;
+
+ if(!$event=get_record('event','instance',$instanceNumber))
+ {
+ wimba_add_log(WIMBA_ERROR,WV,"Problem to delete calendar event : ".$instanceNumber);
+ return false;
+ }
+ $result=delete_records("event", "id", $event->id);
}
function voicetools_delete_resource($rid) {
- /// Given an ID of an instance of this module,
- /// this function will permanently delete the instance
- /// and any data that depends on it.
-
- if (! $voicetool = get_record("voicetools_resources", "rid", $rid)) {
- return false;
- }
- # Delete any dependent records here #
- if (! delete_records("voicetools_resources", "id", "$voicetool->id")) {
- return false;
- }
+ /// Given an ID of an instance of this module,
+ /// this function will permanently delete the instance
+ /// and any data that depends on it.
+
+ if (! $voicetool = get_record("voicetools_resources", "rid", $rid)) {
+ wimba_add_log(WIMBA_ERROR,WV,"Problem to delete a resource : ".$rid);
+ return false;
+ }
+ # Delete any dependent records here #
+ if (! delete_records("voicetools_resources", "id", "$voicetool->id")) {
+ wimba_add_log(WIMBA_ERROR,WV,"Problem to delete a resource : ".$rid);
+ return false;
+ }
- return true;
+ return true;
}
function voicetools_user_outline($course, $user, $mod, $voicetool) {
@@ -288,8 +323,7 @@
/// Used for user activity reports.
/// $return->time = the time they did it
/// $return->info = a short text description
-
- return $return;
+ return $return;
}
function voicetools_user_complete($course, $user, $mod, $voicetool) {
@@ -395,37 +429,41 @@
/// and any data that depends on it.
//delete the resource of the vt list
- voicetools_delete_resource($id);
+
$result = true;
-
- if ($voicetools = get_records("voicetools", "rid", $id)) {
-
+ wimba_add_log(WIMBA_INFO,WV,"Delete the resouce ". $id);
+ if ($voicetools = get_records("voicetools", "rid", $id))
+ {
# Delete any dependent records here #
- foreach($voicetools as $voicetool){
+ foreach($voicetools as $voicetool){
//get the course_module instance linked to the liveclassroom instance
- if(! $cm = get_coursemodule_from_instance("voicetools", $voicetool->id, $voicetool->course)) {
- error("Course Module ID was incorrect");
+ $cm=get_coursemodule_from_instance("voicetools", $voicetool->id, $voicetool->course);
+
+ if(!empty($cm)) //old event exsit
+ {
+ if (! delete_course_module($cm->id))
+ {
+ wimba_add_log(WIMBA_ERROR,WV,"Problem to delete the course module : ".$cm->id);
+ $result = false;
+ //Delete a course module and any associated data at the course level (events)
+ }
+ //delete the instance
+ if (! delete_records("voicetools", "id", $voicetool->id))
+ {
+ wimba_add_log(WIMBA_ERROR,WV,"Problem to delete all the activities associated to the voice tools");
+ $result = false;
+ }
+ //delete in the course section too
+ if (! delete_mod_from_section($cm->id, $cm->section))
+ {
+ wimba_add_log(WIMBA_ERROR,WV,"Could not delete the ".$cm->id." from that section : ".$cm->section);
+ $result = false;
+ }
+ voicetools_deleteCalendarEvent($voicetool->id);
}
-
- if (! delete_course_module($cm->id)) {
- add_to_log($voicetool->course, "voicetools", voicetools_send_logs("errorDeleteAllcm","rid=".$voicetool->id."&cm=".$cm->id), "Delete all activities", "Could not delete the ".$cm->id." (coursemodule)");
- $result = false;
- //Delete a course module and any associated data at the course level (events)
- // notify("Could not delete the $cm->id (coursemodule)");
- }
- //delete the instance
- if (! delete_records("voicetools", "id", $voicetool->id)) {
- add_to_log($liveclassrooms->course, "voicetools", voicetools_send_logs("errorDeleteAlldb","id=".$voicetool->id), "Delete all activities", "All activities associated to the vocie tools have not been deleted from the voice tools database");
- $result = false;
- }
- //delete in the course section too
- if (! delete_mod_from_section($cm->id, "$cm->section")) {
- add_to_log($voicetool->course, "voicetools", voicetools_send_logs("errorDeleteAllsection","rid=".$voicetool->id."&cm=".$cm->id."§ion=".$cm->section), "Delete all activities", "Could not delete the ".$cm->id." from that section");
- $result = false;
- }
}
}
-
+ voicetools_delete_resource($id);
return $result;
}
@@ -438,27 +476,31 @@
*/
function voicetools_get_voicetools_list($courseId) {
$tools_list = get_records('voicetools_resources','course',$courseId);
- $result= array();
- $result["rid"]= array();
- $result["info"]= array();
-
- if(empty($tools_list)){
- return null;
-
-
+ $result= array();
+ $result["rid"]= array();
+ $result["info"]= array();
+
+ if(empty($tools_list))
+ {
+ wimba_add_log(WIMBA_INFO,WV,"No resources have been created yet");
+ return null;
}
- else if($tools_list == false) {
- error( "Response get_board_list : query to database failed");
- return "error_moodleDatabase";
+ else if($tools_list == false)
+ {
+ wimba_add_log(WIMBA_ERROR,WV,"Problem to get the list of resources");
+ error( "Response get_board_list : query to database failed");
+ return "error_moodleDatabase";
}
$result = array();
foreach($tools_list as $tool) {
-
- if($tool->type!="recorder"){
- $result["rid"][]= $tool->rid;
- $result["info"][$tool->rid]= $tool;
- }
+ if($tool->type!="recorder")
+ {
+ $result["rid"][]= $tool->rid;
+ $result["info"][$tool->rid]= $tool;
+ }
}
+ wimba_add_log(WIMBA_DEBUG,WV,"list of resource :\n".print_r($result, true ));
+
return $result;
}
@@ -470,38 +512,47 @@
function voicetools_get_voicetool_informations($rid) {
$tool = get_record('voicetools_resources','rid',$rid);
-
+
if(empty($tool))
{
- return null;
+ wimba_add_log(WIMBA_INFO,WV,"No resources have been created yet");
+ return null;
}
else if($tool == false)
{
- error( "Response get_board_list : query to database failed");
- return "error_moodleDatabase";
+ wimba_add_log(WIMBA_ERROR,WV,"Problem to get the list of resources");
+ error( "Response get_board_list : query to database failed");
+ return "error_moodleDatabase";
}
-
+ wimba_add_log(WIMBA_DEBUG,WV,"list of resource :\n".print_r($tool, true ));
+
return $tool;
}
function vocietools_get_recorder_rid($courseId) {
- $tools_list = get_records('voicetools_resources','course',$courseId);
-
- if(empty($tools_list)){
- return NULL;
-
- }
- else if($tools_list == false) {
- error( "Response get_board_list : query to database failed");
- return "error_moodleDatabase";
- }
- $result = array();
- foreach($tools_list as $tool) {
- if($tool->type=="recorder")
- return $tool->rid;
-
- }
- return NULL;
+ $tools_list = get_records('voicetools_resources','course',$courseId);
+
+ if(empty($tools_list))
+ {
+ wimba_add_log(WIMBA_INFO,WV,"No resources have been created yet");
+ return NULL;
+ }
+ else if($tools_list == false)
+ {
+ wimba_add_log(WIMBA_ERROR,WV,"Problem to get the list of resources");
+ error( "Response get_board_list : query to database failed");
+ return "error_moodleDatabase";
+ }
+
+ $result = array();
+ foreach($tools_list as $tool) {
+ if($tool->type=="recorder")
+ {
+ wimba_add_log(WIMBA_DEBUG,WV,$tool->rid ." : rid of the recorder for the course ".$courseId);
+ return $tool->rid;
+ }
+ }
+ return NULL;
}
@@ -512,13 +563,12 @@
*/
function voicetools_get_voiceboard_Informations($rid) {
+ if(!($board_informations = get_record('voicetools_resources','rid',$rid)))
+ {
+ error( "Response get_board_list : query to database failed");
+ return "error_moodleDatabase";
+ }
- if(!($board_informations = get_record('voicetools_resources','rid',$rid))) {
- error( "Response get_board_list : query to database failed");
- return "error_moodleDatabase";
- }
-
-
return $board_informations;
}
@@ -532,7 +582,6 @@
*/
function voicetools_get_event_calendar($id) {
-
$event = get_record('event','instance',$id);
if($event==false || empty($event)) {
@@ -543,74 +592,62 @@
function voicetools_update_recorder_informations($blockId,$comment,$title) {
- $oldRecorder = get_record('voicetools_recorder','bid',$blockId);
- if($oldRecorder==false){
-
- return false;
- }else if(empty($oldRecorder)) { //no data saved before
+ $oldRecorder = get_record('voicetools_recorder','bid',$blockId);
+ if($oldRecorder==false)
+ {
+ wimba_add_log(WIMBA_ERROR,WV,"Problem to get the recorder information");
+ return false;
+ }
+ else if(empty($oldRecorder))
+ { //no data saved before
+ $recorder->bid=$blockId;
+ $recorder->comment= $comment;
+ $recorder->title=$title;
+ $id=insert_record("voicetools_recorder", $recorder);
+ }
+ else
+ {
+ $oldRecorder->title = $title;
+ $oldRecorder->comment = $comment;
+ $id=update_record("voicetools_recorder", $oldRecorder);
+ }
+ return $id;
+}
- $recorder->bid=$blockId;
- $recorder->comment= $comment;
- $recorder->title=$title;
-
- $id=insert_record("voicetools_recorder", $recorder);
-
- }else{
- $oldRecorder->title = $title;
- $oldRecorder->comment = $comment;
- $id=update_record("voicetools_recorder", $oldRecorder);
- }
- return $id;
-}
function voicetools_get_recorder_informations($blockId) {
- $recorder = get_record('voicetools_recorder','bid',$blockId);
- if($recorder==false || empty($recorder)) {
-
- $recorder->bid=$blockId;
- $recorder->comment= "Description";
- $recorder->title="Announcement";
-
- $id=insert_record("voicetools_recorder", $recorder);
-
- }
- $recorder = get_record('voicetools_recorder','bid',$blockId);
- if($recorder==false || empty($recorder)) {
-
- return false;
+ $recorder = get_record('voicetools_recorder','bid',$blockId);
+ if($recorder==false || empty($recorder))
+ {
+ $recorder->bid=$blockId;
+ $recorder->comment= "Description";
+ $recorder->title="Announcement";
+ $id=insert_record("voicetools_recorder", $recorder);
+ }
+
+ $recorder = get_record('voicetools_recorder','bid',$blockId);
+ if($recorder==false || empty($recorder))
+ {
+ return false;
}
- return $recorder;
+ wimba_add_log(WIMBA_DEBUG,WV,"Recorder informations : \n".print_r($recorder, true ));
+ return $recorder;
}
function voicetools_get_version() {
- $answer = voicetools_api_get_version();
-
- if (!strcmp($answer, "error")) {
- return get_string('voicetools', "error");
- }
- elseif (!strcmp($answer, 'unknown')) {
- return get_string('voicetools', 'unknown');
- }
-
- return $answer;
+ $answer = voicetools_api_get_version();
+
+ if (!strcmp($answer, "error"))
+ {
+ return get_string('voicetools', "error");
+ }
+ elseif (!strcmp($answer, 'unknown'))
+ {
+ return get_string('voicetools', 'unknown');
+ }
+
+ return $answer;
}
-/*
-* Send info to the logs system
-* @param $type : type of the log
-* @param $parameters : string with the parameters needed
-* return a string which is the link to the logs file
-*/
-function voicetools_send_logs($type,$parameters) {
-
- global $VOICETOOLS_LOGS;
-
-
- $link = $VOICETOOLS_LOGS."?type=$type";
- $link .= "&$parameters";
- $link .= "&time=".time();
-
- return $link;
-}
?>
Modified: branches/team/Thomas/moodle/mod/voicetools/manageAction.php
===================================================================
--- branches/team/Thomas/moodle/mod/voicetools/manageAction.php 2008-02-14 23:21:43 UTC (rev 242)
+++ branches/team/Thomas/moodle/mod/voicetools/manageAction.php 2008-02-14 23:22:21 UTC (rev 243)
@@ -42,14 +42,15 @@
$messageAction=optional_param("messageAction","");
$notool=optional_param("novoicetools","false");
$createWorkflow = optional_param("createWorkflow", false, PARAM_BOOL); // course
-
+
$keys=array_merge(getKeysOfGeneralParameters(),getKeyWimbaVoiceForm());
foreach($keys as $param){
$value=optional_param($param["value"],$param["default_value"],$param["type"]);
if($value!=null)
$params[$param["value"]] = $value;
-}
+}
+wimba_add_log(WIMBA_DEBUG,WV,"manageAction : parameters \n" . print_r($params,true));
require_login($params["enc_course_id"]);
$vtAction = new vtAction($params);
@@ -64,15 +65,19 @@
$messageType = "";
if ($session->error == false && $session != NULL ) {
- if ($params['action'] == 'launch') {
+ if ($params['action'] == 'launch')
+ {
$session->setCurrentVtUSer($params["type"]);
- if ($params["studentView"] == "true") {
+
+ if ($params["studentView"] == "true")
+ {
$session->setVtUserRigths($params["type"], "student");
}
$resource = voicetools_api_get_resource($params["resource_id"]);
$result = $vtAction->getVtSession($resource, $session->getVtUser(), $session->getVtUserRigths());
if ($result != NULL)
{
+ wimba_add_log(WIMBA_DEBUG,WV,"launch the ". $params["type"] . ", nid =" .$result->getNid());
redirection($CFG->voicetools_servername . '/' . $params["type"] . '?action=display_popup&nid=' . $result->getNid());
}
else
@@ -100,23 +105,20 @@
$messageAction = "created";
$messageProduct = "pc";
}
-
+
if ($result != NULL && $result->error != "error")
{
- $params["resource_id"] = storeResource($result->getRid(), $params);
-
- if (empty ($params["resource_id"]))
+ $resource_id = storeResource($result->getRid(), $session->getCourseId(), $params);
+
+ if (empty ($resource_id))
{
- error_log(__FUNCTION__ . " : Problem to add the new resource on the database", TRUE);
+ wimba_add_log(WIMBA_ERROR,WV,"manageAction : Problem to add the resource into the database");
redirection($redirectionUrl. '&error=problem_bd');
}
- if(VTAPI_DEBUG) {
- error_log(__FUNCTION__ . " : Board Created and added on the database, rid=" . $result->getRid(), TRUE);
- }
}
else
{
- error_log(__FUNCTION__ . " : Problem to add the new resource on the vt server", TRUE);
+ wimba_add_log(WIMBA_ERROR,WV,"manageAction :Problem ...
[truncated message content] |