[Hw4mdl-svn] SF.net SVN: hw4mdl: [14] trunk/moodle/mod
Brought to you by:
jhlinder,
trollinger
From: <hu...@us...> - 2006-05-06 22:32:36
|
Revision: 14 Author: hugues Date: 2006-05-06 15:32:23 -0700 (Sat, 06 May 2006) ViewCVS: http://svn.sourceforge.net/hw4mdl/?rev=14&view=rev Log Message: ----------- Adding bakup stuff for the LC & re-organizing VT Modified Paths: -------------- trunk/moodle/mod/voicedirect/config.html trunk/moodle/mod/voicedirect/lib.php trunk/moodle/mod/voicedirect/mod.html trunk/moodle/mod/voicetoolapi.php Added Paths: ----------- trunk/moodle/mod/liveclassroom/backuplib.php Added: trunk/moodle/mod/liveclassroom/backuplib.php =================================================================== --- trunk/moodle/mod/liveclassroom/backuplib.php (rev 0) +++ trunk/moodle/mod/liveclassroom/backuplib.php 2006-05-06 22:32:23 UTC (rev 14) @@ -0,0 +1,74 @@ +<?PHP +/// Library of functions and constants for module liveclassroom + +require_once($CFG->libdir.'/datalib.php'); +require_once("$CFG->dirroot/mod/liveclassroom/api.php"); +require_once("$CFG->dirroot/mod/liveclassroom/lib.php"); + + + +function liveclassroom_backup_mods($bf,$preferences) { + global $CFG; + + $status = true; + + //Iterate over liveclassroom table + $liveclassroomss = get_records ("liveclassroom","course",$preferences->backup_course,"id"); + if ($liveclassrooms) { + foreach ($liveclassrooms as $liveclassroom) { + //Start mod + fwrite ($bf,start_tag("MOD",3,true)); + //Print LC data + fwrite ($bf,full_tag("ID",4,false,$liveclassroom->id)); + fwrite ($bf,full_tag("MODTYPE",4,false,"liveclassroom")); + fwrite ($bf,full_tag("NAME",4,false,$liveclassroom->name)); + + $status =fwrite ($bf,end_tag("MOD",3,true)); + } + } + + //if we've selected to backup users info, then backup files too + if ($status) { + if ($preferences->mods["liveclassroom"]->userinfo) { + //$status = liveclassroom_backup_files($bf,$preferences); + } + } + + + return $status; +} + + + + +////Return an array of info (name,value) reporting what will be backed up +function liveclassroom_check_backup_mods($course,$user_data=false,$backup_unique_code) { + //First the course data + $info[0][0] = get_string("modulenameplural","liveclassroom"); + if ($ids = liveclassroom_ids ($course)) { + $info[0][1] = count($ids); + } else { + $info[0][1] = 0; + } + + + //Now, if requested, the user_data: look for the number of + //rooms/archives available on the server and report + if ($user_data) { + $info[1][0] = get_string("rooms","liveclassroom"); + if ($ids = liveclassroom_count_rooms ($course)) { + $info[1][1] = count($ids); + } else { + $info[1][1] = 0; + } + $info[2][0] = get_string("archives","liveclassroom"); + if ($ids = liveclassroom_count_archives ($course)) { + $info[2][1] = count($ids); + } else { + $info[2][1] = 0; + } + } + return $info; +} + +?> Modified: trunk/moodle/mod/voicedirect/config.html =================================================================== --- trunk/moodle/mod/voicedirect/config.html 2006-05-05 08:13:48 UTC (rev 13) +++ trunk/moodle/mod/voicedirect/config.html 2006-05-06 22:32:23 UTC (rev 14) @@ -1,5 +1,21 @@ +<?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="voicedirect"> <table cellpadding="9" cellspacing="0" > @@ -13,7 +29,7 @@ <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) ?>" /> + <input name="servername" type="text" size="30" value="<?php p($CFG->voicetool_servername) ?>" /> </td> <td> <?php print_string("configservername", "voicetool") ?> @@ -22,7 +38,7 @@ <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) ?>" /> + <input name="adminusername" type="text" size="20" value="<?php p($CFG->voicetool_adminusername) ?>" /> </td> <td> <?php print_string("configadminusername", "voicetool") ?> @@ -31,21 +47,12 @@ <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) ?>" /> + <input name="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> Modified: trunk/moodle/mod/voicedirect/lib.php =================================================================== --- trunk/moodle/mod/voicedirect/lib.php 2006-05-05 08:13:48 UTC (rev 13) +++ trunk/moodle/mod/voicedirect/lib.php 2006-05-06 22:32:23 UTC (rev 14) @@ -11,7 +11,7 @@ * @param $config - the information from the form mod.html */ function voicedirect_process_options ($config) { - return true; + return; } function voicedirect_add_instance($voicedirect) { @@ -28,24 +28,26 @@ $data = voicedirect_create_rsc_data ($voicedirect); if (empty ($data)) { - error('Data not created correctly'); + error('Data not created correctly', "javascript:back();"); } //print_r($data); if (!$result = voicetool_create_resource ($data)) { - error('Cannot create the resource on the VT server'); + error('Cannot create the resource on the VT server', "javascript:back();"); } - # May have to add extra stuff in here # - foreach ($result['values'] as $item) { - $values[$item['name']] = $item['value']; - } - - $rid = $values['rid']; - - $voicedirect->rid = $rid; + //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; + } + } + $voicedirect->rid = $values['rid']; + return insert_record('voicedirect', $voicedirect); } Modified: trunk/moodle/mod/voicedirect/mod.html =================================================================== --- trunk/moodle/mod/voicedirect/mod.html 2006-05-05 08:13:48 UTC (rev 13) +++ trunk/moodle/mod/voicedirect/mod.html 2006-05-06 22:32:23 UTC (rev 14) @@ -25,7 +25,6 @@ if (!isset($form->rid)) { $form->rid = ''; } - ?> Modified: trunk/moodle/mod/voicetoolapi.php =================================================================== --- trunk/moodle/mod/voicetoolapi.php 2006-05-05 08:13:48 UTC (rev 13) +++ trunk/moodle/mod/voicetoolapi.php 2006-05-06 22:32:23 UTC (rev 14) @@ -23,7 +23,26 @@ +/** + * Voicetool_process_options - proces the informations from the config.html + * forms arriving from the server. We need to update all values that begin + * with $module to make them begin with 'voicetool'. + * + * We also need to update the table of course that have access to the tools. + * + * @param $config - the config object + */ +function voicetool_process_options ($config) { + $module = $config->module; + foreach ($config as $name => $value) { + + } + + +} + + /** * Send an SDK request to the VT server to create the resource. * @uses CFG @@ -44,7 +63,8 @@ $resource_data); //print_r($resource); - $result = $soapclient->call($VT_API_CREATE_RESOURCE, $resource); + $result = $soapclient->call($VT_API_CREATE_RESOURCE, $resource); + //print_r ($result); @@ -75,7 +95,8 @@ $resource_data); //print_r($resource); - $result = $soapclient->call($VT_API_MODIFY_RESOURCE, $resource); + $result = $soapclient->call($VT_API_MODIFY_RESOURCE, $resource); + //print_r ($result); @@ -105,7 +126,8 @@ $CFG->voicetool_adminpassword, $rid); - $result = $soapclient->call($VT_API_DELETE_RESOURCE, $resource); + $result = $soapclient->call($VT_API_DELETE_RESOURCE, $resource); + if (!voicetool_check_result ($result)) { return false; @@ -143,7 +165,8 @@ //print_r($resource); - $result = $soapclient->call($VT_API_CREATE_SESSION, $resource); + $result = $soapclient->call($VT_API_CREATE_SESSION, $resource); + //print_r ($result); @@ -151,10 +174,13 @@ return false; } - foreach ($result['values'] as $item) { - $values[$item['name']] = $item['value']; - } + foreach ($result['values'] as $item) { + $values[$item['name']] = $item['value']; + + } + + return $values['nid']; } @@ -171,7 +197,8 @@ return false; } - foreach ($result['values'] as $item) { + foreach ($result['values'] as $item) { + if ($item['name'] == 'error_message') { error_log( "voicetool_check_result: ".$item['name'].': '.$item['value']); return false; @@ -179,9 +206,11 @@ if (($item['name'] == 'status_code') && ($item['value'] == 'ok')) { return true; - } + } + } - + + return true; } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |