Revision: 234
http://hw4mdl.svn.sourceforge.net/hw4mdl/?rev=234&view=rev
Author: trollinger
Date: 2008-01-25 14:54:52 -0800 (Fri, 25 Jan 2008)
Log Message:
-----------
code review and cleaning
Modified Paths:
--------------
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/lib.php
branches/team/Thomas/moodle/mod/voicetools/manageAction.php
branches/team/Thomas/moodle/mod/voicetools/mod.html
branches/team/Thomas/moodle/mod/voicetools/welcome.php
Modified: branches/team/Thomas/moodle/mod/voicetools/getXmlChoicePage.php
===================================================================
--- branches/team/Thomas/moodle/mod/voicetools/getXmlChoicePage.php 2008-01-22 23:54:29 UTC (rev 233)
+++ branches/team/Thomas/moodle/mod/voicetools/getXmlChoicePage.php 2008-01-25 22:54:52 UTC (rev 234)
@@ -28,7 +28,6 @@
******************************************************************************/
/* $Id: getXmlChoicePage.php 52853 2007-08-24 17:55:26Z thomasr $ */
-error_reporting(E_ERROR);
global $CFG;
require_once("../../config.php");
require_once("lib.php");
@@ -45,6 +44,8 @@
$params[$param["value"]] = $value;
}
+ini_set('display_errors','off');
+ini_set('log_errors','on');
require_login($params["enc_course_id"]);
$xml=new WimbaXml();
$session=new WimbaMoodleSession($params);
Modified: branches/team/Thomas/moodle/mod/voicetools/getXmlListPanel.php
===================================================================
--- branches/team/Thomas/moodle/mod/voicetools/getXmlListPanel.php 2008-01-22 23:54:29 UTC (rev 233)
+++ branches/team/Thomas/moodle/mod/voicetools/getXmlListPanel.php 2008-01-25 22:54:52 UTC (rev 234)
@@ -30,9 +30,8 @@
/* $Id: getXmlListPanel.php 52853 2007-08-24 17:55:26Z thomasr $ */
/// This page generates the xml of the principal window
-error_reporting(E_ERROR);
+
global $CFG;
-
require_once("../../config.php");
require_once("lib.php");
require_once("lib/php/common/WimbaXml.php");
@@ -59,8 +58,12 @@
require_login($params["enc_course_id"]);
$session=new WimbaMoodleSession($params);
$uiManager=new WimbaUI($session);
-if(isset($params["error"])){
- $display=$uiManager->setError(get_string ($params["error"], 'voicetools'));
+
+
+
+if(isset($params["error"]) )
+{
+ $uiManager->setError(get_string ($params["error"], 'voicetools'));
}
else
{
@@ -70,13 +73,12 @@
$message="";
if(!empty($messageProduct) && !empty($messageAction))
$message=get_string("message_".$messageProduct."_start", "voicetools")." ".get_string("message_".$messageAction."_end","voicetools");
- $display=$uiManager->getVTPrincipalView($message);
+ $uiManager->getVTPrincipalView($message);
}
else
- { //bad session
- $display="";//to make sure that nothing was displayed before
- $display=$uiManager->setError(get_string ('error_'.$session->error, 'voicetools'));
+ { //bad session
+ $uiManager->setError(get_string ('error_'.$session->error, 'voicetools'));
}
}
-echo $display;
+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-01-22 23:54:29 UTC (rev 233)
+++ branches/team/Thomas/moodle/mod/voicetools/getXmlNewPanel.php 2008-01-25 22:54:52 UTC (rev 234)
@@ -34,7 +34,6 @@
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");
@@ -44,64 +43,67 @@
if (version_compare(PHP_VERSION,'5','>=')) {
require_once('lib/php/common/domxml-php4-php5.php');
}
-set_time_limit(30);
$createWorkflow = optional_param('createWorkflow', false, PARAM_BOOL); // course
-foreach(getKeysOfGeneralParameters() as $param){
+foreach(getKeysOfGeneralParameters() as $param)
+{
$value=optional_param($param["value"],$param["default_value"],$param["type"]);
if($value!=null)
$params[$param["value"]] = $value;
}
require_login($params["enc_course_id"]);
-
$session=new WimbaMoodleSession($params);
$uiManager=new WimbaUI($session);
+
if($session->error==false)
{
-
-
/*******************
GET URL INFORMATIONS
********************/
$action = optional_param('action', ""); // Course Module ID, or
$typeProduct = $params['type'];
-
add_to_log($session->getCourseId(), "voicetools", "xml", "product" , $typeProduct);
- if($action == 'update') { //get the information of the resource
-
+ if($action == 'update')
+ { //get the information of the resource
$currentBoard = voicetools_api_get_resource($params["resource_id"]);
- if($currentBoard==null || $currentBoard->error==true){
- $xml->setError(get_string('problem_vt','voicetools'));
- echo $xml->getXml();
- exit();
+ if($currentBoard==null || $currentBoard->error==true)
+ {
+ $uiManager->setError(get_string('problem_vt','voicetools'));
}
+
$currentBoardInformations=voicetools_get_voiceboard_Informations($params["resource_id"]);
- if($currentBoard->error==true){
- $xml->setError(get_string('problem_bd','voicetools'));
- echo $xml->getXml();
- exit();
+
+ if($currentBoard->error==true)
+ {
+ $uiManager->setError(get_string('problem_bd','voicetools'));
}
+
$uiManager->setCurrentProduct($typeProduct,$currentBoard,$currentBoardInformations);
- }else{
-
+ }
+ else
+ {
+ $uiManager->setCurrentProduct($typeProduct);
+ }
- $uiManager->setCurrentProduct($typeProduct);
- }
$display= $uiManager->getVTSettingsView($action,$createWorkflow);
-
-}else{
+}
+else
+{
if($session->error=="session")
- $xml->setError(get_string ('session', 'voicetools'));
- else if($session->error=="signature")
- $xml->setError(get_string ('signature', 'voicetools'));
-
+ {
+ $uiManager->setError(get_string ('session', 'voicetools'));
+ }
+ else if($session->error=="signature")
+ {
+ $uiManager->setError(get_string ('signature', 'voicetools'));
+ }
}
-echo $display;
+echo $uiManager->getXmlString();
?>
Modified: branches/team/Thomas/moodle/mod/voicetools/lib.php
===================================================================
--- branches/team/Thomas/moodle/mod/voicetools/lib.php 2008-01-22 23:54:29 UTC (rev 233)
+++ branches/team/Thomas/moodle/mod/voicetools/lib.php 2008-01-25 22:54:52 UTC (rev 234)
@@ -28,7 +28,6 @@
/* $Id: lib.php 56815 2007-12-04 15:08:45Z thomasr $ */
/// Library of functions and constants for module voicetools
-error_reporting(0);
require_once($CFG->libdir.'/datalib.php');
require_once($CFG->dirroot.'/course/lib.php');
require_once('lib/php/vt/WimbaVoicetoolsAPI.php');
@@ -42,38 +41,50 @@
* @param $config - the information from the form mod.html
*/
function voicetools_process_options ($config) {
- global $CFG;
+ global $CFG;
- if(empty($config->servername)){
- error(get_string('wrongconfigurationURLunavailable', 'voicetools'), $_SERVER["HTTP_REFERER"]);
+ /*******
+ we do the following verfication before submitting the configuration
+ -The parameters sent can not be empty
+ -The url of the server can not finish with a /
+ -The url must start with http:// or https://
+ -The api account has to valid
+ ********/
+
+ if(empty($config->servername))
+ {
+ error(get_string('wrongconfigurationURLunavailable', 'voicetools'), $_SERVER["HTTP_REFERER"]);
}
- else if(empty($config->adminusername)){
- error(get_string('emptyAdminUsername', 'voicetools'), $_SERVER["HTTP_REFERER"]);
+
+ if(empty($config->adminusername))
+ {
+ error(get_string('emptyAdminUsername', 'voicetools'), $_SERVER["HTTP_REFERER"]);
}
- else if(empty($config->adminpassword)){
- error(get_string('emptyAdminPassword', 'voicetools'), $_SERVER["HTTP_REFERER"]);
+
+ if(empty($config->adminpassword))
+ {
+ error(get_string('emptyAdminPassword', 'voicetools'), $_SERVER["HTTP_REFERER"]);
}
- $length = strlen($config->servername);
- if ($config->servername{$length-1} == '/') {
- error(get_String('trailingSlash', 'voicetools'), $_SERVER["HTTP_REFERER"]);
- }
- if (!preg_match('/^http:\/\//', $config->servername)) {
- error(get_String('trailingHttp', 'voicetools'), $_SERVER["HTTP_REFERER"]);
- }
- $result = voicetools_api_check_documentbase ($config->servername, $config->adminusername,$config->adminpassword,$CFG->wwwroot);
+
+ if ($config->servername{strlen($config->servername)-1} == '/')
+ {
+ error(get_String('trailingSlash', 'voicetools'), $_SERVER["HTTP_REFERER"]);
+ }
+
+ if (!preg_match('/^http:\/\//', $config->servername) && !preg_match('/^https:\/\//', $config->servername))
+ {
+ error(get_String('trailingHttp', 'voicetools'), $_SERVER["HTTP_REFERER"]);
+ }
+
+ //check if the api account filled is correct and allowed
+ $result = voicetools_api_check_documentbase ($config->servername, $config->adminusername,$config->adminpassword,$CFG->wwwroot);
- if ($result != 'is_allowed.true') {
- if(get_string($result, 'voicetools' )=="[[]]")
- error(get_string($result, 'voicetools' ), 'javascript:history.back();');
+ if ($result != "ok") {
+ if(get_string($result, 'voicetools' ) == "[[]]")//the error description is not in the bundle
+ error($result, 'javascript:history.back();');
else
- error($result, 'javascript:history.back();');
-
+ error(get_string($result, 'voicetools' ), 'javascript:history.back();');
}
- //get the error string and display it
-
-
-
- return;
}
function voicetools_add_instance($voicetool) {
@@ -82,78 +93,142 @@
/// will create a new instance and return the id number
/// of the new instance.
global $USER;
-
+ //get the resource information(type and id)
+ list($rid, $type) = explode(";", $voicetool->resource);
+
$voicetool->timemodified = time();
-list($rid, $type) = explode(";", $voicetool->resource);
-
$voicetool->rid=$rid;
- $name=get_string("$type","voicetools").$voicetool->name;
+ $voicetool->name=get_string("$type","voicetools").$voicetool->name;
+
+ if (!$voicetool->id = insert_record('voicetools', $voicetool)) {
+ return false;
+ }
- $voicetool->name=$name;
- if(!isset($voicetool->section))
- $voicetool->section=0;
- $instanceNumber=insert_record("voicetools", $voicetool);
- if($instanceNumber!=false ){
- add_to_log($voicetool->course, "voicetools", "Add activity", voicetools_send_logs("addInstance","voicetoolsId=".$instanceNumber), "Activity \"".$voicetool->name."\" added");
- }else{
- add_to_log($voicetool->course, "voicetools", "Add activity",voicetools_send_logs("errorAddInstance","voicetoolsId=".$instanceNumber), "Activity \"".$voicetool->name."\" added");
-
-
+ if(isset($voicetool->calendar_event) && $voicetool->calendar_event==true) {
+ voicetools_addCalendarEvent($voicetool);
}
- if($instanceNumber!=false && isset($voicetool->calendar_event) && $voicetool->calendar_event==true) {//no problem
- voicetools_addCalendarEvent($voicetool,$instanceNumber);
-
- }
- return $instanceNumber;
+ return $voicetool->id;
}
+function voicetools_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;
+
+ //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)) {
+ 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 ;
+}
-function voicetools_addCalendarEvent($informations,$instanceNumber){
- /// Basic event record for the database.
+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
+
+ return $result;
+}
+
+
+function voicetools_addCalendarEvent($activity_informations){
global $CFG;
+
+ //get some complementary of the resource
+ $resource=get_record('voicetools_resources','rid',$activity_informations->rid);
- $oldEvent=get_record('event','instance',$instanceNumber);
-
- $resource=get_record('voicetools_resources','rid',$informations->rid);
$event = new Object();
- $event->name = $informations->name;
- $event->description = $informations->description."<br><a href=".$CFG->wwwroot."/mod/voicetools/view.php?id=".$instanceNumber."&action=launchCalendar target=_self >".get_string("launch_calendar","voicetools").$resource->type." ...</a>";
-
+ $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 = $informations->course; //course event
+ $event->userid = 0;
+ $event->courseid = $activity_informations->course; //course event
$event->groupid = 0;
$event->modulename = 'voicetools';
- $event->instance = $instanceNumber;
+ $event->instance = $activity_informations->id;
$event->eventtype = '';
$event->visible = 1;
- if(isset($informations->start_month) && isset($informations->start_year)){//tpics
- $event->timestart = mktime($informations->start_hr,$informations->start_min,0,$informations->start_month,$informations->start_day,$informations->start_year);
- if( $event->timestart < time())
- {
- error(get_string("date_error","voicetools"),$_SERVER["HTTP_REFERER"]);
- }
- }
- else{
- $event->timestart = mktime($informations->start_hr,$informations->start_min,0,date('m',$informations->calendar_start),date('d',$informations->calendar_start),date('Y',$informations->calendar_start));
-
- }
-
+ $event->timemodified = time();
- $duration = $informations->duration_hr*3600 + $informations->duration_min*60;
- if ($duration < 0){
+ 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 {
+ else
+ {
$event->timeduration = $duration;
}
- $event->timemodified = time();
-
- if(!empty($oldEvent) && $oldEvent!=false) //old event exsit
+ if(!$oldEvent=get_record('event','instance',$activity_informations->id)) //old event exsit
{
$event->id = $oldEvent->id ;
$result=update_record('event', $event);
@@ -165,118 +240,34 @@
return $result;
}
+
function voicetools_deleteCalendarEvent($instanceNumber){
/// Basic event record for the database.
global $CFG;
- $oldEvent=get_record('event','instance',$instanceNumber);
- if(!empty($oldEvent) && $oldEvent!=false){
- $result=delete_records("event", "id", $oldEvent->id);
+ if(!$event=get_record('event','instance',$instanceNumber)){
+ return false;
}
- else
- {
- return false;
- }
- return $result;
-
-}
-
-function voicetools_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;
- if(!isset($voicetool->section))
- $voicetool->section=0;
- // Need to update the 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");
- }
+ $result=delete_records("event", "id", $event->id);
+}
- $old_section = $cm->section;
- //Find the right section in the course_section
- $section = get_record("course_sections", "id", $cm->section);
- //delete in the course section
- if (! delete_mod_from_section($cm->id, $cm->section)) {
-
- $result = false;
- //error("Could not delete the $mod->modulename from that section");
- }
- //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);
- $name=get_string("$type","voicetools").$voicetool->name;
- $voicetool->rid=$rid;
- $voicetool->name=$name;
- $instanceNumber=update_record("voicetools", $voicetool);
- if($instanceNumber!=false && isset($voicetool->calendar_event) && $voicetool->calendar_event==true) {//no problem
- voicetools_addCalendarEvent($voicetool,$voicetool->instance);
- } else{
- voicetools_deleteCalendarEvent($voicetool->instance);
-
- }
- add_to_log($voicetool->course, "voicetools", "Update activity",voicetools_send_logs("updateInstance","voicetoolsId=".$instanceNumber), "Activity ".$voicetool->name." has been updated with success");
-
- return $instanceNumber;
-}
-
-
-function voicetools_delete_instance($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.
- $result = true;
- if (! $voicetool = get_record("voicetools", "id", "$id")) {
-
+ if (! $voicetool = get_record("voicetools_resources", "rid", $rid)) {
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;
+ if (! delete_records("voicetools_resources", "id", "$voicetool->id")) {
+ return false;
}
- voicetools_deleteCalendarEvent("$voicetool->id");
- // delete the related calendar event
- return $result;
+ return true;
}
-
-function voicetools_delete_resource($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_resources", "rid", "$id")) {
- return false;
- }
-
- # Delete any dependent records here #
- if (! delete_records("voicetools_resources", "id", "$voicetool->id")) {
- $result = false;
- }
-
-
- return $result;
-}
-
function voicetools_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
@@ -388,42 +379,39 @@
/// Given an ID of an instance of this module,
/// this function will permanently delete the instance
/// 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)) {
-
+
# Delete any dependent records here #
- foreach($voicetools as $voicetool){
-
- //get the course_module instance linked to the liveclassroom instance
- if (! $cm = get_coursemodule_from_instance("voicetools", $voicetool->rid, $voicetool->course)) {
- error("Course Module ID was incorrect");
- }
- 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)");
- }
- if (! delete_records("voicetools_resources", "rid", $voicetool->rid)) {
- add_to_log($liveclassrooms->course, "voicetools", voicetools_send_logs("errorDeleteAlldb","rid=".$voicetool->id), "Delete all activities", "All activities associated to the vocie tools have not been deleted from the voice tools database");
- $result = false;
- }
- if (! delete_records("voicetools", "rid", $voicetool->rid)) {
- add_to_log($liveclassrooms->course, "voicetools", voicetools_send_logs("errorDeleteAlldb","rid=".$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;
- //notify("Could not delete the $mod->modulename from that section");
- }
+ 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");
+ }
+
+ 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;
+ }
+ }
+ }
- }
- }
-
-
return $result;
}
Modified: branches/team/Thomas/moodle/mod/voicetools/manageAction.php
===================================================================
--- branches/team/Thomas/moodle/mod/voicetools/manageAction.php 2008-01-22 23:54:29 UTC (rev 233)
+++ branches/team/Thomas/moodle/mod/voicetools/manageAction.php 2008-01-25 22:54:52 UTC (rev 234)
@@ -31,7 +31,7 @@
/* $Id: manageRoomAction.php 179 2007-01-11 15:25:54Z hugues $ */
/* This page manage the action create, update, delete for a room */
-error_reporting(E_ERROR);
+global $CFG;
require_once ('../../config.php');
require_once ('lib.php');
require_once ("lib/php/common/WimbaLib.php");
@@ -39,11 +39,15 @@
require_once ('lib/php/vt/WimbaVoicetools.php');
require_once ('lib/php/vt/WimbaVoicetoolsAPI.php');
require_once ('lib/php/vt/VtAction.php');
-global $CFG;
+
+
+
$messageProduct=optional_param("messageProduct","");
$messageAction=optional_param("messageAction","");
$notool=optional_param("novoicetools","false");
+$createWorkflow = optional_param('createWorkflow', $dddddd, PARAM_BOOL); // course
+
$keys=array_merge(getKeysOfGeneralParameters(),getKeyWimbaVoiceForm());
foreach($keys as $param){
$value=optional_param($param["value"],$param["default_value"],$param["type"]);
@@ -54,13 +58,14 @@
require_login($params["enc_course_id"]);
$vtAction = new vtAction($params);
-
$session = new WimbaMoodleSession($params);
-$messageType = "";
-if ($session->error == false && $session != NULL) {
+$redirectionUrl='welcome.php?id=' . $session->getCourseId() . '&' . $session->url_params . '&time=' . $session->timeOfLoad;
+$urlModuleForm=$CFG->wwwroot.'/course/mod.php?section=0&sesskey='.sesskey().'&id='.$session->getCourseId().'&add=voicetools&rid='.$rid;
+$messageType = "";
+if ($session->error == false && $session != NULL || $CFG->error==true) {
if ($params['action'] == 'launch') {
$session->setCurrentVtUSer($params["type"]);
if ($params["studentView"] == "true") {
@@ -69,105 +74,95 @@
$resource = voicetools_api_get_resource($params["resource_id"]);
$result = $vtAction->getVtSession($resource, $session->getVtUser(), $session->getVtUserRigths());
if ($result != NULL) {
- header('Location:' . $CFG->voicetools_servername . '/' . $params["type"] . '?action=display_popup&nid=' . $result->getNid());
+ redirection($CFG->voicetools_servername . '/' . $params["type"] . '?action=display_popup&nid=' . $result->getNid());
}
else {
- header('Location: welcome.php?id=' . $session->getCourseId() . '&' . $session->url_params . '&time=' . $session->timeOfLoad . '&error=problem_vt');
+ redirection($redirectionUrl.'&error=problem_vt');
}
- exit ();
-
}
- elseif ($params['action'] == 'create') {
- if ($params['type'] == "board") {
-
+ elseif ($params['action'] == 'create')
+ {
+ if ($params['type'] == "board")
+ {
$result = $vtAction->createBoard(); //create the resource on the vt
$messageAction = "created";
$messageProduct = "board";
}
- elseif ($params['type'] == "presentation") {
-
+ elseif ($params['type'] == "presentation")
+ {
$result = $vtAction->createPresentation();
$messageAction = "created";
$messageProduct = "presentation";
}
- elseif ($params['type'] == "pc") {
-
+ elseif ($params['type'] == "pc")
+ {
$result = $vtAction->createPodcaster();
$messageAction = "created";
$messageProduct = "pc";
}
- if ($result != NULL && $result->error != "error") {
+ if ($result != NULL && $result->error != "error")
+ {
$params["resource_id"] = storeResource($result->getRid(), $session->getCourseId(), $params['type'],$params["longname"], $params);
if (empty ($params["resource_id"])) {
-
error_log(__FUNCTION__ . " : Problem to add the new resource on the database", TRUE);
- header('Location: welcome.php?id=' . $session->getCourseId() . '&' . $session->url_params . '&time=' . $session->timeOfLoad . '&error=problem_bd');
- exit ();
+ redirection($redirectionUrl. '&error=problem_bd');
}
- // if(VTAPI_DEBUG) {
- error_log(__FUNCTION__ . " : Board Created and added on the database, rid=" . $result->getRid(), TRUE);
- //}
-
-
+ if(VTAPI_DEBUG) {
+ error_log(__FUNCTION__ . " : Board Created and added on the database, rid=" . $result->getRid(), TRUE);
+ }
}
- else {
+ else
+ {
error_log(__FUNCTION__ . " : Problem to add the new resource on the vt server", TRUE);
- header('Location: welcome.php?id=' . $session->getCourseId() . '&' . $session->url_params . '&time=' . $session->timeOfLoad . '&error=problem_vt');
-
- exit ();
+ redirection($redirectionUrl . '&error=problem_vt');
}
}
- elseif ($params['action'] == 'update') {
- if ($params['type'] == "board") {
-
+ elseif ($params['action'] == 'update')
+ {
+ if ($params['type'] == "board")
+ {
$result = $vtAction->modifyBoard($params["resource_id"]); //create the resource on the vt
$messageAction = "updated";
$messageProduct = "board";
}
- elseif ($params['type'] == "presentation") {
-
+ elseif ($params['type'] == "presentation")
+ {
$result = $vtAction->modifyPresentation($params["resource_id"]);
$messageAction = "updated";
$messageProduct = "presentation";
}
- elseif ($params['type'] == "pc") {
-
+ elseif ($params['type'] == "pc")
+ {
$result = $vtAction->modifyPodcaster($params["resource_id"]);
$messageAction = "updated";
$messageProduct = "pc";
}
- if ($result != NULL) {
-
-
+ if ($result != NULL)
+ {
//create the object to store in the db
$params["resource_id"] = updateResource($result->getRid(), $session->getCourseId(), $param['type'], $param, $params["resource_id"]);
- if (empty ($params["resource_id"])) {
-
+ if (empty ($params["resource_id"]))
+ {
error_log(__FUNCTION__ . " : Problem to update the resource on the database", TRUE);
- header('Location: welcome.php?id=' . $session->getCourseId() . '&' . $session->url_params . '&time=' . $session->timeOfLoad . '&error=problem_bd');
- exit ();
+ redirection($redirectionUrl . '&error=problem_bd');
}
- $messageType = $_GET['type'] . 'Updated';
+ $messageType = $params['type'] . 'Updated';
}
else {
error_log(__FUNCTION__ . " : Problem to update the resource on the vt server", TRUE);
- header('Location: welcome.php?id=' . $session->getCourseId() . '&' . $session->url_params . '&time=' . $session->timeOfLoad . '&error=problem_vt');
- exit ();
+ redirection($redirectionUrl . '&error=problem_vt');
}
}
-
- elseif ($params['action'] == 'delete') {
-
+ elseif ($params['action'] == 'delete')
+ {
$result = $vtAction->deleteRessource($params["resource_id"]);
-
if ($result != NULL && $result->error != "error") { //if no error during the creation
-
if (! voicetools_delete_all_instance_of_resource($params["resource_id"])) {
notify("Could not delete the activities for the vocietools:". $params["resource_id"]);
}
@@ -176,26 +171,23 @@
$messageProduct = $_GET["type"];
}
- }
+ }
- if (isset ($param["createWorkflow"]) && $param["createWorkflow"] == "true") {
-
+ if (isset($createWorkflow) && $createWorkflow == true)
+ {
if(!isset($result) )
$rid="";
else
$rid=$result->getRid();
- ?>
- <script>
- parent.location.href="<?php echo $CFG->wwwroot.'/course/mod.php?section=0&sesskey='.sesskey().'&id='.$session->getCourseId().'&add=voicetools&rid='.$rid; ?>"
- </script>
- <?
-
-
+ parentRedirection($urlModuleForm);
}
else
- header('Location: welcome.php?id='.$session->getCourseId() . '&' . $session->url_params . '&time=' . $session->timeOfLoad . '&messageAction=' . $messageAction. '&messageProduct=' .$messageProduct);
+ {
+ redirection($redirectionUrl . '&messageAction=' . $messageAction. '&messageProduct=' .$messageProduct);
+ }
}
-else {
- header('Location: welcome.php?id=' . $session->getCourseId() . '&' . $session->url_params . '&time=' . $session->timeOfLoad . '&error=session');
+else //bad session
+{
+ redirection($redirectionUrl . '&error=session');
}
?>
\ No newline at end of file
Modified: branches/team/Thomas/moodle/mod/voicetools/mod.html
===================================================================
--- branches/team/Thomas/moodle/mod/voicetools/mod.html 2008-01-22 23:54:29 UTC (rev 233)
+++ branches/team/Thomas/moodle/mod/voicetools/mod.html 2008-01-25 22:54:52 UTC (rev 234)
@@ -29,7 +29,7 @@
******************************************************************************/
/* $Id: mod.html 200 2008-01-09 11:37:50Z trollinger $ */
-error_reporting(E_ERROR);
+
require_once("../config.php");
require_once('lib/php/vt/WimbaVoicetoolsAPI.php');
require_once('lib/php/vt/WimbaVoicetools.php');
@@ -43,10 +43,10 @@
if (!isteacher($course->id, $USER->id)) { //to Be sure
error("You need to be a teacher in this course to create an instance");
}
-
+
//get the required parameters
-$id = optional_param('id', 0, PARAM_INT);
-$roomId = optional_param('roomId',null, PARAM_RAW);
+$course_id = optional_param('id', 0, PARAM_INT);
+$resource_id = optional_param('rid',null, PARAM_RAW);
$update = optional_param('update', null, PARAM_INT);
$sectionId = optional_param('section', null, PARAM_INT);
@@ -66,7 +66,7 @@
if (!isset($form->section)) {
$form->section = '';
}
-
+$error="";
$event=false;
$description="";
$stringDate="";
@@ -77,14 +77,14 @@
if (! $cmVT = get_record("course_modules", "id", $update)) {
return false;
}
- $activity = get_record("voicetools", "id", $cmVT->instance );
- $sectionId=$activity->section;
- $action = "update";
+ $activity = get_record("voicetools", "id", $cmVT->instance );
+ $sectionId=$activity->section;
+
+ $resource_id = $activity->rid;
- $id=$cmVT->course;//get the id of the course
- $event=liveclassroom_get_event_calendar($activity->id);
+ $event=voicetools_get_event_calendar($activity->id);
if($event==true)//no event
{
@@ -98,12 +98,12 @@
else
{//new
$checked ="checked";
-
$name="";
-}
+}
+
//manage the state of the calendar form
//it is disabled for the Introduction section (week 0) of a weekly course
-if($course->format == "week" && $sectionId != 0){
+if($course->format == "weeks" || $course->format == "weekscss" && $sectionId != 0){
$disabledCheckbox="disabled";
$disableAllElements="disabled";
$eventDate=mktime(0,0,0,1,date('z',$course->startdate)+($sectionId-1)*7+1,date('y',$course->startdate)) ;
@@ -114,8 +114,9 @@
$disabledCheckbox="";
$disableAllElements="";
}
-
+
+
// Visible to students or not
if ($form->coursemodule) {
$visible = get_field('course_modules', 'visible', 'id', $form->coursemodule);
@@ -133,6 +134,15 @@
if ($hiddensection) {
$visible = false;
}
+
+//get the list of resource available
+$resourcesRid= voicetools_get_voicetools_list($course->id);
+$vtResources=voicetools_api_get_resources($resourcesRid["rid"]);
+if($vtResources==null)
+{
+ $error=true;
+}
+
?>
<link rel="STYLESHEET" href="<?php p($CFG->wwwroot) ?>/mod/liveclassroom/css/StyleSheet.css"" type="text/css" />
@@ -145,26 +155,9 @@
margin:-5px;
}
-div.Table_01 {
- position:absolute;
- left:0px;
- top:0px;
- width:350px;
- height:150px;
- z-index: 50;
- font-family:Verdana;
- padding: 2px;
- margin: 2px;
- left: 40%;
- top: 30%;
- font-size:9px;
- display:none;
-
-
-}
</style>
-<script type="text/javascript">
-
+
+<script type="text/javascript">
//cookie management
function createCookie(name,value,days) {
if (days) {
@@ -234,13 +227,13 @@
function popupCancel(){
document.getElementById("popup").style.display="none";
document.getElementById("hiddenDiv").style.display="none";
- location.href = "<?php echo $CFG->wwwroot;?>/course/view.php?id=<?php p($id)?>";
+ location.href = "<?php echo $CFG->wwwroot;?>/course/view.php?id=<?php p($course_id)?>";
}
function popupOk(){
document.getElementById("popup").style.display="none";
document.getElementById("hiddenDiv").style.display="none";
- location.href = "<?php echo $CFG->wwwroot;?>/mod/voicetools/index.php?id=<?php echo $id;?>&createWorkflow=true";
+ location.href = "<?php echo $CFG->wwwroot;?>/mod/voicetools/index.php?id=<?php echo $course_id;?>&createWorkflow=true";
}
function LaunchCreateWorkflow(){
@@ -294,12 +287,12 @@
if(document.getElementById("description")!=null)
createCookie("description_disabled",document.getElementById("description").disabled);
- location.href = "<?php echo $CFG->wwwroot;?>/mod/voicetools/index.php?id=<?php echo $id;?>&createWorkflow=true";
+ location.href = "<?php echo $CFG->wwwroot;?>/mod/voicetools/index.php?id=<?php echo $course_id;?>&createWorkflow=true";
}
function hideCalendarEvent(value){
if(value=="check"){
- if( document.getElementById("calendar_event").checked==true)
+ if(document.getElementById("calendar_event").checked==true)
value="";
else
value="disabled";
@@ -409,7 +402,6 @@
deleteCookie("description");
deleteCookie("description_disabled");
}
- change();
}
function loadPage(){
@@ -423,451 +415,401 @@
<title>Wimba</title>
</head>
- <body>
- <div class="content" id=content width=700px align=center>
- <form name="form" id="form" method="post" action="mod.php">
- <input type="hidden" value="" name="type">
+<body>
+ <div class="content" id=content width=700px align=center>
+ <form name="form" id="form" method="post" action="mod.php">
+ <input type="hidden" value="" name="type">
- <div id="headerBar" width=700px align=center>
- <table cellspacing="0" cellpadding="0" width=700px align=center>
+ <div id="headerBar" width=700px align=center>
+ <table cellspacing="0" cellpadding="0" width=700px align=center>
+ <tr>
+ <td class="headerBarLeft" align="left">
+ <img alt="" src="<?php echo $CFG->wwwroot;?>/mod/voicetools/lib/web/pictures/items/headerbar-logo.png">
+ </td>
+ <td align="right" class="headerBarRight">
+ </td>
+ </tr>
+ </table>
+ </div>
+ <div id="contextBar" width=700px align=center>
+ <table width=700px align=center>
+ <tbody>
<tr>
- <td class="headerBarLeft" align="left">
- <img alt="" src="<?php echo $CFG->wwwroot;?>/mod/voicetools/lib/web/pictures/items/headerbar-logo.png">
- </td>
-
- <td align="right" class="headerBarRight">
+ <td class="contextBarLeft" align="left">
+ <label class= "nameElement"><?php print_string('addactivity', 'voicetools') ?></label>
+ <label class="nameTools">: Voice Tools in <?php echo $course->fullname; ?></label>
</td>
+ <td class="contextBarRight" align="right">Voice Tools</td>
</tr>
- </table>
- </div>
- <div id="contextBar" width=700px align=center>
- <table width=700px align=center>
- <tbody>
- <tr>
- <td class="contextBarLeft" align="left"><label class= "nameElement"><?php print_string('addactivity', 'voicetools') ?></label>
- <label class="nameTools">: Voice Tools in<?php echo $course->fullname; ?></label>
- </td>
-
- <td class="contextBarRight" align="right">Voice Tools</td>
- </tr>
- </tbody>
- </table>
- </div>
- <div id="activity" width="700px" align=center>
- <table border="0" width="700px" align=center cellpadding="5" cellspacing="0">
- <tr valign="top">
- <td align="right">
- <font color="red">*</font> <font class="fontCurrent"><?php print_string('activity_name', 'voicetools') ?></font>
- </td>
- <td align="left">
- <input type="text" id="name" name="name" size="25" value="<?php echo $name ?>">
- </td>
- <td colspan="2">
- <font color="red">*</font><font class="fontCurrent"><?php print_string('required_fields', 'voicetools')?></font>
- </td>
- </tr>
-
- <tr valign="top">
- <?php
- if($course->format == "weeks" || $course->format == "weekscss"){
- ?>
- <td align="right">
- <font class="fontCurrent"><?php print_string('weeksformat', 'voicetools')?></font>
- </td>
- <td align="left">
- <select name="section" id="section" onchange="change()">
- <?php
- echo getListOfWeeks($course,$sectionId);
- ?>
- </select>
- </td>
- </tr>
- <?php
- }else if($course->format == "topics" ){
+ </tbody>
+ </table>
+ </div>
+ <div id="activity" width="700px" align=center>
+ <table border="0" width="700px" align=center cellpadding="5" cellspacing="0">
+ <tr valign="top">
+ <td align="right">
+ <font color="red">*</font> <font class="fontCurrent"><?php print_string('activity_name', 'voicetools') ?></font>
+ </td>
+ <td align="left">
+ <input type="text" id="name" name="name" size="25" value="<?php echo $name ?>">
+ </td>
+ <td colspan="2">
+ <font color="red">*</font><font class="fontCurrent"><?php print_string('required_fields', 'voicetools')?></font>
+ </td>
+ </tr>
+ <?php if($course->format == "weeks" || $course->format == "weekscss"){ ?>
+ <tr valign="top">
+ <td align="right">
+ <font class="fontCurrent"><?php print_string('weeksformat', 'voicetools')?></font>
+ </td>
+ <td align="left">
+ <select name="section" id="section" onchange="change()">
+ <?php
+ echo getListOfWeeks($course,$sectionId);
+ ?>
+ </select>
+ </td>
+ </tr>
+ <?php }else if($course->format == "topics" ){ ?>
+ <tr valign="top">
+ <td align="right">
+ <font class="fontCurrent"><?php print_string('topicformat', 'voicetools') ?></font>
+ </td>
+ <td colspan="2" align="left">
+ <select name="section" id="section">
+ <?php echo getListOfTopics($course,$sectionId); ?>
+ </select>
+ </td>
+ </tr>
+ <?php } ?>
+ <tr valign="top">
+ <td align="right">
+ <font color="red">*</font><?php print_string('voicetoolstype', 'voicetools')?>
+ </td>
- ?>
- <tr valign="top">
- <td align="right">
- <font class="fontCurrent"><?php print_string('topicformat', 'voicetools') ?></font>
- </td>
- <td colspan="2" align="left">
- <select name="section" id="section">
- <?php
- echo getListOfTopics($course,$sectionId);
- ?>
- </select>
- </td>
- </tr>
- <?php } ?>
- </tr>
- <tr valign="top">
- <td align="right"><font color="red">*</font><font class="fontCurrent"><?php print_string('voicetoolstype', 'voicetools')?></font></td>
+ <td align="left"><select id="resource" name="resource">
+ <option value="empty">
+ Select...
+ </option>
+ <optgroup label="<?php echo get_string ('voiceboard', 'voicetools') ?>">
+ <?php
+ for($i=0;$vtResources!=null && $i<count($vtResources->getResources()) ;$i++) {
+ $resource = $vtResources->getResource($i);
+ if($resource->getType()=="board"){
+ if (isset($resource_id) && $resource_id == $resource->getRid())
+ {
+ echo "<option value=".$resource->getRid().";".$resource->getType()." selected >".((strlen($resource->getTitle())>25)?substr($resource->getTitle(),0,25)."...":$resource->getTitle())."</option>" ;
+ }
+ else
+ {
+ echo "<option value=".$resource->getRid().";".$resource->getType().">".((strlen($resource->getTitle())>25)?substr($resource->getTitle(),0,25)."...":$resource->getTitle())."</option>" ;
+ }
+ }
- <td align="left"><select id="resource" name="resource">
- <option value="empty">
- Select...
- </option>
+ }
+ ?>
+ </optgroup>
+ <optgroup label="<?php echo get_string ('voicepresentation', 'voicetools') ?>">
+ <?php
+ for($i=0;$vtResources!=null && $i<count($vtResources->getResources());$i++) {
+ $resource = $vtResources->getResource($i);
+ if($resource->getType()=="presentation"){
- <optgroup label="<?php echo get_string ('voiceboard', 'voicetools') ?>">
- <?php
-
- $resourcesRid= voicetools_get_voicetools_list($course->id);
- $vtResources=voicetools_api_get_resources($resourcesRid["rid"]);
- if($vtResources==null)
- {
- $error=true;
- }
- for($i=0;$vtResources!=null && $i<count($vtResources->getResources()) ;$i++) {
- $resource = $vtResources->getResource($i);
- if($resource->getType()=="board"){
+ if (isset($resource_id) && $resource_id == $resource->getRid())
+ {
+ echo "<option value=".$resource->getRid().";".$resource->getType()." selected >".((strlen($resource->getTitle())>25)?substr($resource->getTitle(),0,25)."...":$resource->getTitle())."</option>" ;
+ }
+ else
+ {
+ echo "<option value=".$resource->getRid().";".$resource->getType().">".((strlen($resource->getTitle())>25)?substr($resource->getTitle(),0,25)."...":$resource->getTitle())."</option>" ;
+ }
+ }
- if (isset($_GET["rid"]) || (isset($action) && $action=="update"))
- {
- if((isset($_GET["rid"]) && $_GET["rid"] == $resource->getRid()) || (isset($activity) && $activity->rid == $resource->getRid()) ) {
- echo "<option value=".$resource->getRid().";".$resource->getType()." selected >".((strlen($resource->getTitle())>25)?substr($resource->getTitle(),0,25)."...":$resource->getTitle())."</option>" ;
- }
- else{
- echo "<option value=".$resource->getRid().";".$resource->getType().">".((strlen($resource->getTitle())>25)?substr($resource->getTitle(),0,25)."...":$resource->getTitle())."</option>" ;
- }
- }
- else
- {
- echo "<option value=".$resource->getRid().";".$resource->getType().">".((strlen($resource->getTitle())>25)?substr($resource->getTitle(),0,25)."...":$resource->getTitle())."</option>" ;
- }
- }
+ }
+ ?>
+ </optgroup>
- }
-
- ?>
- </optgroup>
+ <optgroup label="<?php echo get_string ('podcaster', 'voicetools') ?>">
+ <?php
+ for($i=0;$vtResources!=null && $i<count($vtResources->getResources());$i++) {
+ $resource = $vtResources->getResource($i);
+ if($resource->getType()=="pc"){
- <optgroup label="<?php echo get_string ('voicepresentation', 'voicetools') ?>">
- <?php
- for($i=0;$vtResources!=null && $i<count($vtResources->getResources());$i++) {
- $resource = $vtResources->getResource($i);
- if($resource->getType()=="presentation"){
+ if (isset($resource_id) && $resource_id == $resource->getRid())
+ {
+ echo "<option value=".$resource->getRid().";".$resource->getType()." selected >".((strlen($resource->getTitle())>25)?substr($resource->getTitle(),0,25)."...":$resource->getTitle())."</option>" ;
+ }
+ else
+ {
+ echo "<option value=".$resource->getRid().";".$resource->getType().">".((strlen($resource->getTitle())>25)?substr($resource->getTitle(),0,25)."...":$resource->getTitle())."</option>" ;
+ }
+ }
- if (isset($_GET["rid"]) || (isset($action) && $action=="update"))
- {
- if((isset($_GET["rid"]) && $_GET["rid"] == $resource->getRid()) || (isset($activity) && $activity->rid == $resource->getRid()) ) {
- echo "<option value=".$resource->getRid().";".$resource->getType()." selected >".((strlen($resource->getTitle())>25)?substr($resource->getTitle(),0,25)."...":$resource->getTitle())."</option>" ;
- }
- else{
- echo "<option value=".$resource->getRid().";".$resource->getType().">".((strlen($resource->getTitle())>25)?substr($resource->getTitle(),0,25)."...":$resource->getTitle())."</option>" ;
- }
- }
- else
- {
- echo "<option value=".$resource->getRid().";".$resource->getType().">".((strlen($resource->getTitle())>25)?substr($resource->getTitle(),0,25)."...":$resource->getTitle())."</option>" ;
- }
- }
+ }
+ ?>
+ </optgroup>
+ </select>
+ </td>
- }
- ?>
- </optgroup>
-
- <optgroup label="<?php echo get_string ('podcaster', 'voicetools') ?>">
- <?php
- for($i=0;$vtResources!=null && $i<count($vtResources->getResources());$i++) {
- $resource = $vtResources->getResource($i);
- if($resource->getType()=="pc"){
-
- if (isset($_GET["rid"]) || (isset($action) && $action=="update"))
- {
- if((isset($_GET["rid"]) && $_GET["rid"] == $resource->getRid()) || (isset($activity) && $activity->rid == $resource->getRid()) ) {
- echo "<option value=".$resource->getRid().";".$resource->getType()." selected >".((strlen($resource->getTitle())>25)?substr($resource->getTitle(),0,25)."...":$resource->getTitle())."</option>" ;
- }
- else{
- echo "<option value=".$resource->getRid().";".$resource->getType().">".((strlen($resource->getTitle())>25)?substr($resource->getTitle(),0,25)."...":$resource->getTitle())."</option>" ;
- }
- }
- else
- {
- echo "<option value=".$resource->getRid().";".$resource->getType().">".((strlen($resource->getTitle())>25)?substr($resource->getTitle(),0,25)."...":$resource->getTitle())."</option>" ;
- }
- }
-
- }
- ?>
- </optgroup>
- </select>
- </td>
-
- <td width="50px"><?php print_string('or', 'voicetools')?></td>
- <td>
- <input type="button" value="<?php print_string('new', 'voicetools')?>" onclick="javascript:LaunchCreateWorkflow()">
- </td>
- </tr>
- <tr valign="top" >
- <td align="right">
- <font class="fontCurrent"><?php echo get_string('visibletostudents','voicetools'); ?></font>
- </td>
- <td align="left" >
- <?php
- unset($choices);
- $choices[1] = get_string('show');
- $choices[0] = get_string('hide');
- choose_from_menu($choices, 'visible', $visible, '', '', 0, false, $hiddensection);
- ?>
- </td>
- </tr>
- <tr>
- <td height="30px">
- </td>
- </tr>
- <tr>
- <td align="right" colspan="2" width="500px">
- <div id="calendar">
- <table cellpadding=5 cellspacing="5" width="100%" >
- <tr>
- <td align=right>
- <input type="checkbox" value="true" id="calendar_event" name="calendar_event" onclick=hideCalendarEvent("check") <?php echo $checked." ".$disabledCheckbox ?>>
- <font class="fontCurrent"><?php echo get_string ('add_calendar', 'voicetools') ?></font>
- </td>
- </tr>
-
- <tr>
- <td align=right style="width:200px">
- <?php
- if($course->format == "weeks" || $course->format == "weekscss"){?>
- <select style="float:left" id="start_day" name= "start_day" onchange="change()" <?php echo $disableAllElements ?>>
- <?php
- for($i=0;$i<7;$i++){
- if($event==false && $i==0 || $event!=false && date('w',$event->timestart)==date('w',$i*86400+$course->startdate))
- echo "<option value=".($i*86400)." selected>".get_string("day".date('w',$i*86400+$course->startdate),"voicetools")."</option>";
- else
- echo "<option value=".($i*86400).">".get_string("day".date('w',(($i*86400)+$course->startdate)),"voicetools")."</option>";
- }
- ?>
- </select>
- <label id="comment_date"><?php echo $stringDate;?></label>
-
- <?
- }else if($course->format == "topics" || $course->format == "social" || $course->format == "site"){?>
- <select id="start_month" name="start_month" <?php echo $disableAllElements ?>>
- <?php
- for($i=1;$i<=12;$i++){
- if($event==false && $i==date('m') || $event!=false && date('m',$event->timestart)==$i)
- echo "<option value=".$i." selected>".get_string("month".$i,"voicetools")."</option>";
- else
- echo "<option value=".$i.">".get_string("month".$i,"voicetools")."</option>";
- }
- ?>
- </sel...
[truncated message content] |