[Hw4mdl-svn] SF.net SVN: hw4mdl: [100] trunk/moodle/mod/voicetool
Brought to you by:
jhlinder,
trollinger
|
From: <sh...@us...> - 2006-11-24 15:32:00
|
Revision: 100
http://svn.sourceforge.net/hw4mdl/?rev=100&view=rev
Author: shazan
Date: 2006-11-24 07:31:35 -0800 (Fri, 24 Nov 2006)
Log Message:
-----------
Add new files to generate the list of Voice Tools and to choose the different types of products
Modified Paths:
--------------
trunk/moodle/mod/voicetool/index.php
trunk/moodle/mod/voicetool/lib.php
trunk/moodle/mod/voicetool/mod.html
trunk/moodle/mod/voicetool/view.php
trunk/moodle/mod/voicetool/voicetoolapi.php
Added Paths:
-----------
trunk/moodle/mod/voicetool/displayChoicePage.php
trunk/moodle/mod/voicetool/generateListPanel.php
trunk/moodle/mod/voicetool/welcome.php
Added: trunk/moodle/mod/voicetool/displayChoicePage.php
===================================================================
--- trunk/moodle/mod/voicetool/displayChoicePage.php (rev 0)
+++ trunk/moodle/mod/voicetool/displayChoicePage.php 2006-11-24 15:31:35 UTC (rev 100)
@@ -0,0 +1,175 @@
+<?PHP
+
+/******************************************************************************
+ * *
+ * Copyright (c) 1999-2006 Horizon Wimba, All Rights Reserved. *
+ * *
+ * COPYRIGHT: *
+ * This software is the property of Horizon Wimba. *
+ * You can redistribute it and/or modify it under the terms of *
+ * the GNU General Public License as published by the *
+ * Free Software Foundation. *
+ * *
+ * WARRANTIES: *
+ * This software is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+ * GNU General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU General Public License *
+ * along with the Horizon Wimba Moodle Integration; *
+ * if not, write to the Free Software Foundation, Inc., *
+ * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA *
+ * *
+ * Author: Hazan Samy *
+ * *
+ * Date: October 2006 *
+ * *
+ ******************************************************************************/
+
+/* $Id$ */
+
+
+ require_once("../../config.php");
+ require_once("lib.php");
+ // require_once("api.php");
+
+ // Variables needed
+ global $CFG;
+
+ if(empty($_POST)){
+ $params = $_GET;
+ }
+ else $params = $_POST;
+
+
+ //print_r($params);
+ $courseid = $params['enc_course_id'];
+ add_to_log("", "voicetool", "view", "test", $courseid);
+ // echo $courseid;
+/*
+
+ if(isteacher($courseid, $USER->id) ) {
+ $userid = liveclassroom_api_get_teacher_user_id($courseid);
+ $isteacher = 1;
+
+ }
+ else if (isstudent($courseid) ) {
+
+ $userid = liveclassroom_api_get_student_user_id($courseid);
+ $isteacher = 0;
+
+ }
+
+ if (!liveclassroom_init_session($params)) {
+ error("ExpiredSessionException");
+ }
+*/
+
+ $xmldoc = new DomDocument();
+
+ $root = $xmldoc->createElement('root');
+
+ $root->appendChild(voicetool_get_session_params($xmldoc,$params));
+
+ $windows = $xmldoc->createElement('windows');
+
+ //HEADER BAR
+ $windows->appendChild(voicetool_create_headerbar($xmldoc));
+
+ // NEW BOARD
+ $productChoice = $xmldoc->createElement('windowsElement');
+ $productChoicetype = $xmldoc->createElement('type');
+ $productChoicetype->appendChild($xmldoc->createTextNode("productChoice"));
+ $productChoice->appendChild($productChoicetype);
+
+ $productChoiceElementParameters = $xmldoc->createElement("windowsElementParameters");
+
+ $productInfo = $xmldoc->createElement('productInformations');
+
+ $action = $xmldoc->createElement('action');
+
+ $actionName = $xmldoc->createElement('name');
+ $actionName->appendChild($xmldoc->createTextNode("gaga.php"));
+ $action->appendChild($actionName);
+
+ $productParameters = $xmldoc->createElement('parameters');
+ $productParameter = $xmldoc->createElement('parameter');
+ $productParameter->appendChild($xmldoc->createTextNode("test=2"));
+ $productParameters->appendChild($productParameter);
+ $action->appendChild($productParameters);
+
+ $productInfo->appendChild($action);
+
+ $pictureUrl = $xmldoc->createElement('pictureUrl');
+ $pictureUrl->appendChild($xmldoc->createTextNode("pictures/buttons/new-createvoiceboard.png"));
+ $productInfo->appendChild($pictureUrl);
+
+ $value = $xmldoc->createElement('value');
+ $value->appendChild($xmldoc->createTextNode("New Board"));
+ $productInfo->appendChild($value);
+
+ $description = $xmldoc->createElement('description');
+ $description->appendChild($xmldoc->createTextNode(get_string('newVoiceBoard', 'voicetool')));
+ $productInfo->appendChild($description);
+
+ $productChoiceElementParameters->appendChild($productInfo);
+
+ $productChoice->appendChild($productChoiceElementParameters);
+
+ $windows->appendChild($productChoice);
+
+ // NEW PRESENTATION
+ $productPresentation = $xmldoc->createElement('windowsElement');
+ $productPresentationtype = $xmldoc->createElement('type');
+ $productPresentationtype->appendChild($xmldoc->createTextNode("productChoice"));
+ $productPresentation->appendChild($productPresentationtype);
+
+ $productPresentationElementParameters = $xmldoc->createElement("windowsElementParameters");
+
+ $productPresentationInfo = $xmldoc->createElement('productInformations');
+
+ $productPresentationaction = $xmldoc->createElement('action');
+
+ $productPresentationactionName = $xmldoc->createElement('name');
+ $productPresentationactionName->appendChild($xmldoc->createTextNode("gaga.php"));
+ $productPresentationaction->appendChild($productPresentationactionName);
+
+ $productPresentationproductParameters = $xmldoc->createElement('parameters');
+ $productPresentationproductParameter = $xmldoc->createElement('parameter');
+ $productPresentationproductParameter->appendChild($xmldoc->createTextNode("test=2"));
+ $productPresentationproductParameters->appendChild($productPresentationproductParameter);
+ $productPresentationaction->appendChild($productPresentationproductParameters);
+
+ $productPresentationInfo->appendChild($productPresentationaction);
+
+ $productPresentationpictureUrl = $xmldoc->createElement('pictureUrl');
+ $productPresentationpictureUrl->appendChild($xmldoc->createTextNode("pictures/buttons/new-createvoicepresentation.png"));
+ $productPresentationInfo->appendChild($productPresentationpictureUrl);
+
+ $productPresentationvalue = $xmldoc->createElement('value');
+ $productPresentationvalue->appendChild($xmldoc->createTextNode("New Presentation"));
+ $productPresentationInfo->appendChild($productPresentationvalue);
+
+ $productPresentationdescription = $xmldoc->createElement('description');
+ $productPresentationdescription->appendChild($xmldoc->createTextNode(get_string('newVoicePresentation', 'voicetool')));
+ $productPresentationInfo->appendChild($productPresentationdescription);
+
+ $productPresentationElementParameters->appendChild($productPresentationInfo);
+
+ $productPresentation->appendChild($productPresentationElementParameters);
+
+ //---------
+
+ $windows->appendChild($productPresentation);
+
+ $root->appendChild($windows);
+
+ $xmldoc->appendChild($root);
+ $xmldoc->save('choice.xml');
+
+ $xmlstring = $xmldoc->saveXML(); // Xml datas into a string
+
+ $finalstring = str_replace("\n", '', $xmlstring);
+ echo $xmlstring;
+?>
\ No newline at end of file
Property changes on: trunk/moodle/mod/voicetool/displayChoicePage.php
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Name: svn:keywords
+ Date Revision Author Id
Name: svn:eol-style
+ native
Added: trunk/moodle/mod/voicetool/generateListPanel.php
===================================================================
--- trunk/moodle/mod/voicetool/generateListPanel.php (rev 0)
+++ trunk/moodle/mod/voicetool/generateListPanel.php 2006-11-24 15:31:35 UTC (rev 100)
@@ -0,0 +1,154 @@
+<?PHP
+
+/******************************************************************************
+ * *
+ * Copyright (c) 1999-2006 Horizon Wimba, All Rights Reserved. *
+ * *
+ * COPYRIGHT: *
+ * This software is the property of Horizon Wimba. *
+ * You can redistribute it and/or modify it under the terms of *
+ * the GNU General Public License as published by the *
+ * Free Software Foundation. *
+ * *
+ * WARRANTIES: *
+ * This software is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+ * GNU General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU General Public License *
+ * along with the Horizon Wimba Moodle Integration; *
+ * if not, write to the Free Software Foundation, Inc., *
+ * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA *
+ * *
+ * Author: Hazan Samy *
+ * *
+ * Date: October 2006 *
+ * *
+ ******************************************************************************/
+
+/* $Id$ */
+
+/// This page is to generate the list of VT
+
+ require_once("../../config.php");
+ require_once("lib.php");
+ // require_once("api.php");
+
+ // Variables needed
+ global $CFG;
+
+ if(empty($_POST)){
+ $params = $_GET;
+ }
+ else $params = $_POST;
+
+
+ //print_r($params);
+ $courseid = $params['enc_course_id'];
+ add_to_log("", "voicetool", "view", "test", $courseid);
+ // echo $courseid;
+/*
+
+ if(isteacher($courseid, $USER->id) ) {
+ $userid = liveclassroom_api_get_teacher_user_id($courseid);
+ $isteacher = 1;
+
+ }
+ else if (isstudent($courseid) ) {
+
+ $userid = liveclassroom_api_get_student_user_id($courseid);
+ $isteacher = 0;
+
+ }
+
+ if (!liveclassroom_init_session($params)) {
+ error("ExpiredSessionException");
+ }
+*/
+
+ $xmldoc = new DomDocument();
+
+ $root = $xmldoc->createElement('root');
+
+ $root->appendChild(voicetool_get_session_params($xmldoc,$params));
+
+ $windows = $xmldoc->createElement('windows');
+
+ //HEADER BAR
+ $windows->appendChild(voicetool_create_headerbar($xmldoc));
+
+
+ //TOOL BAR
+ $toolbar = $xmldoc->createElement('windowsElement');
+ $tbtype = $xmldoc->createElement('type');
+ $tbtype->appendChild($xmldoc->createTextNode("toolBar"));
+ $toolbar->appendChild($tbtype);
+
+ $tbelementParameters = $xmldoc->createElement("windowsElementParameters");
+
+ $menubar = $xmldoc->createElement('menuElements');
+
+ $menubar->appendChild(voicetool_create_menu_element($xmldoc,'false', 'button', 'all', 'all', 'pictures/buttons/toolbar-launch', 'Launch', 'Launch()', ''));
+ $menubar->appendChild(voicetool_create_menu_element($xmldoc,'true', 'button', 'instructor', 'all', 'pictures/buttons/toolbar-new', 'New', "launchAjaxRequest('displayChoicePage.php','Management','new','true')", ''));
+ //separator
+ $menubar->appendChild(voicetool_create_menu_element($xmldoc,'true', 'fixSpace', 'all', 'all', '', '', '', '', ''));
+ $menubar->appendChild(voicetool_create_menu_element($xmldoc,'false', 'button', 'instructor', 'all', 'pictures/buttons/toolbar-activities', 'Add Activity', "doOpenAddActivity('../../course/mod.php','add=liveclassroom')",''));
+ $menubar->appendChild(voicetool_create_menu_element($xmldoc,'false','button', 'instructor', 'all', 'pictures/buttons/toolbar-settings', 'Settings', "launchAjaxRequest('generateSettings.php','Management','update','false')", ''));
+ $menubar->appendChild(voicetool_create_menu_element($xmldoc,'false','button', 'instructor', 'all', 'pictures/buttons/toolbar-delete', 'Delete', 'doDelete()', ''));
+ $menubar->appendChild(voicetool_create_menu_element($xmldoc,'true', 'fixSpace', 'all', 'all', '', '', '', '', ''));
+ $menubar->appendChild(voicetool_create_menu_element($xmldoc,'true','search', 'all','all', "", "", "", "",""));
+
+ $tbelementParameters->appendChild($menubar);
+ $toolbar->appendChild($tbelementParameters);
+
+ $windows->appendChild($toolbar);
+ /*
+ // MESSAGE BAR
+ if (isset($params['messageType'])) {
+ $windows->appendChild(liveclassroom_create_message($xmldoc, 'info', liveclassroom_get_message($params['messageType'])));
+ }
+ */
+ // LIST
+
+ $list = $xmldoc->createElement('windowsElement');
+ $typeWindowsElement = $xmldoc->createElement('type');
+ $typeWindowsElement->appendChild($xmldoc->createTextNode("list"));
+ $list->appendChild($typeWindowsElement);
+
+ $elementParameters = $xmldoc->createElement('windowsElementParameters');
+
+ $products = $xmldoc->createElement('products');
+
+ // LIST PRODUCTS
+
+ $listProducts = $xmldoc->createElement('listProducts');
+
+ $listProducts->appendChild(voicetool_create_product_information($xmldoc,'1','','productType','Voice Boards'));
+ $listProducts->appendChild(voicetool_create_product_information($xmldoc,'2','','productType','Voice Presentations'));
+
+ $products->appendChild($listProducts);
+
+
+ // PRODUCTS CONTENT
+ $productContent = $xmldoc->createElement('productsContent');
+ $productContent->appendChild(voicetool_xml_list_voice_board($xmldoc,$courseid));
+
+ $products->appendChild($productContent);
+
+ $elementParameters->appendChild($products);
+
+ $list->appendChild($elementParameters);
+
+ $windows->appendChild($list);
+
+ $root->appendChild($windows);
+
+ $xmldoc->appendChild($root);
+ $xmldoc->save('list.xml');
+ $xmlstring = $xmldoc->saveXML(); // Xml datas into a string
+
+ $finalstring = str_replace("\n", '', $xmlstring);
+ echo $xmlstring;
+
+?>
\ No newline at end of file
Property changes on: trunk/moodle/mod/voicetool/generateListPanel.php
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Name: svn:keywords
+ Date Revision Author Id
Name: svn:eol-style
+ native
Modified: trunk/moodle/mod/voicetool/index.php
===================================================================
--- trunk/moodle/mod/voicetool/index.php 2006-11-23 16:30:56 UTC (rev 99)
+++ trunk/moodle/mod/voicetool/index.php 2006-11-24 15:31:35 UTC (rev 100)
@@ -30,11 +30,12 @@
/// This page lists all the instances of voicetools in a particular course
- require_once("../../config.php");
+ require_once("../../config.php");
require_once("lib.php");
- require_variable($id); // course
-
+ $id = optional_param('id', 0, PARAM_INT); // course
+ //$course = optional_param('course', 0, PARAM_INT);
+ $course = optional_param('course', 0, PARAM_INT);
if (! $course = get_record("course", "id", $id)) {
error("Course ID is incorrect");
}
@@ -60,51 +61,42 @@
/// Get all the appropriate data
- if (! $voicetools = get_all_instances_in_course("voicedirect", $course)) {
+ if (! $voicetools = get_all_instances_in_course("voicetool", $course)) {
notice("There are no voicetools", "../../course/view.php?id=$course->id");
die;
}
+
+ global $CFG;
-/// Print the list of instances (your module will probably extend this)
+
+ $url = voicetool_get_url_params($course->id);
+
+?>
- $timenow = time();
- $strname = get_string("name");
- $strweek = get_string("week");
- $strtopic = get_string("topic");
+ <head>
+ </head>
+<br>
+<body>
+<br>
- 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");
- }
+<div align="center">
+ <table height="95%">
+ <iframe src="welcome.php?id=<?php echo $id; ?>&<?php echo $url; ?>&time=<?php echo time() ?>" width="800" height="400" name="frameWidget" FRAMEBORDER=0 align="middle">
+ <p>Sorry your navigator can't display this iframe
- 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>";
- }
+ </iframe>
+</table>
+</div>
+
+</body>
- 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);
+<?php
+/// Finish the page
+
+ print_footer($course);
?>
Modified: trunk/moodle/mod/voicetool/lib.php
===================================================================
--- trunk/moodle/mod/voicetool/lib.php 2006-11-23 16:30:56 UTC (rev 99)
+++ trunk/moodle/mod/voicetool/lib.php 2006-11-24 15:31:35 UTC (rev 100)
@@ -29,7 +29,8 @@
/* $Id$ */
require_once ('voicetoolapi.php');
-
+require_once($CFG->libdir.'/datalib.php');
+require_once($CFG->dirroot.'/course/lib.php');
/// Library of functions and constants for module voicetool
@@ -242,7 +243,7 @@
$result = new PairSet ();
- $result->addNameValuePair ('type', $VT_API_VDIRECT);
+ $result->addNameValuePair ('type', 'board');
$result->addNameValuePair ('title', $voicetool->name);
$result->addNameValuePair ('description', $voicetool->description);
$result->addNameValuePair ('email', $voicetool->email);
@@ -284,10 +285,10 @@
$rights = new PairSet ();
if (isteacher($voicetool->course)) {
- $rights->addNameValuePair ('profile', 'blackboard.voicetool.instructor');
+ $rights->addNameValuePair ('profile', 'moodle.voicetool.instructor');
}
else {
- $rights->addNameValuePair ('profile', 'blackboard.voicetool.student');
+ $rights->addNameValuePair ('profile', 'moodle.voicetool.student');
}
return array ('user' => $user->getData(),
@@ -296,4 +297,309 @@
'rights' => $rights->getData() );
}
-?>
+/**
+ * List all the board for the course given
+ * @param $courseId - the current course id
+ * @return the list of boards
+ */
+function voicetool_get_voiceBoard_list($courseId) {
+
+ if(!($board_list = get_records('voicetool','course',$courseId))) {
+ error( "Response get_board_list : query to database failed");
+ }
+ $result = array();
+ foreach($board_list as $board) {
+
+ if ($board->type == "board") array_push($result, $board);
+
+ }
+
+ return $result;
+}
+
+/**
+ * List all the voice direct for the course given
+ * @param $courseId - the current course id
+ * @return the list of voice direct
+ */
+function voicetool_get_voicePresentation_list($courseId) {
+
+ if(!($voicedirect_list = get_records('voicetool','course',$courseId))) {
+ error( "Response get_voicedirect_list : query to database failed");
+ }
+ $result = array();
+ foreach($voicedirect_list as $presentation) {
+
+ if ($presentation->type == "presentation") array_push($result, $presentation);
+
+ }
+ return $result;
+
+}
+
+function voicetool_get_all_tools_list($courseId) {
+
+ if(!($voicedirect_list = get_records('voicetool','course',$courseId))) {
+ error( "Response get_voicedirect_list : query to database failed");
+ }/*
+ $result = array();
+ foreach($voicedirect_list as $presentation) {
+
+ if ($presentation->type == "presentation") array_push($result, $presentation);
+
+ }*/
+ return $voicedirect_list;
+
+}
+
+
+/*
+* Create a header bar element
+*
+* @param $xmldoc : the DOM document
+*
+* Return a DOM document element which represent the header bar
+**/
+function voicetool_create_headerbar($xmldoc){
+ $headerbar = $xmldoc->createElement('windowsElement');
+
+ $hbtype = $xmldoc->createElement('type');
+ $hbtype->appendChild($xmldoc->createTextNode("headerBar"));
+ $headerbar->appendChild($hbtype);
+ $hbelementParameters = $xmldoc->createElement("windowsElementParameters");
+ $headerbarinformations = $xmldoc->createElement("headerBarInformations");
+ $hbstyle = $xmldoc->createElement("style");
+ $hbstyle->appendChild($xmldoc->createTextNode("headerBar"));
+ $headerbarinformations->appendChild($hbstyle);
+ $hbpictureUrl = $xmldoc->createElement("pictureUrl");
+ $hbpictureUrl->appendChild($xmldoc->createTextNode("pictures/items/headerbar-logo.png"));
+ $headerbarinformations->appendChild($hbpictureUrl);
+ $hbelementParameters->appendChild($headerbarinformations);
+
+ $headerbar->appendChild($hbelementParameters);
+
+ return $headerbar;
+}
+
+/*
+* Create a menu element
+*
+* @param $xmldoc : the DOM document
+* @params $p_... : parameters of the menu element
+*
+* Return a DOM document element which correspond to a menu element
+**/
+function voicetool_create_menu_element($xmldoc,$p_availibility, $p_type, $p_typeOfUser, $p_typeOfProduct, $p_pictureUrl, $p_value, $p_lcTypeAction, $p_lcNameAction){
+
+ $menuElement = $xmldoc->createElement('menuElement');
+
+ $type = $xmldoc->createElement('type');
+ $type->appendChild($xmldoc->createTextNode("$p_type"));
+ $menuElement->appendChild($type);
+
+ $typeOfProduct = $xmldoc->createElement('typeOfProduct');
+ $typeOfProduct->appendChild($xmldoc->createTextNode("$p_typeOfProduct"));
+ $menuElement->appendChild($typeOfProduct);
+
+ $availibility = $xmldoc->createElement('availibility');
+ $availibility->appendChild($xmldoc->createTextNode("$p_availibility"));
+ $menuElement->appendChild($availibility);
+
+ $typeOfUser = $xmldoc->createElement('typeOfUser');
+ $typeOfUser->appendChild($xmldoc->createTextNode("$p_typeOfUser"));
+ $menuElement->appendChild($typeOfUser);
+
+ $pictureUrl = $xmldoc->createElement('pictureUrl');
+ $pictureUrl->appendChild($xmldoc->createTextNode("$p_pictureUrl"));
+ $menuElement->appendChild($pictureUrl);
+
+ $value = $xmldoc->createElement('value');
+ $value->appendChild($xmldoc->createTextNode("$p_value"));
+ $menuElement->appendChild($value);
+
+ $lcAction = $xmldoc->createElement('action');
+ $lcActionName = $xmldoc->createElement('name');
+ $lcActionName->appendChild($xmldoc->createTextNode("$p_lcTypeAction"));
+
+ $lcAction->appendChild($lcActionName);
+ $lcActionParameters = $xmldoc->createElement('parameters');
+
+ $lcActionParameter = $xmldoc->createElement('parameter');
+ $lcActionParameter->appendChild($xmldoc->createTextNode("$p_lcNameAction"));
+ $lcActionParameters->appendChild($lcActionParameter);
+
+ $lcAction->appendChild($lcActionParameters);
+
+ $lcAction->appendChild($lcActionParameters);
+
+
+ $menuElement->appendChild($lcAction);
+
+ $xmldoc->appendChild($menuElement);
+
+ return $menuElement;
+}
+/*
+* Create a product information element
+*
+* @param $xmldoc : the DOM document
+* @param $position : type of the element
+* @param $name : name of the element
+* @param $style : style of the element
+* @param $value : value of the element
+*
+* Return a DOM document element which correspond to a product information element
+**/
+function voicetool_create_product_information($xmldoc,$position,$name,$style,$value) {
+
+ $productInfo = $xmldoc->createElement('productInformations');
+
+ $productPosition = $xmldoc->createElement('position');
+ $productPosition->appendChild($xmldoc->createTextNode("$position"));
+ $productInfo->appendChild($productPosition);
+
+ $productName = $xmldoc->createElement('name');
+ $productName->appendChild($xmldoc->createTextNode("$name"));
+ $productInfo->appendChild($productName);
+
+ $productStyle = $xmldoc->createElement('style');
+ $productStyle->appendChild($xmldoc->createTextNode("$style"));
+ $productInfo->appendChild($productStyle);
+
+ $productValue = $xmldoc->createElement('value');
+ $productValue->appendChild($xmldoc->createTextNode("$value"));
+ $productInfo->appendChild($productValue);
+
+ return $productInfo;
+
+}
+
+function voicetool_xml_list_voice_board($xmldoc, $courseId) {
+
+ $list = voicetool_get_all_tools_list($courseId);
+ $listElements = $xmldoc->createElement('listElements');
+ //print_($list);
+
+ add_to_log("", "voicetool", "view", "size", sizeof($list));
+ foreach ($list as $board) {
+
+ $element = $xmldoc->createElement('listElement');
+ $roomParameters = $xmldoc->createElement('listElementParameters');
+
+ $type = $xmldoc->createElement('typeOfElement');
+ $type->appendChild($xmldoc->createTextNode("VoiceBoard"));
+ $roomParameters->appendChild($type);
+ $position = $xmldoc->createElement('position');
+ if($board->type == "board"){
+ $position->appendChild($xmldoc->createTextNode("1"));
+ }
+ else if($board->type == "presentation"){
+ $position->appendChild($xmldoc->createTextNode("2"));
+ }
+
+ $roomParameters->appendChild($position);
+
+ $longname = $xmldoc->createElement('nameDisplay');
+ $longname->appendChild($xmldoc->createTextNode($board->name));
+ $roomParameters->appendChild($longname);
+ $preview = $xmldoc->createElement('preview');
+ $preview->appendChild($xmldoc->createTextNode("available"));
+ $roomParameters->appendChild($preview);
+ $nid = $xmldoc->createElement('nid');
+ $nid->appendChild($xmldoc->createTextNode($board->id));
+ $roomParameters->appendChild($nid);
+ $rid = $xmldoc->createElement('rid');
+ $rid->appendChild($xmldoc->createTextNode($board->rid));
+ $roomParameters->appendChild($rid);
+ /*if ($roompreview=="1")
+ {
+ $preview->appendChild($xmldoc->createTextNode("unavailable"));
+ }
+ else
+ {
+ $preview->appendChild($xmldoc->createTextNode("available"));
+ }
+ */
+
+ $element->appendChild($roomParameters);
+ $listElements->appendChild($element);
+
+ }
+ $xmldoc->appendChild($listElements);
+
+
+
+ return $listElements;
+
+}
+
+/*
+* Give the parameters with the signature md5 to give to the frame
+* @param $courseid : the id of the current course
+* return a string with all the parameters to give to the url
+*/
+function voicetool_get_url_params($courseid) {
+
+ global $USER;
+
+ if (isstudent($courseid)) {
+ $role='Student';
+ }
+ else if (isteacher($courseid, $USER->id)) {
+ $role='Instructor';
+ }
+ $signature = md5($courseid.$USER->email.$USER->firstname.$USER->lastname.$role);
+ $url_params = "enc_course_id=".$courseid."&enc_email=".$USER->email."&enc_firstname=".$USER->firstname."&enc_lastname=".$USER->lastname."&enc_role=".$role."&signature=".$signature;
+
+ return $url_params;
+}
+
+
+
+/* Create a information element
+* @param $xmldoc : the DOM document to add the information element
+* @param $sessionParams : array with the url parameters
+* return a DOM Document element with the general information
+*/
+
+function voicetool_get_session_params($xmldoc, $sessionParams) {
+
+// General Information
+
+ $information = $xmldoc->createElement("information");
+
+ $firstName = $xmldoc->createElement("firstName");
+ $firstName->appendChild($xmldoc->createTextNode($sessionParams['enc_firstname']));
+ $lastName = $xmldoc->createElement("lastName");
+ $lastName->appendChild($xmldoc->createTextNode($sessionParams['enc_lastname']));
+ $role = $xmldoc->createElement("role");
+ $role->appendChild($xmldoc->createTextNode($sessionParams['enc_role']));
+ $email = $xmldoc->createElement("email");
+ $email->appendChild($xmldoc->createTextNode($sessionParams['enc_email']));
+ $timeOfLoad = $xmldoc->createElement("timeOfLoad");
+ $timeOfLoad->appendChild($xmldoc->createTextNode($sessionParams['time']));
+ $courseId = $xmldoc->createElement("courseId");
+ $courseId->appendChild($xmldoc->createTextNode($sessionParams['enc_course_id']));
+ if ($sessionParams['authToken'] != null) {
+ $authToken = $xmldoc->createElement("authToken");
+ $authToken->appendChild($xmldoc->createTextNode($sessionParams['authToken']));
+ }
+ $signature = $xmldoc->createElement("signature");
+ $signature->appendChild($xmldoc->createTextNode($sessionParams['signature']));
+
+ $information->appendChild($firstName);
+ $information->appendChild($lastName);
+ $information->appendChild($role);
+ $information->appendChild($email);
+ $information->appendChild($timeOfLoad);
+ $information->appendChild($courseId);
+ $information->appendChild($authToken);
+ $information->appendChild($signature);
+
+ return $information;
+
+ // END of General Information
+
+}
+
+?>
\ No newline at end of file
Modified: trunk/moodle/mod/voicetool/mod.html
===================================================================
--- trunk/moodle/mod/voicetool/mod.html 2006-11-23 16:30:56 UTC (rev 99)
+++ trunk/moodle/mod/voicetool/mod.html 2006-11-24 15:31:35 UTC (rev 100)
@@ -44,13 +44,28 @@
<input type="text" name="description" id="description" size="30" value="<?php p($form->description) ?>">
</td>
</tr>
+
<tr valign="top">
+ <td align="right"><label for="type"><?php echo get_string('type', 'voicetool') ?>:</label></td>
+ <td>
+ <select id="type" name="type">
+ <option value="board" <?php if ($form->type == 'voiceBoard') { echo 'selected';}?>><?php echo get_string ('voiceBoard', 'voicetool') ?></option>
+ <option value="presentation" <?php if ($form->type == 'voicePresentation') { echo 'selected';}?>><?php echo get_string ('voicePresentation', 'voicetool') ?></option>
+ </select>
+
+ </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>
+<option value="spx_32_q8" <?php if ($form->quality == 'spx_32_q8') { echo 'selected';}?>><?php echo get_string ('superiorquality', 'voicetool') ?></option>
+
+
</select>
</td>
</tr>
@@ -64,8 +79,8 @@
<!-- 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) ?>" />
@@ -78,6 +93,7 @@
<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>
Modified: trunk/moodle/mod/voicetool/view.php
===================================================================
--- trunk/moodle/mod/voicetool/view.php 2006-11-23 16:30:56 UTC (rev 99)
+++ trunk/moodle/mod/voicetool/view.php 2006-11-24 15:31:35 UTC (rev 100)
@@ -35,8 +35,8 @@
require_once('lib.php');
require_once('voicetoolapi.php');
- optional_variable($id); // Course Module ID, or
- optional_variable($a); // voicetool ID
+ $id = optional_param('id', 0, PARAM_INT); // Course Module ID, or
+ $a = optional_param('a', 0, PARAM_INT); // voicetool ID
if ($id) {
if (! $cm = get_record("course_modules", "id", $id)) {
@@ -71,6 +71,7 @@
error(get_string ('cannotgetsession', 'voicetool'));
}
+ add_to_log($course->id, "voicetool", "view", "view.php?id=$cm->id", "fffff ");
/// Print the page header
Modified: trunk/moodle/mod/voicetool/voicetoolapi.php
===================================================================
--- trunk/moodle/mod/voicetool/voicetoolapi.php 2006-11-23 16:30:56 UTC (rev 99)
+++ trunk/moodle/mod/voicetool/voicetoolapi.php 2006-11-24 15:31:35 UTC (rev 100)
@@ -28,7 +28,10 @@
/* $Id$ */
-require_once("$CFG->dirroot/lib/nusoap/nusoap.php");
+//WebService Client.
+require_once($CFG->libdir.'/soapadded/lib/nusoap.php');
+//require_once($CFG->dirroot.'/lib/soap/nusoap.php');
+//require_once("$CFG->dirroot./lib/soap/nusoap.php");
/// Library of functions and constants for the voicetool API
@@ -40,16 +43,24 @@
$VT_API_QUALITY_BASIC = 'spx_8_q3';
$VT_API_QUALITY_STANDARD = 'spx_16_q4';
$VT_API_QUALITY_GOOD = 'spx_16_q6';
+$VT_API_QUALITY_SUPERIOR = 'spx_32_q8'; //ou q10 ??
-
$VT_API_SERVICES = '/services/Broker?wsdl';
$VT_API_CREATE_RESOURCE = 'createResource';
$VT_API_MODIFY_RESOURCE = 'modifyResource';
$VT_API_DELETE_RESOURCE = 'deleteResource';
+$VT_API_GET_RESOURCE = 'getResource';
+$VT_API_GET_RESOURCES = 'getResources';
+$VT_API_RESOURCE_EXISTS = 'resourceExists';
$VT_API_CREATE_SESSION = 'createSession';
$VT_API_ALLOWEDDOCBASE = 'isDocumentBaseAllowed';
+$VT_API_MESSAGE_EXISTS = 'messageExists';
+//-------
+$VT_API_STORE_AUDIO = 'storeAudio';
+$VT_API_GET_AUDIO = 'getAudio';
+$VT_API_AUDIO_EXISTS = 'audioExists';
/**
@@ -64,23 +75,32 @@
global $CFG,
$VT_API_SERVICES,
$VT_API_CREATE_RESOURCE;
-
+
+ // print_r($resource_data);
+
+ // Set the WebService URL
$soapclient = new soapclient($CFG->voicetool_servername.$VT_API_SERVICES,true);
+ // Set the parameters to send to the WebService
$resource = array ($CFG->voicetool_adminusername,
$CFG->voicetool_adminpassword,
$resource_data);
- //print_r($resource);
+
+ //print_r($resource);
+ // Call the WebService and store its result in $result.
$result = $soapclient->call($VT_API_CREATE_RESOURCE, $resource);
-
+ // echo "create resource".'<br>';
//print_r ($result);
+ /*
if (!voicetool_api_check_result ($result)) {
+
return false;
}
-
+ */
+ //return false;
return $result;
}
@@ -97,24 +117,58 @@
$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;
}
+// To CHECK !!!
+function voicetool_api_message_exists ($rid, $mid) {
+
+ global $CFG,
+ $VT_API_SERVICES,
+ $VT_API_MESSAGE_EXISTS;
+
+ $soapclient = new soapclient($CFG->voicetool_servername.$VT_API_SERVICES,true);
+
+ $resource = array ($CFG->voicetool_adminusername,
+ $CFG->voicetool_adminpassword,
+ $rid,
+ $mid);
+ //print_r($resource);
+
+ $result = $soapclient->call($VT_API_MESSAGE_EXISTS, $resource);
+
+ if (!voicetool_api_check_result ($result)) {
+ return false;
+ }
+
+
+ $res=false;
+ foreach ($result['values'] as $item) {
+ if ($item['name'] == 'exists') {
+ $res = $item['value'];
+ }
+ }
+
+ return $res;
+ //return $result;
+}
/**
* Send an SDK request to the VT server to delete a resource.
@@ -137,17 +191,115 @@
$result = $soapclient->call($VT_API_DELETE_RESOURCE, $resource);
-
+ /*
if (!voicetool_api_check_result ($result)) {
return false;
}
-
+ */
return $result;
}
+/**
+ * Send an SDK request to the VT server to test if the resource exist.
+ * @uses CFG
+ * @uses VT_API_SERVICES
+ * @uses VT_API_RESOURCE_EXISTS
+ * @param $rid - the rid of the resource to find
+ * @return - a boolean. true if the resource exist, false elsewhere.
+ */
+function voicetool_api_resource_exists ($rid) {
+ global $CFG,
+ $VT_API_SERVICES,
+ $VT_API_RESOURCE_EXISTS;
+
+ $soapclient = new soapclient($CFG->voicetool_servername.$VT_API_SERVICES,true);
+
+ $resource = array ($CFG->voicetool_adminusername,
+ $CFG->voicetool_adminpassword,
+ $rid);
+
+ $result = $soapclient->call($VT_API_RESOURCE_EXISTS, $resource);
+ /*
+ if (!voicetool_api_check_result ($result)) {
+ return false;
+ }
+ */
+ $res=false;
+ foreach ($result['values'] as $item) {
+ if ($item['name'] == 'exists') {
+ $res = $item['value'];
+ }
+ }
+
+ return $res;
+}
+/**
+ * Send an SDK request to the VT server to get the resource.
+ * @uses CFG
+ * @uses VT_API_SERVICES
+ * @uses VT_API_GET_RESOURCE
+ * @param $rid - the rid of the resource to get
+ * @return - the object returned by the call, or false if something goes wrong.
+ */
+function voicetool_api_get_resource($rid) {
+
+ global $CFG,
+ $VT_API_SERVICES,
+ $VT_API_GET_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_GET_RESOURCE, $resource);
+
+ /*
+ if (!voicetool_api_check_result ($result)) {
+ return false;
+ }
+ */
+ //pair set
+ return $result;
+}
+
/**
+ * Send an SDK request to the VT server to get the resources.
+ * @uses CFG
+ * @uses VT_API_SERVICES
+ * @uses VT_API_GET_RESOURCES
+ * @param $ridtable - a table with the rid of the resources to get
+ * @return - an array of the objects returned by the call, or false if something goes wrong.
+ */
+function voicetool_api_get_resources($ridtable) {
+
+ global $CFG,
+ $VT_API_SERVICES,
+ $VT_API_GET_RESOURCES;
+
+ $soapclient = new soapclient($CFG->voicetool_servername.$VT_API_SERVICES,true);
+
+ $resource = array ($CFG->voicetool_adminusername,
+ $CFG->voicetool_adminpassword,
+ $ridtable);
+
+ $result = $soapclient->call($VT_API_GET_RESOURCES, $resource);
+
+ /*
+ if (!voicetool_api_check_result ($result)) {
+ return false;
+ }
+ */
+ //pair set
+ return $result;
+}
+
+
+
+/**
* Create the session for a voice direct applet.
* @uses CFG
* @uses VT_API_SERVICES
@@ -176,10 +328,11 @@
$result = $soapclient->call($VT_API_CREATE_SESSION, $resource);
+ echo "create session".'<br>';
+ print_r ($result);
- //print_r ($result);
-
if (!voicetool_api_check_result ($result)) {
+
return false;
}
@@ -206,17 +359,19 @@
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)) {
+ add_to_log("", "voice tool", "", "", "result ".$result);
return voicetool_api_get_error_message ($result);
}
@@ -229,8 +384,55 @@
error('Return Value not Found');
}
+function voicetool_api_audio_exists ($rid, $mid) {
+
+ global $CFG,
+ $VT_API_SERVICES,
+ $VT_API_AUDIO_EXISTS;
+
+ $soapclient = new soapclient($CFG->voicetool_servername.$VT_API_SERVICES,true);
+
+ $resource = array ($CFG->voicetool_adminusername,
+ $CFG->voicetool_adminpassword,
+ $rid,
+ $mid);
+ //print_r($resource);
+
+ $result = $soapclient->call($VT_API_AUDIO_EXISTS, $resource);
+
+ if (!voicetool_api_check_result ($result)) {
+ return false;
+ }
+
+
+ $res=false;
+ foreach ($result['values'] as $item) {
+ if ($item['name'] == 'exists') {
+ $res = $item['value'];
+ }
+ }
+
+ return $res;
+ //return $result;
+}
+function voicetool_api_store_audio($rid, $mid, $audio, $filename) {
+ global $CFG,
+ $VT_API_SERVICES,
+ $VT_API_STORE_AUDIO;
+ $soapclient = new soapclient($CFG->voicetool_servername.$VT_API_SERVICES,true);
+
+ $resource = array ($CFG->voicetool_adminusername,
+ $CFG->voicetool_adminpassword,
+ $rid,
+ $mid,
+ $audio,
+ $filename);
+
+ $result = $soapclient->call($VT_API_STORE_AUDIO, $resource);
+}
+
////////// Helper Function, kind of private
/**
@@ -239,14 +441,18 @@
* @return true f $result does not contain an error code, false otherwise.
*/
function voicetool_api_check_result ($result) {
+
+
if (empty($result)){
//error ("Empty result after call to $VT_API_SERVICES");
error_log( "voicetool_api_check_result: Empty result after call to $VT_API_SERVICES");
+ add_to_log("", "voice tool", "", "", "voicetool_api_check_result: Empty result after call to ".$VT_API_SERVICES);
return false;
}
-
- if (voicetool_api_get_status_code($result) != 'ok') {
+ //$resultcode = voicetool_api_get_status_code($result);
+ if (voicetool_api_get_status_code($result) != 'ok') {
+ add_to_log("", "voice tool", "", "", "voicetool_api_check_result: not ok");
error_log( "voicetool_api_check_result: ".voicetool_api_get_error_message($result));
return false;
}
@@ -261,6 +467,7 @@
* @return string - the status code returned if any, or the empty string if none is found
*/
function voicetool_api_get_status_code ($result) {
+
foreach ($result['values'] as $values) {
if ($values['name'] == 'status_code') {
return $values['value'];
@@ -283,8 +490,21 @@
return '';
}
+function voicetool_api_get_options($resourceid) {
+
+ $result = voicetool_api_get_resource($resourceid) ;
+
+ foreach ($result['groups'] as $values) {
+ if ($values['name'] == 'options'){
+ return $values['pairSet'];
+ }
+ }
+
+
+}
+
////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////
Added: trunk/moodle/mod/voicetool/welcome.php
===================================================================
--- trunk/moodle/mod/voicetool/welcome.php (rev 0)
+++ trunk/moodle/mod/voicetool/welcome.php 2006-11-24 15:31:35 UTC (rev 100)
@@ -0,0 +1,663 @@
+<?PHP
+
+/******************************************************************************
+ * *
+ * Copyright (c) 1999-2006 Horizon Wimba, All Rights Reserved. *
+ * *
+ * COPYRIGHT: *
+ * This software is the property of Horizon Wimba. *
+ * You can redistribute it and/or modify it under the terms of *
+ * the GNU General Public License as published by the *
+ * Free Software Foundation. *
+ * *
+ * WARRANTIES: *
+ * This software is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+ * GNU General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU General Public License *
+ * along with the Horizon Wimba Moodle Integration; *
+ * if not, write to the Free Software Foundation, Inc., *
+ * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA *
+ * *
+ * Author: Hazan Samy *
+ * *
+ * Date: September 2006 *
+ * *
+ ******************************************************************************/
+
+/* $Id$ */
+
+/// This page is to display the widget - Voice Tools list
+
+
+
+ require_once("../../config.php");
+ require_once("lib.php");
+
+ $id = optional_param('id', 0, PARAM_INT);
+
+ $course = optional_param('course', 0, PARAM_INT);
+
+ global $CFG;
+
+ if (! $course = get_record("course", "id", $id)) {
+ error("Course ID is incorrect");
+ }
+
+ require_login($course->id);
+
+/*
+ if (!liveclassroom_init_session($_GET)) {
+ error("ExpiredSessionException");
+ }
+*/
+
+ //session_start();
+
+/// Get all required strings
+
+ $strvoicetools = get_string("modulenameplural", "voicetool");
+ $strvoicetool = get_string("modulename", "voicetool");
+
+
+// Get all the appropriate data
+
+ if (! $voicetools = get_all_instances_in_course("voicetool", $course)) {
+ notice("There are no voicetools", "../../course/view.php?id=$course->id");
+ die;
+ }
+?>
+<html>
+<head>
+<title>Wimba Voice Tools</title>
+<link rel="STYLESHEET" href="css/StyleSheet.css" type="text/css" />
+
+<script type="text/javascript" src='js/xmldom.js'></script>
+<script language="javascript" src="js/verif.js"></script>
+<script type="text/javascript" src="js/xml.js"></script>
+<script type="text/javascript" src="js/Hw.js"></script>
+<script language="javascript" src="js/General.js"></script>
+
+
+
+<script type="text/javascript">
+
+function getHTTPObject()
+{
+ var xmlhttp = false;
+
+ /* Compilation conditionnelle d'IE */
+ /*@cc_on
+ @if (@_jscript_version >= 5)
+ try
+ {
+ xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
+ }
+ catch (e)
+ {
+ try
+ {
+ xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
+ }
+ catch (E)
+ {
+ xmlhttp = false;
+ }
+ }
+ @else
+ xmlhttp = false;
+ @end @*/
+
+ /* on essaie de cr\xE9er l'objet si ce n'est pas d\xE9j\xE0 fait */
+ if (!xmlhttp && typeof XMLHttpRequest != 'undefined')
+ {
+ try
+ {
+ xmlhttp = new XMLHttpRequest();
+ }
+ catch (e)
+ {
+ xmlhttp = false;
+ }
+ }
+
+ if (xmlhttp)
+ {
+ /* on d\xE9finit ce qui doit se passer quand la page r\xE9pondra */
+ xmlhttp.onreadystatechange=function()
+ {
+
+ if (xmlhttp.readyState == 4) /* 4 : \xE9tat "complete" */
+ {
+
+ /*alert(xmlhttp.responseText);
+ Traitement de la r\xE9ponse.
+ Ici on affiche la r\xE9ponse dans une bo\xEEte de dialogue.
+ */
+ studentView=false;
+ objDom=new XMLDoc(xmlhttp.responseText, null);
+ manageXml("");
+
+ }
+ }
+ }
+ return xmlhttp;
+}
+
+
+function ChangeView()
+{
+ if( document.getElementById("view").value=="student")
+ {
+ studentView=true;
+ }
+ else
+ {
+ studentView=false;
+ }
+ manageXml("","all");
+}
+
+function gestionDisplay(isfilter)
+{
+
+
+ if(numberMainLectureRoom>5 && isfilter==false)
+ {
+
+ document.getElementById("div1").style.height=5*19+"px";
+
+
+
+ document.getElementById("div1More").style.display="block";
+ document.getElementById("div1More").innerHTML="<label class='moreRoom' onclick='displayAllDiv(\"div1\",\""+numberMainLectureRoom+"\")'>"+(numberMainLectureRoom-5)+" more...</label>";
+
+ }else if(numberMainLectureRoom==0){
+ document.getElementById("div1").style.display="none";
+ document.getElementById("div1Title").style.display="none";
+ document.getElementById("div1More").style.display="none";
+
+ }else{
+
+ document.getElementById("div1").style.height=numberMainLectureRoom*19+"px";
+ document.getElementById("div1More").style.display="none";
+
+ }
+
+ if(numberBreakoutRoom>5 && isfilter==false)
+ {
+ document.getElementById("div2").style.height=5*19+"px";
+ document.getElementById("div2More").style.display="block";
+ document.getElementById("div2More").innerHTML="<table><tr><td><label class='moreRoom' onclick='displayAllDiv(\"div2\",\""+numberBreakoutRoom+"\")'>"+(numberBreakoutRoom-5)+" more...</label></td></tr></table>";
+
+
+
+
+ }else if(numberBreakoutRoom==0){
+ document.getElementById("div2").style.display="none";
+ document.getElementById("div2Title").style.display="none";
+ document.getElementById("div2More").style.display="none";
+
+ }else{
+
+ document.getElementById("div2").style.height=numberBreakoutRoom*19+"px";
+ document.getElementById("div2More").style.display="none";
+ }
+
+ if(numberVoiceBoard>5 && isfilter==false)
+ {
+ document.getElementById("div3").style.height=5*19+"px";
+ document.getElementById("div3More").style.display="block";
+ document.getElementById("div3More").innerHTML="<label class='moreRoom' onclick='displayAllDiv(\"div3\",\""+numberVoiceBoard+"\")'>"+(numberVoiceBoard-5)+" more...</label>";
+
+
+
+
+ }else if(numberVoiceBoard==0){
+ document.getElementById("div3").style.display="none";
+ document.getElementById("div3Title").style.display="none";
+ document.getElementById("div3More").style.display="none";
+
+ }else{
+
+ document.getElementById("div3").style.height=numberVoiceBoard*19+"px";
+ document.getElementById("div3More").style.display="none";
+ }
+
+ if(numberVoicePresentation>5 && isfilter==false)
+ {
+
+ document.getElementById("div4").style.height=5*19+"px";
+ document.getElementById("div4More").style.display="block";
+ document.getElementById("div4More").innerHTML="<label class='moreRoom' onclick='displayAllDiv(\"div4\",\""+numberVoicePresentation+"\")'>"+(numberVoicePresentation-5)+" more...</label>";
+
+
+
+ }else if(numberVoicePresentation==0 && isfilter==false){
+ document.getElementById("div4").style.display="none";
+ document.getElementById("div4Title").style.display="none";
+ document.getElementById("div4More").style.display="none";
+
+ }
+ else{
+ document.getElementById("div4").style.height=numberVoicePresentation*19+"px";
+ document.getElementById("div4More").style.display="none";
+ }
+
+
+}
+
+
+ function execAction(lcAction,VtAction){
+
+
+ eval(lcAction);
+
+ }
+
+
+
+
+var session=new Array();
+var timeOfLoad="";
+var currentFilter='all';
+var numberOfProduct=4;
+var currentId="";
+var currentProduct="";
+var currentDiv=0;
+var numberMainLectureRoom=0;
+var numberBreakoutRoom=0;
+var numberVoiceBoard=0;
+var numberVoicePresentation=0;
+var studentView=false;
+
+var typeSelect="mainLectureRoom";
+var numberArchive=new Array();
+// xml
+
+var objDom;
+var objDomTree;
+
+
+
+function createSession(informations){
+ session["timeOfLoad"] = informations[0].getElements("timeOfLoad")[0].getText();
+ session["courseId"] = informations[0].getElements("courseId")[0].getText();
+ session["firstName"] = informations[0].getElements("firstName")[0].getText();
+ session["lastName"] = informations[0].getElements("lastName")[0].getText();
+ session["email"] = informations[0].getElements("email")[0].getText();
+ session["signature"] = informations[0].getElements("signature")[0].getText();
+ session["role"] = informations[0].getElements("role")[0].getText();
+ if(informations[0].getElements("authToken")!="")
+ session["authToken"] = informations[0].getElements("authToken")[0].getText();
+ if(informations[0].getElements("vtServerUrl")!="")
+ session["vtServerUrl"] = informations[0].getElements("vtServerUrl")[0].getText();
+ if(informations[0].getElements("lcServerUrl")!="")
+ session["lcServerUrl"] = informations[0].getElements("lcServerUrl")[0].getText();
+
+}
+
+
+
+function redirection(url){
+ window.location=url;
+
+}
+
+
+
+
+function initDisplay(){
+ var display="<table cellspacing='0' cellpadding='0' width='100%' border='0' align='center' id='MainTable'>"
+
+ return display;
+}
+function openDiv(id,style){
+ var display="<tr><td><div id='"+id+"' class="+style+">";
+ return display;
+}
+function closeDiv(){
+ var display="</div></td></tr>";
+ return display;
+}
+
+function closeDisplay(){
+ var display="</td></tr></table>";
+ return display;
+}
+
+function closeDivProduct(position){
+ var display="";
+ display+="</table></div></td></tr></table></div>";
+ return display
+}
+
+
+
+
+
+function displayAllDiv(name,number){
+ if(currentId!="")
+ document.getElementById(currentId).style.backgroundColor="white";
+currentId="";
+
+ document.getElementById(name).style.height=number*19+"px";
+ document.getElementById(name+"More").innerHTML="<label class='moreRoom' onclick='RemoveAllDiv(\""+name+"\",\""+number+"\")'>Show Top 5...</label>";
+
+}
+function RemoveAllDiv(name,number){
+ if(currentId!="")
+ document.getElementById(currentId).style.backgroundColor="white";
+currentId="";
+ document.getElementById(name).style.height=5*19+"px";
+ document.getElementById(name+"More").innerHTML="<label class='moreRoom' onclick='displayAllDiv(\""+name+"\",\""+number+"\")'>"+(number-5)+" more...</label>";
+
+}
+function createAction(action){
+if(action!="") {
+ return "\"javascript:"+action[0].getElements("name")[0].getText()+"('"+action[0].getElements("parameters")[0].getText()+"')\"";
+}
+return "";
+}
+
+
+
+
+
+
+
+/*
+
+
+function getSessionParameters(){
+
+xmlhttp.open("GET", 'getSessionParameters.php',true);
+
+xmlhttp.onreadystatechange=sessionManagement;
+xmlhttp.send(null);
+
+
+}
+*/
+function sessionManagement(){
+
+ if (xmlhttp.readyState == 4) /* 4 : \xE9tat "complete" */
+ {
+
+ objDom=new XMLDoc(xmlhttp.responseText, null);
+ objDomTree = objDom.docNode;
+
+ //session management
+ var information= objDomTree.getElements("information");
+ if(information!="")
+ createSession(information);
+
+
+ DisplayFirstPage()
+ }
+}
+
+function getURLParameters()
+{
+ var sURL = window.document.URL.toString();
+ var params="";
+ if (sURL.indexOf("?") > 0)
+ {
+ var arrParams = sURL.split("?");
+
+ var arrURLParams = arrParams[1].split("&");
+
+ var arrParamNames = new Array(arrURLParams.length);
+ var arrParamValues = new Array(arrURLParams.length);
+
+ var i = 0;
+ for (i=0;i<arrURLParams.length;i++)
+ {
+ var sParam = arrURLParams[i];
+ arrParamNames[i] = sParam[0];
+ if (sParam[1] != "")
+ params += "&"+unescape(sParam);
+
+ }
+ params=params.substring(1,params.length)
+ }
+
+ return params;
+}
+
+function DisplayFirstPage(){
+
+/* Cr\xE9ation de l'objet : */
+
+
+/* Pr\xE9paration d'une requ\xEAte asynchrone de type GET : */
+xmlhttp.open("POST", 'generateListPanel.php',true);
+/* Effectue la requ\xEAte : */
+xmlhttp.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
+ xmlhttp.onreadystatechange=Management;
+xmlhttp.send(getURLParameters())
+
+
+}
+
+function DisplayChoicePage(){
+
+xmlhttp.open("GET", 'displayChoicePage.php?teacherid=<?php echo $teacherid; ?>&courseid=<?php echo $course->id; ?>&isteacher=<?php echo isteacher($course->id, $USER->id); ?>&usersession=<?php echo $usersession;?>',true);
+
+xmlhttp.onreadystatechange=ManagementNew;
+xmlhttp.send(getURLParameters())
+
+
+}
+function launchAjaxRequest(url,fonction,action,init){
+
+showPopup()
+
+ var parameters="";
+ if(currentProduct != "" )
+ parameters="product="+currentProduct+"&"
+
+ if( currentId != "")
+ parameters+="id="+currentId+"&"
+ if(action!="")
+ parameters+="action="+action+"&";
+
+ if(init=="true")
+ currentId = ""
+ /* Pr\xE9paration d'une requ\xEAte asynchrone de type GET : */
+ xmlhttp.open("GET", url+'?'+parameters+'time='+session["timeOfLoad"]+'&enc_course_id='+session["courseId"]+'&enc_email='+session["email"]+'&enc_firstname='+session["firstName"]+'&enc_lastname='+session["lastName"]+'&enc_role='+session["role"]+'&signature='+session["signature"]+'',true);
+ /* Effectue la requ\xEAte : */
+ xmlhttp.onreadystatechange=eval(fonction);
+ //alert(currentId);
+ xmlhttp.send(null);
+}
+
+
+function launchNew(url,fonction,action,product){
+
+ currentProduct = product;
+
+ launchAjaxRequest(url,fonction,action,"true");
+}
+
+
+function Affiche_forms() {
+
+ // Fonction qui affiche le nom de tous les formulaires
+ // et de tous les les \xE9l\xE9ments d'un document HTML
+ // Boucle tous les formulaire
+ for (var i = 0; i < document.forms.length; i++) {
+
+ // Affiche le nom ou la propri\xE9t\xE9 name du formulaire i
+ alert(document.forms[i].name+"<br />"+document.forms[i].value);
+
+ // Boucle tous les \xE9l\xE9ments du formulaire i
+ for (var l = 0; l < document.forms[i].elements.length; l++) {
+
+ // Affiche le nom ou la propri\xE9t\xE9 name de l'\xE9l\xE9ment l
+ alert("- "+document.forms[i].elements[l].name+"<br />");
+ }
+ }
+}
+
+function getFormVariables(){
+
+ var formvars='';
+
+ if(document.getElementsByName('myform')!=null){
+ var childElements=document.getElementsByName('myform')[0].childNodes;
+
+ for(var i=0;i<childElements.length;i++){
+//alert(childElements[i].nodeName)
+
+
+ }
+
+
+
+ formvars=formvars.substring(0,formvars.length-1);
+}
+ return formvars;
+
+}
+
+function displayNew(){
+ if (xmlhttp.readyState == 4) /* 4 : \xE9ta...
[truncated message content] |