[Hw4mdl-svn] SF.net SVN: hw4mdl: [15] trunk/moodle/mod
Brought to you by:
jhlinder,
trollinger
From: <hu...@us...> - 2006-05-12 09:28:28
|
Revision: 15 Author: hugues Date: 2006-05-12 02:27:58 -0700 (Fri, 12 May 2006) ViewCVS: http://svn.sourceforge.net/hw4mdl/?rev=15&view=rev Log Message: ----------- moed most of the voice direct into voicetool. Also improved the error cheking in the configuration page Modified Paths: -------------- trunk/moodle/lang/en/voicetool.php trunk/moodle/mod/voicetool/db/mysql.sql Added Paths: ----------- trunk/moodle/mod/voicetool/ trunk/moodle/mod/voicetool/README.txt trunk/moodle/mod/voicetool/config.html trunk/moodle/mod/voicetool/db/ trunk/moodle/mod/voicetool/icon.gif trunk/moodle/mod/voicetool/index.php trunk/moodle/mod/voicetool/lib.php trunk/moodle/mod/voicetool/mod.html trunk/moodle/mod/voicetool/version.php trunk/moodle/mod/voicetool/view.php trunk/moodle/mod/voicetool/voicetoolapi.php Removed Paths: ------------- trunk/moodle/lang/en/voiceboard.php trunk/moodle/lang/en/voicedirect.php trunk/moodle/mod/voicedirect/ trunk/moodle/mod/voicetool/README.txt trunk/moodle/mod/voicetool/config.html trunk/moodle/mod/voicetool/db/ trunk/moodle/mod/voicetool/icon.gif trunk/moodle/mod/voicetool/index.php trunk/moodle/mod/voicetool/lib.php trunk/moodle/mod/voicetool/mod.html trunk/moodle/mod/voicetool/version.php trunk/moodle/mod/voicetool/view.php trunk/moodle/mod/voicetoolapi.php Deleted: trunk/moodle/lang/en/voiceboard.php =================================================================== --- trunk/moodle/lang/en/voiceboard.php 2006-05-06 22:32:23 UTC (rev 14) +++ trunk/moodle/lang/en/voiceboard.php 2006-05-12 09:27:58 UTC (rev 15) @@ -1,16 +0,0 @@ -<?PHP - -$string['modulename'] = 'Voice Board'; -$string['modulenameplural'] = 'Voice Boards'; - - -$string['title'] = 'Title'; -$string['description'] = 'Description'; -$string['basicquality'] = 'Basic Quality (Telephone quality) - 8 kbit/s - Modem usage'; -$string['standardquality'] = 'Standard Quality - 12.8 kbit/s - Modem usage'; -$string['goodquality'] = 'Good Quality (FM Radio quality) - 20.8 kbit/s - Broadband usage'; -$string['audioquality'] = 'Audio Quality'; - - - -?> Deleted: trunk/moodle/lang/en/voicedirect.php =================================================================== --- trunk/moodle/lang/en/voicedirect.php 2006-05-06 22:32:23 UTC (rev 14) +++ trunk/moodle/lang/en/voicedirect.php 2006-05-12 09:27:58 UTC (rev 15) @@ -1,17 +0,0 @@ -<?PHP - -$string['modulename'] = 'Voice Direct'; -$string['modulenameplural'] = 'Voice Directs'; - - -$string['title'] = 'Title'; -$string['description'] = 'Description'; -$string['basicquality'] = 'Basic Quality (Telephone quality) - 8 kbit/s - Modem usage'; -$string['standardquality'] = 'Standard Quality - 12.8 kbit/s - Modem usage'; -$string['goodquality'] = 'Good Quality (FM Radio quality) - 20.8 kbit/s - Broadband usage'; -$string['audioquality'] = 'Audio Quality'; - -$string['archivesession'] = 'Archive Sessions'; - - -?> Modified: trunk/moodle/lang/en/voicetool.php =================================================================== --- trunk/moodle/lang/en/voicetool.php 2006-05-06 22:32:23 UTC (rev 14) +++ trunk/moodle/lang/en/voicetool.php 2006-05-12 09:27:58 UTC (rev 15) @@ -1,5 +1,10 @@ <?PHP +$string['modulename'] = 'Wimba Voice Tool'; +$string['modulenameplural'] = 'Wimba Voice Tools'; + + +// configuration stuff $string['serverconfiguration'] = 'Voice Tools Server Configuration'; $string['explainserverconfiguration'] = 'This is the Voice Tools Server Configuration.'; $string['servername'] = 'Voice Tools Server Name'; @@ -9,4 +14,24 @@ $string['adminpassword'] = 'Voice Tools Admin Password'; $string['configadminpassword'] = 'Enter the admin password'; $string['alert.submit'] = 'Are you sure these settings are correct?'; +$string['is_allowed.false'] = 'The configuration is not correct. The url of this server is not allowed in your Voice Tools Server. Please, click on Continue to go back to the configuration page.'; +$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.'; + + +// common VT items +$string['title'] = 'Title'; +$string['description'] = 'Description'; +$string['basicquality'] = 'Basic Quality (Telephone quality) - 8 kbit/s - Modem usage'; +$string['standardquality'] = 'Standard Quality - 12.8 kbit/s - Modem usage'; +$string['goodquality'] = 'Good Quality (FM Radio quality) - 20.8 kbit/s - Broadband usage'; +$string['audioquality'] = 'Audio Quality'; + + +// Voice Direct tags +$string['voicedirect'] = 'Voice Direct'; +$string['voicedirects'] = 'Voice Directs'; + +$string['archivesession'] = 'Archive Sessions'; + + ?> Copied: trunk/moodle/mod/voicetool (from rev 13, trunk/moodle/mod/voicedirect) Deleted: trunk/moodle/mod/voicetool/README.txt =================================================================== --- trunk/moodle/mod/voicedirect/README.txt 2006-05-05 08:13:48 UTC (rev 13) +++ trunk/moodle/mod/voicetool/README.txt 2006-05-12 09:27:58 UTC (rev 15) @@ -1,57 +0,0 @@ -USING THE NEW MODULE TEMPLATE ------------------------------ - -1. Unzip the archive and read this file ;-) - -2. Change the name of the directory to your new module name. - This name should be a single english word, if possible, - all lowercase and with only a-z characters. eg widget - -3. Edit all the files in this directory and change all the - instances of NEWMODULE to your new module name (eg widget). - -4. Edit db/mysql.sql and put in the SQL database definitions - for your module. The names of any table definitions you create - there should use the prefix 'prefix_' instead of 'mdl_' - (or whatever you've configured your moodle installation to use - as a table prefix) (optional) - -5. Edit db/mysql.php and change all the instances of NEWMODULE - to your new module name. (optional) - -6. Do the same for db/postgres7.sql and db/postgres7.php as you - did for db/mysql.sql and db/mysql.php (optional) - -7. Create one or more language files for your module in - lang/LANG/NEWMODULE.php where LANG is the language or - languages you are creating the module for use with. (usually - this will be 'en') Use one of the language files for another - module as a template for the file. - -8. Visit the admin page and your module should be noticed and - registered as a new entry in the table "modules". - -Now you can start adding code to the .php and .html files in -this directory to make it do what you want! - -Note about database changes: - - Every time you update the database schema in the db directory, - remember to - - - edit version.php with a higher version number - - edit db/mysql.php with an execute_sql() call that - upgrades the databases to the new format (see core - modules for examples) - - and then visit the admin page to actually upgrade your databases. - - -If you have problems, questions, suggestions etc then visit -the "Activity modules" developers forum in the online -course called "Using Moodle" at http:/* moodle.org */ - -Or email me: ma...@mo... - -Cheers! -Martin Dougiamas Copied: trunk/moodle/mod/voicetool/README.txt (from rev 14, trunk/moodle/mod/voicedirect/README.txt) =================================================================== --- trunk/moodle/mod/voicetool/README.txt (rev 0) +++ trunk/moodle/mod/voicetool/README.txt 2006-05-12 09:27:58 UTC (rev 15) @@ -0,0 +1,57 @@ +USING THE NEW MODULE TEMPLATE +----------------------------- + +1. Unzip the archive and read this file ;-) + +2. Change the name of the directory to your new module name. + This name should be a single english word, if possible, + all lowercase and with only a-z characters. eg widget + +3. Edit all the files in this directory and change all the + instances of NEWMODULE to your new module name (eg widget). + +4. Edit db/mysql.sql and put in the SQL database definitions + for your module. The names of any table definitions you create + there should use the prefix 'prefix_' instead of 'mdl_' + (or whatever you've configured your moodle installation to use + as a table prefix) (optional) + +5. Edit db/mysql.php and change all the instances of NEWMODULE + to your new module name. (optional) + +6. Do the same for db/postgres7.sql and db/postgres7.php as you + did for db/mysql.sql and db/mysql.php (optional) + +7. Create one or more language files for your module in + lang/LANG/NEWMODULE.php where LANG is the language or + languages you are creating the module for use with. (usually + this will be 'en') Use one of the language files for another + module as a template for the file. + +8. Visit the admin page and your module should be noticed and + registered as a new entry in the table "modules". + +Now you can start adding code to the .php and .html files in +this directory to make it do what you want! + +Note about database changes: + + Every time you update the database schema in the db directory, + remember to + + - edit version.php with a higher version number + - edit db/mysql.php with an execute_sql() call that + upgrades the databases to the new format (see core + modules for examples) + + and then visit the admin page to actually upgrade your databases. + + +If you have problems, questions, suggestions etc then visit +the "Activity modules" developers forum in the online +course called "Using Moodle" at http:/* moodle.org */ + +Or email me: ma...@mo... + +Cheers! +Martin Dougiamas Deleted: trunk/moodle/mod/voicetool/config.html =================================================================== --- trunk/moodle/mod/voicedirect/config.html 2006-05-05 08:13:48 UTC (rev 13) +++ trunk/moodle/mod/voicetool/config.html 2006-05-12 09:27:58 UTC (rev 15) @@ -1,55 +0,0 @@ -<form method="post" action="module.php" name="form"> -<input type="hidden" name="sesskey" value="<?php echo $USER->sesskey ?>"> - -<table cellpadding="9" cellspacing="0" > - -<tr> - <td colspan="3" align="center"> - <div><b><?php print_string('serverconfiguration', 'voicetool')?></b></div> - <div style="font-size: 0.8em;">(<?php print_string('explainserverconfiguration', 'voicetool')?>)</div> - </td> -</tr> - -<tr valign="top"> - <td align="right"><?php print_string('servername', 'voicetool')?>:</td> - <td> - <input name="voicetool_servername" type="text" size="30" value="<?php p($CFG->voicetool_servername) ?>" /> - </td> - <td> - <?php print_string("configservername", "voicetool") ?> - </td> -</tr> -<tr valign="top"> - <td align="right"><?php print_string('adminusername', 'voicetool')?>:</td> - <td> - <input name="voicetool_adminusername" type="text" size="20" value="<?php p($CFG->voicetool_adminusername) ?>" /> - </td> - <td> - <?php print_string("configadminusername", "voicetool") ?> - </td> -</tr> -<tr valign="top"> - <td align="right"><?php print_string('adminpassword', 'voicetool')?>:</td> - <td> - <input name="voicetool_adminpassword" type="text" size="20" value="<?php p($CFG->voicetool_adminpassword) ?>" /> - </td> - <td> - <?php print_string("configadminpassword", "voicetool") ?> - </td> -</tr> -<tr valign="top"> - <td align="right"><?php print_string('settinguniqueid', 'voicetool')?>:</td> - <td> - <input name="voicetool_settinguniqueid" type="text" size="20" value="<?php p($CFG->voicetool_settinguniqueid) ?>" /> - </td> - <td> - <?php print_string("configsettinguniqueid", "voicetool") ?> - </td> -</tr> -<tr> - <td colspan="3" align="center"> - <input type="submit" value="<?php print_string("savechanges") ?>" /></td> -</tr> -</table> - -</form> Copied: trunk/moodle/mod/voicetool/config.html (from rev 14, trunk/moodle/mod/voicedirect/config.html) =================================================================== --- trunk/moodle/mod/voicetool/config.html (rev 0) +++ trunk/moodle/mod/voicetool/config.html 2006-05-12 09:27:58 UTC (rev 15) @@ -0,0 +1,60 @@ +<?php +require_once ("$CFG->dirroot/lib/datalib.php"); + + +if (!$courses = get_records ('course', '', '', 'shortname ASC', 'id, shortname, fullname')) { + error('Cannot retreive Course list'); +} + + + +?> + + +<form method="post" action="module.php" name="form"> +<input type="hidden" name="sesskey" value="<?php echo $USER->sesskey ?>"> +<input type="hidden" name="module" value="voicetool"> + +<table cellpadding="9" cellspacing="0" > + +<tr> + <td colspan="3" align="center"> + <div><b><?php print_string('serverconfiguration', 'voicetool')?></b></div> + <div style="font-size: 0.8em;">(<?php print_string('explainserverconfiguration', 'voicetool')?>)</div> + </td> +</tr> + +<tr valign="top"> + <td align="right"><?php print_string('servername', 'voicetool')?>:</td> + <td> + <input name="servername" type="text" size="30" value="<?php p($CFG->voicetool_servername) ?>" /> + </td> + <td> + <?php print_string('configservername', 'voicetool') ?> + </td> +</tr> +<tr valign="top"> + <td align="right"><?php print_string('adminusername', 'voicetool')?>:</td> + <td> + <input name="adminusername" type="text" size="20" value="<?php p($CFG->voicetool_adminusername) ?>" /> + </td> + <td> + <?php print_string('configadminusername', 'voicetool') ?> + </td> +</tr> +<tr valign="top"> + <td align="right"><?php print_string('adminpassword', 'voicetool')?>:</td> + <td> + <input name="adminpassword" type="text" size="20" value="<?php p($CFG->voicetool_adminpassword) ?>" /> + </td> + <td> + <?php print_string('configadminpassword', 'voicetool') ?> + </td> +</tr> +<tr> + <td colspan="3" align="center"> + <input type="submit" value="<?php print_string('savechanges') ?>" /></td> +</tr> +</table> + +</form> Copied: trunk/moodle/mod/voicetool/db (from rev 14, trunk/moodle/mod/voicedirect/db) Modified: trunk/moodle/mod/voicetool/db/mysql.sql =================================================================== --- trunk/moodle/mod/voicedirect/db/mysql.sql 2006-05-06 22:32:23 UTC (rev 14) +++ trunk/moodle/mod/voicetool/db/mysql.sql 2006-05-12 09:27:58 UTC (rev 15) @@ -5,18 +5,25 @@ # that may be used, especially new entries in the table log_display -CREATE TABLE `prefix_voicedirect` ( +CREATE TABLE `prefix_voicetool` ( `id` int(10) unsigned NOT NULL auto_increment, `rid` varchar(160) NOT NULL default '', `course` int(10) unsigned NOT NULL default '0', `name` varchar(255) NOT NULL default '', `timemodified` int(10) unsigned NOT NULL default '0', + `type` varchar(15) NOT NULL default '', + PRIMARY KEY (`id`) +) COMMENT='Defines Voice Tool'; +# -------------------------------------------------------- + +CREATE TABLE `prefix_voicedirect`( + `rid` varchar(160) NOT NULL default '', `description` varchar(255) NOT NULL default '', `email` varchar(255) NOT NULL default '', `type` varchar(10) NOT NULL, `quality` varchar(20) NOT NULL default 'basicquality', `archive` varchar(20) NOT NULL default '', - PRIMARY KEY (`id`) + PRIMARY KEY (`rid`) ) COMMENT='Defines Voice Direct'; # -------------------------------------------------------- Deleted: trunk/moodle/mod/voicetool/icon.gif =================================================================== (Binary files differ) Copied: trunk/moodle/mod/voicetool/icon.gif (from rev 14, trunk/moodle/mod/voicedirect/icon.gif) =================================================================== (Binary files differ) Deleted: trunk/moodle/mod/voicetool/index.php =================================================================== --- trunk/moodle/mod/voicedirect/index.php 2006-05-05 08:13:48 UTC (rev 13) +++ trunk/moodle/mod/voicetool/index.php 2006-05-12 09:27:58 UTC (rev 15) @@ -1,83 +0,0 @@ -<?PHP // $Id:$ - -/// This page lists all the instances of voicedirects in a particular course -/// Replace voicedirect with the name of your module - - require_once("../../config.php"); - require_once("lib.php"); - - require_variable($id); // course - - if (! $course = get_record("course", "id", $id)) { - error("Course ID is incorrect"); - } - - require_login($course->id); - - add_to_log($course->id, "voicedirect", "view all", "index.php?id=$course->id", ""); - - -/// Get all required strings - - $strvoicedirects = get_string("modulenameplural", "voicedirect"); - $strvoicedirect = get_string("modulename", "voicedirect"); - - -/// Print the header - - if ($course->category) { - $navigation = "<A HREF=\"../../course/view.php?id=$course->id\">$course->shortname</A> ->"; - } - - print_header("$course->shortname: $strvoicedirects", "$course->fullname", "$navigation $strvoicedirects", "", "", true, "", navmenu($course)); - -/// Get all the appropriate data - - if (! $voicedirects = get_all_instances_in_course("voicedirect", $course)) { - notice("There are no voicedirects", "../../course/view.php?id=$course->id"); - die; - } - -/// Print the list of instances (your module will probably extend this) - - $timenow = time(); - $strname = get_string("name"); - $strweek = get_string("week"); - $strtopic = get_string("topic"); - - if ($course->format == "weeks") { - $table->head = array ($strweek, $strname); - $table->align = array ("CENTER", "LEFT"); - } else if ($course->format == "topics") { - $table->head = array ($strtopic, $strname); - $table->align = array ("CENTER", "LEFT", "LEFT", "LEFT"); - } else { - $table->head = array ($strname); - $table->align = array ("LEFT", "LEFT", "LEFT"); - } - - foreach ($voicedirects as $voicedirect) { - if (!$voicedirect->visible) { - //Show dimmed if the mod is hidden - $link = "<A class=\"dimmed\" HREF=\"view.php?id=$voicedirect->coursemodule\">$voicedirect->name</A>"; - } else { - //Show normal if the mod is visible - $link = "<A HREF=\"view.php?id=$voicedirect->coursemodule\">$voicedirect->name</A>"; - } - - if ($course->format == "weeks" or $course->format == "topics") { - $table->data[] = array ($voicedirect->section, $link); - } else { - $table->data[] = array ($link); - } - } - - echo "<BR>"; - - print_table($table); - -/// Finish the page - - print_footer($course); - -?> Copied: trunk/moodle/mod/voicetool/index.php (from rev 14, trunk/moodle/mod/voicedirect/index.php) =================================================================== --- trunk/moodle/mod/voicetool/index.php (rev 0) +++ trunk/moodle/mod/voicetool/index.php 2006-05-12 09:27:58 UTC (rev 15) @@ -0,0 +1,83 @@ +<?PHP // $Id:$ + +/// This page lists all the instances of voicedirects in a particular course +/// Replace voicedirect with the name of your module + + require_once("../../config.php"); + require_once("lib.php"); + + require_variable($id); // course + + if (! $course = get_record("course", "id", $id)) { + error("Course ID is incorrect"); + } + + require_login($course->id); + + add_to_log($course->id, "voicetool", "view all", "index.php?id=$course->id", ""); + + +/// Get all required strings + + $strvoicetools = get_string("modulenameplural", "voicetool"); + $strvoicetool = get_string("modulename", "voicetool"); + + +/// Print the header + + if ($course->category) { + $navigation = "<A HREF=\"../../course/view.php?id=$course->id\">$course->shortname</A> ->"; + } + + print_header("$course->shortname: $strvoicetoolss", "$course->fullname", "$navigation $strvoicetools", "", "", true, "", navmenu($course)); + +/// Get all the appropriate data + + if (! $voicetools = get_all_instances_in_course("voicedirect", $course)) { + notice("There are no voicetools", "../../course/view.php?id=$course->id"); + die; + } + +/// Print the list of instances (your module will probably extend this) + + $timenow = time(); + $strname = get_string("name"); + $strweek = get_string("week"); + $strtopic = get_string("topic"); + + if ($course->format == "weeks") { + $table->head = array ($strweek, $strname); + $table->align = array ("CENTER", "LEFT"); + } else if ($course->format == "topics") { + $table->head = array ($strtopic, $strname); + $table->align = array ("CENTER", "LEFT", "LEFT", "LEFT"); + } else { + $table->head = array ($strname); + $table->align = array ("LEFT", "LEFT", "LEFT"); + } + + foreach ($voicetools as $voicetool) { + if (!$voicetool->visible) { + //Show dimmed if the mod is hidden + $link = "<A class=\"dimmed\" HREF=\"view.php?id=$voicetool->coursemodule\">$voicetool->name</A>"; + } else { + //Show normal if the mod is visible + $link = "<A HREF=\"view.php?id=$voicetool->coursemodule\">$voicetool->name</A>"; + } + + if ($course->format == "weeks" or $course->format == "topics") { + $table->data[] = array ($voicedirect->section, $link); + } else { + $table->data[] = array ($link); + } + } + + echo "<BR>"; + + print_table($table); + +/// Finish the page + + print_footer($course); + +?> Deleted: trunk/moodle/mod/voicetool/lib.php =================================================================== --- trunk/moodle/mod/voicedirect/lib.php 2006-05-05 08:13:48 UTC (rev 13) +++ trunk/moodle/mod/voicetool/lib.php 2006-05-12 09:27:58 UTC (rev 15) @@ -1,255 +0,0 @@ -<?PHP // $Id:$ - -require_once ("$CFG->dirroot/mod/voicetoolapi.php"); - -/// Library of functions and constants for module voicedirect -/// (replace voicedirect with the name of your module and delete this line) - - -/** - * Validate the data in passed in the configuration page - * @param $config - the information from the form mod.html - */ -function voicedirect_process_options ($config) { - return true; -} - -function voicedirect_add_instance($voicedirect) { -/// Given an object containing all the necessary data, -/// (defined by the form in mod.html) this function -/// will create a new instance and return the id number -/// of the new instance. - global $USER; - - $voicedirect->email = $USER->email; // email of the creator - $voicedirect->timemodified = time(); - - - $data = voicedirect_create_rsc_data ($voicedirect); - - if (empty ($data)) { - error('Data not created correctly'); - } - - //print_r($data); - - if (!$result = voicetool_create_resource ($data)) { - error('Cannot create the resource on the VT server'); - } - - # May have to add extra stuff in here # - foreach ($result['values'] as $item) { - $values[$item['name']] = $item['value']; - } - - $rid = $values['rid']; - - $voicedirect->rid = $rid; - - return insert_record('voicedirect', $voicedirect); -} - - -function voicedirect_update_instance($voicedirect) { -/// 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; - - $voicedirect->timemodified = time(); - $voicedirect->id = $voicedirect->instance; - - $data = voicedirect_create_rsc_data ($voicedirect); - - if (empty ($data)) { - error('Data not created correctly'); - } - -///print_r($data); -///error (info); - - if (! $result = voicetool_modify_resource ($data)) { - error('Cannot modify the resource on the VT server'); - } - - # May have to add extra stuff in here # - -///print_r($voicedirect); - - return update_record('voicedirect', $voicedirect); -} - - -function voicedirect_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. - - if (! $voicedirect = get_record("voicedirect", "id", "$id")) { - return false; - } - - if (! ($result = voicetool_delete_resource ($voicedirect->rid))) { - error('Cannot modify the resource on the VT server'); - } - - $result = true; - # Delete any dependent records here # - if (! delete_records("voicedirect", "id", "$voicedirect->id")) { - $result = false; - } - - return $result; -} - -function voicedirect_user_outline($course, $user, $mod, $voicedirect) { -/// Return a small object with summary information about what a -/// user has done with a given particular instance of this module -/// Used for user activity reports. -/// $return->time = the time they did it -/// $return->info = a short text description - - return $return; -} - -function voicedirect_user_complete($course, $user, $mod, $voicedirect) { -/// Print a detailed representation of what a user has done with -/// a given particular instance of this module, for user activity reports. - - return true; -} - -function voicedirect_print_recent_activity($course, $isteacher, $timestart) { -/// Given a course and a time, this module should find recent activity -/// that has occurred in voicedirect activities and print it out. -/// Return true if there was output, or false is there was none. - - global $CFG; - - return false; // True if anything was printed, otherwise false -} - -function voicedirect_cron () { -/// Function to be run periodically according to the moodle cron -/// This function searches for things that need to be done, such -/// as sending out mail, toggling flags etc ... - - global $CFG; - - return true; -} - -function voicedirect_grades($voicedirectid) { -/// Must return an array of grades for a given instance of this module, -/// indexed by user. It also returns a maximum allowed grade. -/// -/// $return->grades = array of grades; -/// $return->maxgrade = maximum allowed grade; -/// -/// return $return; - - return NULL; -} - -function voicedirect_get_participants($voicedirectid) { -//Must return an array of user records (all data) who are participants -//for a given instance of voicedirect. Must include every user involved -//in the instance, independient of his role (student, teacher, admin...) -//See other modules as example. - - return false; -} - -function voicedirect_scale_used ($voicedirectid,$scaleid) { -//This function returns if a scale is being used by one voicedirect -//it it has support for grading and scales. Commented code should be -//modified if necessary. See forum, glossary or journal modules -//as reference. - - $return = false; - - //$rec = get_record("voicedirect","id","$voicedirectid","scale","-$scaleid"); - // - //if (!empty($rec) && !empty($scaleid)) { - // $return = true; - //} - - return $return; -} - -////////////////////////////////////////////////////////////////////////////////////// -/// Any other voicedirect functions go here. Each of them must have a name that -/// starts with voicedirect_ -/// -/// PairSet : array ('values' => array (), 'groups' => array ()); -/// NameSetPair : array ('name' => false, 'pairSet' => array ()); -/// NalmeValuePair : array ('name' => false, 'value' => false); -/// - -/** - * Create the data structure for a resource - * @param $voicedirect - the information incoming from the mod.html form - * @return the information ready to be sent to the API - */ -function voicedirect_create_rsc_data ($voicedirect) { - global $VT_API_VDIRECT; - - //add_to_log($voicedirect->course, "voicedirect", "", "", "Creating Data for Voice Direct"); - - $result = new PairSet (); - - $result->addNameValuePair ('type', $VT_API_VDIRECT); - $result->addNameValuePair ('title', $voicedirect->name); - $result->addNameValuePair ('description', $voicedirect->description); - $result->addNameValuePair ('email', $voicedirect->email); - if (isset($voicedirect->rid)) { - $result->addNameValuePair ('rid', $voicedirect->rid); - } - - $audioformat = new PairSet (); - $audioformat->addNameValuePair ('name', $voicedirect->audioformat); - - $options = new PairSet (); - $options->addPairSet('audio_format', $audioformat); - $options->addNameValuePair('archive', (($voicedirect->archive == 'on')?'true':'false')); - - $result->addPairSet ('options', $options); - - return $result->getData(); -} - - -/** - * Create the data structure for a resource - * @param $voicedirect - the information incoming from the mod.html form - * @return the information ready to be sent to the API - */ -function voicedirect_create_session_data ($voicedirect) { - global $VT_API_VDIRECT, - $USER; - - add_to_log($voicedirect->course, "voicedirect", "", "", "Creating Data for Voice Direct Session"); - - $user = new PairSet (); - $user->addNameValuePair ('screen_name', $USER->firstname."_".$USER->lastname); - $user->addNameValuePair ('email', $USER->email); - - $resource = new PairSet (); - $resource->addNameValuePair('rid', $voicedirect->rid); - - $rights = new PairSet (); - - if (isteacher($voicedirect->course)) { - $rights->addNameValuePair ('profile', 'blackboard.voicedirect.instructor'); - } - else { - $rights->addNameValuePair ('profile', 'blackboard.voicedirect.student'); - } - - return array ('user' => $user->getData(), - 'resource' => $resource->getData(), - 'message' => array(), - 'rights' => $rights->getData() ); -} - -?> Copied: trunk/moodle/mod/voicetool/lib.php (from rev 14, trunk/moodle/mod/voicedirect/lib.php) =================================================================== --- trunk/moodle/mod/voicetool/lib.php (rev 0) +++ trunk/moodle/mod/voicetool/lib.php 2006-05-12 09:27:58 UTC (rev 15) @@ -0,0 +1,271 @@ +<?PHP // $Id:$ + +require_once ('voicetoolapi.php'); + +/// Library of functions and constants for module voicetool + + +/** + * Validate the data in passed in the configuration page + * @param $config - the information from the form mod.html + */ +function voicetool_process_options ($config) { + global $CFG; + + $result = voicetool_api_check_documentbase ($config->servername, + $config->adminusername, + $config->adminpassword, + $CFG->wwwroot); + + if ($result == 'is_allowed.true') { + return; + } + + //get the error string and display it + + error(get_string($result, 'voicetool' ), 'javascript:history.back();'); + + return; +} + +function voicetool_add_instance($voicetool) { +/// Given an object containing all the necessary data, +/// (defined by the form in mod.html) this function +/// will create a new instance and return the id number +/// of the new instance. + global $USER; + + $voicetool->email = $USER->email; // email of the creator + $voicetool->timemodified = time(); + + + $data = voicetool_create_rsc_data ($voicetool); + + if (empty ($data)) { + error('Data not created correctly', "javascript:back();"); + } + + //print_r($data); + + if (!$result = voicetool_api_create_resource ($data)) { + error('Cannot create the resource on the VT server', "javascript:back();"); + } + + //the function returned correctly, we do not have to care whether + //the rid is in or not: it is + foreach ($result['values'] as $item) { + $values[$item['name']] = $item['value']; + if ($item['name'] == 'rid') { + continue; + } + } + + $voicetool->rid = $values['rid']; + + return insert_record('voicetool', $voicetool); +} + + +function voicetool_update_instance($voicetool) { +/// 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; + + $voicetool->timemodified = time(); + $voicetool->id = $voicetool->instance; + + $data = voicetool_create_rsc_data ($voicetool); + + if (empty ($data)) { + error('Data not created correctly'); + } + +///print_r($data); +///error (info); + + if (! $result = voicetool_api_modify_resource ($data)) { + error('Cannot modify the resource on the VT server'); + } + + # May have to add extra stuff in here # + +///print_r($voicetool); + + return update_record('voicetool', $voicetool); +} + + +function voicetool_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. + + if (! $voicetool = get_record("voicetool", "id", "$id")) { + return false; + } + + if (! ($result = voicetool_api_delete_resource ($voicetool->rid))) { + error('Cannot modify the resource on the VT server'); + } + + $result = true; + # Delete any dependent records here # + if (! delete_records("voicetool", "id", "$voicetool->id")) { + $result = false; + } + + return $result; +} + +function voicetool_user_outline($course, $user, $mod, $voicetool) { +/// Return a small object with summary information about what a +/// user has done with a given particular instance of this module +/// Used for user activity reports. +/// $return->time = the time they did it +/// $return->info = a short text description + + return $return; +} + +function voicetool_user_complete($course, $user, $mod, $voicetool) { +/// Print a detailed representation of what a user has done with +/// a given particular instance of this module, for user activity reports. + + return true; +} + +function voicetool_print_recent_activity($course, $isteacher, $timestart) { +/// Given a course and a time, this module should find recent activity +/// that has occurred in voicetool activities and print it out. +/// Return true if there was output, or false is there was none. + + global $CFG; + + return false; // True if anything was printed, otherwise false +} + +function voicetool_cron () { +/// Function to be run periodically according to the moodle cron +/// This function searches for things that need to be done, such +/// as sending out mail, toggling flags etc ... + + global $CFG; + + return true; +} + +function voicetool_grades($voicetoolid) { +/// Must return an array of grades for a given instance of this module, +/// indexed by user. It also returns a maximum allowed grade. +/// +/// $return->grades = array of grades; +/// $return->maxgrade = maximum allowed grade; +/// +/// return $return; + + return NULL; +} + +function voicetool_get_participants($voicetoolid) { +//Must return an array of user records (all data) who are participants +//for a given instance of voicetool. Must include every user involved +//in the instance, independient of his role (student, teacher, admin...) +//See other modules as example. + + return false; +} + +function voicetool_scale_used ($voicetoolid,$scaleid) { +//This function returns if a scale is being used by one voicetool +//it it has support for grading and scales. Commented code should be +//modified if necessary. See forum, glossary or journal modules +//as reference. + + $return = false; + + //$rec = get_record("voicetool","id","$voicetoolid","scale","-$scaleid"); + // + //if (!empty($rec) && !empty($scaleid)) { + // $return = true; + //} + + return $return; +} + +////////////////////////////////////////////////////////////////////////////////////// +/// Any other voicetool functions go here. Each of them must have a name that +/// starts with voicetool_ +/// +/// PairSet : array ('values' => array (), 'groups' => array ()); +/// NameSetPair : array ('name' => false, 'pairSet' => array ()); +/// NalmeValuePair : array ('name' => false, 'value' => false); +/// + +/** + * Create the data structure for a resource + * @param $voicetool - the information incoming from the mod.html form + * @return the information ready to be sent to the API + */ +function voicetool_create_rsc_data ($voicetool) { + global $VT_API_VDIRECT; + + //add_to_log($voicetool->course, "voicetool", "", "", "Creating Data for Voice Direct"); + + $result = new PairSet (); + + $result->addNameValuePair ('type', $VT_API_VDIRECT); + $result->addNameValuePair ('title', $voicetool->name); + $result->addNameValuePair ('description', $voicetool->description); + $result->addNameValuePair ('email', $voicetool->email); + if (isset($voicetool->rid)) { + $result->addNameValuePair ('rid', $voicetool->rid); + } + + $audioformat = new PairSet (); + $audioformat->addNameValuePair ('name', $voicetool->audioformat); + + $options = new PairSet (); + $options->addPairSet('audio_format', $audioformat); + $options->addNameValuePair('archive', (($voicetool->archive == 'on')?'true':'false')); + + $result->addPairSet ('options', $options); + + return $result->getData(); +} + + +/** + * Create the data structure for a resource + * @param $voicetool - the information incoming from the mod.html form + * @return the information ready to be sent to the API + */ +function voicetool_create_session_data ($voicetool) { + global $VT_API_VDIRECT, + $USER; + + add_to_log($voicetool->course, "voicetool", "", "", "Creating Data for Voice Direct Session"); + + $user = new PairSet (); + $user->addNameValuePair ('screen_name', $USER->firstname."_".$USER->lastname); + $user->addNameValuePair ('email', $USER->email); + + $resource = new PairSet (); + $resource->addNameValuePair('rid', $voicetool->rid); + + $rights = new PairSet (); + + if (isteacher($voicetool->course)) { + $rights->addNameValuePair ('profile', 'blackboard.voicetool.instructor'); + } + else { + $rights->addNameValuePair ('profile', 'blackboard.voicetool.student'); + } + + return array ('user' => $user->getData(), + 'resource' => $resource->getData(), + 'message' => array(), + 'rights' => $rights->getData() ); +} + +?> Deleted: trunk/moodle/mod/voicetool/mod.html =================================================================== --- trunk/moodle/mod/voicedirect/mod.html 2006-05-05 08:13:48 UTC (rev 13) +++ trunk/moodle/mod/voicetool/mod.html 2006-05-12 09:27:58 UTC (rev 15) @@ -1,85 +0,0 @@ -<!-- This page defines the form to create or edit an instance of this module --> -<!-- It is used from /course/mod.php. The whole instance is available as $form. --> - -<?php - -require_once ("$CFG->dirroot/mod/voicetoolapi.php"); - -/// First we check that form variables have been initialised -if (!isset($form->name)) { - $form->name = ''; -} - -if (!isset($form->description)) { - $form->description = ''; -} - -if (!isset($form->quality)) { - $form->quality = $VT_API_QUALITY_BASIC; -} - -if (!isset($form->archive)) { - $form->archive = ''; -} - -if (!isset($form->rid)) { - $form->rid = ''; -} - -?> - - -<form name="form" method="post" action="mod.php"> -<center> -<table cellpadding="5"> -<tr valign="top"> - <td align="right"><label for="name"><?php echo get_string('title', 'voicedirect') ?>:</label></td> - <td> - <input type="text" name="name" id="name" size="30" value="<?php p($form->name) ?>"> - </td> -</tr> -<!-- More rows go in here... --> -<tr valign="top"> - <td align="right"><label for="description"><?php echo get_string('description', 'voicedirect') ?>:</label></td> - <td> - <input type="text" name="description" id="description" size="30" value="<?php p($form->description) ?>"> - </td> -</tr> -<tr valign="top"> - <td align="right"><b><label for="quality"><?php echo get_string ('audioquality', 'voicedirect') ?></label>:</b></td> - <td> -<select id="quality" name="quality"> -<option value="spx_8_q3" <?php if ($form->quality == 'spx_8_q3') { echo 'selected';}?>><?php echo get_string ('basicquality', 'voicedirect') ?></option> -<option value="spx_16_q4" <?php if ($form->quality == 'spx_16_q4') { echo 'selected';}?>><?php echo get_string ('standardquality', 'voicedirect') ?></option> -<option value="spx_16_q6" <?php if ($form->quality == 'spx_16_q6') { echo 'selected';}?>><?php echo get_string ('goodquality', 'voicedirect') ?></option> -</select> - </td> -</tr> -<tr valign="top"> - <td align="right"><b><label for='archive'><?php echo get_string('archivesession', 'voicedirect') ?></label>:</b></td> - <td> - <input type="checkbox" name="archive" id="archive" <?php if ($form->archive == 'on'){echo 'checked';} ?>> - </td> -</tr> - -<!-- The following line for Moodle 1.5 prints the visibility setting form element --> -<?php print_visible_setting($form); ?> -<!-- and if your module uses groups you would also have --> -<?php print_groupmode_setting($form); ?> - -</table> - -<input type="hidden" name="rid" value="<?php p($form->rid) ?>" /> -<!-- These hidden variables are always the same --> -<input type="hidden" name="course" value="<?php p($form->course) ?>" /> -<input type="hidden" name="sesskey" value="<?php p($form->sesskey) ?>" /> -<input type="hidden" name="coursemodule" value="<?php p($form->coursemodule) ?>" /> -<input type="hidden" name="section" value="<?php p($form->section) ?>" /> -<input type="hidden" name="module" value="<?php p($form->module) ?>" /> -<input type="hidden" name="modulename" value="<?php p($form->modulename) ?>" /> -<input type="hidden" name="instance" value="<?php p($form->instance) ?>" /> -<input type="hidden" name="mode" value="<?php p($form->mode) ?>" /> -<input type="submit" value="<?php print_string("savechanges") ?>" /> -</center> - -</form> Copied: trunk/moodle/mod/voicetool/mod.html (from rev 14, trunk/moodle/mod/voicedirect/mod.html) =================================================================== --- trunk/moodle/mod/voicetool/mod.html (rev 0) +++ trunk/moodle/mod/voicetool/mod.html 2006-05-12 09:27:58 UTC (rev 15) @@ -0,0 +1,84 @@ +<!-- This page defines the form to create or edit an instance of this module --> +<!-- It is used from /course/mod.php. The whole instance is available as $form. --> + +<?php + +require_once ('voicetoolapi.php'); + +/// First we check that form variables have been initialised +if (!isset($form->name)) { + $form->name = ''; +} + +if (!isset($form->description)) { + $form->description = ''; +} + +if (!isset($form->quality)) { + $form->quality = $VT_API_QUALITY_BASIC; +} + +if (!isset($form->archive)) { + $form->archive = ''; +} + +if (!isset($form->rid)) { + $form->rid = ''; +} +?> + + +<form name="form" method="post" action="mod.php"> +<center> +<table cellpadding="5"> +<tr valign="top"> + <td align="right"><label for="name"><?php echo get_string('title', 'voicetool') ?>:</label></td> + <td> + <input type="text" name="name" id="name" size="30" value="<?php p($form->name) ?>"> + </td> +</tr> +<!-- More rows go in here... --> +<tr valign="top"> + <td align="right"><label for="description"><?php echo get_string('description', 'voicetool') ?>:</label></td> + <td> + <input type="text" name="description" id="description" size="30" value="<?php p($form->description) ?>"> + </td> +</tr> +<tr valign="top"> + <td align="right"><b><label for="quality"><?php echo get_string ('audioquality', 'voicetool') ?></label>:</b></td> + <td> +<select id="quality" name="quality"> +<option value="spx_8_q3" <?php if ($form->quality == 'spx_8_q3') { echo 'selected';}?>><?php echo get_string ('basicquality', 'voicetool') ?></option> +<option value="spx_16_q4" <?php if ($form->quality == 'spx_16_q4') { echo 'selected';}?>><?php echo get_string ('standardquality', 'voicetool') ?></option> +<option value="spx_16_q6" <?php if ($form->quality == 'spx_16_q6') { echo 'selected';}?>><?php echo get_string ('goodquality', 'voicetool') ?></option> +</select> + </td> +</tr> +<tr valign="top"> + <td align="right"><b><label for='archive'><?php echo get_string('archivesession', 'voicetool') ?></label>:</b></td> + <td> + <input type="checkbox" name="archive" id="archive" <?php if ($form->archive == 'on'){echo 'checked';} ?>> + </td> +</tr> + +<!-- The following line for Moodle 1.5 prints the visibility setting form element --> +<?php print_visible_setting($form); ?> +<!-- and if your module uses groups you would also have --> +<?php print_groupmode_setting($form); ?> + +</table> + +<input type="hidden" name="rid" value="<?php p($form->rid) ?>" /> +<!-- These hidden variables are always the same --> +<input type="hidden" name="course" value="<?php p($form->course) ?>" /> +<input type="hidden" name="sesskey" value="<?php p($form->sesskey) ?>" /> +<input type="hidden" name="coursemodule" value="<?php p($form->coursemodule) ?>" /> +<input type="hidden" name="section" value="<?php p($form->section) ?>" /> +<input type="hidden" name="module" value="<?php p($form->module) ?>" /> +<input type="hidden" name="modulename" value="<?php p($form->modulename) ?>" /> +<input type="hidden" name="instance" value="<?php p($form->instance) ?>" /> +<input type="hidden" name="mode" value="<?php p($form->mode) ?>" /> +<input type="submit" value="<?php print_string("savechanges") ?>" /> +</center> + +</form> Deleted: trunk/moodle/mod/voicetool/version.php =================================================================== --- trunk/moodle/mod/voicedirect/version.php 2006-05-05 08:13:48 UTC (rev 13) +++ trunk/moodle/mod/voicetool/version.php 2006-05-12 09:27:58 UTC (rev 15) @@ -1,11 +0,0 @@ -<?PHP // $Id: version.php,v 1.1 2003/09/30 02:45:19 moodler Exp $ - -///////////////////////////////////////////////////////////////////////////////// -/// Code fragment to define the version of NEWMODULE -/// This fragment is called by moodle_needs_upgrading() and /admin/index.php -///////////////////////////////////////////////////////////////////////////////// - -$module->version = 2003092800; // The current module version (Date: YYYYMMDDXX) -$module->cron = 0; // Period for cron to check this module (secs) - -?> Copied: trunk/moodle/mod/voicetool/version.php (from rev 14, trunk/moodle/mod/voicedirect/version.php) =================================================================== --- trunk/moodle/mod/voicetool/version.php (rev 0) +++ trunk/moodle/mod/voicetool/version.php 2006-05-12 09:27:58 UTC (rev 15) @@ -0,0 +1,11 @@ +<?PHP // $Id: version.php,v 1.1 2003/09/30 02:45:19 moodler Exp $ + +///////////////////////////////////////////////////////////////////////////////// +/// Code fragment to define the version of NEWMODULE +/// This fragment is called by moodle_needs_upgrading() and /admin/index.php +///////////////////////////////////////////////////////////////////////////////// + +$module->version = 2003092800; // The current module version (Date: YYYYMMDDXX) +$module->cron = 0; // Period for cron to check this module (secs) + +?> Deleted: trunk/moodle/mod/voicetool/view.php =================================================================== --- trunk/moodle/mod/voicedirect/view.php 2006-05-05 08:13:48 UTC (rev 13) +++ trunk/moodle/mod/voicetool/view.php 2006-05-12 09:27:58 UTC (rev 15) @@ -1,96 +0,0 @@ -<?PHP // $Id: view.php,v 1.1 2003/09/30 02:45:19 moodler Exp $ - -/// This page prints a particular instance of voicedirect -/// (Replace voicedirect with the name of your module) - - require_once('../../config.php'); - require_once('lib.php'); - require_once('../voicetoolapi.php'); - - optional_variable($id); // Course Module ID, or - optional_variable($a); // voicedirect ID - - if ($id) { - 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 (! $voicedirect = get_record("voicedirect", "id", $cm->instance)) { - error("Course module is incorrect"); - } - - } else { - if (! $voicedirect = get_record("voicedirect", "id", $a)) { - error("Course module is incorrect"); - } - if (! $course = get_record("course", "id", $voicedirect->course)) { - error("Course is misconfigured"); - } - if (! $cm = get_coursemodule_from_instance("voicedirect", $voicedirect->id, $course->id)) { - error("Course Module ID was incorrect"); - } - } - - require_login($course->id); - - add_to_log($course->id, "voicedirect", "view", "view.php?id=$cm->id", "$voicedirect->id"); - - if (!$nid = voicetool_create_session ($voicedirect)) { - error(get_string ('cannotgetsession', 'voicedirect')); - } - - - -/// Print the page header - - if ($course->category) { - $navigation = "<A HREF=\"../../course/view.php?id=$course->id\">$course->shortname</A> ->"; - } - - $strvoicedirects = get_string("modulenameplural", "voicedirect"); - $strvoicedirect = get_string("modulename", "voicedirect"); - - print_header("$course->shortname: $voicedirect->name", "$course->fullname", - "$navigation <A HREF=index.php?id=$course->id>$strvoicedirects</A> -> $voicedirect->name", - "", "", true, update_module_button($cm->id, $course->id, $strvoicedirect), - navmenu($course, $cm)); - -/// Print the main part of the page - global $CFG; - - $servername = $CFG->voicetool_servername; - -?> -<p><em><strong><?php p($voicedirect->description) ?></strong></em></p> -<SCRIPT type="text/javascript"> - this.focus(); -</SCRIPT> -<SCRIPT type="text/javascript" SRC="<?php echo $servername ?>/voicedirect/voicedirect.js"></SCRIPT> -<SCRIPT type="text/javascript"> - var w_p = new Object(); - w_p.view_archives_url="<?php echo $servername ?>/board?action=display_popup&language=fr&width=545&height=805"; - w_p.view_archives_target = "wimba_archives"; - w_p.language="fr"; - - w_p.nid="<?php echo $nid?>"; - - if (window.w_voicedirect_tag) w_voicedirect_tag(w_p); - else document.write("Applet should be there, but the Voice Tools server is down"); -</SCRIPT> -<NOSCRIPT> -Your browser does not seem to be configured correctly to be able to use Horizon Wimba -Tools. Please go through the -<a href="<?php echo $servername ?>/wizard/launcher.jsp"> Setup Wizard</a> to configure it correctly. -</NOSCRIPT> - - - -<?php -/// Finish the page - print_footer($course); - -?> Copied: trunk/moodle/mod/voicetool/view.php (from rev 14, trunk/moodle/mod/voicedirect/view.php) =================================================================== --- trunk/moodle/mod/voicetool/view.php (rev 0) +++ trunk/moodle/mod/voicetool/view.php 2006-05-12 09:27:58 UTC (rev 15) @@ -0,0 +1,96 @@ +<?PHP // $Id: view.php,v 1.1 2003/09/30 02:45:19 moodler Exp $ + +/// This page prints a particular instance of voicedirect +/// (Replace voicedirect with the name of your module) + + require_once('../../config.php'); + require_once('lib.php'); + require_once('voicetoolapi.php'); + + optional_variable($id); // Course Module ID, or + optional_variable($a); // voicetool ID + + if ($id) { + 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("voicetool", "id", $cm->instance)) { + error("Course module is incorrect"); + } + + } else { + if (! $voicetool = get_record("voicetool", "id", $a)) { + error("Course module is incorrect"); + } + if (! $course = get_record("course", "id", $voicetool->course)) { + error("Course is misconfigured"); + } + if (! $cm = get_coursemodule_from_instance("voicetool", $voicetool->id, $course->id)) { + error("Course Module ID was incorrect"); + } + } + + require_login($course->id); + + add_to_log($course->id, "voicetool", "view", "view.php?id=$cm->id", "$voicetool->id"); + + if (!$nid = voicetool_api_create_session ($voicetool)) { + error(get_string ('cannotgetsession', 'voicetool')); + } + + + +/// Print the page header + + if ($course->category) { + $navigation = "<A HREF=\"../../course/view.php?id=$course->id\">$course->shortname</A> ->"; + } + + $strvoicetools = get_string("modulenameplural", "voicetool"); + $strvoicetool = get_string("modulename", "voicetool"); + + print_header("$course->shortname: $voicetool->name", "$course->fullname", + "$navigation <A HREF=index.php?id=$course->id>$strvoicetools</A> -> $voicetool->name", + "", "", true, update_module_button($cm->id, $course->id, $strvoicetool), + navmenu($course, $cm)); + +/// Print the main part of the page + global $CFG; + + $servername = $CFG->voicetool_servername; + +?> +<p><em><strong><?php p($voicetool->description) ?></strong></em></p> +<SCRIPT type="text/javascript"> + this.focus(); +</SCRIPT> +<SCRIPT type="text/javascript" SRC="<?php echo $servername ?>/voicedirect/voicedirect.js"></SCRIPT> +<SCRIPT type="text/javascript"> + var w_p = new Object(); + w_p.view_archives_url="<?php echo $servername ?>/board?action=display_popup&language=fr&width=545&height=805"; + w_p.view_archives_target = "wimba_archives"; + w_p.language="fr"; + + w_p.nid="<?php echo $nid?>"; + + if (window.w_voicedirect_tag) w_voicedirect_tag(w_p); + else document.write("Applet should be there, but the Voice Tools server is down"); +</SCRIPT> +<NOSCRIPT> +Your browser does not seem to be configured correctly to be able to use Horizon Wimba +Tools. Please go through the +<a href="<?php echo $servername ?>/wizard/launcher.jsp"> Setup Wizard</a> to configure it correctly. +</NOSCRIPT> + + + +<?php +/// Finish the page + print_footer($course); + +?> Copied: trunk/moodle/mod/voicetool/voicetoolapi.php (from rev 14, trunk/moodle/mod/voicetoolapi.php) =================================================================== --- trunk/moodle/mod/voicetool/voicetoolapi.php (rev 0) +++ trunk/moodle/mod/voicetool/voicetoolapi.php 2006-05-12 09:27:58 UTC (rev 15) @@ -0,0 +1,296 @@ +<?PHP // $Id:$ + + +require_once("$CFG->dirroot/lib/nusoap/nusoap.php"); + +/// Library of functions and constants for the voicetool API + +$VT_API_VBOARD = 'board'; +$VT_API_VMAIL = 'vmail'; +$VT_API_VDIRECT = 'voicedirect'; +$VT_API_VRECORDER = 'recorder'; + +$VT_API_QUALITY_BASIC = 'spx_8_q3'; +$VT_API_QUALITY_STANDARD = 'spx_16_q4'; +$VT_API_QUALITY_GOOD = 'spx_16_q6'; + + +$VT_API_SERVICES = '/services/Broker?wsdl'; +$VT_API_CREATE_RESOURCE = 'createResource'; +$VT_API_MODIFY_RESOURCE = 'modifyResource'; +$VT_API_DELETE_RESOURCE = 'deleteResource'; +$VT_API_CREATE_SESSION = 'createSession'; +$VT_API_ALLOWEDDOCBASE = 'isDocumentBaseAllowed'; + + + + +/** + * Send an SDK request to the VT server to create the resource. + * @uses CFG + * @uses VT_API_SERVICES + * @uses VT_API_CREATE_RESOURCE + * @param $resource_data - the resource to create + * @return - the object returned by the call, or false if something goes wrong + */ +function voicetool_api_create_resource ($resource_data) { + global $CFG, + $VT_API_SERVICES, + $VT_API_CREATE_RESOURCE; + + $soapclient = new soapclient($CFG->voicetool_servername.$VT_API_SERVICES,true); + + $resource = array ($CFG->voicetool_adminusername, + $CFG->voicetool_adminpassword, + $resource_data); + //print_r($resource); + + $result = $soapclient->call($VT_API_CREATE_RESOURCE, $resource); + + + //print_r ($result); + + if (!voicetool_api_check_result ($result)) { + return false; + } + + return $result; +} + +/** + * Send an SDK request to the VT server to create the resource. + * @uses CFG + * @uses VT_API_SERVICES + * @uses VT_API_MODIFY_RESOURCE + * @param $resource_data - the resource to create + * @return - the object returned by the call, or false if something goes wrong + */ +function voicetool_api_modify_resource ($resource_data) { + global $CFG, + $VT_API_SERVICES, + $VT_API_MODIFY_RESOURCE; + + $soapclient = new soapclient($CFG->voicetool_servername.$VT_API_SERVICES,true); + + $resource = array ($CFG->voicetool_adminusername, + $CFG->voicetool_adminpassword, + $resource_data); + //print_r($resource); + + $result = $soapclient->call($VT_API_MODIFY_RESOURCE, $resource); + + + //print_r ($result); + + if (!voicetool_api_check_result ($result)) { + return false; + } + + return $result; +} + +/** + * Send an SDK request to the VT server to delete a resource. + * @uses CFG + * @uses VT_API_SERVICES + * @uses VT_API_DELETE_RESOURCE + * @param $rid - the rid of the resource to delete + * @return - the object returned by the call, or false if something goes wrong + */ +function voicetool_api_delete_resource ($rid) { + global $CFG, + $VT_API_SERVICES, + $VT_API_DELETE_RESOURCE; + + $soapclient = new soapclient($CFG->voicetool_servername.$VT_API_SERVICES,true); + + $resource = array ($CFG->voicetool_adminusername, + $CFG->voicetool_adminpassword, + $rid); + + $result = $soapclient->call($VT_API_DELETE_RESOURCE, $resource); + + + if (!voicetool_api_check_result ($result)) { + return false; + } + + return $result; +} + + + +/** + * Create the session for a voice direct applet. + * @uses CFG + * @uses VT_API_SERVICES + * @uses VT_API_CREATE_SESSION + * @param - the voicetool information + * @return - the mid to insert into the html + */ +function voicetool_api_create_session ($voicetool) { + global $CFG, + $VT_API_SERVICES, + $VT_API_CREATE_SESSION; + + + $sessiondata = voicetool_create_session_data($voicetool); + + $soapclient = new soapclient($CFG->voicetool_servername.$VT_API_SERVICES,true); + + $resource = array ($CFG->voicetool_adminusername, + $CFG->voicetool_adminpassword, + $sessiondata['user'], + $sessiondata['resource'], + $sessiondata['message'], + $sessiondata['rights']); + + //print_r($resource); + + $result = $soapclient->call($VT_API_CREATE_SESSION, $resource); + + + //print_r ($result); + + if (!voicetool_api_check_result ($result)) { + return false; + } + + foreach ($result['values'] as $item) { + + $values[$item['name']] = $item['value']; + + } + + + return $values['nid']; +} + +/** + * Checks that the documentabase is allowed on the VT server + * @param string $server the url of the VT server + * @param string $login the API login to use + * @param string $password the API password to use + * @param string the url that need to be checked + * @return string the string 'ok' if the url given is authorized to display voice tools, + * or an error message otherwise + */ +function voicetool_api_check_documentbase($server, $login, $password, $url) { + global $VT_API_SERVICES, + $VT_API_ALLOWEDDOCBASE; + + $soapclient = new soapclient($server.$VT_API_SERVICES,true); + + $resource = array ($login, + $password, + $url); + + $result = $soapclient->call($VT_API_ALLOWEDDOCBASE, $resource); + + //print_r($result); + + if (!voicetool_api_check_result ($result)) { + return voicetool_api_get_error_message ($result); + } + + foreach ($result['values'] as $item) { + if ($item['name'] == 'is_allowed') { + return 'is_allowed.'.$item['value']; + } + } + + error('Return Value not Found'); +} + + + +////////// Helper Function, kind of private + +/** + * Return true if the result does not contain an error code, or false wise. + * @param $result... [truncated message content] |