From: skodak
Date: Wed, 20 Sep 2006 19:46:52 +0000 (+0000)
Subject: major whitespace cleanup - fixed \r\n line-ending
X-Git-Url: http://git.mjollnir.org/gw?a=commitdiff_plain;h=03f5a0f87cb64e701afda419b787e6a0cf2a8d6e;p=moodle.git
major whitespace cleanup - fixed \r\n line-ending
---
diff --git a/auth/fc/Readme.txt b/auth/fc/Readme.txt
index fad629a242..da49241c65 100644
--- a/auth/fc/Readme.txt
+++ b/auth/fc/Readme.txt
@@ -1,71 +1,71 @@
-Moodle - FirstClass authentication module
------------------------------------------
-This module uses the FirstClass Flexible Provisining Protocol (FPP) to communicate between the FirstClass server
-and the Moodle host.
-
-Installation
-------------
-
-1. Enable FPP on the FirstClass server
-FPP is not doumented in the FirstClass documentation and is not enable by default.
-To enable the protocol you need to edit the file \FCPO\Server\Netinfo. Open the file and insert the
-following lines.
-
-// TCP port for Flexible Provisioning Protocol (FPP).
-TCPFPPPORT = 3333
-
-
-2. Create an account on the FirstClass server with privilege "Subadministrator".
-Using the FPP protocoll this module logs in to the FirstClass server and issuess batch admin commands.
-Batch admin command can only be issued in the context of a user with subadministrative privileges.
-
-Default account name is "fcMoodle".
-
-
-3. Check that the FPP protocoll is working by running a Telnet session. If everyting is working you
-should get a "+0" answer from the server.
-
-> telnet yourhost.domain.com 3333
-+0
-
-Check that the "fcMoodle" is working by entering the following sequens of commands:
-
-> telnet yourhost.domain.com 3333
-+0
-fcMoodle
-+0
-
-the_password_you_gave_fcmoodle
-+0
-
-Get user some_user_id 1201
-
-1201 0 some_user_id
-+0
-
-
-
-4. On the Moodle host go to the directory where you have installed Moodle.
-Open the folder "auth", where all other authentication modules are installed,
- and create a new directory with the name "fc".
-
-Copy the files "config.html", "fcFPP.php" and "lib.php" to the "auth" directory.
-
-Now you need to add som strings to the language file. This distribution contains
-string for the English (en) and Swedish (sv) translation.
-
-Open the file "auth.php" in the folder "lang/sv" and paste the text from the file
-"auth.php - sv.txt" at the end of the file above the line "?>"
-
-Open the file "auth.php" in the folder "lang/en" and paste the text from the file
-"auth.php - en.txt" at the end of the file above the line "?>"
-
-
-
-
-
-
-
-
-
-
+Moodle - FirstClass authentication module
+-----------------------------------------
+This module uses the FirstClass Flexible Provisining Protocol (FPP) to communicate between the FirstClass server
+and the Moodle host.
+
+Installation
+------------
+
+1. Enable FPP on the FirstClass server
+FPP is not doumented in the FirstClass documentation and is not enable by default.
+To enable the protocol you need to edit the file \FCPO\Server\Netinfo. Open the file and insert the
+following lines.
+
+// TCP port for Flexible Provisioning Protocol (FPP).
+TCPFPPPORT = 3333
+
+
+2. Create an account on the FirstClass server with privilege "Subadministrator".
+Using the FPP protocoll this module logs in to the FirstClass server and issuess batch admin commands.
+Batch admin command can only be issued in the context of a user with subadministrative privileges.
+
+Default account name is "fcMoodle".
+
+
+3. Check that the FPP protocoll is working by running a Telnet session. If everyting is working you
+should get a "+0" answer from the server.
+
+> telnet yourhost.domain.com 3333
++0
+
+Check that the "fcMoodle" is working by entering the following sequens of commands:
+
+> telnet yourhost.domain.com 3333
++0
+fcMoodle
++0
+
+the_password_you_gave_fcmoodle
++0
+
+Get user some_user_id 1201
+
+1201 0 some_user_id
++0
+
+
+
+4. On the Moodle host go to the directory where you have installed Moodle.
+Open the folder "auth", where all other authentication modules are installed,
+ and create a new directory with the name "fc".
+
+Copy the files "config.html", "fcFPP.php" and "lib.php" to the "auth" directory.
+
+Now you need to add som strings to the language file. This distribution contains
+string for the English (en) and Swedish (sv) translation.
+
+Open the file "auth.php" in the folder "lang/sv" and paste the text from the file
+"auth.php - sv.txt" at the end of the file above the line "?>"
+
+Open the file "auth.php" in the folder "lang/en" and paste the text from the file
+"auth.php - en.txt" at the end of the file above the line "?>"
+
+
+
+
+
+
+
+
+
+
diff --git a/auth/fc/fcFPP.php b/auth/fc/fcFPP.php
index daac9b5e1d..99cec4244c 100644
--- a/auth/fc/fcFPP.php
+++ b/auth/fc/fcFPP.php
@@ -1,218 +1,218 @@
-_hostname = $host;
- $this->_port = $port;
- $this->_user = "";
- $this->_pwd = "";
- }
-
- // open a connection to the FirstClass server
- function open()
- {
- if($this->_debug) echo "Connecting to host ";
- $host = $this->_hostname;
- $port = $this->_port;
-
- if($this->_debug) echo "[$host:$port]..";
-
- // open the connection to the FirstClass server
- $conn = fsockopen($host, $port, $errno, $errstr, 5);
- if(!$conn)
- {
- echo "connection failed!".$errno. $errstr;
- return false;
- }
-
- // We are connected
- if($this->_debug) echo "connected!";
-
- // Read connection message.
- $line = fgets ($conn); //+0
- $line = fgets ($conn); //new line
-
- // store the connection in this class, so we can use it later
- $this->_conn = & $conn;
-
- return true;
- }
-
- // close any open connections
- function close()
- {
- // get the current connection
- $conn = &$this->_conn;
-
- // close it if it's open
- if($conn)
- {
- fclose($conn);
-
- // cleanup the variable
- unset($this->_conn);
- return true;
- }
- return;
- }
-
-
- // Authenticate to the FirstClass server
- function login($userid, $passwd)
- {
- // we did have a connection right?!
- if($this->_conn)
- {
- # Send username
- fputs($this->_conn,"$userid\r\n");
-
- $line = fgets ($this->_conn); //new line
- $line = fgets ($this->_conn); //+0
- $line = fgets ($this->_conn); //new line
-
- # Send password
- fputs($this->_conn,"$passwd\r\n");
- $line = fgets ($this->_conn); //new line
- $line = fgets ($this->_conn); //+0
- $line = fgets ($this->_conn); //+0 or message
-
- if($this->_debug) echo $line;
-
- if (preg_match ("/^\+0/", $line)) { //+0, user with subadmin privileges
- $this->_user = $userid;
- $this->_pwd = $passwd;
- return TRUE;
- } elseif (preg_match ("/^\Sorry/",$line)){ //Denied access but a valid user and password
- return TRUE;
- } else { //Invalid user or password
- return FALSE;
- }
-
-
- }
- return FALSE;
- }
-
- // Get the list of groups the user is a member of
- function getGroups($userid){
-
- $groups = array();
-
- // we must be logged in as a user with subadmin privileges
- if($this->_conn AND $this->_user) {
- # Send BA-command to get groups
- fputs($this->_conn,"GET USER '" . $userid . "' 4 -1\r");
- $line = "";
- while (!$line) {
- $line = trim(fgets ($this->_conn));
- }
- $n = 0;
- while ($line AND !preg_match("/^\+0/", $line) AND $line != "-1003") {
- list( , , $groups[$n++]) = explode(" ",$line,3);
- $line = trim(fgets ($this->_conn));
- }
- if($this->_debug) echo "getGroups:" . implode(",",$groups);
- }
-
- return $groups;
- }
-
- // Check if the user is member of any of the groups.
- // Return the list of groups the user is member of.
- function isMemberOf($userid, $groups){
-
- $usergroups = array_map("strtolower",$this->getGroups($userid));
- $groups = array_map("strtolower",$groups);
-
- $result = array_intersect($groups,$usergroups);
-
- if($this->_debug) echo "isMemberOf:" . implode(",",$result);
-
- return $result;
-
- }
-
- function getUserInfo($userid, $field){
-
- $userinfo = "";
-
- if($this->_conn AND $this->_user) {
- # Send BA-command to get data
- fputs($this->_conn,"GET USER '" . $userid . "' " . $field . "\r");
- $line = "";
- while (!$line) {
- $line = trim(fgets ($this->_conn));
- }
- $n = 0;
- while ($line AND !preg_match("/^\+0/", $line)) {
- list( , , $userinfo) = explode(" ",$line,3);
- $line = trim(fgets ($this->_conn));
- }
- if($this->_debug) echo "getUserInfo:" . $userinfo;
- }
-
- return str_replace('\r',' ',trim($userinfo,'"'));
-
- }
-
- function getResume($userid){
-
- $resume = "";
-
- $pattern = "/\[.+:.+\..+\]/"; // Remove references to pictures in resumes
-
- if($this->_conn AND $this->_user) {
- # Send BA-command to get data
- fputs($this->_conn,"GET RESUME '" . $userid . "' 6\r");
- $line = "";
- while (!$line) {
- $line = trim(fgets ($this->_conn));
- }
- $n = 0;
- while ($line AND !preg_match("/^\+0/", $line)) {
- $resume .= preg_replace($pattern,"",str_replace('\r',"\n",trim($line,'6 ')));
- $line = trim(fgets ($this->_conn));
- //print $line;
-
- }
- if($this->_debug) echo "getResume:" . $resume;
- }
-
- return $resume;
-
- }
-
-
-}
-
-
+_hostname = $host;
+ $this->_port = $port;
+ $this->_user = "";
+ $this->_pwd = "";
+ }
+
+ // open a connection to the FirstClass server
+ function open()
+ {
+ if($this->_debug) echo "Connecting to host ";
+ $host = $this->_hostname;
+ $port = $this->_port;
+
+ if($this->_debug) echo "[$host:$port]..";
+
+ // open the connection to the FirstClass server
+ $conn = fsockopen($host, $port, $errno, $errstr, 5);
+ if(!$conn)
+ {
+ echo "connection failed!".$errno. $errstr;
+ return false;
+ }
+
+ // We are connected
+ if($this->_debug) echo "connected!";
+
+ // Read connection message.
+ $line = fgets ($conn); //+0
+ $line = fgets ($conn); //new line
+
+ // store the connection in this class, so we can use it later
+ $this->_conn = & $conn;
+
+ return true;
+ }
+
+ // close any open connections
+ function close()
+ {
+ // get the current connection
+ $conn = &$this->_conn;
+
+ // close it if it's open
+ if($conn)
+ {
+ fclose($conn);
+
+ // cleanup the variable
+ unset($this->_conn);
+ return true;
+ }
+ return;
+ }
+
+
+ // Authenticate to the FirstClass server
+ function login($userid, $passwd)
+ {
+ // we did have a connection right?!
+ if($this->_conn)
+ {
+ # Send username
+ fputs($this->_conn,"$userid\r\n");
+
+ $line = fgets ($this->_conn); //new line
+ $line = fgets ($this->_conn); //+0
+ $line = fgets ($this->_conn); //new line
+
+ # Send password
+ fputs($this->_conn,"$passwd\r\n");
+ $line = fgets ($this->_conn); //new line
+ $line = fgets ($this->_conn); //+0
+ $line = fgets ($this->_conn); //+0 or message
+
+ if($this->_debug) echo $line;
+
+ if (preg_match ("/^\+0/", $line)) { //+0, user with subadmin privileges
+ $this->_user = $userid;
+ $this->_pwd = $passwd;
+ return TRUE;
+ } elseif (preg_match ("/^\Sorry/",$line)){ //Denied access but a valid user and password
+ return TRUE;
+ } else { //Invalid user or password
+ return FALSE;
+ }
+
+
+ }
+ return FALSE;
+ }
+
+ // Get the list of groups the user is a member of
+ function getGroups($userid){
+
+ $groups = array();
+
+ // we must be logged in as a user with subadmin privileges
+ if($this->_conn AND $this->_user) {
+ # Send BA-command to get groups
+ fputs($this->_conn,"GET USER '" . $userid . "' 4 -1\r");
+ $line = "";
+ while (!$line) {
+ $line = trim(fgets ($this->_conn));
+ }
+ $n = 0;
+ while ($line AND !preg_match("/^\+0/", $line) AND $line != "-1003") {
+ list( , , $groups[$n++]) = explode(" ",$line,3);
+ $line = trim(fgets ($this->_conn));
+ }
+ if($this->_debug) echo "getGroups:" . implode(",",$groups);
+ }
+
+ return $groups;
+ }
+
+ // Check if the user is member of any of the groups.
+ // Return the list of groups the user is member of.
+ function isMemberOf($userid, $groups){
+
+ $usergroups = array_map("strtolower",$this->getGroups($userid));
+ $groups = array_map("strtolower",$groups);
+
+ $result = array_intersect($groups,$usergroups);
+
+ if($this->_debug) echo "isMemberOf:" . implode(",",$result);
+
+ return $result;
+
+ }
+
+ function getUserInfo($userid, $field){
+
+ $userinfo = "";
+
+ if($this->_conn AND $this->_user) {
+ # Send BA-command to get data
+ fputs($this->_conn,"GET USER '" . $userid . "' " . $field . "\r");
+ $line = "";
+ while (!$line) {
+ $line = trim(fgets ($this->_conn));
+ }
+ $n = 0;
+ while ($line AND !preg_match("/^\+0/", $line)) {
+ list( , , $userinfo) = explode(" ",$line,3);
+ $line = trim(fgets ($this->_conn));
+ }
+ if($this->_debug) echo "getUserInfo:" . $userinfo;
+ }
+
+ return str_replace('\r',' ',trim($userinfo,'"'));
+
+ }
+
+ function getResume($userid){
+
+ $resume = "";
+
+ $pattern = "/\[.+:.+\..+\]/"; // Remove references to pictures in resumes
+
+ if($this->_conn AND $this->_user) {
+ # Send BA-command to get data
+ fputs($this->_conn,"GET RESUME '" . $userid . "' 6\r");
+ $line = "";
+ while (!$line) {
+ $line = trim(fgets ($this->_conn));
+ }
+ $n = 0;
+ while ($line AND !preg_match("/^\+0/", $line)) {
+ $resume .= preg_replace($pattern,"",str_replace('\r',"\n",trim($line,'6 ')));
+ $line = trim(fgets ($this->_conn));
+ //print $line;
+
+ }
+ if($this->_debug) echo "getResume:" . $resume;
+ }
+
+ return $resume;
+
+ }
+
+
+}
+
+
?>
\ No newline at end of file
diff --git a/auth/fc/lib.php b/auth/fc/lib.php
index 4c2bd2d72b..70bedab44b 100644
--- a/auth/fc/lib.php
+++ b/auth/fc/lib.php
@@ -1,154 +1,154 @@
-auth_fchost;
- $port = $CFG->auth_fcfppport;
-
- $retval = FALSE;
-
- if (!$username or !$password) { // Don't allow blank usernames or passwords
- return $retval;
- }
-
-
- $fpp = new fcFPP($hostname,$port);
- if ($fpp->open()) {
- if ($fpp->login($username,$password)){
- $retval = TRUE;
- }
- }
- $fpp->close();
-
- return $retval;
-
-
-}
-
-function auth_get_userinfo($username){
-// Get user information from FirstCLass server and return it in an array.
-// Localize this routine to fit your needs.
-
-/*
-Moodle FirstCLass fieldID in UserInfo form
------- -----------------------------------
-firstname 1202
-lastname 1204
-email 1252
-icq -
-phone1 1206
-phone2 1207 (Fax)
-institution -
-department -
-address 1205
-city -
-country -
-lang -
-timezone 8030 (Not used yet. Need to figure out how FC codes timezones)
-
-description Get data from users resume. Pictures will be removed.
-
-*/
-
- global $CFG;
-
- $hostname = $CFG->auth_fchost;
- $port = $CFG->auth_fcfppport;
- $userid = $CFG->auth_fcuserid;
- $passwd = $CFG->auth_fcpasswd;
-
- $userinfo = array();
-
- $fpp = new fcFPP($hostname,$port);
- if ($fpp->open()) {
- if ($fpp->login($userid,$passwd)){
-
- $userinfo['firstname'] = $fpp->getUserInfo($username,"1202");
- $userinfo['lastname'] = $fpp->getUserInfo($username,"1204");
- $userinfo['email'] = strtok($fpp->getUserInfo($username,"1252"),',');
- $userinfo['phone1'] = $fpp->getUserInfo($username,"1206");
- $userinfo['phone2'] = $fpp->getUserInfo($username,"1207");
- $userinfo['description'] = $fpp->getResume($username);
-
- }
- }
-
- $fpp->close();
-
- foreach($userinfo as $key => $value) {
- if (!$value) {
- unset($userinfo[$key]);
- }
- }
-
- return $userinfo;
-
-}
-
-
-function auth_iscreator($username=0) {
-//Get users group membership from the FirstClass server user and check if
-// user is member of one of the groups of creators.
-
- global $CFG, $USER;
-
- if (! $CFG->auth_fccreators) {
- return false;
- }
-
- if (! $username) {
- $username=$USER->username;
- }
-
- $fcgroups = array();
-
- $hostname = $CFG->auth_fchost;
- $port = $CFG->auth_fcfppport;
- $userid = $CFG->auth_fcuserid;
- $passwd = $CFG->auth_fcpasswd;
-
- $fpp = new fcFPP($hostname,$port);
- if ($fpp->open()) {
- if ($fpp->login($userid,$passwd)){
- $fcgroups = $fpp->getGroups($username);
- }
- }
- $fpp->close();
-
-
- if ((! $fcgroups)) {
- return false;
- }
-
- $creators = explode(";",$CFG->auth_fccreators);
-
- foreach($creators as $creator) {
- If (in_array($creator, $fcgroups)) return true;
- }
-
- return false;
-}
-
+auth_fchost;
+ $port = $CFG->auth_fcfppport;
+
+ $retval = FALSE;
+
+ if (!$username or !$password) { // Don't allow blank usernames or passwords
+ return $retval;
+ }
+
+
+ $fpp = new fcFPP($hostname,$port);
+ if ($fpp->open()) {
+ if ($fpp->login($username,$password)){
+ $retval = TRUE;
+ }
+ }
+ $fpp->close();
+
+ return $retval;
+
+
+}
+
+function auth_get_userinfo($username){
+// Get user information from FirstCLass server and return it in an array.
+// Localize this routine to fit your needs.
+
+/*
+Moodle FirstCLass fieldID in UserInfo form
+------ -----------------------------------
+firstname 1202
+lastname 1204
+email 1252
+icq -
+phone1 1206
+phone2 1207 (Fax)
+institution -
+department -
+address 1205
+city -
+country -
+lang -
+timezone 8030 (Not used yet. Need to figure out how FC codes timezones)
+
+description Get data from users resume. Pictures will be removed.
+
+*/
+
+ global $CFG;
+
+ $hostname = $CFG->auth_fchost;
+ $port = $CFG->auth_fcfppport;
+ $userid = $CFG->auth_fcuserid;
+ $passwd = $CFG->auth_fcpasswd;
+
+ $userinfo = array();
+
+ $fpp = new fcFPP($hostname,$port);
+ if ($fpp->open()) {
+ if ($fpp->login($userid,$passwd)){
+
+ $userinfo['firstname'] = $fpp->getUserInfo($username,"1202");
+ $userinfo['lastname'] = $fpp->getUserInfo($username,"1204");
+ $userinfo['email'] = strtok($fpp->getUserInfo($username,"1252"),',');
+ $userinfo['phone1'] = $fpp->getUserInfo($username,"1206");
+ $userinfo['phone2'] = $fpp->getUserInfo($username,"1207");
+ $userinfo['description'] = $fpp->getResume($username);
+
+ }
+ }
+
+ $fpp->close();
+
+ foreach($userinfo as $key => $value) {
+ if (!$value) {
+ unset($userinfo[$key]);
+ }
+ }
+
+ return $userinfo;
+
+}
+
+
+function auth_iscreator($username=0) {
+//Get users group membership from the FirstClass server user and check if
+// user is member of one of the groups of creators.
+
+ global $CFG, $USER;
+
+ if (! $CFG->auth_fccreators) {
+ return false;
+ }
+
+ if (! $username) {
+ $username=$USER->username;
+ }
+
+ $fcgroups = array();
+
+ $hostname = $CFG->auth_fchost;
+ $port = $CFG->auth_fcfppport;
+ $userid = $CFG->auth_fcuserid;
+ $passwd = $CFG->auth_fcpasswd;
+
+ $fpp = new fcFPP($hostname,$port);
+ if ($fpp->open()) {
+ if ($fpp->login($userid,$passwd)){
+ $fcgroups = $fpp->getGroups($username);
+ }
+ }
+ $fpp->close();
+
+
+ if ((! $fcgroups)) {
+ return false;
+ }
+
+ $creators = explode(";",$CFG->auth_fccreators);
+
+ foreach($creators as $creator) {
+ If (in_array($creator, $fcgroups)) return true;
+ }
+
+ return false;
+}
+
diff --git a/lang/README.txt b/lang/README.txt
index 9783aa34e7..3bd89305b5 100644
--- a/lang/README.txt
+++ b/lang/README.txt
@@ -1,23 +1,23 @@
-Moodle Language Packs
-
-This directory contains the standard packaged Moodle language files,
-for making the Moodle interface appear in different interfaces.
-
-The default language for Moodle is the English language, under the
-Unicode scheme (UTF8).
-
-To add more languages to Moodle, you can either:
-
- 1) use the Moodle languages GUI in the interface to fetch
- new languages and install them in your 'dataroot' directory.
-
- 2) download them and unzip the packs in this directory manually
-
-
-For more information, see the Moodle Documentation:
-
- http://docs.moodle.org/en/Translation
-
-
-Cheers,
-Moodle Development Team
+Moodle Language Packs
+
+This directory contains the standard packaged Moodle language files,
+for making the Moodle interface appear in different interfaces.
+
+The default language for Moodle is the English language, under the
+Unicode scheme (UTF8).
+
+To add more languages to Moodle, you can either:
+
+ 1) use the Moodle languages GUI in the interface to fetch
+ new languages and install them in your 'dataroot' directory.
+
+ 2) download them and unzip the packs in this directory manually
+
+
+For more information, see the Moodle Documentation:
+
+ http://docs.moodle.org/en/Translation
+
+
+Cheers,
+Moodle Development Team
diff --git a/lang/en_utf8/help/assignment/quickgrade.html b/lang/en_utf8/help/assignment/quickgrade.html
index b915845f3d..879670a2c2 100644
--- a/lang/en_utf8/help/assignment/quickgrade.html
+++ b/lang/en_utf8/help/assignment/quickgrade.html
@@ -1,10 +1,10 @@
-
Quick Grade
-
-
With quickgrading enabled you can quickly grade multiple assignments on one page.
-
-
Just change the grades and comments and use the Save button at the bottom to save
- all your changes for that page at once.
-
-
The normal grading buttons on the right still work too in case you need more space.
- Your quickgrading preference is saved and will apply to all assignments in all courses.
-
+
Quick Grade
+
+
With quickgrading enabled you can quickly grade multiple assignments on one page.
+
+
Just change the grades and comments and use the Save button at the bottom to save
+ all your changes for that page at once.
+
+
The normal grading buttons on the right still work too in case you need more space.
+ Your quickgrading preference is saved and will apply to all assignments in all courses.
All of the PowerPoint slides get imported as Branch Tables with Previous and Next answers.
-
-
-
Open up your PowerPoint presentation.
-
Save it As a Web Page (no special options)
-
The result of step 3 should be a htm file and a folder with all of the slides converted to web pages.
- ZIP THE FOLDER only.
-
Go to your moodle site and add a new lesson.
-
After saving the lesson settings you should see 4 options under "What would you like to do first?" Click on "Import PowerPoint"
-
Use to the "Browse..." button to find your zip file from step 3. Then click on "Upload this file"
-
If everything worked, the next screen should just display a continue button.
-
-
-
If any images were in your PowerPoint, they would have been saved as course files in moddata/XY where X is your lesson's name and Y is a number (usually 0). Also, during the import process, files are created in your moodle data directory inside temp/lesson. These files are not deleted by importppt.php as of yet.
-
-
+
Import PowerPoint HTML
+
HOW TO USE
+
All of the PowerPoint slides get imported as Branch Tables with Previous and Next answers.
+
+
+
Open up your PowerPoint presentation.
+
Save it As a Web Page (no special options)
+
The result of step 3 should be a htm file and a folder with all of the slides converted to web pages.
+ ZIP THE FOLDER only.
+
Go to your moodle site and add a new lesson.
+
After saving the lesson settings you should see 4 options under "What would you like to do first?" Click on "Import PowerPoint"
+
Use to the "Browse..." button to find your zip file from step 3. Then click on "Upload this file"
+
If everything worked, the next screen should just display a continue button.
+
+
+
If any images were in your PowerPoint, they would have been saved as course files in moddata/XY where X is your lesson's name and Y is a number (usually 0). Also, during the import process, files are created in your moodle data directory inside temp/lesson. These files are not deleted by importppt.php as of yet.
A few of the Question Types have an option which is activated by clicking on
- the checkbox. The question types and the meaning of the options are
- detailed below.
-
-
-
Multichoice There is variant of Multichoice questions called
- "Multichoice Multianswer" questions. If the Question
- Option is selected then the student is required to select all the
- correct answers from the set of answers. The question may or may not tell
- the student how many correct answers there are. For example "Which of the
- following were US Presidents?" does not, while "Select the two US
- presidents from the following list." does. The actual number of correct
- answers can be from one up to the number of choices. (A Multichoice
- Multianswer question with one correct answer is different from a
- Multichoice question as the former allows the student the possibility of
- choosing more than one answer while the latter does not.)
-
-
-
Short Answer There are two different comparison systems available
- for the Short Answer type of question: the simple system is used by default;
- the "Regular Expressions" system is used if the "Use Regular
- Expressions" option box is checked. For more information, please read
- the Lesson question types help file.
-
-
-
The other Question Types do not use the Question Option.
+
Question Option
+
+
A few of the Question Types have an option which is activated by clicking on
+ the checkbox. The question types and the meaning of the options are
+ detailed below.
+
+
+
Multichoice There is variant of Multichoice questions called
+ "Multichoice Multianswer" questions. If the Question
+ Option is selected then the student is required to select all the
+ correct answers from the set of answers. The question may or may not tell
+ the student how many correct answers there are. For example "Which of the
+ following were US Presidents?" does not, while "Select the two US
+ presidents from the following list." does. The actual number of correct
+ answers can be from one up to the number of choices. (A Multichoice
+ Multianswer question with one correct answer is different from a
+ Multichoice question as the former allows the student the possibility of
+ choosing more than one answer while the latter does not.)
+
+
+
Short Answer There are two different comparison systems available
+ for the Short Answer type of question: the simple system is used by default;
+ the "Regular Expressions" system is used if the "Use Regular
+ Expressions" option box is checked. For more information, please read
+ the Lesson question types help file.
+
+
+
The other Question Types do not use the Question Option.
The types of Questions currently supported by the Lesson module are:
-
-
-
Multichoice This is the default question type. Multichoice questions
- are popular questions where the student is asked to choose one answer from a
- set of alternatives. The correct answer takes the student further into the
- lesson, the wrong answers do not. The wrong answers are sometimes called the
- "distractors" and the utility of these questions often rely more
- on the quality of the distractors than either the questions themselves or their
- correct answers.
-
-
Each answer can optionally have a response. If no response is
- entered for an answer then the default response "That's the Correct
- Answer" or "That's the Wrong Answer" is shown to the student.
-
-
It is possible to have more than one correct answer to a multichoice question.
- The different correct answers may give the student different responses and
- jump to different (forward) pages in the lesson but
- do not vary in their grades, (that is, some answers are not more correct
- than others, at least in terms of grade.) It is possible for all the answers
- to be correct and they might take the student to different (forward) parts of
- the lesson depending on which one is chosen.
-
-
There is variant of Multichoice questions called "Multichoice
- Multianswer" questions. These require the student to select all the
- correct answers from the set of answers. The question may or may not tell
- the student how many correct answers there are. For example "Which of the
- following were US Presidents?" does not, while "Select the two US
- presidents from the following list." does. The actual number of correct
- answers can be from one up to the number of choices. (A Multichoice
- Multianswer question with one correct answer is different from a
- Multichoice question as the former allows the student the possibility of
- choosing more than one answer while the latter does not.)
-
-
Again the correct answers are flagged using forward jumps, the wrong answers
- by same page or backward jumps. When there is more than one correct answer
- the jumps should all go to the same page, similarly with the wrong answers.
- If that is not the case a warning is given on the teacher's view of
- the lesson. The correct response, if required, should be given on the first
- correct answer and the wrong response, if required, should be on the first
- wrong answer. Responses on the other answers are ignored (without warning).
-
-
Short Answer
-
The student is prompted for a short piece of text.
- This is checked against one or more answers. Answers can be either correct
- or wrong. Each answer can optionally have a response. If no response is
- entered for an answer then the default response "That's the Correct
- Answer" or "That's the Wrong Answer" is shown to the student.
- If the text entered does not match any of the answers the question is wrong
- and the student is shown the default wrong response.
-
There are two different comparison systems available for the
- Short Answer type of question: the simple system is used by default; the
- "Regular Expressions" system is used if the "Use Regular
- Expressions" option box is checked.
-
-
Simple analysis
-
In this (default) system of analysis, the comparisons ignore the case of the text. The
- asterisk (*) character can be used in answers as a "wild card"
- character. It stands for any number of characters (including no characters
- at all). For example, the answer "Long*" will match
- "longer", "longest" and "long". If one of
- the answers is just "*" (a single *) this answer will match
- anything, it is normally used as the last "catch-all" answer. The
- matching process goes through the answers in the order they appear on the
- screen. Once a match is found the process stops and the corresponding
- result (and response, if present) is returned. So, if for example the
- answers are Longest, Long* and * (in that order), the input
- "longer" will match the second answer and, in this case, the
- third answer, although a match, is ignored.
-
If an asterisk (*) is actually needed in an answer, it should be entered as
- \*, backslash asterisk.
-
-
-
-
Regular Expressions analysis
-
This system gives you access to a more powerful but more complicated system for
- analysing the student's answers. For a complete introduction to Regular Expressions,
- see these sites regular-expressions
- tutorial or rezeau.org.
-
Correct answer matching a regular expression pattern
-
It is not possible to give complete examples of the vast possibilities offered
- by this system, and the following are just some possibilities.
-
Example 1. Suppose your question is "What are the colors
- of the French flag?". In the Answer 1 frame you type this regular
- expression: "it’s blue, white(,| and)
- red/i". This will match any of those four student answers:
-
-
it’s blue, white, red
-
it’s blue, white and red
-
It’s blue, white, red
-
It’s blue, white and red
-
-
Please note that by default a regular expression match is case sensitive; to
- make the match case insensitive you must add the /i parameter
- right at the end of your expression.
-
Example 2. Question: "What is blue, or red, or yellow?".
- Answer: "(|it's )a colou?r". This will match:
-
-
a colour
-
a color
-
it's a colour
-
it's a color
-
-
Notes.- The beginning of this regular expression "(|it's )" will
- match either nothing or "it's " (i.e. "it's" followed by
- a space). The ? (question-mark) means: preceding character zero or one time;
- it is used here to match British English as well as US spelling.
-
Example 3. Question: "Name an animal whose name is made
- of 3 letters and the middle letter is the vowel a". Anwer:
- "[bcr]at". This will match: bat, cat and rat.
-
Detecting missing required words or character strings
-
Regular expressions alone cannot detect absent character strings, so you have to
- add a little code in your Answer to take care of this. Any Teacher Answer which
- begins with a double hyphen will analyse the student’s answer to find out
- whether the following string is present or absent. If present, the analysis
- continues to the next question; if absent, the analysis stops and the relevant
- Response message is displayed.
-
Example 4.
-
-
Answer 2: --.*blue.*/i
-
student answer: "it's red and white"
-
Response 2: The color of the sky is missing!
-
Jump 2: this page
-
-
Here, the . (dot) stands for “any character” and the * (asterisk)
- means “preceding special character repeated any number of times”.
- The Answer2 regular expression above means: check whether the character string
- "blue", preceded with anything and followed by anything is absent
- from the student's answer. Please note that the use of the asterisk is different
- in the Simple analysis system and in the Regular Expressions system.
-
Example 5. Question: "Name an animal whose name is made of
- 3 letters and the middle letter is the vowel a". Teacher Answer: "--[b|c|r]". Response: "Your answer should start with one of these letters: b, c or r"
-
Detecting unwanted (incorrect) words or character strings
-
You may want to detect, in the student's answer, the presence of one or several
- words which should be not be there (because they are wrong) and
- to single them out with a specific response. Just start your teacher Answer by a
- double plus sign (++).
If any of these (wrong) colors is detected in the student’s answer,
- then the negative feedback message (Response 3) will be displayed and the
- wrong strings will be colored red (or the color of the .incorrect class if
- it exists in a CSS stylesheet of your active theme).
-
Example 7. Question: "Name an animal whose name is made
- of 3 letters and the middle letter is the vowel a". Teacher
- Answer: "++hat". Response: "You might wear one made of an
- animal's skin, but a hat can't be considered as an animal."
-
Escaping special characters
-
If you need to use characters which are part of the regular expressions set
- of special characters, you need to "escape" them (i.e. precede
- them with a backslash). E.g. if you want to accept the answer "My computer
- cost 1000$", you must write the regular expression as "My computer cost
- 1000\$". The special characters which must be escaped are .^$*()[]+?|
-
-
-
-
-
True/False The answer to this type of question only has two options,
- true or false. The student is prompted to choose which is the correct
- option. This type of question is basically a Multichoice question with just
- two choices.
-
-
Matching These are quite powerful and flexible questions. They
- consist of a list of names or statements which must be correctly matched
- against other list of names or statements. For example "Match the
- Capital with the Country" with the two lists Japan, Canada, Italy and
- Tokyo, Ottawa, Rome. It is possible to have repeated entries in one of the
- lists but care should be taken to make the repeats identical. For example
- "Identify the type of these creatures" with the lists Sparrow,
- Cow, Ant, Dog and Bird, Animal, Insect, Animal.
-
-
When creating this type of question the items for the first list go into the
- Answer boxes and items for the second list go into the Response boxes. Once
- created a more sensible labeling scheme is shown. When the student
- successfully matches the items the jump on the first answer is used. An
- unsuccessful answer jumps to the page on the second answer. The question does
- not support custom responses, the student is told how many matches
- are correct or if all the matches are correct.
-
-
Unlike the Multichoice question where the choices are shown in a random
- order, the first list of items is not shuffled but shown in the same
- order as entered. This allows for "Ordered" questions to be
- constructed. Consider the question " Put the following into the order
- they were born, the earliest first" with the lists 1., 2., 3., 4. and
- Longfellow, Lawrence, Lowell, Larkin. The second list is shuffed before
- being used in the question, of course.
-
-
Numerical This type of question requires a number as the answer.
- In it's simplest form it requires just one answer to be specified. For
- example "What is 2 plus 2?" with the answer 4 given a forward
- jump. However, it is better to specify a range because the internal rounding
- of numerical values can make single numeric comparisons rather hit or miss.
- Thus, if the question were "What is 10 divided by 3" it would be
- necessary to give the answer as "Minimum:Maximum", that
- is two values separated by a colon (:). Thus if 3.33:3.34 is given as the
- acceptable range for the answer, then the answers 3.33, 3.333, 3.3333...
- would all be taken as correct answers. "Wrong" answers would
- include 3.3 (less than the minimum) and 3.4 (greater than the maximum).
-
-
More than one correct answer is allowed and the answers can be either single
- or pair of values. Note that the order in which the answers are tested is
- Answer 1, Answer 2... so some care needs to taken if the desired response
- is to appear. For example the question "When was Larkin born?"
- could have the single value of 1922, the exact answer, and the pair of
- values 1920:1929, the 20's, as the less exact answer.The order in which
- these values should be tested is, obviously, 1922 then 1920:1929. The
- first answer might have the response "That's exactly right"
- while the other answer's response might be "That's close, you've got
- the right decade"
-
-
Wrong answers can be given but depending on their actual range, care should
- be taken to place them after the correct answers. For example in adding the
- wrong answer 3:4 to the "10 divided by 3" question it needs to come
- after the correct answer. That is the answers are ordered 3.33:3.34 (the
- "correct" answer) then 3:4 (the "wrong" answer, but
- not wildly wrong answer!).
-
-
+
Question Types
+
+
The types of Questions currently supported by the Lesson module are:
+
+
+
Multichoice This is the default question type. Multichoice questions
+ are popular questions where the student is asked to choose one answer from a
+ set of alternatives. The correct answer takes the student further into the
+ lesson, the wrong answers do not. The wrong answers are sometimes called the
+ "distractors" and the utility of these questions often rely more
+ on the quality of the distractors than either the questions themselves or their
+ correct answers.
+
+
Each answer can optionally have a response. If no response is
+ entered for an answer then the default response "That's the Correct
+ Answer" or "That's the Wrong Answer" is shown to the student.
+
+
It is possible to have more than one correct answer to a multichoice question.
+ The different correct answers may give the student different responses and
+ jump to different (forward) pages in the lesson but
+ do not vary in their grades, (that is, some answers are not more correct
+ than others, at least in terms of grade.) It is possible for all the answers
+ to be correct and they might take the student to different (forward) parts of
+ the lesson depending on which one is chosen.
+
+
There is variant of Multichoice questions called "Multichoice
+ Multianswer" questions. These require the student to select all the
+ correct answers from the set of answers. The question may or may not tell
+ the student how many correct answers there are. For example "Which of the
+ following were US Presidents?" does not, while "Select the two US
+ presidents from the following list." does. The actual number of correct
+ answers can be from one up to the number of choices. (A Multichoice
+ Multianswer question with one correct answer is different from a
+ Multichoice question as the former allows the student the possibility of
+ choosing more than one answer while the latter does not.)
+
+
Again the correct answers are flagged using forward jumps, the wrong answers
+ by same page or backward jumps. When there is more than one correct answer
+ the jumps should all go to the same page, similarly with the wrong answers.
+ If that is not the case a warning is given on the teacher's view of
+ the lesson. The correct response, if required, should be given on the first
+ correct answer and the wrong response, if required, should be on the first
+ wrong answer. Responses on the other answers are ignored (without warning).
+
+
Short Answer
+
The student is prompted for a short piece of text.
+ This is checked against one or more answers. Answers can be either correct
+ or wrong. Each answer can optionally have a response. If no response is
+ entered for an answer then the default response "That's the Correct
+ Answer" or "That's the Wrong Answer" is shown to the student.
+ If the text entered does not match any of the answers the question is wrong
+ and the student is shown the default wrong response.
+
There are two different comparison systems available for the
+ Short Answer type of question: the simple system is used by default; the
+ "Regular Expressions" system is used if the "Use Regular
+ Expressions" option box is checked.
+
+
Simple analysis
+
In this (default) system of analysis, the comparisons ignore the case of the text. The
+ asterisk (*) character can be used in answers as a "wild card"
+ character. It stands for any number of characters (including no characters
+ at all). For example, the answer "Long*" will match
+ "longer", "longest" and "long". If one of
+ the answers is just "*" (a single *) this answer will match
+ anything, it is normally used as the last "catch-all" answer. The
+ matching process goes through the answers in the order they appear on the
+ screen. Once a match is found the process stops and the corresponding
+ result (and response, if present) is returned. So, if for example the
+ answers are Longest, Long* and * (in that order), the input
+ "longer" will match the second answer and, in this case, the
+ third answer, although a match, is ignored.
+
If an asterisk (*) is actually needed in an answer, it should be entered as
+ \*, backslash asterisk.
+
+
+
+
Regular Expressions analysis
+
This system gives you access to a more powerful but more complicated system for
+ analysing the student's answers. For a complete introduction to Regular Expressions,
+ see these sites regular-expressions
+ tutorial or rezeau.org.
+
Correct answer matching a regular expression pattern
+
It is not possible to give complete examples of the vast possibilities offered
+ by this system, and the following are just some possibilities.
+
Example 1. Suppose your question is "What are the colors
+ of the French flag?". In the Answer 1 frame you type this regular
+ expression: "it’s blue, white(,| and)
+ red/i". This will match any of those four student answers:
+
+
it’s blue, white, red
+
it’s blue, white and red
+
It’s blue, white, red
+
It’s blue, white and red
+
+
Please note that by default a regular expression match is case sensitive; to
+ make the match case insensitive you must add the /i parameter
+ right at the end of your expression.
+
Example 2. Question: "What is blue, or red, or yellow?".
+ Answer: "(|it's )a colou?r". This will match:
+
+
a colour
+
a color
+
it's a colour
+
it's a color
+
+
Notes.- The beginning of this regular expression "(|it's )" will
+ match either nothing or "it's " (i.e. "it's" followed by
+ a space). The ? (question-mark) means: preceding character zero or one time;
+ it is used here to match British English as well as US spelling.
+
Example 3. Question: "Name an animal whose name is made
+ of 3 letters and the middle letter is the vowel a". Anwer:
+ "[bcr]at". This will match: bat, cat and rat.
+
Detecting missing required words or character strings
+
Regular expressions alone cannot detect absent character strings, so you have to
+ add a little code in your Answer to take care of this. Any Teacher Answer which
+ begins with a double hyphen will analyse the student’s answer to find out
+ whether the following string is present or absent. If present, the analysis
+ continues to the next question; if absent, the analysis stops and the relevant
+ Response message is displayed.
+
Example 4.
+
+
Answer 2: --.*blue.*/i
+
student answer: "it's red and white"
+
Response 2: The color of the sky is missing!
+
Jump 2: this page
+
+
Here, the . (dot) stands for “any character” and the * (asterisk)
+ means “preceding special character repeated any number of times”.
+ The Answer2 regular expression above means: check whether the character string
+ "blue", preceded with anything and followed by anything is absent
+ from the student's answer. Please note that the use of the asterisk is different
+ in the Simple analysis system and in the Regular Expressions system.
+
Example 5. Question: "Name an animal whose name is made of
+ 3 letters and the middle letter is the vowel a". Teacher Answer: "--[b|c|r]". Response: "Your answer should start with one of these letters: b, c or r"
+
Detecting unwanted (incorrect) words or character strings
+
You may want to detect, in the student's answer, the presence of one or several
+ words which should be not be there (because they are wrong) and
+ to single them out with a specific response. Just start your teacher Answer by a
+ double plus sign (++).
If any of these (wrong) colors is detected in the student’s answer,
+ then the negative feedback message (Response 3) will be displayed and the
+ wrong strings will be colored red (or the color of the .incorrect class if
+ it exists in a CSS stylesheet of your active theme).
+
Example 7. Question: "Name an animal whose name is made
+ of 3 letters and the middle letter is the vowel a". Teacher
+ Answer: "++hat". Response: "You might wear one made of an
+ animal's skin, but a hat can't be considered as an animal."
+
Escaping special characters
+
If you need to use characters which are part of the regular expressions set
+ of special characters, you need to "escape" them (i.e. precede
+ them with a backslash). E.g. if you want to accept the answer "My computer
+ cost 1000$", you must write the regular expression as "My computer cost
+ 1000\$". The special characters which must be escaped are .^$*()[]+?|
+
+
+
+
+
True/False The answer to this type of question only has two options,
+ true or false. The student is prompted to choose which is the correct
+ option. This type of question is basically a Multichoice question with just
+ two choices.
+
+
Matching These are quite powerful and flexible questions. They
+ consist of a list of names or statements which must be correctly matched
+ against other list of names or statements. For example "Match the
+ Capital with the Country" with the two lists Japan, Canada, Italy and
+ Tokyo, Ottawa, Rome. It is possible to have repeated entries in one of the
+ lists but care should be taken to make the repeats identical. For example
+ "Identify the type of these creatures" with the lists Sparrow,
+ Cow, Ant, Dog and Bird, Animal, Insect, Animal.
+
+
When creating this type of question the items for the first list go into the
+ Answer boxes and items for the second list go into the Response boxes. Once
+ created a more sensible labeling scheme is shown. When the student
+ successfully matches the items the jump on the first answer is used. An
+ unsuccessful answer jumps to the page on the second answer. The question does
+ not support custom responses, the student is told how many matches
+ are correct or if all the matches are correct.
+
+
Unlike the Multichoice question where the choices are shown in a random
+ order, the first list of items is not shuffled but shown in the same
+ order as entered. This allows for "Ordered" questions to be
+ constructed. Consider the question " Put the following into the order
+ they were born, the earliest first" with the lists 1., 2., 3., 4. and
+ Longfellow, Lawrence, Lowell, Larkin. The second list is shuffed before
+ being used in the question, of course.
+
+
Numerical This type of question requires a number as the answer.
+ In it's simplest form it requires just one answer to be specified. For
+ example "What is 2 plus 2?" with the answer 4 given a forward
+ jump. However, it is better to specify a range because the internal rounding
+ of numerical values can make single numeric comparisons rather hit or miss.
+ Thus, if the question were "What is 10 divided by 3" it would be
+ necessary to give the answer as "Minimum:Maximum", that
+ is two values separated by a colon (:). Thus if 3.33:3.34 is given as the
+ acceptable range for the answer, then the answers 3.33, 3.333, 3.3333...
+ would all be taken as correct answers. "Wrong" answers would
+ include 3.3 (less than the minimum) and 3.4 (greater than the maximum).
+
+
More than one correct answer is allowed and the answers can be either single
+ or pair of values. Note that the order in which the answers are tested is
+ Answer 1, Answer 2... so some care needs to taken if the desired response
+ is to appear. For example the question "When was Larkin born?"
+ could have the single value of 1922, the exact answer, and the pair of
+ values 1920:1929, the 20's, as the less exact answer.The order in which
+ these values should be tested is, obviously, 1922 then 1920:1929. The
+ first answer might have the response "That's exactly right"
+ while the other answer's response might be "That's close, you've got
+ the right decade"
+
+
Wrong answers can be given but depending on their actual range, care should
+ be taken to place them after the correct answers. For example in adding the
+ wrong answer 3:4 to the "10 divided by 3" question it needs to come
+ after the correct answer. That is the answers are ordered 3.33:3.34 (the
+ "correct" answer) then 3:4 (the "wrong" answer, but
+ not wildly wrong answer!).
This facility allows the batch upload of groups into Moodle.
-
-
-
-
Each line of the file contains one record
-
Each record is a series of data separated by commas
-
The first record of the file is special, and contains a list of fieldnames. This defines the format of the rest of the file.
-
-
Required fieldnames: these fields must be included in the first record, and defined for each user
-
- groupname
-
-
Default fieldnames: these are optional - if they are not included then the values are taken from the current language and current course
-
idnumber, coursename, lang
-
Optional fieldnames: all of these are completely optional.
-
description, picture, hidepicture
-
-
-
Commas within the data should be encoded as , - the script will automatically decode these back to commas.
-
For Boolean fields, use 0 for false and 1 for true.
-
Either idnumber or coursename can be used to identify the course. Idnumber overrides coursename. If neither is specified, the groups will be added to the current course.
-
Coursename is the course shortname.
-
Note: If a group is already registered in the Moodle database for a particular course, this script will return the
- group name for that group. Teachers are only allowed to upload groups in courses they are authorized to edit.
-
-
-
Here is an example of a valid import file:
-
groupname,idnumber,lang,description,picture
-group1, Phil101, en, this group requires extra attention!, 0
-group2, Math243, , ,
-
-
+
Upload groups
+
+
This facility allows the batch upload of groups into Moodle.
+
+
+
+
Each line of the file contains one record
+
Each record is a series of data separated by commas
+
The first record of the file is special, and contains a list of fieldnames. This defines the format of the rest of the file.
+
+
Required fieldnames: these fields must be included in the first record, and defined for each user
+
+ groupname
+
+
Default fieldnames: these are optional - if they are not included then the values are taken from the current language and current course
+
idnumber, coursename, lang
+
Optional fieldnames: all of these are completely optional.
+
description, picture, hidepicture
+
+
+
Commas within the data should be encoded as , - the script will automatically decode these back to commas.
+
For Boolean fields, use 0 for false and 1 for true.
+
Either idnumber or coursename can be used to identify the course. Idnumber overrides coursename. If neither is specified, the groups will be added to the current course.
+
Coursename is the course shortname.
+
Note: If a group is already registered in the Moodle database for a particular course, this script will return the
+ group name for that group. Teachers are only allowed to upload groups in courses they are authorized to edit.
+
+
+
Here is an example of a valid import file:
+
groupname,idnumber,lang,description,picture
+group1, Phil101, en, this group requires extra attention!, 0
+group2, Math243, , ,
+
+
diff --git a/lang/en_utf8/lams.php b/lang/en_utf8/lams.php
index 4d37b58361..f56c1594f2 100644
--- a/lang/en_utf8/lams.php
+++ b/lang/en_utf8/lams.php
@@ -1,28 +1,28 @@
-LAMS international.';
-$string['serverkey'] = 'Enter the server key received from LAMS international.';
-$string['serverurl'] = 'Enter the basic URL used to access the LAMS server. For example http://localhost:8080/lams';
-$string['useSequence'] = 'Use selected sequence';
-$string['visibletostudents'] = 'Show activity to students';
-$string['wikistartederror'] = 'Wiki already has entries - can\'t change.';
-$string['workspace'] = 'Select Workspace';
-$string['wrongversionrange'] = '$a is not a correct range!';
-
-?>
+LAMS international.';
+$string['serverkey'] = 'Enter the server key received from LAMS international.';
+$string['serverurl'] = 'Enter the basic URL used to access the LAMS server. For example http://localhost:8080/lams';
+$string['useSequence'] = 'Use selected sequence';
+$string['visibletostudents'] = 'Show activity to students';
+$string['wikistartederror'] = 'Wiki already has entries - can\'t change.';
+$string['workspace'] = 'Select Workspace';
+$string['wrongversionrange'] = '$a is not a correct range!';
+
+?>
diff --git a/login/change_password_form.html b/login/change_password_form.html
index c9a924c1cd..ff585a6262 100644
--- a/login/change_password_form.html
+++ b/login/change_password_form.html
@@ -1,65 +1,65 @@
-
-
-
';
+ } else {
+ $reportshow = get_string('noreports','scorm');
+ }
+ } else if (has_capability('mod/scorm:viewscores', $context)) {
+ require_once('locallib.php');
+ $report = scorm_grade_user(get_records('scorm_scoes','scorm',$scorm->id), $USER->id, $scorm->grademethod);
+ $reportshow = get_string('score','scorm').": ".$report;
+ }
+ if (!$scorm->visible) {
+ //Show dimmed if the mod is hidden
+ $table->data[] = array ($tt, "coursemodule\">".format_string($scorm->name,true)."",
+ format_text($scorm->summary),$reportshow);
+ } else {
+ //Show normal if the mod is visible
+ $table->data[] = array ($tt, "coursemodule\">".format_string($scorm->name,true)."",
+ format_text($scorm->summary), $reportshow);
+ }
+ }
+
+ echo " ";
+
+ print_table($table);
+
+ print_footer($course);
+
+?>
+
diff --git a/mod/scorm/loadSCO.php b/mod/scorm/loadSCO.php
index c1361fc3de..56db83cd6e 100755
--- a/mod/scorm/loadSCO.php
+++ b/mod/scorm/loadSCO.php
@@ -1,113 +1,113 @@
-course)) {
- error("Course is misconfigured");
- }
- if (! $scorm = get_record("scorm", "id", $cm->instance)) {
- error("Course module is incorrect");
- }
- } else if (!empty($a)) {
- if (! $scorm = get_record("scorm", "id", $a)) {
- error("Course module is incorrect");
- }
- if (! $course = get_record("course", "id", $scorm->course)) {
- error("Course is misconfigured");
- }
- if (! $cm = get_coursemodule_from_instance("scorm", $scorm->id, $course->id)) {
- error("Course Module ID was incorrect");
- }
- } else {
- error('A required parameter is missing');
- }
-
- require_login($course->id, false, $cm);
- if (!empty($scoid)) {
- //
- // Direct SCO request
- //
- if ($sco = get_record("scorm_scoes","id",$scoid)) {
- if ($sco->launch == '') {
- // Search for the next launchable sco
- if ($scoes = get_records_select("scorm_scoes","scorm=".$scorm->id." AND launch<>'' AND id>".$sco->id,"id ASC")) {
- $sco = current($scoes);
- }
- }
- }
- }
- //
- // If no sco was found get the first of SCORM package
- //
- if (!isset($sco)) {
- $scoes = get_records_select("scorm_scoes","scorm=".$scorm->id." AND launch<>''","id ASC");
- $sco = current($scoes);
- }
-
- //
- // Forge SCO URL
- //
- $connector = '';
- $version = substr($scorm->version,0,4);
- if (!empty($sco->parameters) || ($version == 'AICC')) {
- if (stripos($sco->launch,'?') !== false) {
- $connector = '&';
- } else {
- $connector = '?';
- }
- if (!empty($sco->parameters) && ($sco->parameters[0] == '?')) {
- $sco->parameters = substr($sco->parameters,1);
- }
- }
-
- if ($version == 'AICC') {
- if (!empty($sco->parameters)) {
- $sco->parameters = '&'. $sco->parameters;
- }
- $launcher = $sco->launch.$connector.'aicc_sid='.sesskey().'&aicc_url='.$CFG->wwwroot.'/mod/scorm/type/aicc/aicc.php'.$sco->parameters;
- } else {
- $launcher = $sco->launch.$connector.$sco->parameters;
- }
-
- if (scorm_external_link($sco->launch)) {
- $result = $launcher;
- } else if ($scorm->reference[0] == '#') {
- require_once($repositoryconfigfile);
- $result = $CFG->repositorywebroot.substr($scorm->reference,1).'/'.$sco->launch;
- } else {
- if (basename($scorm->reference) == 'imsmanifest.xml') {
- $basedir = dirname($scorm->reference);
- } else {
- $basedir = 'moddata/scorm/'.$scorm->id;
- }
- if ($CFG->slasharguments) {
- $result = $CFG->wwwroot.'/file.php/'.$scorm->course.'/'.$basedir.'/'.$launcher;
- } else {
- $result = $CFG->wwwroot.'/file.php?file=/'.$scorm->course.'/'.$basedir.'/'.$launcher;
- }
- }
-?>
-
-
- LoadSCO
-
-
-
-
-
-
-
+course)) {
+ error("Course is misconfigured");
+ }
+ if (! $scorm = get_record("scorm", "id", $cm->instance)) {
+ error("Course module is incorrect");
+ }
+ } else if (!empty($a)) {
+ if (! $scorm = get_record("scorm", "id", $a)) {
+ error("Course module is incorrect");
+ }
+ if (! $course = get_record("course", "id", $scorm->course)) {
+ error("Course is misconfigured");
+ }
+ if (! $cm = get_coursemodule_from_instance("scorm", $scorm->id, $course->id)) {
+ error("Course Module ID was incorrect");
+ }
+ } else {
+ error('A required parameter is missing');
+ }
+
+ require_login($course->id, false, $cm);
+ if (!empty($scoid)) {
+ //
+ // Direct SCO request
+ //
+ if ($sco = get_record("scorm_scoes","id",$scoid)) {
+ if ($sco->launch == '') {
+ // Search for the next launchable sco
+ if ($scoes = get_records_select("scorm_scoes","scorm=".$scorm->id." AND launch<>'' AND id>".$sco->id,"id ASC")) {
+ $sco = current($scoes);
+ }
+ }
+ }
+ }
+ //
+ // If no sco was found get the first of SCORM package
+ //
+ if (!isset($sco)) {
+ $scoes = get_records_select("scorm_scoes","scorm=".$scorm->id." AND launch<>''","id ASC");
+ $sco = current($scoes);
+ }
+
+ //
+ // Forge SCO URL
+ //
+ $connector = '';
+ $version = substr($scorm->version,0,4);
+ if (!empty($sco->parameters) || ($version == 'AICC')) {
+ if (stripos($sco->launch,'?') !== false) {
+ $connector = '&';
+ } else {
+ $connector = '?';
+ }
+ if (!empty($sco->parameters) && ($sco->parameters[0] == '?')) {
+ $sco->parameters = substr($sco->parameters,1);
+ }
+ }
+
+ if ($version == 'AICC') {
+ if (!empty($sco->parameters)) {
+ $sco->parameters = '&'. $sco->parameters;
+ }
+ $launcher = $sco->launch.$connector.'aicc_sid='.sesskey().'&aicc_url='.$CFG->wwwroot.'/mod/scorm/type/aicc/aicc.php'.$sco->parameters;
+ } else {
+ $launcher = $sco->launch.$connector.$sco->parameters;
+ }
+
+ if (scorm_external_link($sco->launch)) {
+ $result = $launcher;
+ } else if ($scorm->reference[0] == '#') {
+ require_once($repositoryconfigfile);
+ $result = $CFG->repositorywebroot.substr($scorm->reference,1).'/'.$sco->launch;
+ } else {
+ if (basename($scorm->reference) == 'imsmanifest.xml') {
+ $basedir = dirname($scorm->reference);
+ } else {
+ $basedir = 'moddata/scorm/'.$scorm->id;
+ }
+ if ($CFG->slasharguments) {
+ $result = $CFG->wwwroot.'/file.php/'.$scorm->course.'/'.$basedir.'/'.$launcher;
+ } else {
+ $result = $CFG->wwwroot.'/file.php?file=/'.$scorm->course.'/'.$basedir.'/'.$launcher;
+ }
+ }
+?>
+
+
+ LoadSCO
+
+
+
+
+
+
+
diff --git a/mod/scorm/mod.html b/mod/scorm/mod.html
index 66a8de0f67..88a86db795 100755
--- a/mod/scorm/mod.html
+++ b/mod/scorm/mod.html
@@ -1,450 +1,450 @@
-dirroot.'/mod/scorm/configurations.php');
- if (!isset($form->name)) {
- $form->name = '';
- }
- if (!isset($form->reference)) {
- $form->reference = '';
- }
- if (!isset($form->summary)) {
- $form->summary = '';
- }
- if (!isset($form->launch)) {
- $form->launch = '';
- }
- if (!isset($form->auto)) {
- $form->auto = '';
- }
- if (!isset($form->popup)) {
- $form->popup = 0;
- }
- if (!isset($form->datadir)) {
- $form->datadir = '';
- }
- if (!isset($form->maxgrade)) {
- $form->maxgrade = '';
- }
- if (!isset($form->grademethod)) {
- $form->grademethod = 0;
- }
- if (!isset($form->maxattempt)) {
- $form->maxattempt = 1;
- }
- if (!isset($form->whatgrade)) {
- $form->whatgrade = 0;
- }
- if (!isset($form->hidebrowse)) {
- $form->hidebrowse = 0;
- }
- if (!isset($form->hidetoc)) {
- $form->hidetoc = 0;
- }
- if (!isset($form->hidenav)) {
- $form->hidenav = 0;
- }
- if (!isset($form->width)) {
- $form->width = $CFG->scorm_framewidth;
- }
- if ((strpos($form->width,'%') === false) && ($form->width <= 100)) {
- $form->width .= '%';
- }
- if (!isset($form->height)) {
- $form->height = $CFG->scorm_frameheight;
- }
- if ((strpos($form->height,'%') === false) && ($form->height <= 100)) {
- $form->height .= '%';
- }
- if (!isset($form->options) || empty($form->options)) {
- $form->options = $stdoptions;
- }
- $options = explode(',',$form->options);
- $window = new stdClass();
- foreach ($options as $option) {
- list($element,$value) = explode('=',$option);
- $element = trim($element);
- $window->$element = trim($value)==1?'checked':'';
- }
- if (!isset($form->pkgtype)) {
- $form->pkgtype = '';
- }
- $scormid = '';
- if (!empty($form->instance)) {
- $scormid = '&instance='.$form->instance;
- }
- $datadir = '';
- if (!empty($form->datadir)) {
- $datadir = '&datadir='.$form->datadir;
- }
- $sessionkey = '';
- if (!empty($form->sesskey)) {
- $sessionkey = '&sesskey='.$form->sesskey;
- }
-
- $strfilename = get_string('coursepacket', 'scorm');
- $strchooseafile = get_string('chooseapacket', 'scorm');
- $strbrowserepository = get_string('browserepository', 'scorm');
- $striframe = get_string('iframe', 'scorm');
- $striframedisplay = get_string('iframedisplay', 'scorm');
- $strnewwindow = get_string('popup', 'scorm');
- $strnewwindowopen = get_string('popupopen', 'scorm');
- $strheight = get_string('height', 'scorm');
- $strwidth = get_string('width', 'scorm');
- $strresizable = get_string('resizable', 'scorm');
- $strscrollbars = get_string('scrollbars', 'scorm');
- $strdirectories = get_string('directories', 'scorm');
- $strlocation = get_string('location', 'scorm');
- $strmenubar = get_string('menubar', 'scorm');
- $strtoolbar = get_string('toolbar', 'scorm');
- $strstatus = get_string('statusbar', 'scorm');
-?>
-
-
-
-
-
+dirroot.'/mod/scorm/configurations.php');
+ if (!isset($form->name)) {
+ $form->name = '';
+ }
+ if (!isset($form->reference)) {
+ $form->reference = '';
+ }
+ if (!isset($form->summary)) {
+ $form->summary = '';
+ }
+ if (!isset($form->launch)) {
+ $form->launch = '';
+ }
+ if (!isset($form->auto)) {
+ $form->auto = '';
+ }
+ if (!isset($form->popup)) {
+ $form->popup = 0;
+ }
+ if (!isset($form->datadir)) {
+ $form->datadir = '';
+ }
+ if (!isset($form->maxgrade)) {
+ $form->maxgrade = '';
+ }
+ if (!isset($form->grademethod)) {
+ $form->grademethod = 0;
+ }
+ if (!isset($form->maxattempt)) {
+ $form->maxattempt = 1;
+ }
+ if (!isset($form->whatgrade)) {
+ $form->whatgrade = 0;
+ }
+ if (!isset($form->hidebrowse)) {
+ $form->hidebrowse = 0;
+ }
+ if (!isset($form->hidetoc)) {
+ $form->hidetoc = 0;
+ }
+ if (!isset($form->hidenav)) {
+ $form->hidenav = 0;
+ }
+ if (!isset($form->width)) {
+ $form->width = $CFG->scorm_framewidth;
+ }
+ if ((strpos($form->width,'%') === false) && ($form->width <= 100)) {
+ $form->width .= '%';
+ }
+ if (!isset($form->height)) {
+ $form->height = $CFG->scorm_frameheight;
+ }
+ if ((strpos($form->height,'%') === false) && ($form->height <= 100)) {
+ $form->height .= '%';
+ }
+ if (!isset($form->options) || empty($form->options)) {
+ $form->options = $stdoptions;
+ }
+ $options = explode(',',$form->options);
+ $window = new stdClass();
+ foreach ($options as $option) {
+ list($element,$value) = explode('=',$option);
+ $element = trim($element);
+ $window->$element = trim($value)==1?'checked':'';
+ }
+ if (!isset($form->pkgtype)) {
+ $form->pkgtype = '';
+ }
+ $scormid = '';
+ if (!empty($form->instance)) {
+ $scormid = '&instance='.$form->instance;
+ }
+ $datadir = '';
+ if (!empty($form->datadir)) {
+ $datadir = '&datadir='.$form->datadir;
+ }
+ $sessionkey = '';
+ if (!empty($form->sesskey)) {
+ $sessionkey = '&sesskey='.$form->sesskey;
+ }
+
+ $strfilename = get_string('coursepacket', 'scorm');
+ $strchooseafile = get_string('chooseapacket', 'scorm');
+ $strbrowserepository = get_string('browserepository', 'scorm');
+ $striframe = get_string('iframe', 'scorm');
+ $striframedisplay = get_string('iframedisplay', 'scorm');
+ $strnewwindow = get_string('popup', 'scorm');
+ $strnewwindowopen = get_string('popupopen', 'scorm');
+ $strheight = get_string('height', 'scorm');
+ $strwidth = get_string('width', 'scorm');
+ $strresizable = get_string('resizable', 'scorm');
+ $strscrollbars = get_string('scrollbars', 'scorm');
+ $strdirectories = get_string('directories', 'scorm');
+ $strlocation = get_string('location', 'scorm');
+ $strmenubar = get_string('menubar', 'scorm');
+ $strtoolbar = get_string('toolbar', 'scorm');
+ $strstatus = get_string('statusbar', 'scorm');
+?>
+
+
+
+
+
diff --git a/mod/scorm/sequencinglib.php b/mod/scorm/sequencinglib.php
index ed08701583..3d88b4ad7d 100755
--- a/mod/scorm/sequencinglib.php
+++ b/mod/scorm/sequencinglib.php
@@ -1,514 +1,514 @@
->>>> SCO goi Rollup la ".$scoidchild);
- $scochild = get_record("scorm_scoes","id",$scoidchild);
- $scoparent = get_record("scorm_scoes","scorm",$scormid,"identifier",$scochild->parent);
- //Danh sach cac con cua cha
- $scochildren = get_records_select("scorm_scoes","scorm =".$scormid." and parent ='".$scoparent->identifier."'");
- //Lay gia tri last attempt
- //fwrite($ft,"\n >>>>> Bat dau xu ly Rollup SCO cha ".$scoparent->id);
- $attempt = scorm_get_last_attempt($scormid,$userid);
-
- if(!empty($scoparent)){
- $scoid = $scoparent->id;
- $rolluprules = get_record("scorm_sequencing_rolluprules","scormid",$scormid,"scoid",$scoid);
- if (!empty($rolluprules)){
- $idrolluprules = $rolluprules->id;
- $rules = get_records_select('scorm_sequencing_rolluprule','scoid ='.$scoid.' and rolluprulesid ='. $idrolluprules);
-
- foreach ($rules as $rule){
- $ruleid = $rule->id;
- $ruleConditions = get_record("scorm_sequencing_rollupruleconditions","scoid",$scoid,"rollupruleid",$ruleid);
- $idruleConditions = $ruleConditions->id;
- $conditions = get_records_select('scorm_sequencing_rolluprulecondition','scoid ='.$scoid.' and ruleconditionsid ='.$idruleConditions);
-
- //Truong hop 1: childactivitySet = all
- // conditioncombination = any
- if (($rule->childactivityset == 'all') && ($ruleConditions->conditioncombination=='any')){
- foreach($conditions as $condition){
- $conditionOK = false;
- //Condition 1: condition = attempted operator = 'noOp'
- // Thuc hien rollupaction
- if (($condition->condition == 'attempted') && ($condition->operator=='noOp')){
- $conditionOK = true;
- foreach ($scochildren as $sco){
- //fwrite($ft,"\n >>>>> Xu ly Rollup voi dieu kien attempt \n");
- $usertrack = scorm_get_tracks($sco->id,$userid);
- if ($usertrack->attempt_status != 'attempted'){
- //fwrite($ft,"\n >>>>> Co SCO con chua attempted \n");
- $conditionOK = false;
- }
- }
- }
- //Condition 2: condition = attempted operator = 'not'
- // Thuc hien rollupaction
- if (($condition->condition == 'attempted') && ($condition->operator=='not')){
- $conditionOK = true;
- foreach ($scochildren as $sco){
- //fwrite($ft,"\n >>>>> Xu ly Rollup voi dieu kien not attempt \n");
- $usertrack = scorm_get_tracks($sco->id,$userid);
- if ($usertrack->attempt_status != 'notattempted'){
- $conditionOK = false;
- }
- }
- }
- //Condition 3: condition = satisfied operator = 'noOp'
- // Thuc hien rollupaction
- if (($condition->condition == 'satisfied') && ($condition->operator=='noOp')){
- $conditionOK = true;
- foreach ($scochildren as $sco){
- $usertrack = scorm_get_tracks($sco->id,$userid);
- if ($usertrack->satisfied_status != 'satisfied'){
- $conditionOK = false;
- }
- }
- }
- //Condition 4: condition = satisfied operator = 'not'
- // Thuc hien rollupaction
- if (($condition->condition == 'satisfied') && ($condition->operator=='not')){
- $conditionOK = true;
- foreach ($scochildren as $sco){
- $usertrack = scorm_get_tracks($sco->id,$userid);
- if ($usertrack->satisfied_status != 'notSatisfied'){
- $conditionOK = false;
- }
- }
- }
- //Condition 5: condition = completed operator = 'noOp'
- // Thuc hien rollupaction
- if (($condition->condition == 'completed') && ($condition->operator=='noOp')){
- $conditionOK = true;
- foreach ($scochildren as $sco){
- $usertrack = scorm_get_tracks($sco->id,$userid);
- if ($usertrack->attempt_status != 'completed'){
- $conditionOK = false;
- }
- }
- }
- //Condition 6: condition = completed operator = 'not'
- // Thuc hien rollupaction
- if (($condition->condition == 'completed') && ($condition->operator=='not')){
- $conditionOK = true;
- foreach ($scochildren as $sco){
- $usertrack = scorm_get_tracks($sco->id,$userid);
- if ($usertrack->attempt_status != 'notcompleted'){
- $conditionOK = false;
- }
- }
- }
- //Neu dieu kien van dung sau khi xem xet thi thuc hien action
- if ($conditionOK == true){
- if ($ruleConditions->rollupruleaction == 'completed')
- {
- scorm_insert_track($userid,$scormid,$scoid,$attempt,'cmi.completion_status','completed');
- //fwrite($ft,"\n >>>>> Xu ly Rollup thanh cong voi completed cho SCO ".$scoid);
- }
- if ($ruleConditions->rollupruleaction == 'satisfied')
- {
- scorm_insert_track($userid,$scormid,$scoid,$attempt,'cmi.success_status','passed');
- //fwrite($ft,"\n >>>>> Xu ly Rollup thanh cong voi satisfied\n");
- }
- if ($ruleConditions->rollupruleaction == 'notSatisfied')
- {
- scorm_insert_track($userid,$scormid,$scoid,$attempt,'cmi.success_status','failed');
- //fwrite($ft,"\n >>>>> Xu ly Rollup thanh cong voi notSatisfied\n");
- }
- //echo "";
- $sequencingResult->rule = 'exit';
- $sequencingResult->action = 'exit';
- }
- if ($sequencingrule->preconditionruleaction=='disabled')
- {
- //fwrite($ft,"\n >>>>> Xu ly Sequencing thanh cong -- Thuc hien su kien disable \n");
- echo "";
- $sequencingResult->rule = 'pre';
- $sequencingResult->action = 'disable';
-
- }
-
- }
- }
- }
- }
- return $sequencingResult;
-}
-
-function get_sco_after_exit($scoid,$scormid){
- $scochild = get_record("scorm_scoes","id",$scoid);
- $scoparent = get_record("scorm_scoes","scorm",$scormid,"identifier",$scochild->parent);
- $exitscoid = $scoid++;
- $exitscochild = get_record("scorm_scoes","id",$exitscoid,"scorm",$scormid);
- if (empty($exitscochild)){
- //Da ra ngoai vung scoid. Hay day chinh la sco cuoi cung
- return 0;
- }
- else{
- $exitscoparent = get_record("scorm_scoes","scorm",$scormid,"identifier",$exitscochild->parent);
- //Neu chua ra khoi activity do thi tiep tuc
- while ($exitscoparent->id == $scoparent->id){
- $exitscoid++;
- $exitscochild = get_record("scorm_scoes","id",$exitscoid);
- if (empty($exitscochild)){
- //Da ra ngoai vung scoid. Hay day chinh la sco cuoi cung
- return 0;
- }
- else{
- $exitscoparent = get_record("scorm_scoes","scorm",$scormid,"identifier",$exitscochild->parent);
- }
- }
- }
- return $exitscoid;
-}
-
-?>
+>>>> SCO goi Rollup la ".$scoidchild);
+ $scochild = get_record("scorm_scoes","id",$scoidchild);
+ $scoparent = get_record("scorm_scoes","scorm",$scormid,"identifier",$scochild->parent);
+ //Danh sach cac con cua cha
+ $scochildren = get_records_select("scorm_scoes","scorm =".$scormid." and parent ='".$scoparent->identifier."'");
+ //Lay gia tri last attempt
+ //fwrite($ft,"\n >>>>> Bat dau xu ly Rollup SCO cha ".$scoparent->id);
+ $attempt = scorm_get_last_attempt($scormid,$userid);
+
+ if(!empty($scoparent)){
+ $scoid = $scoparent->id;
+ $rolluprules = get_record("scorm_sequencing_rolluprules","scormid",$scormid,"scoid",$scoid);
+ if (!empty($rolluprules)){
+ $idrolluprules = $rolluprules->id;
+ $rules = get_records_select('scorm_sequencing_rolluprule','scoid ='.$scoid.' and rolluprulesid ='. $idrolluprules);
+
+ foreach ($rules as $rule){
+ $ruleid = $rule->id;
+ $ruleConditions = get_record("scorm_sequencing_rollupruleconditions","scoid",$scoid,"rollupruleid",$ruleid);
+ $idruleConditions = $ruleConditions->id;
+ $conditions = get_records_select('scorm_sequencing_rolluprulecondition','scoid ='.$scoid.' and ruleconditionsid ='.$idruleConditions);
+
+ //Truong hop 1: childactivitySet = all
+ // conditioncombination = any
+ if (($rule->childactivityset == 'all') && ($ruleConditions->conditioncombination=='any')){
+ foreach($conditions as $condition){
+ $conditionOK = false;
+ //Condition 1: condition = attempted operator = 'noOp'
+ // Thuc hien rollupaction
+ if (($condition->condition == 'attempted') && ($condition->operator=='noOp')){
+ $conditionOK = true;
+ foreach ($scochildren as $sco){
+ //fwrite($ft,"\n >>>>> Xu ly Rollup voi dieu kien attempt \n");
+ $usertrack = scorm_get_tracks($sco->id,$userid);
+ if ($usertrack->attempt_status != 'attempted'){
+ //fwrite($ft,"\n >>>>> Co SCO con chua attempted \n");
+ $conditionOK = false;
+ }
+ }
+ }
+ //Condition 2: condition = attempted operator = 'not'
+ // Thuc hien rollupaction
+ if (($condition->condition == 'attempted') && ($condition->operator=='not')){
+ $conditionOK = true;
+ foreach ($scochildren as $sco){
+ //fwrite($ft,"\n >>>>> Xu ly Rollup voi dieu kien not attempt \n");
+ $usertrack = scorm_get_tracks($sco->id,$userid);
+ if ($usertrack->attempt_status != 'notattempted'){
+ $conditionOK = false;
+ }
+ }
+ }
+ //Condition 3: condition = satisfied operator = 'noOp'
+ // Thuc hien rollupaction
+ if (($condition->condition == 'satisfied') && ($condition->operator=='noOp')){
+ $conditionOK = true;
+ foreach ($scochildren as $sco){
+ $usertrack = scorm_get_tracks($sco->id,$userid);
+ if ($usertrack->satisfied_status != 'satisfied'){
+ $conditionOK = false;
+ }
+ }
+ }
+ //Condition 4: condition = satisfied operator = 'not'
+ // Thuc hien rollupaction
+ if (($condition->condition == 'satisfied') && ($condition->operator=='not')){
+ $conditionOK = true;
+ foreach ($scochildren as $sco){
+ $usertrack = scorm_get_tracks($sco->id,$userid);
+ if ($usertrack->satisfied_status != 'notSatisfied'){
+ $conditionOK = false;
+ }
+ }
+ }
+ //Condition 5: condition = completed operator = 'noOp'
+ // Thuc hien rollupaction
+ if (($condition->condition == 'completed') && ($condition->operator=='noOp')){
+ $conditionOK = true;
+ foreach ($scochildren as $sco){
+ $usertrack = scorm_get_tracks($sco->id,$userid);
+ if ($usertrack->attempt_status != 'completed'){
+ $conditionOK = false;
+ }
+ }
+ }
+ //Condition 6: condition = completed operator = 'not'
+ // Thuc hien rollupaction
+ if (($condition->condition == 'completed') && ($condition->operator=='not')){
+ $conditionOK = true;
+ foreach ($scochildren as $sco){
+ $usertrack = scorm_get_tracks($sco->id,$userid);
+ if ($usertrack->attempt_status != 'notcompleted'){
+ $conditionOK = false;
+ }
+ }
+ }
+ //Neu dieu kien van dung sau khi xem xet thi thuc hien action
+ if ($conditionOK == true){
+ if ($ruleConditions->rollupruleaction == 'completed')
+ {
+ scorm_insert_track($userid,$scormid,$scoid,$attempt,'cmi.completion_status','completed');
+ //fwrite($ft,"\n >>>>> Xu ly Rollup thanh cong voi completed cho SCO ".$scoid);
+ }
+ if ($ruleConditions->rollupruleaction == 'satisfied')
+ {
+ scorm_insert_track($userid,$scormid,$scoid,$attempt,'cmi.success_status','passed');
+ //fwrite($ft,"\n >>>>> Xu ly Rollup thanh cong voi satisfied\n");
+ }
+ if ($ruleConditions->rollupruleaction == 'notSatisfied')
+ {
+ scorm_insert_track($userid,$scormid,$scoid,$attempt,'cmi.success_status','failed');
+ //fwrite($ft,"\n >>>>> Xu ly Rollup thanh cong voi notSatisfied\n");
+ }
+ //echo "";
+ $sequencingResult->rule = 'exit';
+ $sequencingResult->action = 'exit';
+ }
+ if ($sequencingrule->preconditionruleaction=='disabled')
+ {
+ //fwrite($ft,"\n >>>>> Xu ly Sequencing thanh cong -- Thuc hien su kien disable \n");
+ echo "";
+ $sequencingResult->rule = 'pre';
+ $sequencingResult->action = 'disable';
+
+ }
+
+ }
+ }
+ }
+ }
+ return $sequencingResult;
+}
+
+function get_sco_after_exit($scoid,$scormid){
+ $scochild = get_record("scorm_scoes","id",$scoid);
+ $scoparent = get_record("scorm_scoes","scorm",$scormid,"identifier",$scochild->parent);
+ $exitscoid = $scoid++;
+ $exitscochild = get_record("scorm_scoes","id",$exitscoid,"scorm",$scormid);
+ if (empty($exitscochild)){
+ //Da ra ngoai vung scoid. Hay day chinh la sco cuoi cung
+ return 0;
+ }
+ else{
+ $exitscoparent = get_record("scorm_scoes","scorm",$scormid,"identifier",$exitscochild->parent);
+ //Neu chua ra khoi activity do thi tiep tuc
+ while ($exitscoparent->id == $scoparent->id){
+ $exitscoid++;
+ $exitscochild = get_record("scorm_scoes","id",$exitscoid);
+ if (empty($exitscochild)){
+ //Da ra ngoai vung scoid. Hay day chinh la sco cuoi cung
+ return 0;
+ }
+ else{
+ $exitscoparent = get_record("scorm_scoes","scorm",$scormid,"identifier",$exitscochild->parent);
+ }
+ }
+ }
+ return $exitscoid;
+}
+
+?>
diff --git a/mod/scorm/styles.php b/mod/scorm/styles.php
index ea57b3034e..409a5196bc 100644
--- a/mod/scorm/styles.php
+++ b/mod/scorm/styles.php
@@ -1,83 +1,83 @@
-.structlist {
- list-style-type: none;
- white-space: nowrap;
- font-size: small;
-}
-.orgtitle {
- font-weight: bold;
- font-size: small;
-}
-.mod-scorm .top {
- vertical-align: top;
-}
-.mod-scorm .left {
- text-align: left;
-}
-.mod-scorm .center {
- text-align: center;
-}
-.mod-scorm .right {
- text-align: right;
-}
-.mod-scorm .scoframe {
-
-}
-
-#mod-scorm-player #scormpage {
- position: relative;
- width: 100%;
-}
-#mod-scorm-player #tocbox {
- position: absolute;
- left: 0px;
- top: 0px;
- width: 19%;
-}
-#mod-scorm-player #tochead {
- text-align: center;
- font-weight: bold;
-}
-#mod-scorm-player #scormbox {
- position: absolute;
- right: 0px;
- top: 0px;
-}
-#mod-scorm-player .toc {
- width: 80%;
- margin-left: 20%;
-}
-#mod-scorm-player .no-toc {
- width: 100%;
-}
-#mod-scorm-player #scormobject {
- /* border: 1px solid black; */
-}
-#mod-scorm-player #scormtop {
- position: relative;
- width: 100%;
- height: 30px;
-}
-#mod-scorm-player #scormbrowse {
- position: absolute;
- left: 5px;
- top: 0px;
-}
-#mod-scorm-player #scormnav {
- position: absolute;
- right: 5px;
- top: 0px;
-}
-#mod-scorm-player .structurelist {
- list-style-type: none;
- text-indent:-4ex;
- font-size: small;
-}
-
-#mod-scorm-view .structurehead {
- font-weight: bold;
- text-align: center;
-}
-#mod-scorm-view .structurelist {
- list-style-type: none;
- white-space: nowrap;
-}
+.structlist {
+ list-style-type: none;
+ white-space: nowrap;
+ font-size: small;
+}
+.orgtitle {
+ font-weight: bold;
+ font-size: small;
+}
+.mod-scorm .top {
+ vertical-align: top;
+}
+.mod-scorm .left {
+ text-align: left;
+}
+.mod-scorm .center {
+ text-align: center;
+}
+.mod-scorm .right {
+ text-align: right;
+}
+.mod-scorm .scoframe {
+
+}
+
+#mod-scorm-player #scormpage {
+ position: relative;
+ width: 100%;
+}
+#mod-scorm-player #tocbox {
+ position: absolute;
+ left: 0px;
+ top: 0px;
+ width: 19%;
+}
+#mod-scorm-player #tochead {
+ text-align: center;
+ font-weight: bold;
+}
+#mod-scorm-player #scormbox {
+ position: absolute;
+ right: 0px;
+ top: 0px;
+}
+#mod-scorm-player .toc {
+ width: 80%;
+ margin-left: 20%;
+}
+#mod-scorm-player .no-toc {
+ width: 100%;
+}
+#mod-scorm-player #scormobject {
+ /* border: 1px solid black; */
+}
+#mod-scorm-player #scormtop {
+ position: relative;
+ width: 100%;
+ height: 30px;
+}
+#mod-scorm-player #scormbrowse {
+ position: absolute;
+ left: 5px;
+ top: 0px;
+}
+#mod-scorm-player #scormnav {
+ position: absolute;
+ right: 5px;
+ top: 0px;
+}
+#mod-scorm-player .structurelist {
+ list-style-type: none;
+ text-indent:-4ex;
+ font-size: small;
+}
+
+#mod-scorm-view .structurehead {
+ font-weight: bold;
+ text-align: center;
+}
+#mod-scorm-view .structurelist {
+ list-style-type: none;
+ white-space: nowrap;
+}
diff --git a/mod/scorm/suspend.php b/mod/scorm/suspend.php
index 260a98a5f3..196c6e213b 100755
--- a/mod/scorm/suspend.php
+++ b/mod/scorm/suspend.php
@@ -1,29 +1,29 @@
-accesstime = $statistic->accesstime;
- $statisticInput->durationtime = $statistic->durationtime + time()- $statistic->accesstime;
- $statisticInput->status = 'suspend';
- $statisticInput->attemptnumber = $attempt;
- $statisticInput->scormid = $statistic->scormid;
- $statisticInput->userid = $statistic->userid;
- $statisticid = scorm_insert_statistic($statisticInput);
-
- $result = scorm_insert_trackmodel($userid, $scormid, $scoid,$attempt);
- if ($result) {
- echo "";
- } else {
- echo "Suspend failed";
- }
-?>
-
+accesstime = $statistic->accesstime;
+ $statisticInput->durationtime = $statistic->durationtime + time()- $statistic->accesstime;
+ $statisticInput->status = 'suspend';
+ $statisticInput->attemptnumber = $attempt;
+ $statisticInput->scormid = $statistic->scormid;
+ $statisticInput->userid = $statistic->userid;
+ $statisticid = scorm_insert_statistic($statisticInput);
+
+ $result = scorm_insert_trackmodel($userid, $scormid, $scoid,$attempt);
+ if ($result) {
+ echo "";
+ } else {
+ echo "Suspend failed";
+ }
+?>
+
diff --git a/mod/survey/db/mysql.sql b/mod/survey/db/mysql.sql
index 0e5ef6b42a..a618c9bfc8 100755
--- a/mod/survey/db/mysql.sql
+++ b/mod/survey/db/mysql.sql
@@ -1,193 +1,193 @@
-# phpMyAdmin MySQL-Dump
-# version 2.2.1
-# http://phpwizard.net/phpMyAdmin/
-# http://phpmyadmin.sourceforge.net/ (download page)
-#
-# Host: localhost
-# Generation Time: Nov 14, 2001 at 04:39 PM
-# Server version: 3.23.36
-# PHP Version: 4.0.6
-# Database : `moodle`
-# --------------------------------------------------------
-
-#
-# Table structure for table `survey`
-#
-
-CREATE TABLE prefix_survey (
- id int(10) unsigned NOT NULL auto_increment,
- course int(10) unsigned NOT NULL default '0',
- template int(10) unsigned NOT NULL default '0',
- days smallint(6) NOT NULL default '0',
- timecreated int(10) unsigned NOT NULL default '0',
- timemodified int(10) unsigned NOT NULL default '0',
- name varchar(255) NOT NULL default '',
- intro text NOT NULL default '',
- questions varchar(255) NOT NULL default '',
- PRIMARY KEY (id),
- KEY `course` (`course`)
-) TYPE=MyISAM COMMENT='all surveys';
-
-#
-# Dumping data for table `survey`
-#
-
-INSERT INTO `prefix_survey` (`id`, `course`, `template`, `days`, `timecreated`, `timemodified`, `name`, `intro`, `questions`) VALUES (1, 0, 0, 0, 985017600, 985017600, 'collesaname', 'collesaintro', '25,26,27,28,29,30,43,44');
-INSERT INTO `prefix_survey` (`id`, `course`, `template`, `days`, `timecreated`, `timemodified`, `name`, `intro`, `questions`) VALUES (2, 0, 0, 0, 985017600, 985017600, 'collespname', 'collespintro', '31,32,33,34,35,36,43,44');
-INSERT INTO `prefix_survey` (`id`, `course`, `template`, `days`, `timecreated`, `timemodified`, `name`, `intro`, `questions`) VALUES (3, 0, 0, 0, 985017600, 985017600, 'collesapname', 'collesapintro', '37,38,39,40,41,42,43,44');
-INSERT INTO `prefix_survey` (`id`, `course`, `template`, `days`, `timecreated`, `timemodified`, `name`, `intro`, `questions`) VALUES (4, 0, 0, 0, 985017600, 985017600, 'attlsname', 'attlsintro', '65,67,68');
-INSERT INTO `prefix_survey` (`id`, `course`, `template`, `days`, `timecreated`, `timemodified`, `name`, `intro`, `questions`) VALUES (5, 0, 0, 0, 985017600, 985017600, 'ciqname', 'ciqintro', '69,70,71,72,73');
-
-
-
-#
-# Table structure for table `survey_analysis`
-#
-
-CREATE TABLE prefix_survey_analysis (
- id int(10) unsigned NOT NULL auto_increment,
- survey int(10) unsigned NOT NULL default '0',
- userid int(10) unsigned NOT NULL default '0',
- notes text NOT NULL default '',
- PRIMARY KEY (id),
- UNIQUE KEY id (id),
- KEY survey (survey),
- KEY userid (userid)
-) TYPE=MyISAM;
-
-#
-# Dumping data for table `survey_analysis`
-#
-
-# --------------------------------------------------------
-
-#
-# Table structure for table `survey_answers`
-#
-
-CREATE TABLE prefix_survey_answers (
- id int(10) unsigned NOT NULL auto_increment,
- userid int(10) unsigned NOT NULL default '0',
- survey int(10) unsigned NOT NULL default '0',
- question int(10) unsigned NOT NULL default '0',
- time int(10) unsigned NOT NULL default '0',
- answer1 text NOT NULL default '',
- answer2 text NOT NULL default '',
- PRIMARY KEY (id),
- UNIQUE KEY id (id),
- KEY userid (userid),
- KEY survey (survey),
- KEY question (question)
-) TYPE=MyISAM;
-
-#
-# Dumping data for table `survey_answers`
-#
-
-# --------------------------------------------------------
-
-#
-# Table structure for table `survey_questions`
-#
-
-CREATE TABLE `prefix_survey_questions` (
- `id` int(10) unsigned NOT NULL auto_increment,
- `text` varchar(255) NOT NULL default '',
- `shorttext` varchar(30) NOT NULL default '',
- `multi` varchar(100) NOT NULL default '',
- `intro` varchar(50) NOT NULL default '',
- `type` tinyint(3) NOT NULL default '0',
- `options` text,
- PRIMARY KEY (`id`)
-) TYPE=MyISAM;
-
-#
-# Dumping data for table `survey_questions`
-#
-
-INSERT INTO `prefix_survey_questions` (`id`, `text`, `shorttext`, `multi`, `intro`, `type`, `options`) VALUES (1, 'colles1', 'colles1short', '', '', 1, 'scaletimes5');
-INSERT INTO `prefix_survey_questions` (`id`, `text`, `shorttext`, `multi`, `intro`, `type`, `options`) VALUES (2, 'colles2', 'colles2short', '', '', 1, 'scaletimes5');
-INSERT INTO `prefix_survey_questions` (`id`, `text`, `shorttext`, `multi`, `intro`, `type`, `options`) VALUES (3, 'colles3', 'colles3short', '', '', 1, 'scaletimes5');
-INSERT INTO `prefix_survey_questions` (`id`, `text`, `shorttext`, `multi`, `intro`, `type`, `options`) VALUES (4, 'colles4', 'colles4short', '', '', 1, 'scaletimes5');
-INSERT INTO `prefix_survey_questions` (`id`, `text`, `shorttext`, `multi`, `intro`, `type`, `options`) VALUES (5, 'colles5', 'colles5short', '', '', 1, 'scaletimes5');
-INSERT INTO `prefix_survey_questions` (`id`, `text`, `shorttext`, `multi`, `intro`, `type`, `options`) VALUES (6, 'colles6', 'colles6short', '', '', 1, 'scaletimes5');
-INSERT INTO `prefix_survey_questions` (`id`, `text`, `shorttext`, `multi`, `intro`, `type`, `options`) VALUES (7, 'colles7', 'colles7short', '', '', 1, 'scaletimes5');
-INSERT INTO `prefix_survey_questions` (`id`, `text`, `shorttext`, `multi`, `intro`, `type`, `options`) VALUES (8, 'colles8', 'colles8short', '', '', 1, 'scaletimes5');
-INSERT INTO `prefix_survey_questions` (`id`, `text`, `shorttext`, `multi`, `intro`, `type`, `options`) VALUES (9, 'colles9', 'colles9short', '', '', 1, 'scaletimes5');
-INSERT INTO `prefix_survey_questions` (`id`, `text`, `shorttext`, `multi`, `intro`, `type`, `options`) VALUES (10, 'colles10', 'colles10short', '', '', 1, 'scaletimes5');
-INSERT INTO `prefix_survey_questions` (`id`, `text`, `shorttext`, `multi`, `intro`, `type`, `options`) VALUES (11, 'colles11', 'colles11short', '', '', 1, 'scaletimes5');
-INSERT INTO `prefix_survey_questions` (`id`, `text`, `shorttext`, `multi`, `intro`, `type`, `options`) VALUES (12, 'colles12', 'colles12short', '', '', 1, 'scaletimes5');
-INSERT INTO `prefix_survey_questions` (`id`, `text`, `shorttext`, `multi`, `intro`, `type`, `options`) VALUES (13, 'colles13', 'colles13short', '', '', 1, 'scaletimes5');
-INSERT INTO `prefix_survey_questions` (`id`, `text`, `shorttext`, `multi`, `intro`, `type`, `options`) VALUES (14, 'colles14', 'colles14short', '', '', 1, 'scaletimes5');
-INSERT INTO `prefix_survey_questions` (`id`, `text`, `shorttext`, `multi`, `intro`, `type`, `options`) VALUES (15, 'colles15', 'colles15short', '', '', 1, 'scaletimes5');
-INSERT INTO `prefix_survey_questions` (`id`, `text`, `shorttext`, `multi`, `intro`, `type`, `options`) VALUES (16, 'colles16', 'colles16short', '', '', 1, 'scaletimes5');
-INSERT INTO `prefix_survey_questions` (`id`, `text`, `shorttext`, `multi`, `intro`, `type`, `options`) VALUES (17, 'colles17', 'colles17short', '', '', 1, 'scaletimes5');
-INSERT INTO `prefix_survey_questions` (`id`, `text`, `shorttext`, `multi`, `intro`, `type`, `options`) VALUES (18, 'colles18', 'colles18short', '', '', 1, 'scaletimes5');
-INSERT INTO `prefix_survey_questions` (`id`, `text`, `shorttext`, `multi`, `intro`, `type`, `options`) VALUES (19, 'colles19', 'colles19short', '', '', 1, 'scaletimes5');
-INSERT INTO `prefix_survey_questions` (`id`, `text`, `shorttext`, `multi`, `intro`, `type`, `options`) VALUES (20, 'colles20', 'colles20short', '', '', 1, 'scaletimes5');
-INSERT INTO `prefix_survey_questions` (`id`, `text`, `shorttext`, `multi`, `intro`, `type`, `options`) VALUES (21, 'colles21', 'colles21short', '', '', 1, 'scaletimes5');
-INSERT INTO `prefix_survey_questions` (`id`, `text`, `shorttext`, `multi`, `intro`, `type`, `options`) VALUES (22, 'colles22', 'colles22short', '', '', 1, 'scaletimes5');
-INSERT INTO `prefix_survey_questions` (`id`, `text`, `shorttext`, `multi`, `intro`, `type`, `options`) VALUES (23, 'colles23', 'colles23short', '', '', 1, 'scaletimes5');
-INSERT INTO `prefix_survey_questions` (`id`, `text`, `shorttext`, `multi`, `intro`, `type`, `options`) VALUES (24, 'colles24', 'colles24short', '', '', 1, 'scaletimes5');
-INSERT INTO `prefix_survey_questions` (`id`, `text`, `shorttext`, `multi`, `intro`, `type`, `options`) VALUES (25, 'collesm1', 'collesm1short', '1,2,3,4', 'collesmintro', 1, 'scaletimes5');
-INSERT INTO `prefix_survey_questions` (`id`, `text`, `shorttext`, `multi`, `intro`, `type`, `options`) VALUES (26, 'collesm2', 'collesm2short', '5,6,7,8', 'collesmintro', 1, 'scaletimes5');
-INSERT INTO `prefix_survey_questions` (`id`, `text`, `shorttext`, `multi`, `intro`, `type`, `options`) VALUES (27, 'collesm3', 'collesm3short', '9,10,11,12', 'collesmintro', 1, 'scaletimes5');
-INSERT INTO `prefix_survey_questions` (`id`, `text`, `shorttext`, `multi`, `intro`, `type`, `options`) VALUES (28, 'collesm4', 'collesm4short', '13,14,15,16', 'collesmintro', 1, 'scaletimes5');
-INSERT INTO `prefix_survey_questions` (`id`, `text`, `shorttext`, `multi`, `intro`, `type`, `options`) VALUES (29, 'collesm5', 'collesm5short', '17,18,19,20', 'collesmintro', 1, 'scaletimes5');
-INSERT INTO `prefix_survey_questions` (`id`, `text`, `shorttext`, `multi`, `intro`, `type`, `options`) VALUES (30, 'collesm6', 'collesm6short', '21,22,23,24', 'collesmintro', 1, 'scaletimes5');
-INSERT INTO `prefix_survey_questions` (`id`, `text`, `shorttext`, `multi`, `intro`, `type`, `options`) VALUES (31, 'collesm1', 'collesm1short', '1,2,3,4', 'collesmintro', 2, 'scaletimes5');
-INSERT INTO `prefix_survey_questions` (`id`, `text`, `shorttext`, `multi`, `intro`, `type`, `options`) VALUES (32, 'collesm2', 'collesm2short', '5,6,7,8', 'collesmintro', 2, 'scaletimes5');
-INSERT INTO `prefix_survey_questions` (`id`, `text`, `shorttext`, `multi`, `intro`, `type`, `options`) VALUES (33, 'collesm3', 'collesm3short', '9,10,11,12', 'collesmintro', 2, 'scaletimes5');
-INSERT INTO `prefix_survey_questions` (`id`, `text`, `shorttext`, `multi`, `intro`, `type`, `options`) VALUES (34, 'collesm4', 'collesm4short', '13,14,15,16', 'collesmintro', 2, 'scaletimes5');
-INSERT INTO `prefix_survey_questions` (`id`, `text`, `shorttext`, `multi`, `intro`, `type`, `options`) VALUES (35, 'collesm5', 'collesm5short', '17,18,19,20', 'collesmintro', 2, 'scaletimes5');
-INSERT INTO `prefix_survey_questions` (`id`, `text`, `shorttext`, `multi`, `intro`, `type`, `options`) VALUES (36, 'collesm6', 'collesm6short', '21,22,23,24', 'collesmintro', 2, 'scaletimes5');
-INSERT INTO `prefix_survey_questions` (`id`, `text`, `shorttext`, `multi`, `intro`, `type`, `options`) VALUES (37, 'collesm1', 'collesm1short', '1,2,3,4', 'collesmintro', 3, 'scaletimes5');
-INSERT INTO `prefix_survey_questions` (`id`, `text`, `shorttext`, `multi`, `intro`, `type`, `options`) VALUES (38, 'collesm2', 'collesm2short', '5,6,7,8', 'collesmintro', 3, 'scaletimes5');
-INSERT INTO `prefix_survey_questions` (`id`, `text`, `shorttext`, `multi`, `intro`, `type`, `options`) VALUES (39, 'collesm3', 'collesm3short', '9,10,11,12', 'collesmintro', 3, 'scaletimes5');
-INSERT INTO `prefix_survey_questions` (`id`, `text`, `shorttext`, `multi`, `intro`, `type`, `options`) VALUES (40, 'collesm4', 'collesm4short', '13,14,15,16', 'collesmintro', 3, 'scaletimes5');
-INSERT INTO `prefix_survey_questions` (`id`, `text`, `shorttext`, `multi`, `intro`, `type`, `options`) VALUES (41, 'collesm5', 'collesm5short', '17,18,19,20', 'collesmintro', 3, 'scaletimes5');
-INSERT INTO `prefix_survey_questions` (`id`, `text`, `shorttext`, `multi`, `intro`, `type`, `options`) VALUES (42, 'collesm6', 'collesm6short', '21,22,23,24', 'collesmintro', 3, 'scaletimes5');
-INSERT INTO `prefix_survey_questions` (`id`, `text`, `shorttext`, `multi`, `intro`, `type`, `options`) VALUES (43, 'howlong', '', '', '', 1, 'howlongoptions');
-INSERT INTO `prefix_survey_questions` (`id`, `text`, `shorttext`, `multi`, `intro`, `type`, `options`) VALUES (44, 'othercomments', '', '', '', 0, '');
-INSERT INTO `prefix_survey_questions` (`id`, `text`, `shorttext`, `multi`, `intro`, `type`, `options`) VALUES (64, 'attls20', 'attls20short', '', '', 1, 'scaleagree5');
-INSERT INTO `prefix_survey_questions` (`id`, `text`, `shorttext`, `multi`, `intro`, `type`, `options`) VALUES (58, 'attls14', 'attls14short', '', '', 1, 'scaleagree5');
-INSERT INTO `prefix_survey_questions` (`id`, `text`, `shorttext`, `multi`, `intro`, `type`, `options`) VALUES (59, 'attls15', 'attls15short', '', '', 1, 'scaleagree5');
-INSERT INTO `prefix_survey_questions` (`id`, `text`, `shorttext`, `multi`, `intro`, `type`, `options`) VALUES (60, 'attls16', 'attls16short', '', '', 1, 'scaleagree5');
-INSERT INTO `prefix_survey_questions` (`id`, `text`, `shorttext`, `multi`, `intro`, `type`, `options`) VALUES (61, 'attls17', 'attls17short', '', '', 1, 'scaleagree5');
-INSERT INTO `prefix_survey_questions` (`id`, `text`, `shorttext`, `multi`, `intro`, `type`, `options`) VALUES (62, 'attls18', 'attls18short', '', '', 1, 'scaleagree5');
-INSERT INTO `prefix_survey_questions` (`id`, `text`, `shorttext`, `multi`, `intro`, `type`, `options`) VALUES (63, 'attls19', 'attls19short', '', '', 1, 'scaleagree5');
-INSERT INTO `prefix_survey_questions` (`id`, `text`, `shorttext`, `multi`, `intro`, `type`, `options`) VALUES (56, 'attls12', 'attls12short', '', '', 1, 'scaleagree5');
-INSERT INTO `prefix_survey_questions` (`id`, `text`, `shorttext`, `multi`, `intro`, `type`, `options`) VALUES (57, 'attls13', 'attls13short', '', '', 1, 'scaleagree5');
-INSERT INTO `prefix_survey_questions` (`id`, `text`, `shorttext`, `multi`, `intro`, `type`, `options`) VALUES (55, 'attls11', 'attls11short', '', '', 1, 'scaleagree5');
-INSERT INTO `prefix_survey_questions` (`id`, `text`, `shorttext`, `multi`, `intro`, `type`, `options`) VALUES (54, 'attls10', 'attls10short', '', '', 1, 'scaleagree5');
-INSERT INTO `prefix_survey_questions` (`id`, `text`, `shorttext`, `multi`, `intro`, `type`, `options`) VALUES (53, 'attls9', 'attls9short', '', '', 1, 'scaleagree5');
-INSERT INTO `prefix_survey_questions` (`id`, `text`, `shorttext`, `multi`, `intro`, `type`, `options`) VALUES (52, 'attls8', 'attls8short', '', '', 1, 'scaleagree5');
-INSERT INTO `prefix_survey_questions` (`id`, `text`, `shorttext`, `multi`, `intro`, `type`, `options`) VALUES (51, 'attls7', 'attls7short', '', '', 1, 'scaleagree5');
-INSERT INTO `prefix_survey_questions` (`id`, `text`, `shorttext`, `multi`, `intro`, `type`, `options`) VALUES (50, 'attls6', 'attls6short', '', '', 1, 'scaleagree5');
-INSERT INTO `prefix_survey_questions` (`id`, `text`, `shorttext`, `multi`, `intro`, `type`, `options`) VALUES (49, 'attls5', 'attls5short', '', '', 1, 'scaleagree5');
-INSERT INTO `prefix_survey_questions` (`id`, `text`, `shorttext`, `multi`, `intro`, `type`, `options`) VALUES (48, 'attls4', 'attls4short', '', '', 1, 'scaleagree5');
-INSERT INTO `prefix_survey_questions` (`id`, `text`, `shorttext`, `multi`, `intro`, `type`, `options`) VALUES (47, 'attls3', 'attls3short', '', '', 1, 'scaleagree5');
-INSERT INTO `prefix_survey_questions` (`id`, `text`, `shorttext`, `multi`, `intro`, `type`, `options`) VALUES (45, 'attls1', 'attls1short', '', '', 1, 'scaleagree5');
-INSERT INTO `prefix_survey_questions` (`id`, `text`, `shorttext`, `multi`, `intro`, `type`, `options`) VALUES (46, 'attls2', 'attls2short', '', '', 1, 'scaleagree5');
-INSERT INTO `prefix_survey_questions` (`id`, `text`, `shorttext`, `multi`, `intro`, `type`, `options`) VALUES (65, 'attlsm1', 'attlsm1', '45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64', 'attlsmintro', 1, 'scaleagree5');
-INSERT INTO `prefix_survey_questions` (`id`, `text`, `shorttext`, `multi`, `intro`, `type`, `options`) VALUES (67, 'attlsm2', 'attlsm2', '63,62,59,57,55,49,52,50,48,47', 'attlsmintro', -1, 'scaleagree5');
-INSERT INTO `prefix_survey_questions` (`id`, `text`, `shorttext`, `multi`, `intro`, `type`, `options`) VALUES (68, 'attlsm3', 'attlsm3', '46,54,45,51,60,53,56,58,61,64', 'attlsmintro', -1, 'scaleagree5');
-
-INSERT INTO `prefix_survey_questions` (`id`, `text`, `shorttext`, `multi`, `intro`, `type`, `options`) VALUES (69, 'ciq1', 'ciq1short', '', '', 0, '');
-INSERT INTO `prefix_survey_questions` (`id`, `text`, `shorttext`, `multi`, `intro`, `type`, `options`) VALUES (70, 'ciq2', 'ciq2short', '', '', 0, '');
-INSERT INTO `prefix_survey_questions` (`id`, `text`, `shorttext`, `multi`, `intro`, `type`, `options`) VALUES (71, 'ciq3', 'ciq3short', '', '', 0, '');
-INSERT INTO `prefix_survey_questions` (`id`, `text`, `shorttext`, `multi`, `intro`, `type`, `options`) VALUES (72, 'ciq4', 'ciq4short', '', '', 0, '');
-INSERT INTO `prefix_survey_questions` (`id`, `text`, `shorttext`, `multi`, `intro`, `type`, `options`) VALUES (73, 'ciq5', 'ciq5short', '', '', 0, '');
-
-
-#
-# Dumping data for table `log_display`
-#
-
-INSERT INTO prefix_log_display (module, action, mtable, field) VALUES ('survey', 'add', 'survey', 'name');
-INSERT INTO prefix_log_display (module, action, mtable, field) VALUES ('survey', 'update', 'survey', 'name');
-INSERT INTO prefix_log_display (module, action, mtable, field) VALUES ('survey', 'download', 'survey', 'name');
-INSERT INTO prefix_log_display (module, action, mtable, field) VALUES ('survey', 'view form', 'survey', 'name');
-INSERT INTO prefix_log_display (module, action, mtable, field) VALUES ('survey', 'view graph', 'survey', 'name');
-INSERT INTO prefix_log_display (module, action, mtable, field) VALUES ('survey', 'view report', 'survey', 'name');
-INSERT INTO prefix_log_display (module, action, mtable, field) VALUES ('survey', 'submit', 'survey', 'name');
+# phpMyAdmin MySQL-Dump
+# version 2.2.1
+# http://phpwizard.net/phpMyAdmin/
+# http://phpmyadmin.sourceforge.net/ (download page)
+#
+# Host: localhost
+# Generation Time: Nov 14, 2001 at 04:39 PM
+# Server version: 3.23.36
+# PHP Version: 4.0.6
+# Database : `moodle`
+# --------------------------------------------------------
+
+#
+# Table structure for table `survey`
+#
+
+CREATE TABLE prefix_survey (
+ id int(10) unsigned NOT NULL auto_increment,
+ course int(10) unsigned NOT NULL default '0',
+ template int(10) unsigned NOT NULL default '0',
+ days smallint(6) NOT NULL default '0',
+ timecreated int(10) unsigned NOT NULL default '0',
+ timemodified int(10) unsigned NOT NULL default '0',
+ name varchar(255) NOT NULL default '',
+ intro text NOT NULL default '',
+ questions varchar(255) NOT NULL default '',
+ PRIMARY KEY (id),
+ KEY `course` (`course`)
+) TYPE=MyISAM COMMENT='all surveys';
+
+#
+# Dumping data for table `survey`
+#
+
+INSERT INTO `prefix_survey` (`id`, `course`, `template`, `days`, `timecreated`, `timemodified`, `name`, `intro`, `questions`) VALUES (1, 0, 0, 0, 985017600, 985017600, 'collesaname', 'collesaintro', '25,26,27,28,29,30,43,44');
+INSERT INTO `prefix_survey` (`id`, `course`, `template`, `days`, `timecreated`, `timemodified`, `name`, `intro`, `questions`) VALUES (2, 0, 0, 0, 985017600, 985017600, 'collespname', 'collespintro', '31,32,33,34,35,36,43,44');
+INSERT INTO `prefix_survey` (`id`, `course`, `template`, `days`, `timecreated`, `timemodified`, `name`, `intro`, `questions`) VALUES (3, 0, 0, 0, 985017600, 985017600, 'collesapname', 'collesapintro', '37,38,39,40,41,42,43,44');
+INSERT INTO `prefix_survey` (`id`, `course`, `template`, `days`, `timecreated`, `timemodified`, `name`, `intro`, `questions`) VALUES (4, 0, 0, 0, 985017600, 985017600, 'attlsname', 'attlsintro', '65,67,68');
+INSERT INTO `prefix_survey` (`id`, `course`, `template`, `days`, `timecreated`, `timemodified`, `name`, `intro`, `questions`) VALUES (5, 0, 0, 0, 985017600, 985017600, 'ciqname', 'ciqintro', '69,70,71,72,73');
+
+
+
+#
+# Table structure for table `survey_analysis`
+#
+
+CREATE TABLE prefix_survey_analysis (
+ id int(10) unsigned NOT NULL auto_increment,
+ survey int(10) unsigned NOT NULL default '0',
+ userid int(10) unsigned NOT NULL default '0',
+ notes text NOT NULL default '',
+ PRIMARY KEY (id),
+ UNIQUE KEY id (id),
+ KEY survey (survey),
+ KEY userid (userid)
+) TYPE=MyISAM;
+
+#
+# Dumping data for table `survey_analysis`
+#
+
+# --------------------------------------------------------
+
+#
+# Table structure for table `survey_answers`
+#
+
+CREATE TABLE prefix_survey_answers (
+ id int(10) unsigned NOT NULL auto_increment,
+ userid int(10) unsigned NOT NULL default '0',
+ survey int(10) unsigned NOT NULL default '0',
+ question int(10) unsigned NOT NULL default '0',
+ time int(10) unsigned NOT NULL default '0',
+ answer1 text NOT NULL default '',
+ answer2 text NOT NULL default '',
+ PRIMARY KEY (id),
+ UNIQUE KEY id (id),
+ KEY userid (userid),
+ KEY survey (survey),
+ KEY question (question)
+) TYPE=MyISAM;
+
+#
+# Dumping data for table `survey_answers`
+#
+
+# --------------------------------------------------------
+
+#
+# Table structure for table `survey_questions`
+#
+
+CREATE TABLE `prefix_survey_questions` (
+ `id` int(10) unsigned NOT NULL auto_increment,
+ `text` varchar(255) NOT NULL default '',
+ `shorttext` varchar(30) NOT NULL default '',
+ `multi` varchar(100) NOT NULL default '',
+ `intro` varchar(50) NOT NULL default '',
+ `type` tinyint(3) NOT NULL default '0',
+ `options` text,
+ PRIMARY KEY (`id`)
+) TYPE=MyISAM;
+
+#
+# Dumping data for table `survey_questions`
+#
+
+INSERT INTO `prefix_survey_questions` (`id`, `text`, `shorttext`, `multi`, `intro`, `type`, `options`) VALUES (1, 'colles1', 'colles1short', '', '', 1, 'scaletimes5');
+INSERT INTO `prefix_survey_questions` (`id`, `text`, `shorttext`, `multi`, `intro`, `type`, `options`) VALUES (2, 'colles2', 'colles2short', '', '', 1, 'scaletimes5');
+INSERT INTO `prefix_survey_questions` (`id`, `text`, `shorttext`, `multi`, `intro`, `type`, `options`) VALUES (3, 'colles3', 'colles3short', '', '', 1, 'scaletimes5');
+INSERT INTO `prefix_survey_questions` (`id`, `text`, `shorttext`, `multi`, `intro`, `type`, `options`) VALUES (4, 'colles4', 'colles4short', '', '', 1, 'scaletimes5');
+INSERT INTO `prefix_survey_questions` (`id`, `text`, `shorttext`, `multi`, `intro`, `type`, `options`) VALUES (5, 'colles5', 'colles5short', '', '', 1, 'scaletimes5');
+INSERT INTO `prefix_survey_questions` (`id`, `text`, `shorttext`, `multi`, `intro`, `type`, `options`) VALUES (6, 'colles6', 'colles6short', '', '', 1, 'scaletimes5');
+INSERT INTO `prefix_survey_questions` (`id`, `text`, `shorttext`, `multi`, `intro`, `type`, `options`) VALUES (7, 'colles7', 'colles7short', '', '', 1, 'scaletimes5');
+INSERT INTO `prefix_survey_questions` (`id`, `text`, `shorttext`, `multi`, `intro`, `type`, `options`) VALUES (8, 'colles8', 'colles8short', '', '', 1, 'scaletimes5');
+INSERT INTO `prefix_survey_questions` (`id`, `text`, `shorttext`, `multi`, `intro`, `type`, `options`) VALUES (9, 'colles9', 'colles9short', '', '', 1, 'scaletimes5');
+INSERT INTO `prefix_survey_questions` (`id`, `text`, `shorttext`, `multi`, `intro`, `type`, `options`) VALUES (10, 'colles10', 'colles10short', '', '', 1, 'scaletimes5');
+INSERT INTO `prefix_survey_questions` (`id`, `text`, `shorttext`, `multi`, `intro`, `type`, `options`) VALUES (11, 'colles11', 'colles11short', '', '', 1, 'scaletimes5');
+INSERT INTO `prefix_survey_questions` (`id`, `text`, `shorttext`, `multi`, `intro`, `type`, `options`) VALUES (12, 'colles12', 'colles12short', '', '', 1, 'scaletimes5');
+INSERT INTO `prefix_survey_questions` (`id`, `text`, `shorttext`, `multi`, `intro`, `type`, `options`) VALUES (13, 'colles13', 'colles13short', '', '', 1, 'scaletimes5');
+INSERT INTO `prefix_survey_questions` (`id`, `text`, `shorttext`, `multi`, `intro`, `type`, `options`) VALUES (14, 'colles14', 'colles14short', '', '', 1, 'scaletimes5');
+INSERT INTO `prefix_survey_questions` (`id`, `text`, `shorttext`, `multi`, `intro`, `type`, `options`) VALUES (15, 'colles15', 'colles15short', '', '', 1, 'scaletimes5');
+INSERT INTO `prefix_survey_questions` (`id`, `text`, `shorttext`, `multi`, `intro`, `type`, `options`) VALUES (16, 'colles16', 'colles16short', '', '', 1, 'scaletimes5');
+INSERT INTO `prefix_survey_questions` (`id`, `text`, `shorttext`, `multi`, `intro`, `type`, `options`) VALUES (17, 'colles17', 'colles17short', '', '', 1, 'scaletimes5');
+INSERT INTO `prefix_survey_questions` (`id`, `text`, `shorttext`, `multi`, `intro`, `type`, `options`) VALUES (18, 'colles18', 'colles18short', '', '', 1, 'scaletimes5');
+INSERT INTO `prefix_survey_questions` (`id`, `text`, `shorttext`, `multi`, `intro`, `type`, `options`) VALUES (19, 'colles19', 'colles19short', '', '', 1, 'scaletimes5');
+INSERT INTO `prefix_survey_questions` (`id`, `text`, `shorttext`, `multi`, `intro`, `type`, `options`) VALUES (20, 'colles20', 'colles20short', '', '', 1, 'scaletimes5');
+INSERT INTO `prefix_survey_questions` (`id`, `text`, `shorttext`, `multi`, `intro`, `type`, `options`) VALUES (21, 'colles21', 'colles21short', '', '', 1, 'scaletimes5');
+INSERT INTO `prefix_survey_questions` (`id`, `text`, `shorttext`, `multi`, `intro`, `type`, `options`) VALUES (22, 'colles22', 'colles22short', '', '', 1, 'scaletimes5');
+INSERT INTO `prefix_survey_questions` (`id`, `text`, `shorttext`, `multi`, `intro`, `type`, `options`) VALUES (23, 'colles23', 'colles23short', '', '', 1, 'scaletimes5');
+INSERT INTO `prefix_survey_questions` (`id`, `text`, `shorttext`, `multi`, `intro`, `type`, `options`) VALUES (24, 'colles24', 'colles24short', '', '', 1, 'scaletimes5');
+INSERT INTO `prefix_survey_questions` (`id`, `text`, `shorttext`, `multi`, `intro`, `type`, `options`) VALUES (25, 'collesm1', 'collesm1short', '1,2,3,4', 'collesmintro', 1, 'scaletimes5');
+INSERT INTO `prefix_survey_questions` (`id`, `text`, `shorttext`, `multi`, `intro`, `type`, `options`) VALUES (26, 'collesm2', 'collesm2short', '5,6,7,8', 'collesmintro', 1, 'scaletimes5');
+INSERT INTO `prefix_survey_questions` (`id`, `text`, `shorttext`, `multi`, `intro`, `type`, `options`) VALUES (27, 'collesm3', 'collesm3short', '9,10,11,12', 'collesmintro', 1, 'scaletimes5');
+INSERT INTO `prefix_survey_questions` (`id`, `text`, `shorttext`, `multi`, `intro`, `type`, `options`) VALUES (28, 'collesm4', 'collesm4short', '13,14,15,16', 'collesmintro', 1, 'scaletimes5');
+INSERT INTO `prefix_survey_questions` (`id`, `text`, `shorttext`, `multi`, `intro`, `type`, `options`) VALUES (29, 'collesm5', 'collesm5short', '17,18,19,20', 'collesmintro', 1, 'scaletimes5');
+INSERT INTO `prefix_survey_questions` (`id`, `text`, `shorttext`, `multi`, `intro`, `type`, `options`) VALUES (30, 'collesm6', 'collesm6short', '21,22,23,24', 'collesmintro', 1, 'scaletimes5');
+INSERT INTO `prefix_survey_questions` (`id`, `text`, `shorttext`, `multi`, `intro`, `type`, `options`) VALUES (31, 'collesm1', 'collesm1short', '1,2,3,4', 'collesmintro', 2, 'scaletimes5');
+INSERT INTO `prefix_survey_questions` (`id`, `text`, `shorttext`, `multi`, `intro`, `type`, `options`) VALUES (32, 'collesm2', 'collesm2short', '5,6,7,8', 'collesmintro', 2, 'scaletimes5');
+INSERT INTO `prefix_survey_questions` (`id`, `text`, `shorttext`, `multi`, `intro`, `type`, `options`) VALUES (33, 'collesm3', 'collesm3short', '9,10,11,12', 'collesmintro', 2, 'scaletimes5');
+INSERT INTO `prefix_survey_questions` (`id`, `text`, `shorttext`, `multi`, `intro`, `type`, `options`) VALUES (34, 'collesm4', 'collesm4short', '13,14,15,16', 'collesmintro', 2, 'scaletimes5');
+INSERT INTO `prefix_survey_questions` (`id`, `text`, `shorttext`, `multi`, `intro`, `type`, `options`) VALUES (35, 'collesm5', 'collesm5short', '17,18,19,20', 'collesmintro', 2, 'scaletimes5');
+INSERT INTO `prefix_survey_questions` (`id`, `text`, `shorttext`, `multi`, `intro`, `type`, `options`) VALUES (36, 'collesm6', 'collesm6short', '21,22,23,24', 'collesmintro', 2, 'scaletimes5');
+INSERT INTO `prefix_survey_questions` (`id`, `text`, `shorttext`, `multi`, `intro`, `type`, `options`) VALUES (37, 'collesm1', 'collesm1short', '1,2,3,4', 'collesmintro', 3, 'scaletimes5');
+INSERT INTO `prefix_survey_questions` (`id`, `text`, `shorttext`, `multi`, `intro`, `type`, `options`) VALUES (38, 'collesm2', 'collesm2short', '5,6,7,8', 'collesmintro', 3, 'scaletimes5');
+INSERT INTO `prefix_survey_questions` (`id`, `text`, `shorttext`, `multi`, `intro`, `type`, `options`) VALUES (39, 'collesm3', 'collesm3short', '9,10,11,12', 'collesmintro', 3, 'scaletimes5');
+INSERT INTO `prefix_survey_questions` (`id`, `text`, `shorttext`, `multi`, `intro`, `type`, `options`) VALUES (40, 'collesm4', 'collesm4short', '13,14,15,16', 'collesmintro', 3, 'scaletimes5');
+INSERT INTO `prefix_survey_questions` (`id`, `text`, `shorttext`, `multi`, `intro`, `type`, `options`) VALUES (41, 'collesm5', 'collesm5short', '17,18,19,20', 'collesmintro', 3, 'scaletimes5');
+INSERT INTO `prefix_survey_questions` (`id`, `text`, `shorttext`, `multi`, `intro`, `type`, `options`) VALUES (42, 'collesm6', 'collesm6short', '21,22,23,24', 'collesmintro', 3, 'scaletimes5');
+INSERT INTO `prefix_survey_questions` (`id`, `text`, `shorttext`, `multi`, `intro`, `type`, `options`) VALUES (43, 'howlong', '', '', '', 1, 'howlongoptions');
+INSERT INTO `prefix_survey_questions` (`id`, `text`, `shorttext`, `multi`, `intro`, `type`, `options`) VALUES (44, 'othercomments', '', '', '', 0, '');
+INSERT INTO `prefix_survey_questions` (`id`, `text`, `shorttext`, `multi`, `intro`, `type`, `options`) VALUES (64, 'attls20', 'attls20short', '', '', 1, 'scaleagree5');
+INSERT INTO `prefix_survey_questions` (`id`, `text`, `shorttext`, `multi`, `intro`, `type`, `options`) VALUES (58, 'attls14', 'attls14short', '', '', 1, 'scaleagree5');
+INSERT INTO `prefix_survey_questions` (`id`, `text`, `shorttext`, `multi`, `intro`, `type`, `options`) VALUES (59, 'attls15', 'attls15short', '', '', 1, 'scaleagree5');
+INSERT INTO `prefix_survey_questions` (`id`, `text`, `shorttext`, `multi`, `intro`, `type`, `options`) VALUES (60, 'attls16', 'attls16short', '', '', 1, 'scaleagree5');
+INSERT INTO `prefix_survey_questions` (`id`, `text`, `shorttext`, `multi`, `intro`, `type`, `options`) VALUES (61, 'attls17', 'attls17short', '', '', 1, 'scaleagree5');
+INSERT INTO `prefix_survey_questions` (`id`, `text`, `shorttext`, `multi`, `intro`, `type`, `options`) VALUES (62, 'attls18', 'attls18short', '', '', 1, 'scaleagree5');
+INSERT INTO `prefix_survey_questions` (`id`, `text`, `shorttext`, `multi`, `intro`, `type`, `options`) VALUES (63, 'attls19', 'attls19short', '', '', 1, 'scaleagree5');
+INSERT INTO `prefix_survey_questions` (`id`, `text`, `shorttext`, `multi`, `intro`, `type`, `options`) VALUES (56, 'attls12', 'attls12short', '', '', 1, 'scaleagree5');
+INSERT INTO `prefix_survey_questions` (`id`, `text`, `shorttext`, `multi`, `intro`, `type`, `options`) VALUES (57, 'attls13', 'attls13short', '', '', 1, 'scaleagree5');
+INSERT INTO `prefix_survey_questions` (`id`, `text`, `shorttext`, `multi`, `intro`, `type`, `options`) VALUES (55, 'attls11', 'attls11short', '', '', 1, 'scaleagree5');
+INSERT INTO `prefix_survey_questions` (`id`, `text`, `shorttext`, `multi`, `intro`, `type`, `options`) VALUES (54, 'attls10', 'attls10short', '', '', 1, 'scaleagree5');
+INSERT INTO `prefix_survey_questions` (`id`, `text`, `shorttext`, `multi`, `intro`, `type`, `options`) VALUES (53, 'attls9', 'attls9short', '', '', 1, 'scaleagree5');
+INSERT INTO `prefix_survey_questions` (`id`, `text`, `shorttext`, `multi`, `intro`, `type`, `options`) VALUES (52, 'attls8', 'attls8short', '', '', 1, 'scaleagree5');
+INSERT INTO `prefix_survey_questions` (`id`, `text`, `shorttext`, `multi`, `intro`, `type`, `options`) VALUES (51, 'attls7', 'attls7short', '', '', 1, 'scaleagree5');
+INSERT INTO `prefix_survey_questions` (`id`, `text`, `shorttext`, `multi`, `intro`, `type`, `options`) VALUES (50, 'attls6', 'attls6short', '', '', 1, 'scaleagree5');
+INSERT INTO `prefix_survey_questions` (`id`, `text`, `shorttext`, `multi`, `intro`, `type`, `options`) VALUES (49, 'attls5', 'attls5short', '', '', 1, 'scaleagree5');
+INSERT INTO `prefix_survey_questions` (`id`, `text`, `shorttext`, `multi`, `intro`, `type`, `options`) VALUES (48, 'attls4', 'attls4short', '', '', 1, 'scaleagree5');
+INSERT INTO `prefix_survey_questions` (`id`, `text`, `shorttext`, `multi`, `intro`, `type`, `options`) VALUES (47, 'attls3', 'attls3short', '', '', 1, 'scaleagree5');
+INSERT INTO `prefix_survey_questions` (`id`, `text`, `shorttext`, `multi`, `intro`, `type`, `options`) VALUES (45, 'attls1', 'attls1short', '', '', 1, 'scaleagree5');
+INSERT INTO `prefix_survey_questions` (`id`, `text`, `shorttext`, `multi`, `intro`, `type`, `options`) VALUES (46, 'attls2', 'attls2short', '', '', 1, 'scaleagree5');
+INSERT INTO `prefix_survey_questions` (`id`, `text`, `shorttext`, `multi`, `intro`, `type`, `options`) VALUES (65, 'attlsm1', 'attlsm1', '45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64', 'attlsmintro', 1, 'scaleagree5');
+INSERT INTO `prefix_survey_questions` (`id`, `text`, `shorttext`, `multi`, `intro`, `type`, `options`) VALUES (67, 'attlsm2', 'attlsm2', '63,62,59,57,55,49,52,50,48,47', 'attlsmintro', -1, 'scaleagree5');
+INSERT INTO `prefix_survey_questions` (`id`, `text`, `shorttext`, `multi`, `intro`, `type`, `options`) VALUES (68, 'attlsm3', 'attlsm3', '46,54,45,51,60,53,56,58,61,64', 'attlsmintro', -1, 'scaleagree5');
+
+INSERT INTO `prefix_survey_questions` (`id`, `text`, `shorttext`, `multi`, `intro`, `type`, `options`) VALUES (69, 'ciq1', 'ciq1short', '', '', 0, '');
+INSERT INTO `prefix_survey_questions` (`id`, `text`, `shorttext`, `multi`, `intro`, `type`, `options`) VALUES (70, 'ciq2', 'ciq2short', '', '', 0, '');
+INSERT INTO `prefix_survey_questions` (`id`, `text`, `shorttext`, `multi`, `intro`, `type`, `options`) VALUES (71, 'ciq3', 'ciq3short', '', '', 0, '');
+INSERT INTO `prefix_survey_questions` (`id`, `text`, `shorttext`, `multi`, `intro`, `type`, `options`) VALUES (72, 'ciq4', 'ciq4short', '', '', 0, '');
+INSERT INTO `prefix_survey_questions` (`id`, `text`, `shorttext`, `multi`, `intro`, `type`, `options`) VALUES (73, 'ciq5', 'ciq5short', '', '', 0, '');
+
+
+#
+# Dumping data for table `log_display`
+#
+
+INSERT INTO prefix_log_display (module, action, mtable, field) VALUES ('survey', 'add', 'survey', 'name');
+INSERT INTO prefix_log_display (module, action, mtable, field) VALUES ('survey', 'update', 'survey', 'name');
+INSERT INTO prefix_log_display (module, action, mtable, field) VALUES ('survey', 'download', 'survey', 'name');
+INSERT INTO prefix_log_display (module, action, mtable, field) VALUES ('survey', 'view form', 'survey', 'name');
+INSERT INTO prefix_log_display (module, action, mtable, field) VALUES ('survey', 'view graph', 'survey', 'name');
+INSERT INTO prefix_log_display (module, action, mtable, field) VALUES ('survey', 'view report', 'survey', 'name');
+INSERT INTO prefix_log_display (module, action, mtable, field) VALUES ('survey', 'submit', 'survey', 'name');
diff --git a/mod/survey/db/oci8po.sql b/mod/survey/db/oci8po.sql
index 105eca6df7..ec74b5a277 100755
--- a/mod/survey/db/oci8po.sql
+++ b/mod/survey/db/oci8po.sql
@@ -1,227 +1,227 @@
-rem
-rem Table structure for table survey
-rem
-
-drop TABLE prefix_survey;
-CREATE TABLE prefix_survey (
- id number(10) primary key,
- course number(10) default '0' not null,
- template number(10) default '0' not null,
- days number(6) default '0' not null,
- timecreated number(10) default '0' not null,
- timemodified number(10) default '0' not null,
- name varchar2(255) default '' not null,
- intro varchar2(1024),
- questions varchar2(255) default NULL
-);
-
-drop sequence p_survey_seq;
-create sequence p_survey_seq;
-
-create or replace trigger p_survey_trig
- before insert on prefix_survey
- referencing new as new_row
- for each row
- begin
- select p_survey_seq.nextval into :new_row.id from dual;
- end;
-.
-/
-
-COMMENT on table prefix_survey is 'all surveys';
-
-INSERT INTO prefix_survey (course, template, days, timecreated, timemodified, name, intro, questions) VALUES (0, 0, 0, 985017600, 985017600, 'collesaname', 'collesaintro', '25,26,27,28,29,30,43,44');
-INSERT INTO prefix_survey (course, template, days, timecreated, timemodified, name, intro, questions) VALUES (0, 0, 0, 985017600, 985017600, 'collespname', 'collespintro', '31,32,33,34,35,36,43,44');
-INSERT INTO prefix_survey (course, template, days, timecreated, timemodified, name, intro, questions) VALUES (0, 0, 0, 985017600, 985017600, 'collesapname', 'collesapintro', '37,38,39,40,41,42,43,44');
-INSERT INTO prefix_survey (course, template, days, timecreated, timemodified, name, intro, questions) VALUES (0, 0, 0, 985017600, 985017600, 'attlsname', 'attlsintro', '65,67,68');
-
-select * from prefix_survey order by 1,2;
-
-rem
-rem Table structure for table survey_analysis
-rem
-
-drop TABLE prefix_survey_analysis;
-CREATE TABLE prefix_survey_analysis (
-id number(10) primary key,
-survey number(10) default '0' not null,
-userid number(10) default '0' not null,
-notes varchar2(1024) NOT NULL
-
-drop sequence p_survey_analysis_seq;
-create sequence p_survey_analysis_seq;
-
-create or replace trigger p_survey_analysis_trig
- before insert on prefix_survey_analysis
- referencing new as new_row
- for each row
- begin
- select p_survey_analysis_seq.nextval into :new_row.id from dual;
- end;
-.
-/
-
-);
-
-comment on table prefix_survey_analysis is 'Survey analysis';
-
-rem
-rem Dumping data for table survey_analysis
-rem
-
-rem --------------------------------------------------------
-
-rem
-rem Table structure for table survey_answers
-rem
-
-drop TABLE prefix_survey_answers;
-CREATE TABLE prefix_survey_answers (
-id number(10) primary key,
-userid number(10) default '0' not null,
-survey number(10) default '0' not null,
-question number(10) default '0' not null,
-time number(10) default NULL,
-answer1 varchar2(255) default NULL,
-answer2 varchar2(255) default NULL
-);
-
-drop sequence p_survey_answers_seq;
-create sequence p_survey_answers_seq;
-
-create or replace trigger p_survey_answers_trig
-before insert on prefix_survey_answers
-referencing new as new_row
-for each row
-begin
- select p_survey_answers_seq.nextval into :new_row.id from dual;
-end;
-.
-/
-
-
-rem
-rem Dumping data for table survey_answers
-rem
-
-rem --------------------------------------------------------
-
-rem
-rem Table structure for table survey_questions
-rem
-
-drop TABLE prefix_survey_questions;
-CREATE TABLE prefix_survey_questions (
-id number(10) primary key,
-text varchar2(255) default '' not null,
-shorttext varchar2(30) default '' not null,
-multi varchar2(100) default '' not null,
-intro varchar2(50) default NULL,
-type number(3) default '0' not null,
-options varchar2(1024)
-);
-
-comment on table prefix_survey_questions is 'structure for survey_questions';
-
-drop sequence p_survey_questions_seq;
-create sequence p_survey_questions_seq;
-
-create or replace trigger p_survey_questions_trig
- before insert on prefix_survey_questions
- referencing new as new_row
- for each row
- begin
- select p_survey_questions_seq.nextval into :new_row.id from dual;
- end;
-.
-/
-
-rem
-rem Dumping data for table survey_questions
-rem
-
-INSERT INTO prefix_survey_questions ( text, shorttext, multi, intro, type, options) VALUES ('colles1', 'colles1short', '1', '1', 1, 'scaletimes5');
-INSERT INTO prefix_survey_questions (text, shorttext, multi, intro, type, options) VALUES ('colles2', 'colles2short', '1', '1', 1, 'scaletimes5');
-INSERT INTO prefix_survey_questions (text, shorttext, multi, intro, type, options) VALUES ('colles3', 'colles3short', '1', '1', 1, 'scaletimes5');
-INSERT INTO prefix_survey_questions (text, shorttext, multi, intro, type, options) VALUES ('colles4', 'colles4short', '1', '1', 1, 'scaletimes5');
-INSERT INTO prefix_survey_questions (text, shorttext, multi, intro, type, options) VALUES ('colles5', 'colles5short', '1', '1', 1, 'scaletimes5');
-INSERT INTO prefix_survey_questions (text, shorttext, multi, intro, type, options) VALUES ('colles6', 'colles6short', '1', '1', 1, 'scaletimes5');
-INSERT INTO prefix_survey_questions (text, shorttext, multi, intro, type, options) VALUES ('colles7', 'colles7short', '1', '1', 1, 'scaletimes5');
-INSERT INTO prefix_survey_questions (text, shorttext, multi, intro, type, options) VALUES ('colles8', 'colles8short', '1', '1', 1, 'scaletimes5');
-INSERT INTO prefix_survey_questions (text, shorttext, multi, intro, type, options) VALUES ('colles9', 'colles9short', '1', '1', 1, 'scaletimes5');
-INSERT INTO prefix_survey_questions (text, shorttext, multi, intro, type, options) VALUES ( 'colles10', 'colles10short', '1', '1', 1, 'scaletimes5');
-INSERT INTO prefix_survey_questions (text, shorttext, multi, intro, type, options) VALUES ( 'colles11', 'colles11short', '1', '1', 1, 'scaletimes5');
-INSERT INTO prefix_survey_questions (text, shorttext, multi, intro, type, options) VALUES ( 'colles12', 'colles12short', '1', '1', 1, 'scaletimes5');
-INSERT INTO prefix_survey_questions (text, shorttext, multi, intro, type, options) VALUES ( 'colles13', 'colles13short', '1', '1', 1, 'scaletimes5');
-INSERT INTO prefix_survey_questions (text, shorttext, multi, intro, type, options) VALUES ('colles14', 'colles14short', '1', '1', 1, 'scaletimes5');
-INSERT INTO prefix_survey_questions (text, shorttext, multi, intro, type, options) VALUES ('colles15', 'colles15short', '1', '1', 1, 'scaletimes5');
-INSERT INTO prefix_survey_questions (text, shorttext, multi, intro, type, options) VALUES ('colles16', 'colles16short', '1', '1', 1, 'scaletimes5');
-INSERT INTO prefix_survey_questions (text, shorttext, multi, intro, type, options) VALUES ('colles17', 'colles17short', '1', '1', 1, 'scaletimes5');
-INSERT INTO prefix_survey_questions (text, shorttext, multi, intro, type, options) VALUES ('colles18', 'colles18short', '1', '1', 1, 'scaletimes5');
-INSERT INTO prefix_survey_questions (text, shorttext, multi, intro, type, options) VALUES ('colles19', 'colles19short', '1', '1', 1, 'scaletimes5');
-INSERT INTO prefix_survey_questions (text, shorttext, multi, intro, type, options) VALUES ('colles20', 'colles20short', '1', '1', 1, 'scaletimes5');
-INSERT INTO prefix_survey_questions (text, shorttext, multi, intro, type, options) VALUES ('colles21', 'colles21short', '1', '1', 1, 'scaletimes5');
-INSERT INTO prefix_survey_questions (text, shorttext, multi, intro, type, options) VALUES ('colles22', 'colles22short', '1', '1', 1, 'scaletimes5');
-INSERT INTO prefix_survey_questions (text, shorttext, multi, intro, type, options) VALUES ('colles23', 'colles23short', '1', '1', 1, 'scaletimes5');
-INSERT INTO prefix_survey_questions (text, shorttext, multi, intro, type, options) VALUES ('colles24', 'colles24short', '1', '1', 1, 'scaletimes5');
-INSERT INTO prefix_survey_questions (text, shorttext, multi, intro, type, options) VALUES ('collesm1', 'collesm1short', '1,2,3,4', 'collesmintro', 1, 'scaletimes5');
-INSERT INTO prefix_survey_questions (text, shorttext, multi, intro, type, options) VALUES ('collesm2', 'collesm2short', '5,6,7,8', 'collesmintro', 1, 'scaletimes5');
-INSERT INTO prefix_survey_questions (text, shorttext, multi, intro, type, options) VALUES ('collesm3', 'collesm3short', '9,10,11,12', 'collesmintro', 1, 'scaletimes5');
-INSERT INTO prefix_survey_questions (text, shorttext, multi, intro, type, options) VALUES ('collesm4', 'collesm4short', '13,14,15,16', 'collesmintro', 1, 'scaletimes5');
-INSERT INTO prefix_survey_questions (text, shorttext, multi, intro, type, options) VALUES ('collesm5', 'collesm5short', '17,18,19,20', 'collesmintro', 1, 'scaletimes5');
-INSERT INTO prefix_survey_questions (text, shorttext, multi, intro, type, options) VALUES ('collesm6', 'collesm6short', '21,22,23,24', 'collesmintro', 1, 'scaletimes5');
-INSERT INTO prefix_survey_questions (text, shorttext, multi, intro, type, options) VALUES ('collesm1', 'collesm1short', '1,2,3,4', 'collesmintro', 2, 'scaletimes5');
-INSERT INTO prefix_survey_questions (text, shorttext, multi, intro, type, options) VALUES ('collesm2', 'collesm2short', '5,6,7,8', 'collesmintro', 2, 'scaletimes5');
-INSERT INTO prefix_survey_questions (text, shorttext, multi, intro, type, options) VALUES ('collesm3', 'collesm3short', '9,10,11,12', 'collesmintro', 2, 'scaletimes5');
-INSERT INTO prefix_survey_questions (text, shorttext, multi, intro, type, options) VALUES ('collesm4', 'collesm4short', '13,14,15,16', 'collesmintro', 2, 'scaletimes5');
-INSERT INTO prefix_survey_questions (text, shorttext, multi, intro, type, options) VALUES ('collesm5', 'collesm5short', '17,18,19,20', 'collesmintro', 2, 'scaletimes5');
-INSERT INTO prefix_survey_questions (text, shorttext, multi, intro, type, options) VALUES ('collesm6', 'collesm6short', '21,22,23,24', 'collesmintro', 2, 'scaletimes5');
-INSERT INTO prefix_survey_questions (text, shorttext, multi, intro, type, options) VALUES ('collesm1', 'collesm1short', '1,2,3,4', 'collesmintro', 3, 'scaletimes5');
-INSERT INTO prefix_survey_questions (text, shorttext, multi, intro, type, options) VALUES ('collesm2', 'collesm2short', '5,6,7,8', 'collesmintro', 3, 'scaletimes5');
-INSERT INTO prefix_survey_questions (text, shorttext, multi, intro, type, options) VALUES ('collesm3', 'collesm3short', '9,10,11,12', 'collesmintro', 3, 'scaletimes5');
-INSERT INTO prefix_survey_questions (text, shorttext, multi, intro, type, options) VALUES ('collesm4', 'collesm4short', '13,14,15,16', 'collesmintro', 3, 'scaletimes5');
-INSERT INTO prefix_survey_questions (text, shorttext, multi, intro, type, options) VALUES ('collesm5', 'collesm5short', '17,18,19,20', 'collesmintro', 3, 'scaletimes5');
-INSERT INTO prefix_survey_questions (text, shorttext, multi, intro, type, options) VALUES ('collesm6', 'collesm6short', '21,22,23,24', 'collesmintro', 3, 'scaletimes5');
-INSERT INTO prefix_survey_questions (text, shorttext, multi, intro, type, options) VALUES ('howlong', '1', '1', '1', 1, 'howlongoptions');
-INSERT INTO prefix_survey_questions (text, shorttext, multi, intro, type, options) VALUES ('othercomments', '1', '1', '1', 0, '');
-INSERT INTO prefix_survey_questions (text, shorttext, multi, intro, type, options) VALUES ('attls20', 'attls20short', '1', '1', 1, 'scaleagree5');
-INSERT INTO prefix_survey_questions (text, shorttext, multi, intro, type, options) VALUES ('attls14', 'attls14short', '1', '1', 1, 'scaleagree5');
-INSERT INTO prefix_survey_questions (text, shorttext, multi, intro, type, options) VALUES ('attls15', 'attls15short', '1', '1', 1, 'scaleagree5');
-INSERT INTO prefix_survey_questions (text, shorttext, multi, intro, type, options) VALUES ('attls16', 'attls16short', '1', '1', 1, 'scaleagree5');
-INSERT INTO prefix_survey_questions (text, shorttext, multi, intro, type, options) VALUES ('attls17', 'attls17short', '1', '1', 1, 'scaleagree5');
-INSERT INTO prefix_survey_questions (text, shorttext, multi, intro, type, options) VALUES ('attls18', 'attls18short', '1', '1', 1, 'scaleagree5');
-INSERT INTO prefix_survey_questions (text, shorttext, multi, intro, type, options) VALUES ('attls19', 'attls19short', '1', '1', 1, 'scaleagree5');
-INSERT INTO prefix_survey_questions (text, shorttext, multi, intro, type, options) VALUES ('attls12', 'attls12short', '1', '1', 1, 'scaleagree5');
-INSERT INTO prefix_survey_questions (text, shorttext, multi, intro, type, options) VALUES ('attls13', 'attls13short', '1', '1', 1, 'scaleagree5');
-INSERT INTO prefix_survey_questions (text, shorttext, multi, intro, type, options) VALUES ('attls11', 'attls11short', '1', '1', 1, 'scaleagree5');
-INSERT INTO prefix_survey_questions (text, shorttext, multi, intro, type, options) VALUES ('attls10', 'attls10short', '1', '1', 1, 'scaleagree5');
-INSERT INTO prefix_survey_questions (text, shorttext, multi, intro, type, options) VALUES ('attls9', 'attls9short', '1', '1', 1, 'scaleagree5');
-INSERT INTO prefix_survey_questions (text, shorttext, multi, intro, type, options) VALUES ('attls8', 'attls8short', '1', '1', 1, 'scaleagree5');
-INSERT INTO prefix_survey_questions (text, shorttext, multi, intro, type, options) VALUES ('attls7', 'attls7short', '1', '1', 1, 'scaleagree5');
-INSERT INTO prefix_survey_questions (text, shorttext, multi, intro, type, options) VALUES ('attls6', 'attls6short', '1', '1', 1, 'scaleagree5');
-INSERT INTO prefix_survey_questions (text, shorttext, multi, intro, type, options) VALUES ('attls5', 'attls5short', '1', '1', 1, 'scaleagree5');
-INSERT INTO prefix_survey_questions (text, shorttext, multi, intro, type, options) VALUES ('attls4', 'attls4short', '1', '1', 1, 'scaleagree5');
-INSERT INTO prefix_survey_questions (text, shorttext, multi, intro, type, options) VALUES ('attls3', 'attls3short', '1', '1', 1, 'scaleagree5');
-INSERT INTO prefix_survey_questions (text, shorttext, multi, intro, type, options) VALUES ('attls1', 'attls1short', '1', '1', 1, 'scaleagree5');
-INSERT INTO prefix_survey_questions (text, shorttext, multi, intro, type, options) VALUES ('attls2', 'attls2short', '1', '1', 1, 'scaleagree5');
-INSERT INTO prefix_survey_questions (text, shorttext, multi, intro, type, options) VALUES ('attlsm1', 'attlsm1', '45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64', 'attlsmintro', 1, 'scaleagree5');
-INSERT INTO prefix_survey_questions (text, shorttext, multi, intro, type, options) VALUES ('attlsm2', 'attlsm2', '63,62,59,57,55,49,52,50,48,47', 'attlsmintro', -1, 'scaleagree5');
-INSERT INTO prefix_survey_questions (text, shorttext, multi, intro, type, options) VALUES ('attlsm3', 'attlsm3', '46,54,45,51,60,53,56,58,61,64', 'attlsmintro', -1, 'scaleagree5');
-
-rem select * from prefix_survey_questions where text like 'colles%' or text like 'attlsm%'
-
-col id format 99
-select * from prefix_survey_questions;
-
-
-rem
-rem Dumping data for table log_display
-rem
-
-delete from prefix_log_display where module = 'survey';
-INSERT INTO prefix_log_display (module, action, mtable, field) VALUES ('survey', 'download', 'survey', 'name');
-INSERT INTO prefix_log_display (module, action, mtable, field) VALUES ('survey', 'view form', 'survey', 'name');
-INSERT INTO prefix_log_display (module, action, mtable, field) VALUES ('survey', 'view graph', 'survey', 'name');
-INSERT INTO prefix_log_display (module, action, mtable, field) VALUES ('survey', 'view report', 'survey', 'name');
-INSERT INTO prefix_log_display (module, action, mtable, field) VALUES ('survey', 'submit', 'survey', 'name');
-select * from prefix_log_display where module = 'survey';
+rem
+rem Table structure for table survey
+rem
+
+drop TABLE prefix_survey;
+CREATE TABLE prefix_survey (
+ id number(10) primary key,
+ course number(10) default '0' not null,
+ template number(10) default '0' not null,
+ days number(6) default '0' not null,
+ timecreated number(10) default '0' not null,
+ timemodified number(10) default '0' not null,
+ name varchar2(255) default '' not null,
+ intro varchar2(1024),
+ questions varchar2(255) default NULL
+);
+
+drop sequence p_survey_seq;
+create sequence p_survey_seq;
+
+create or replace trigger p_survey_trig
+ before insert on prefix_survey
+ referencing new as new_row
+ for each row
+ begin
+ select p_survey_seq.nextval into :new_row.id from dual;
+ end;
+.
+/
+
+COMMENT on table prefix_survey is 'all surveys';
+
+INSERT INTO prefix_survey (course, template, days, timecreated, timemodified, name, intro, questions) VALUES (0, 0, 0, 985017600, 985017600, 'collesaname', 'collesaintro', '25,26,27,28,29,30,43,44');
+INSERT INTO prefix_survey (course, template, days, timecreated, timemodified, name, intro, questions) VALUES (0, 0, 0, 985017600, 985017600, 'collespname', 'collespintro', '31,32,33,34,35,36,43,44');
+INSERT INTO prefix_survey (course, template, days, timecreated, timemodified, name, intro, questions) VALUES (0, 0, 0, 985017600, 985017600, 'collesapname', 'collesapintro', '37,38,39,40,41,42,43,44');
+INSERT INTO prefix_survey (course, template, days, timecreated, timemodified, name, intro, questions) VALUES (0, 0, 0, 985017600, 985017600, 'attlsname', 'attlsintro', '65,67,68');
+
+select * from prefix_survey order by 1,2;
+
+rem
+rem Table structure for table survey_analysis
+rem
+
+drop TABLE prefix_survey_analysis;
+CREATE TABLE prefix_survey_analysis (
+id number(10) primary key,
+survey number(10) default '0' not null,
+userid number(10) default '0' not null,
+notes varchar2(1024) NOT NULL
+
+drop sequence p_survey_analysis_seq;
+create sequence p_survey_analysis_seq;
+
+create or replace trigger p_survey_analysis_trig
+ before insert on prefix_survey_analysis
+ referencing new as new_row
+ for each row
+ begin
+ select p_survey_analysis_seq.nextval into :new_row.id from dual;
+ end;
+.
+/
+
+);
+
+comment on table prefix_survey_analysis is 'Survey analysis';
+
+rem
+rem Dumping data for table survey_analysis
+rem
+
+rem --------------------------------------------------------
+
+rem
+rem Table structure for table survey_answers
+rem
+
+drop TABLE prefix_survey_answers;
+CREATE TABLE prefix_survey_answers (
+id number(10) primary key,
+userid number(10) default '0' not null,
+survey number(10) default '0' not null,
+question number(10) default '0' not null,
+time number(10) default NULL,
+answer1 varchar2(255) default NULL,
+answer2 varchar2(255) default NULL
+);
+
+drop sequence p_survey_answers_seq;
+create sequence p_survey_answers_seq;
+
+create or replace trigger p_survey_answers_trig
+before insert on prefix_survey_answers
+referencing new as new_row
+for each row
+begin
+ select p_survey_answers_seq.nextval into :new_row.id from dual;
+end;
+.
+/
+
+
+rem
+rem Dumping data for table survey_answers
+rem
+
+rem --------------------------------------------------------
+
+rem
+rem Table structure for table survey_questions
+rem
+
+drop TABLE prefix_survey_questions;
+CREATE TABLE prefix_survey_questions (
+id number(10) primary key,
+text varchar2(255) default '' not null,
+shorttext varchar2(30) default '' not null,
+multi varchar2(100) default '' not null,
+intro varchar2(50) default NULL,
+type number(3) default '0' not null,
+options varchar2(1024)
+);
+
+comment on table prefix_survey_questions is 'structure for survey_questions';
+
+drop sequence p_survey_questions_seq;
+create sequence p_survey_questions_seq;
+
+create or replace trigger p_survey_questions_trig
+ before insert on prefix_survey_questions
+ referencing new as new_row
+ for each row
+ begin
+ select p_survey_questions_seq.nextval into :new_row.id from dual;
+ end;
+.
+/
+
+rem
+rem Dumping data for table survey_questions
+rem
+
+INSERT INTO prefix_survey_questions ( text, shorttext, multi, intro, type, options) VALUES ('colles1', 'colles1short', '1', '1', 1, 'scaletimes5');
+INSERT INTO prefix_survey_questions (text, shorttext, multi, intro, type, options) VALUES ('colles2', 'colles2short', '1', '1', 1, 'scaletimes5');
+INSERT INTO prefix_survey_questions (text, shorttext, multi, intro, type, options) VALUES ('colles3', 'colles3short', '1', '1', 1, 'scaletimes5');
+INSERT INTO prefix_survey_questions (text, shorttext, multi, intro, type, options) VALUES ('colles4', 'colles4short', '1', '1', 1, 'scaletimes5');
+INSERT INTO prefix_survey_questions (text, shorttext, multi, intro, type, options) VALUES ('colles5', 'colles5short', '1', '1', 1, 'scaletimes5');
+INSERT INTO prefix_survey_questions (text, shorttext, multi, intro, type, options) VALUES ('colles6', 'colles6short', '1', '1', 1, 'scaletimes5');
+INSERT INTO prefix_survey_questions (text, shorttext, multi, intro, type, options) VALUES ('colles7', 'colles7short', '1', '1', 1, 'scaletimes5');
+INSERT INTO prefix_survey_questions (text, shorttext, multi, intro, type, options) VALUES ('colles8', 'colles8short', '1', '1', 1, 'scaletimes5');
+INSERT INTO prefix_survey_questions (text, shorttext, multi, intro, type, options) VALUES ('colles9', 'colles9short', '1', '1', 1, 'scaletimes5');
+INSERT INTO prefix_survey_questions (text, shorttext, multi, intro, type, options) VALUES ( 'colles10', 'colles10short', '1', '1', 1, 'scaletimes5');
+INSERT INTO prefix_survey_questions (text, shorttext, multi, intro, type, options) VALUES ( 'colles11', 'colles11short', '1', '1', 1, 'scaletimes5');
+INSERT INTO prefix_survey_questions (text, shorttext, multi, intro, type, options) VALUES ( 'colles12', 'colles12short', '1', '1', 1, 'scaletimes5');
+INSERT INTO prefix_survey_questions (text, shorttext, multi, intro, type, options) VALUES ( 'colles13', 'colles13short', '1', '1', 1, 'scaletimes5');
+INSERT INTO prefix_survey_questions (text, shorttext, multi, intro, type, options) VALUES ('colles14', 'colles14short', '1', '1', 1, 'scaletimes5');
+INSERT INTO prefix_survey_questions (text, shorttext, multi, intro, type, options) VALUES ('colles15', 'colles15short', '1', '1', 1, 'scaletimes5');
+INSERT INTO prefix_survey_questions (text, shorttext, multi, intro, type, options) VALUES ('colles16', 'colles16short', '1', '1', 1, 'scaletimes5');
+INSERT INTO prefix_survey_questions (text, shorttext, multi, intro, type, options) VALUES ('colles17', 'colles17short', '1', '1', 1, 'scaletimes5');
+INSERT INTO prefix_survey_questions (text, shorttext, multi, intro, type, options) VALUES ('colles18', 'colles18short', '1', '1', 1, 'scaletimes5');
+INSERT INTO prefix_survey_questions (text, shorttext, multi, intro, type, options) VALUES ('colles19', 'colles19short', '1', '1', 1, 'scaletimes5');
+INSERT INTO prefix_survey_questions (text, shorttext, multi, intro, type, options) VALUES ('colles20', 'colles20short', '1', '1', 1, 'scaletimes5');
+INSERT INTO prefix_survey_questions (text, shorttext, multi, intro, type, options) VALUES ('colles21', 'colles21short', '1', '1', 1, 'scaletimes5');
+INSERT INTO prefix_survey_questions (text, shorttext, multi, intro, type, options) VALUES ('colles22', 'colles22short', '1', '1', 1, 'scaletimes5');
+INSERT INTO prefix_survey_questions (text, shorttext, multi, intro, type, options) VALUES ('colles23', 'colles23short', '1', '1', 1, 'scaletimes5');
+INSERT INTO prefix_survey_questions (text, shorttext, multi, intro, type, options) VALUES ('colles24', 'colles24short', '1', '1', 1, 'scaletimes5');
+INSERT INTO prefix_survey_questions (text, shorttext, multi, intro, type, options) VALUES ('collesm1', 'collesm1short', '1,2,3,4', 'collesmintro', 1, 'scaletimes5');
+INSERT INTO prefix_survey_questions (text, shorttext, multi, intro, type, options) VALUES ('collesm2', 'collesm2short', '5,6,7,8', 'collesmintro', 1, 'scaletimes5');
+INSERT INTO prefix_survey_questions (text, shorttext, multi, intro, type, options) VALUES ('collesm3', 'collesm3short', '9,10,11,12', 'collesmintro', 1, 'scaletimes5');
+INSERT INTO prefix_survey_questions (text, shorttext, multi, intro, type, options) VALUES ('collesm4', 'collesm4short', '13,14,15,16', 'collesmintro', 1, 'scaletimes5');
+INSERT INTO prefix_survey_questions (text, shorttext, multi, intro, type, options) VALUES ('collesm5', 'collesm5short', '17,18,19,20', 'collesmintro', 1, 'scaletimes5');
+INSERT INTO prefix_survey_questions (text, shorttext, multi, intro, type, options) VALUES ('collesm6', 'collesm6short', '21,22,23,24', 'collesmintro', 1, 'scaletimes5');
+INSERT INTO prefix_survey_questions (text, shorttext, multi, intro, type, options) VALUES ('collesm1', 'collesm1short', '1,2,3,4', 'collesmintro', 2, 'scaletimes5');
+INSERT INTO prefix_survey_questions (text, shorttext, multi, intro, type, options) VALUES ('collesm2', 'collesm2short', '5,6,7,8', 'collesmintro', 2, 'scaletimes5');
+INSERT INTO prefix_survey_questions (text, shorttext, multi, intro, type, options) VALUES ('collesm3', 'collesm3short', '9,10,11,12', 'collesmintro', 2, 'scaletimes5');
+INSERT INTO prefix_survey_questions (text, shorttext, multi, intro, type, options) VALUES ('collesm4', 'collesm4short', '13,14,15,16', 'collesmintro', 2, 'scaletimes5');
+INSERT INTO prefix_survey_questions (text, shorttext, multi, intro, type, options) VALUES ('collesm5', 'collesm5short', '17,18,19,20', 'collesmintro', 2, 'scaletimes5');
+INSERT INTO prefix_survey_questions (text, shorttext, multi, intro, type, options) VALUES ('collesm6', 'collesm6short', '21,22,23,24', 'collesmintro', 2, 'scaletimes5');
+INSERT INTO prefix_survey_questions (text, shorttext, multi, intro, type, options) VALUES ('collesm1', 'collesm1short', '1,2,3,4', 'collesmintro', 3, 'scaletimes5');
+INSERT INTO prefix_survey_questions (text, shorttext, multi, intro, type, options) VALUES ('collesm2', 'collesm2short', '5,6,7,8', 'collesmintro', 3, 'scaletimes5');
+INSERT INTO prefix_survey_questions (text, shorttext, multi, intro, type, options) VALUES ('collesm3', 'collesm3short', '9,10,11,12', 'collesmintro', 3, 'scaletimes5');
+INSERT INTO prefix_survey_questions (text, shorttext, multi, intro, type, options) VALUES ('collesm4', 'collesm4short', '13,14,15,16', 'collesmintro', 3, 'scaletimes5');
+INSERT INTO prefix_survey_questions (text, shorttext, multi, intro, type, options) VALUES ('collesm5', 'collesm5short', '17,18,19,20', 'collesmintro', 3, 'scaletimes5');
+INSERT INTO prefix_survey_questions (text, shorttext, multi, intro, type, options) VALUES ('collesm6', 'collesm6short', '21,22,23,24', 'collesmintro', 3, 'scaletimes5');
+INSERT INTO prefix_survey_questions (text, shorttext, multi, intro, type, options) VALUES ('howlong', '1', '1', '1', 1, 'howlongoptions');
+INSERT INTO prefix_survey_questions (text, shorttext, multi, intro, type, options) VALUES ('othercomments', '1', '1', '1', 0, '');
+INSERT INTO prefix_survey_questions (text, shorttext, multi, intro, type, options) VALUES ('attls20', 'attls20short', '1', '1', 1, 'scaleagree5');
+INSERT INTO prefix_survey_questions (text, shorttext, multi, intro, type, options) VALUES ('attls14', 'attls14short', '1', '1', 1, 'scaleagree5');
+INSERT INTO prefix_survey_questions (text, shorttext, multi, intro, type, options) VALUES ('attls15', 'attls15short', '1', '1', 1, 'scaleagree5');
+INSERT INTO prefix_survey_questions (text, shorttext, multi, intro, type, options) VALUES ('attls16', 'attls16short', '1', '1', 1, 'scaleagree5');
+INSERT INTO prefix_survey_questions (text, shorttext, multi, intro, type, options) VALUES ('attls17', 'attls17short', '1', '1', 1, 'scaleagree5');
+INSERT INTO prefix_survey_questions (text, shorttext, multi, intro, type, options) VALUES ('attls18', 'attls18short', '1', '1', 1, 'scaleagree5');
+INSERT INTO prefix_survey_questions (text, shorttext, multi, intro, type, options) VALUES ('attls19', 'attls19short', '1', '1', 1, 'scaleagree5');
+INSERT INTO prefix_survey_questions (text, shorttext, multi, intro, type, options) VALUES ('attls12', 'attls12short', '1', '1', 1, 'scaleagree5');
+INSERT INTO prefix_survey_questions (text, shorttext, multi, intro, type, options) VALUES ('attls13', 'attls13short', '1', '1', 1, 'scaleagree5');
+INSERT INTO prefix_survey_questions (text, shorttext, multi, intro, type, options) VALUES ('attls11', 'attls11short', '1', '1', 1, 'scaleagree5');
+INSERT INTO prefix_survey_questions (text, shorttext, multi, intro, type, options) VALUES ('attls10', 'attls10short', '1', '1', 1, 'scaleagree5');
+INSERT INTO prefix_survey_questions (text, shorttext, multi, intro, type, options) VALUES ('attls9', 'attls9short', '1', '1', 1, 'scaleagree5');
+INSERT INTO prefix_survey_questions (text, shorttext, multi, intro, type, options) VALUES ('attls8', 'attls8short', '1', '1', 1, 'scaleagree5');
+INSERT INTO prefix_survey_questions (text, shorttext, multi, intro, type, options) VALUES ('attls7', 'attls7short', '1', '1', 1, 'scaleagree5');
+INSERT INTO prefix_survey_questions (text, shorttext, multi, intro, type, options) VALUES ('attls6', 'attls6short', '1', '1', 1, 'scaleagree5');
+INSERT INTO prefix_survey_questions (text, shorttext, multi, intro, type, options) VALUES ('attls5', 'attls5short', '1', '1', 1, 'scaleagree5');
+INSERT INTO prefix_survey_questions (text, shorttext, multi, intro, type, options) VALUES ('attls4', 'attls4short', '1', '1', 1, 'scaleagree5');
+INSERT INTO prefix_survey_questions (text, shorttext, multi, intro, type, options) VALUES ('attls3', 'attls3short', '1', '1', 1, 'scaleagree5');
+INSERT INTO prefix_survey_questions (text, shorttext, multi, intro, type, options) VALUES ('attls1', 'attls1short', '1', '1', 1, 'scaleagree5');
+INSERT INTO prefix_survey_questions (text, shorttext, multi, intro, type, options) VALUES ('attls2', 'attls2short', '1', '1', 1, 'scaleagree5');
+INSERT INTO prefix_survey_questions (text, shorttext, multi, intro, type, options) VALUES ('attlsm1', 'attlsm1', '45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64', 'attlsmintro', 1, 'scaleagree5');
+INSERT INTO prefix_survey_questions (text, shorttext, multi, intro, type, options) VALUES ('attlsm2', 'attlsm2', '63,62,59,57,55,49,52,50,48,47', 'attlsmintro', -1, 'scaleagree5');
+INSERT INTO prefix_survey_questions (text, shorttext, multi, intro, type, options) VALUES ('attlsm3', 'attlsm3', '46,54,45,51,60,53,56,58,61,64', 'attlsmintro', -1, 'scaleagree5');
+
+rem select * from prefix_survey_questions where text like 'colles%' or text like 'attlsm%'
+
+col id format 99
+select * from prefix_survey_questions;
+
+
+rem
+rem Dumping data for table log_display
+rem
+
+delete from prefix_log_display where module = 'survey';
+INSERT INTO prefix_log_display (module, action, mtable, field) VALUES ('survey', 'download', 'survey', 'name');
+INSERT INTO prefix_log_display (module, action, mtable, field) VALUES ('survey', 'view form', 'survey', 'name');
+INSERT INTO prefix_log_display (module, action, mtable, field) VALUES ('survey', 'view graph', 'survey', 'name');
+INSERT INTO prefix_log_display (module, action, mtable, field) VALUES ('survey', 'view report', 'survey', 'name');
+INSERT INTO prefix_log_display (module, action, mtable, field) VALUES ('survey', 'submit', 'survey', 'name');
+select * from prefix_log_display where module = 'survey';
diff --git a/question/format/blackboard_6/format.php b/question/format/blackboard_6/format.php
index b8ccf2a9eb..e47a4da724 100644
--- a/question/format/blackboard_6/format.php
+++ b/question/format/blackboard_6/format.php
@@ -1,909 +1,909 @@
-libdir/xmlize.php");
-
-class qformat_blackboard_6 extends qformat_default {
- function provide_import() {
- return true;
- }
-
-
- //Function to check and create the needed dir to unzip file to
- function check_and_create_import_dir($unique_code) {
-
- global $CFG;
-
- $status = $this->check_dir_exists($CFG->dataroot."/temp",true);
- if ($status) {
- $status = $this->check_dir_exists($CFG->dataroot."/temp/bbquiz_import",true);
- }
- if ($status) {
- $status = $this->check_dir_exists($CFG->dataroot."/temp/bbquiz_import/".$unique_code,true);
- }
-
- return $status;
- }
-
- function clean_temp_dir($dir='') {
- // for now we will just say everything happened okay note
- // that a mess may be piling up in $CFG->dataroot/temp/bbquiz_import
- return true;
-
- if ($dir == '') {
- $dir = $this->temp_dir;
- }
- $slash = "/";
-
- // Create arrays to store files and directories
- $dir_files = array();
- $dir_subdirs = array();
-
- // Make sure we can delete it
- chmod($dir, 0777);
-
- if ((($handle = opendir($dir))) == FALSE) {
- // The directory could not be opened
- return false;
- }
-
- // Loop through all directory entries, and construct two temporary arrays containing files and sub directories
- while($entry = readdir($handle)) {
- if (is_dir($dir. $slash .$entry) && $entry != ".." && $entry != ".") {
- $dir_subdirs[] = $dir. $slash .$entry;
- }
- else if ($entry != ".." && $entry != ".") {
- $dir_files[] = $dir. $slash .$entry;
- }
- }
-
- // Delete all files in the curent directory return false and halt if a file cannot be removed
- for($i=0; $iclean_temp_dir($dir_subdirs[$i]) == FALSE) {
- return false;
- }
- else {
- if (rmdir($dir_subdirs[$i]) == FALSE) {
- return false;
- }
- }
- }
-
- // Close directory
- closedir($handle);
- if (rmdir($this->temp_dir) == FALSE) {
- return false;
- }
- // Success, every thing is gone return true
- return true;
- }
-
- //Function to check if a directory exists and, optionally, create it
- function check_dir_exists($dir,$create=false) {
-
- global $CFG;
-
- $status = true;
- if(!is_dir($dir)) {
- if (!$create) {
- $status = false;
- } else {
- umask(0000);
- $status = mkdir ($dir,$CFG->directorypermissions);
- }
- }
- return $status;
- }
-
- function importpostprocess() {
- /// Does any post-processing that may be desired
- /// Argument is a simple array of question ids that
- /// have just been added.
-
- // need to clean up temporary directory
- return $this->clean_temp_dir();
- }
-
- function copy_file_to_course($filename) {
- global $CFG;
- global $course;
- $filename = str_replace('\\','/',$filename);
- $fullpath = $this->temp_dir.'/res00001/'.$filename;
- $basename = basename($filename);
-
- $copy_to = $CFG->dataroot.'/'.$course->id.'/bb_import';
-
- if ($this->check_dir_exists($copy_to,true)) {
- if(is_readable($fullpath)) {
- $copy_to.= '/'.$basename;
- if (!copy($fullpath, $copy_to)) {
- return false;
- }
- else {
- return $copy_to;
- }
- }
- }
- else {
- return false;
- }
- }
-
- function readdata($filename) {
- /// Returns complete file with an array, one item per line
- global $CFG;
-
- $unique_code = time();
- $temp_dir = $CFG->dataroot."/temp/bbquiz_import/".$unique_code;
- $this->temp_dir = $temp_dir;
- if ($this->check_and_create_import_dir($unique_code)) {
- if(is_readable($filename)) {
- if (!copy($filename, "$temp_dir/bboard.zip")) {
- error("Could not copy backup file");
- }
- if(unzip_file("$temp_dir/bboard.zip", '', false)) {
- // assuming that the information is in res0001.dat
- // after looking at 6 examples this was always the case
- $q_file = "$temp_dir/res00001.dat";
- if (is_file($q_file)) {
- if (is_readable($q_file)) {
- $filearray = file($q_file);
- /// Check for Macintosh OS line returns (ie file on one line), and fix
- if (ereg("\r", $filearray[0]) AND !ereg("\n", $filearray[0])) {
- return explode("\r", $filearray[0]);
- } else {
- return $filearray;
- }
- return false;
- }
- }
- else {
- error("Could not find question data file in zip");
- }
- }
- else {
- print "filename: $filename tempdir: $temp_dir ";
- error("Could not unzip file.");
- }
- }
- else {
- error ("Could not read uploaded file");
- }
- }
- else {
- error("Could not create temporary directory");
- }
- }
-
- function save_question_options($question) {
- return true;
- }
-
-
-
- function readquestions ($lines) {
- /// Parses an array of lines into an array of questions,
- /// where each item is a question object as defined by
- /// readquestion().
-
- $text = implode($lines, " ");
- $xml = xmlize($text, 0);
-
- $raw_questions = $xml['questestinterop']['#']['assessment'][0]['#']['section'][0]['#']['item'];
- $questions = array();
-
- foreach($raw_questions as $quest) {
- $question = $this->create_raw_question($quest);
-
- switch($question->qtype) {
- case "Matching":
- $this->process_matching($question, $questions);
- break;
- case "Multiple Choice":
- $this->process_mc($question, $questions);
- break;
- case "Essay":
- $this->process_essay($question, $questions);
- break;
- case "Multiple Answer":
- $this->process_ma($question, $questions);
- break;
- case "True/False":
- $this->process_tf($question, $questions);
- break;
- case 'Fill in the Blank':
- $this->process_fblank($question, $questions);
- break;
- default:
- print "Unknown or unhandled question type: \"$question->qtype\" ";
- break;
- }
-
- }
- return $questions;
- }
-
-
-// creates a cleaner object to deal with for processing into moodle
-// the object created is NOT a moodle question object
-function create_raw_question($quest) {
-
- $question = $this->defaultquestion();
- $question->qtype = $quest['#']['itemmetadata'][0]['#']['bbmd_questiontype'][0]['#'];
- $presentation->blocks = $quest['#']['presentation'][0]['#']['flow'][0]['#']['flow'];
-
- foreach($presentation->blocks as $pblock) {
-
- $block = NULL;
- $block->type = $pblock['@']['class'];
-
- switch($block->type) {
- case 'QUESTION_BLOCK':
- $sub_blocks = $pblock['#']['flow'];
- foreach($sub_blocks as $sblock) {
- //echo "Calling process_block from line 263 ";
- $this->process_block($sblock, $block);
- }
- break;
-
- case 'RESPONSE_BLOCK':
- $choices = NULL;
- switch($question->qtype) {
- case 'Matching':
- $bb_subquestions = $pblock['#']['flow'];
- $sub_questions = array();
- foreach($bb_subquestions as $bb_subquestion) {
- $sub_question = NULL;
- $sub_question->ident = $bb_subquestion['#']['response_lid'][0]['@']['ident'];
- $this->process_block($bb_subquestion['#']['flow'][0], $sub_question);
- $bb_choices = $bb_subquestion['#']['response_lid'][0]['#']['render_choice'][0]['#']['flow_label'][0]['#']['response_label'];
- $choices = array();
- $this->process_choices($bb_choices, $choices);
- $sub_question->choices = $choices;
- if (!isset($block->subquestions)) {
- $block->subquestions = array();
- }
- $block->subquestions[] = $sub_question;
- }
- break;
- case 'Multiple Answer':
- $bb_choices = $pblock['#']['response_lid'][0]['#']['render_choice'][0]['#']['flow_label'];
- $choices = array();
- $this->process_choices($bb_choices, $choices);
- $block->choices = $choices;
- break;
- case 'Essay':
- // Doesn't apply since the user responds with text input
- break;
- case 'Multiple Choice':
- $mc_choices = $pblock['#']['response_lid'][0]['#']['render_choice'][0]['#']['flow_label'];
- foreach($mc_choices as $mc_choice) {
- $choices = NULL;
- $choices = $this->process_block($mc_choice, $choices);
- $block->choices[] = $choices;
- }
- break;
- case 'Fill in the Blank':
- // do nothing?
- break;
- default:
- $bb_choices = $pblock['#']['response_lid'][0]['#']['render_choice'][0]['#']['flow_label'][0]['#']['response_label'];
- $choices = array();
- $this->process_choices($bb_choices, $choices);
- $block->choices = $choices;
- }
- break;
- case 'RIGHT_MATCH_BLOCK':
- $matching_answerset = $pblock['#']['flow'];
- $answerset = array();
- foreach($matching_answerset as $answer) {
- $this->process_block($answer, $bb_answer);
- $answerset[] = $bb_answer;
- }
- $block->matching_answerset = $answerset;
- break;
- default:
- print "UNHANDLED PRESENTATION BLOCK";
- break;
- }
- $question->{$block->type} = $block;
- }
-
- // determine response processing
- // there is a section called 'outcomes' that I don't know what to do with
- $resprocessing = $quest['#']['resprocessing'];
- $respconditions = $resprocessing[0]['#']['respcondition'];
- $reponses = array();
- if ($question->qtype == 'Matching') {
- $this->process_matching_responses($respconditions, $responses);
- }
- else {
- $this->process_responses($respconditions, $responses);
- }
- $question->responses = $responses;
- $feedbackset = $quest['#']['itemfeedback'];
- $feedbacks = array();
- $this->process_feedback($feedbackset, $feedbacks);
- $question->feedback = $feedbacks;
- return $question;
-}
-
-function process_block($cur_block, &$block) {
- global $course, $CFG;
-
- $cur_type = $cur_block['@']['class'];
- switch($cur_type) {
- case 'FORMATTED_TEXT_BLOCK':
- $block->text = $this->strip_applet_tags_get_mathml($cur_block['#']['material'][0]['#']['mat_extension'][0]['#']['mat_formattedtext'][0]['#']);
- break;
- case 'FILE_BLOCK':
- //revisit this to make sure it is working correctly
- // Commented out ['matapplication']..., etc. because I
- // noticed that when I imported a new Blackboard 6 file
- // and printed out the block, the tree did not extend past ['material'][0]['#'] - CT 8/3/06
- $block->file = $cur_block['#']['material'][0]['#'];//['matapplication'][0]['@']['uri'];
- if ($block->file != '') {
- // if we have a file copy it to the course dir and adjust its name to be visible over the web.
- $block->file = $this->copy_file_to_course($block->file);
- $block->file = $CFG->wwwroot.'/file.php/'.$course->id.'/bb_import/'.basename($block->file);
- }
- break;
- case 'Block':
- if (isset($cur_block['#']['material'][0]['#']['mattext'][0]['#'])) {
- $block->text = $cur_block['#']['material'][0]['#']['mattext'][0]['#'];
- }
- else if (isset($cur_block['#']['material'][0]['#']['mat_extension'][0]['#']['mat_formattedtext'][0]['#'])) {
- $block->text = $cur_block['#']['material'][0]['#']['mat_extension'][0]['#']['mat_formattedtext'][0]['#'];
- }
- else if (isset($cur_block['#']['response_label'])) {
- // this is a response label block
- $sub_blocks = $cur_block['#']['response_label'][0];
- if(!isset($block->ident)) {
- if(isset($sub_blocks['@']['ident'])) {
- $block->ident = $sub_blocks['@']['ident'];
- }
- }
- foreach($sub_blocks['#']['flow_mat'] as $sub_block) {
- $this->process_block($sub_block, $block);
- }
- }
- else {
- if (isset($cur_block['#']['flow_mat']) || isset($cur_block['#']['flow'])) {
- if (isset($cur_block['#']['flow_mat'])) {
- $sub_blocks = $cur_block['#']['flow_mat'];
- }
- elseif (isset($cur_block['#']['flow'])) {
- $sub_blocks = $cur_block['#']['flow'];
- }
- foreach ($sub_blocks as $sblock) {
- // this will recursively grab the sub blocks which should be of one of the other types
- $this->process_block($sblock, $block);
- }
- }
- }
- break;
- case 'LINK_BLOCK':
- // not sure how this should be included
- if (!empty($cur_block['#']['material'][0]['#']['mattext'][0]['@']['uri'])) {
- $block->link = $cur_block['#']['material'][0]['#']['mattext'][0]['@']['uri'];
- }
- else {
- $block->link = '';
- }
- break;
- }
- return $block;
-}
-
-function process_choices($bb_choices, &$choices) {
- foreach($bb_choices as $choice) {
- if (isset($choice['@']['ident'])) {
- $cur_choice = $choice['@']['ident'];
- }
- else { //for multiple answer
- $cur_choice = $choice['#']['response_label'][0];//['@']['ident'];
- }
- if (isset($choice['#']['flow_mat'][0])) { //for multiple answer
- $cur_block = $choice['#']['flow_mat'][0];
- // Reset $cur_choice to NULL because process_block is expecting an object
- // for the second argument and not a string, which is what is was set as
- // originally - CT 8/7/06
- $cur_choice = null;
- $this->process_block($cur_block, $cur_choice);
- }
- elseif (isset($choice['#']['response_label'])) {
- // Reset $cur_choice to NULL because process_block is expecting an object
- // for the second argument and not a string, which is what is was set as
- // originally - CT 8/7/06
- $cur_choice = null;
- $this->process_block($choice, $cur_choice);
- }
- $choices[] = $cur_choice;
- }
-}
-
-function process_matching_responses($bb_responses, &$responses) {
- foreach($bb_responses as $bb_response) {
- $response = NULL;
- if (isset($bb_response['#']['conditionvar'][0]['#']['varequal'])) {
- $response->correct = $bb_response['#']['conditionvar'][0]['#']['varequal'][0]['#'];
- $response->ident = $bb_response['#']['conditionvar'][0]['#']['varequal'][0]['@']['respident'];
- }
- else {
- $response->correct = 'Broken Question?';
- $response->ident = 'Broken Question?';
- }
- $response->feedback = $bb_response['#']['displayfeedback'][0]['@']['linkrefid'];
- $responses[] = $response;
- }
-}
-
-function process_responses($bb_responses, &$responses) {
- foreach($bb_responses as $bb_response) {
- //Added this line to instantiate $response.
- // Without instantiating the $response variable, the same object
- // gets added to the array
- $response = null;
- if (isset($bb_response['@']['title'])) {
- $response->title = $bb_response['@']['title'];
- }
- else {
- $reponse->title = $bb_response['#']['displayfeedback'][0]['@']['linkrefid'];
- }
- $reponse->ident = array();
- if (isset($bb_response['#']['conditionvar'][0]['#'])){//['varequal'][0]['#'])) {
- $response->ident[0] = $bb_response['#']['conditionvar'][0]['#'];//['varequal'][0]['#'];
- }
- else if (isset($bb_response['#']['conditionvar'][0]['#']['other'][0]['#'])) {
- $response->ident[0] = $bb_response['#']['conditionvar'][0]['#']['other'][0]['#'];
- }
-
- if (isset($bb_response['#']['conditionvar'][0]['#']['and'])){//[0]['#'])) {
- $responseset = $bb_response['#']['conditionvar'][0]['#']['and'];//[0]['#']['varequal'];
- foreach($responseset as $rs) {
- $response->ident[] = $rs['#'];
- if(!isset($response->feedback) and isset( $rs['@'] ) ) {
- $response->feedback = $rs['@']['respident'];
- }
- }
- }
- else {
- $response->feedback = $bb_response['#']['displayfeedback'][0]['@']['linkrefid'];
- }
-
- // determine what point value to give response
- if (isset($bb_response['#']['setvar'])) {
- switch ($bb_response['#']['setvar'][0]['#']) {
- case "SCORE.max":
- $response->fraction = 1;
- break;
- default:
- // I have only seen this being 0 or unset
- // there are probably fractional values of SCORE.max, but I'm not sure what they look like
- $response->fraction = 0;
- break;
- }
- }
- else {
- // just going to assume this is the case this is probably not correct.
- $response->fraction = 0;
- }
-
- $responses[] = $response;
- }
-}
-
-function process_feedback($feedbackset, &$feedbacks) {
- foreach($feedbackset as $bb_feedback) {
- // Added line $feedback=null so that $feedback does not get reused in the loop
- // and added the the $feedbacks[] array multiple times
- $feedback = null;
- $feedback->ident = $bb_feedback['@']['ident'];
- if (isset($bb_feedback['#']['flow_mat'][0])) {
- $this->process_block($bb_feedback['#']['flow_mat'][0], $feedback);
- }
- elseif (isset($bb_feedback['#']['solution'][0]['#']['solutionmaterial'][0]['#']['flow_mat'][0])) {
- $this->process_block($bb_feedback['#']['solution'][0]['#']['solutionmaterial'][0]['#']['flow_mat'][0], $feedback);
- }
- $feedbacks[] = $feedback;
- }
-}
-
-//----------------------------------------
-// Process True / False Questions
-//----------------------------------------
-function process_tf($quest, &$questions) {
- $question = $this->defaultquestion();
-
- $question->qtype = TRUEFALSE;
- $question->defaultgrade = 1;
- $question->single = 1; // Only one answer is allowed
- $question->image = ""; // No images with this format
- $question->questiontext = addslashes($quest->QUESTION_BLOCK->text);
- // put name in question object
- $question->name = $question->questiontext;
-
- // first choice is true, second is false.
- if ($quest->responses[0]->fraction == 1) {
- $correct = true;
- }
- else {
- $correct = false;
- }
-
- foreach($quest->feedback as $fb) {
- $fback->{$fb->ident} = $fb->text;
- }
-
- if ($correct) { // true is correct
- $question->answer = 1;
- $question->feedbacktrue = addslashes($fback->correct);
- $question->feedbackfalse = addslashes($fback->incorrect);
- } else { // false is correct
- $question->answer = 0;
- $question->feedbacktrue = addslashes($fback->incorrect);
- $question->feedbackfalse = addslashes($fback->correct);
- }
- $questions[] = $question;
-}
-
-
-//----------------------------------------
-// Process Fill in the Blank
-//----------------------------------------
-function process_fblank($quest, &$questions) {
- $question = $this->defaultquestion();
- $question->qtype = SHORTANSWER;
- $question->defaultgrade = 1;
- $question->single = 1;
- $question->usecase = 0;
- $question->image = '';
- $question->questiontext = addslashes($quest->QUESTION_BLOCK->text);
- $question->name = $question->questiontext;
- $answers = array();
- $fractions = array();
- $feedbacks = array();
-
- // extract the feedback
- $feedback = array();
- foreach($quest->feedback as $fback) {
- if (isset($fback->ident)) {
- if ($fback->ident == 'correct' || $fback->ident == 'incorrect') {
- $feedback[$fback->ident] = $fback->text;
- }
- }
- }
-
- foreach($quest->responses as $response) {
- if(isset($response->title)) {
- if (isset($response->ident[0]['varequal'][0]['#'])) {
- //for BB Fill in the Blank, only interested in correct answers
- if ($response->feedback = 'correct') {
- $answers[] = addslashes($response->ident[0]['varequal'][0]['#']);
- $fractions[] = 1;
- if (isset($feedback['correct'])) {
- $feedbacks[] = addslashes($feedback['correct']);
- }
- else {
- $feedbacks[] = '';
- }
- }
- }
-
- }
- }
-
- //Adding catchall to so that students can see feedback for incorrect answers when they enter something the
- //instructor did not enter
- $answers[] = '*';
- $fractions[] = 0;
- if (isset($feedback['incorrect'])) {
- $feedbacks[] = addslashes($feedback['incorrect']);
- }
- else {
- $feedbacks[] = '';
- }
-
- $question->answer = $answers;
- $question->fraction = $fractions;
- $question->feedback = $feedbacks; // Changed to assign $feedbacks to $question->feedback instead of
-
- if (!empty($question)) {
- $questions[] = $question;
- }
-
-}
-
-//----------------------------------------
-// Process Multiple Choice Questions
-//----------------------------------------
-function process_mc($quest, &$questions) {
- $question = $this->defaultquestion();
- $question->qtype = MULTICHOICE;
- $question->defaultgrade = 1;
- $question->single = 1;
- $question->image = "";
- $question->questiontext = addslashes($quest->QUESTION_BLOCK->text);
- $question->name = $question->questiontext;
-
- $feedback = array();
- foreach($quest->feedback as $fback) {
- $feedback[$fback->ident] = addslashes($fback->text);
- }
-
- foreach($quest->responses as $response) {
- if (isset($response->title)) {
- if ($response->title == 'correct') {
- // only one answer possible for this qtype so first index is correct answer
- $correct = $response->ident[0]['varequal'][0]['#'];
- }
- }
- else {
- // fallback method for when the title is not set
- if ($response->feedback == 'correct') {
- // only one answer possible for this qtype so first index is correct answer
- $correct = $response->ident[0]['varequal'][0]['#']; // added [0]['varequal'][0]['#'] to $response->ident - CT 8/9/06
- }
- }
- }
-
- $i = 0;
- foreach($quest->RESPONSE_BLOCK->choices as $response) {
- $question->answer[$i] = addslashes($response->text);
- if ($correct == $response->ident) {
- $question->fraction[$i] = 1;
- // this is a bit of a hack to catch the feedback... first we see if a 'correct' feedback exists
- // then specific feedback for this question (maybe this should be switched?, but from my example
- // question pools I have not seen response specific feedback, only correct or incorrect feedback
- if (!empty($feedback['correct'])) {
- $question->feedback[$i] = $feedback['correct'];
- }
- elseif (!empty($feedback[$i])) {
- $question->feedback[$i] = $feedback[$i];
- }
- else {
- // failsafe feedback (should be '' instead?)
- $question->feedback[$i] = "correct";
- }
- }
- else {
- $question->fraction[$i] = 0;
- if (!empty($feedback['incorrect'])) {
- $question->feedback[$i] = $feedback['incorrect'];
- }
- elseif (!empty($feedback[$i])) {
- $question->feedback[$i] = $feedback[$i];
- }
- else {
- // failsafe feedback (should be '' instead?)
- $question->feedback[$i] = 'incorrect';
- }
- }
- $i++;
- }
-
- if (!empty($question)) {
- $questions[] = $question;
- }
-}
-
-//----------------------------------------
-// Process Multiple Choice Questions With Multiple Answers
-//----------------------------------------
-function process_ma($quest, &$questions) {
- $question = $this->defaultquestion(); // copied this from process_mc
- $question->questiontext = addslashes($quest->QUESTION_BLOCK->text);
- $question->name = $question->questiontext;
- $question->qtype = MULTICHOICE;
- $question->defaultgrade = 1;
- $question->single = 0; // More than one answer allowed
- $question->image = ""; // No images with this format
-
- $answers = $quest->responses;
- $correct_answers = array();
- foreach($answers as $answer) {
- if($answer->title == 'correct') {
- $answerset = $answer->ident[0]['and'][0]['#']['varequal'];
- foreach($answerset as $ans) {
- $correct_answers[] = $ans['#'];
- }
- }
- }
-
- foreach ($quest->feedback as $fb) {
- $feedback->{$fb->ident} = addslashes(trim($fb->text));
- }
-
- $correct_answer_count = count($correct_answers);
- $choiceset = $quest->RESPONSE_BLOCK->choices;
- $i = 0;
- foreach($choiceset as $choice) {
- $question->answer[$i] = addslashes(trim($choice->text));
- if (in_array($choice->ident, $correct_answers)) {
- // correct answer
- $question->fraction[$i] = floor(100000/$correct_answer_count)/100000; // strange behavior if we have more than 5 decimal places
- $question->feedback[$i] = $feedback->correct;
- }
- else {
- // wrong answer
- $question->fraction[$i] = 0;
- $question->feedback[$i] = $feedback->incorrect;
- }
- $i++;
- }
-
- $questions[] = $question;
-}
-
-//----------------------------------------
-// Process Essay Questions
-//----------------------------------------
-function process_essay($quest, &$questions) {
-// this should be rewritten to accomodate moodle 1.6 essay question type eventually
-
- if (defined("ESSAY")) {
- // treat as short answer
- $question = $this->defaultquestion(); // copied this from process_mc
- $question->qtype = ESSAY;
- $question->defaultgrade = 1;
- $question->usecase = 0; // Ignore case
- $question->image = ""; // No images with this format
- $question->questiontext = addslashes(trim($quest->QUESTION_BLOCK->text));
- $question->name = $question->questiontext;
-
- print $question->name;
-
- $question->feedback = array();
- // not sure where to get the correct answer from
- foreach($quest->feedback as $feedback) {
- // Added this code to put the possible solution that the
- // instructor gives as the Moodle answer for an essay question
- if ($feedback->ident == 'solution') {
- $question->feedback = $feedback->text;
- }
- }
- //Added because essay/questiontype.php:save_question_option is expecting a
- //fraction property - CT 8/10/06
- $question->fraction[] = 1;
- if (!empty($question)) {
- $questions[]=$question;
- }
- }
- else {
- print "Essay question types are not handled because the quiz question type 'Essay' does not exist in this installation of Moodle ";
- print " Omitted Question: ".$quest->QUESTION_BLOCK->text.'
';
- }
-}
-
-//----------------------------------------
-// Process Matching Questions
-//----------------------------------------
-function process_matching($quest, &$questions) {
- if (defined("RENDEREDMATCH")) {
- $question = $this->defaultquestion($this->defaultquestion());
- $question->valid = true;
- $question->qtype = RENDEREDMATCH;
- $question->defaultgrade = 1;
- $question->questiontext = addslashes($quest->QUESTION_BLOCK->text);
- $question->name = $question->questiontext;
-
- foreach($quest->RESPONSE_BLOCK->subquestions as $qid => $subq) {
- foreach($quest->responses as $rid => $resp) {
- if ($resp->ident == $subq->ident) {
- $correct = addslashes($resp->correct);
- $feedback = addslashes($resp->feedback);
- }
- }
-
- foreach($subq->choices as $cid => $choice) {
- if ($choice == $correct) {
- $question->subquestions[] = addslashes($subq->text);
- $question->subanswers[] = addslashes($quest->RIGHT_MATCH_BLOCK->matching_answerset[$cid]->text);
- }
- }
- }
-
- // check format
- $status = true;
- if ( count($quest->RESPONSE_BLOCK->subquestions) > count($quest->RIGHT_MATCH_BLOCK->matching_answerset) || count($question->subquestions) < 2) {
- $status = false;
- }
- else {
- // need to redo to make sure that no two questions have the same answer (rudimentary now)
- foreach($question->subanswers as $qstn) {
- if(isset($previous)) {
- if ($qstn == $previous) {
- $status = false;
- }
- }
- $previous = $qstn;
- if ($qstn == '') {
- $status = false;
- }
- }
- }
-
- if ($status) {
- $questions[] = $question;
- }
- else {
- global $course, $CFG;
- print '
';
- print '
This matching question is malformed. Please ensure there are no blank answers, no two questions have the same answer, and/or there are correct answers for each question. There must be at least as many subanswers as subquestions, and at least one subquestion.
';
-
- print "
Question:
".$quest->QUESTION_BLOCK->text;
- if (isset($quest->QUESTION_BLOCK->file)) {
- print ' There is a subfile contained in the zipfile that has been copied to course files: bb_import/'.basename($quest->QUESTION_BLOCK->file).'';
- if (preg_match('/(gif|jpg|jpeg|png)$/i', $quest->QUESTION_BLOCK->file)) {
- print '';
- }
- }
- print "
";
- print "
Subquestions:
";
- foreach($quest->responses as $rs) {
- $correct_responses->{$rs->ident} = $rs->correct;
- }
- foreach($quest->RESPONSE_BLOCK->subquestions as $subq) {
- print '
'.$subq->text.'
';
- foreach($subq->choices as $id=>$choice) {
- print '
';
- }
- }
- else {
- print "Matching question types are not handled because the quiz question type 'Rendered Matching' does not exist in this installation of Moodle ";
- print " Omitted Question: ".$quest->QUESTION_BLOCK->text.'
';
- }
-}
-
-
-function strip_applet_tags_get_mathml($string) {
- if(stristr($string, '') === FALSE) {
- return $string;
- }
- else {
- // strip all applet tags keeping stuff before/after and inbetween (if mathml) them
- while (stristr($string, '') !== FALSE) {
- preg_match("/(.*)\.*\<\/math\>)\".*\<\/applet\>(.*)/i",$string, $mathmls);
- $string = $mathmls[1].$mathmls[2].$mathmls[3];
- }
- return $string;
- }
-}
-
-} // close object
-?>
+libdir/xmlize.php");
+
+class qformat_blackboard_6 extends qformat_default {
+ function provide_import() {
+ return true;
+ }
+
+
+ //Function to check and create the needed dir to unzip file to
+ function check_and_create_import_dir($unique_code) {
+
+ global $CFG;
+
+ $status = $this->check_dir_exists($CFG->dataroot."/temp",true);
+ if ($status) {
+ $status = $this->check_dir_exists($CFG->dataroot."/temp/bbquiz_import",true);
+ }
+ if ($status) {
+ $status = $this->check_dir_exists($CFG->dataroot."/temp/bbquiz_import/".$unique_code,true);
+ }
+
+ return $status;
+ }
+
+ function clean_temp_dir($dir='') {
+ // for now we will just say everything happened okay note
+ // that a mess may be piling up in $CFG->dataroot/temp/bbquiz_import
+ return true;
+
+ if ($dir == '') {
+ $dir = $this->temp_dir;
+ }
+ $slash = "/";
+
+ // Create arrays to store files and directories
+ $dir_files = array();
+ $dir_subdirs = array();
+
+ // Make sure we can delete it
+ chmod($dir, 0777);
+
+ if ((($handle = opendir($dir))) == FALSE) {
+ // The directory could not be opened
+ return false;
+ }
+
+ // Loop through all directory entries, and construct two temporary arrays containing files and sub directories
+ while($entry = readdir($handle)) {
+ if (is_dir($dir. $slash .$entry) && $entry != ".." && $entry != ".") {
+ $dir_subdirs[] = $dir. $slash .$entry;
+ }
+ else if ($entry != ".." && $entry != ".") {
+ $dir_files[] = $dir. $slash .$entry;
+ }
+ }
+
+ // Delete all files in the curent directory return false and halt if a file cannot be removed
+ for($i=0; $iclean_temp_dir($dir_subdirs[$i]) == FALSE) {
+ return false;
+ }
+ else {
+ if (rmdir($dir_subdirs[$i]) == FALSE) {
+ return false;
+ }
+ }
+ }
+
+ // Close directory
+ closedir($handle);
+ if (rmdir($this->temp_dir) == FALSE) {
+ return false;
+ }
+ // Success, every thing is gone return true
+ return true;
+ }
+
+ //Function to check if a directory exists and, optionally, create it
+ function check_dir_exists($dir,$create=false) {
+
+ global $CFG;
+
+ $status = true;
+ if(!is_dir($dir)) {
+ if (!$create) {
+ $status = false;
+ } else {
+ umask(0000);
+ $status = mkdir ($dir,$CFG->directorypermissions);
+ }
+ }
+ return $status;
+ }
+
+ function importpostprocess() {
+ /// Does any post-processing that may be desired
+ /// Argument is a simple array of question ids that
+ /// have just been added.
+
+ // need to clean up temporary directory
+ return $this->clean_temp_dir();
+ }
+
+ function copy_file_to_course($filename) {
+ global $CFG;
+ global $course;
+ $filename = str_replace('\\','/',$filename);
+ $fullpath = $this->temp_dir.'/res00001/'.$filename;
+ $basename = basename($filename);
+
+ $copy_to = $CFG->dataroot.'/'.$course->id.'/bb_import';
+
+ if ($this->check_dir_exists($copy_to,true)) {
+ if(is_readable($fullpath)) {
+ $copy_to.= '/'.$basename;
+ if (!copy($fullpath, $copy_to)) {
+ return false;
+ }
+ else {
+ return $copy_to;
+ }
+ }
+ }
+ else {
+ return false;
+ }
+ }
+
+ function readdata($filename) {
+ /// Returns complete file with an array, one item per line
+ global $CFG;
+
+ $unique_code = time();
+ $temp_dir = $CFG->dataroot."/temp/bbquiz_import/".$unique_code;
+ $this->temp_dir = $temp_dir;
+ if ($this->check_and_create_import_dir($unique_code)) {
+ if(is_readable($filename)) {
+ if (!copy($filename, "$temp_dir/bboard.zip")) {
+ error("Could not copy backup file");
+ }
+ if(unzip_file("$temp_dir/bboard.zip", '', false)) {
+ // assuming that the information is in res0001.dat
+ // after looking at 6 examples this was always the case
+ $q_file = "$temp_dir/res00001.dat";
+ if (is_file($q_file)) {
+ if (is_readable($q_file)) {
+ $filearray = file($q_file);
+ /// Check for Macintosh OS line returns (ie file on one line), and fix
+ if (ereg("\r", $filearray[0]) AND !ereg("\n", $filearray[0])) {
+ return explode("\r", $filearray[0]);
+ } else {
+ return $filearray;
+ }
+ return false;
+ }
+ }
+ else {
+ error("Could not find question data file in zip");
+ }
+ }
+ else {
+ print "filename: $filename tempdir: $temp_dir ";
+ error("Could not unzip file.");
+ }
+ }
+ else {
+ error ("Could not read uploaded file");
+ }
+ }
+ else {
+ error("Could not create temporary directory");
+ }
+ }
+
+ function save_question_options($question) {
+ return true;
+ }
+
+
+
+ function readquestions ($lines) {
+ /// Parses an array of lines into an array of questions,
+ /// where each item is a question object as defined by
+ /// readquestion().
+
+ $text = implode($lines, " ");
+ $xml = xmlize($text, 0);
+
+ $raw_questions = $xml['questestinterop']['#']['assessment'][0]['#']['section'][0]['#']['item'];
+ $questions = array();
+
+ foreach($raw_questions as $quest) {
+ $question = $this->create_raw_question($quest);
+
+ switch($question->qtype) {
+ case "Matching":
+ $this->process_matching($question, $questions);
+ break;
+ case "Multiple Choice":
+ $this->process_mc($question, $questions);
+ break;
+ case "Essay":
+ $this->process_essay($question, $questions);
+ break;
+ case "Multiple Answer":
+ $this->process_ma($question, $questions);
+ break;
+ case "True/False":
+ $this->process_tf($question, $questions);
+ break;
+ case 'Fill in the Blank':
+ $this->process_fblank($question, $questions);
+ break;
+ default:
+ print "Unknown or unhandled question type: \"$question->qtype\" ";
+ break;
+ }
+
+ }
+ return $questions;
+ }
+
+
+// creates a cleaner object to deal with for processing into moodle
+// the object created is NOT a moodle question object
+function create_raw_question($quest) {
+
+ $question = $this->defaultquestion();
+ $question->qtype = $quest['#']['itemmetadata'][0]['#']['bbmd_questiontype'][0]['#'];
+ $presentation->blocks = $quest['#']['presentation'][0]['#']['flow'][0]['#']['flow'];
+
+ foreach($presentation->blocks as $pblock) {
+
+ $block = NULL;
+ $block->type = $pblock['@']['class'];
+
+ switch($block->type) {
+ case 'QUESTION_BLOCK':
+ $sub_blocks = $pblock['#']['flow'];
+ foreach($sub_blocks as $sblock) {
+ //echo "Calling process_block from line 263 ";
+ $this->process_block($sblock, $block);
+ }
+ break;
+
+ case 'RESPONSE_BLOCK':
+ $choices = NULL;
+ switch($question->qtype) {
+ case 'Matching':
+ $bb_subquestions = $pblock['#']['flow'];
+ $sub_questions = array();
+ foreach($bb_subquestions as $bb_subquestion) {
+ $sub_question = NULL;
+ $sub_question->ident = $bb_subquestion['#']['response_lid'][0]['@']['ident'];
+ $this->process_block($bb_subquestion['#']['flow'][0], $sub_question);
+ $bb_choices = $bb_subquestion['#']['response_lid'][0]['#']['render_choice'][0]['#']['flow_label'][0]['#']['response_label'];
+ $choices = array();
+ $this->process_choices($bb_choices, $choices);
+ $sub_question->choices = $choices;
+ if (!isset($block->subquestions)) {
+ $block->subquestions = array();
+ }
+ $block->subquestions[] = $sub_question;
+ }
+ break;
+ case 'Multiple Answer':
+ $bb_choices = $pblock['#']['response_lid'][0]['#']['render_choice'][0]['#']['flow_label'];
+ $choices = array();
+ $this->process_choices($bb_choices, $choices);
+ $block->choices = $choices;
+ break;
+ case 'Essay':
+ // Doesn't apply since the user responds with text input
+ break;
+ case 'Multiple Choice':
+ $mc_choices = $pblock['#']['response_lid'][0]['#']['render_choice'][0]['#']['flow_label'];
+ foreach($mc_choices as $mc_choice) {
+ $choices = NULL;
+ $choices = $this->process_block($mc_choice, $choices);
+ $block->choices[] = $choices;
+ }
+ break;
+ case 'Fill in the Blank':
+ // do nothing?
+ break;
+ default:
+ $bb_choices = $pblock['#']['response_lid'][0]['#']['render_choice'][0]['#']['flow_label'][0]['#']['response_label'];
+ $choices = array();
+ $this->process_choices($bb_choices, $choices);
+ $block->choices = $choices;
+ }
+ break;
+ case 'RIGHT_MATCH_BLOCK':
+ $matching_answerset = $pblock['#']['flow'];
+ $answerset = array();
+ foreach($matching_answerset as $answer) {
+ $this->process_block($answer, $bb_answer);
+ $answerset[] = $bb_answer;
+ }
+ $block->matching_answerset = $answerset;
+ break;
+ default:
+ print "UNHANDLED PRESENTATION BLOCK";
+ break;
+ }
+ $question->{$block->type} = $block;
+ }
+
+ // determine response processing
+ // there is a section called 'outcomes' that I don't know what to do with
+ $resprocessing = $quest['#']['resprocessing'];
+ $respconditions = $resprocessing[0]['#']['respcondition'];
+ $reponses = array();
+ if ($question->qtype == 'Matching') {
+ $this->process_matching_responses($respconditions, $responses);
+ }
+ else {
+ $this->process_responses($respconditions, $responses);
+ }
+ $question->responses = $responses;
+ $feedbackset = $quest['#']['itemfeedback'];
+ $feedbacks = array();
+ $this->process_feedback($feedbackset, $feedbacks);
+ $question->feedback = $feedbacks;
+ return $question;
+}
+
+function process_block($cur_block, &$block) {
+ global $course, $CFG;
+
+ $cur_type = $cur_block['@']['class'];
+ switch($cur_type) {
+ case 'FORMATTED_TEXT_BLOCK':
+ $block->text = $this->strip_applet_tags_get_mathml($cur_block['#']['material'][0]['#']['mat_extension'][0]['#']['mat_formattedtext'][0]['#']);
+ break;
+ case 'FILE_BLOCK':
+ //revisit this to make sure it is working correctly
+ // Commented out ['matapplication']..., etc. because I
+ // noticed that when I imported a new Blackboard 6 file
+ // and printed out the block, the tree did not extend past ['material'][0]['#'] - CT 8/3/06
+ $block->file = $cur_block['#']['material'][0]['#'];//['matapplication'][0]['@']['uri'];
+ if ($block->file != '') {
+ // if we have a file copy it to the course dir and adjust its name to be visible over the web.
+ $block->file = $this->copy_file_to_course($block->file);
+ $block->file = $CFG->wwwroot.'/file.php/'.$course->id.'/bb_import/'.basename($block->file);
+ }
+ break;
+ case 'Block':
+ if (isset($cur_block['#']['material'][0]['#']['mattext'][0]['#'])) {
+ $block->text = $cur_block['#']['material'][0]['#']['mattext'][0]['#'];
+ }
+ else if (isset($cur_block['#']['material'][0]['#']['mat_extension'][0]['#']['mat_formattedtext'][0]['#'])) {
+ $block->text = $cur_block['#']['material'][0]['#']['mat_extension'][0]['#']['mat_formattedtext'][0]['#'];
+ }
+ else if (isset($cur_block['#']['response_label'])) {
+ // this is a response label block
+ $sub_blocks = $cur_block['#']['response_label'][0];
+ if(!isset($block->ident)) {
+ if(isset($sub_blocks['@']['ident'])) {
+ $block->ident = $sub_blocks['@']['ident'];
+ }
+ }
+ foreach($sub_blocks['#']['flow_mat'] as $sub_block) {
+ $this->process_block($sub_block, $block);
+ }
+ }
+ else {
+ if (isset($cur_block['#']['flow_mat']) || isset($cur_block['#']['flow'])) {
+ if (isset($cur_block['#']['flow_mat'])) {
+ $sub_blocks = $cur_block['#']['flow_mat'];
+ }
+ elseif (isset($cur_block['#']['flow'])) {
+ $sub_blocks = $cur_block['#']['flow'];
+ }
+ foreach ($sub_blocks as $sblock) {
+ // this will recursively grab the sub blocks which should be of one of the other types
+ $this->process_block($sblock, $block);
+ }
+ }
+ }
+ break;
+ case 'LINK_BLOCK':
+ // not sure how this should be included
+ if (!empty($cur_block['#']['material'][0]['#']['mattext'][0]['@']['uri'])) {
+ $block->link = $cur_block['#']['material'][0]['#']['mattext'][0]['@']['uri'];
+ }
+ else {
+ $block->link = '';
+ }
+ break;
+ }
+ return $block;
+}
+
+function process_choices($bb_choices, &$choices) {
+ foreach($bb_choices as $choice) {
+ if (isset($choice['@']['ident'])) {
+ $cur_choice = $choice['@']['ident'];
+ }
+ else { //for multiple answer
+ $cur_choice = $choice['#']['response_label'][0];//['@']['ident'];
+ }
+ if (isset($choice['#']['flow_mat'][0])) { //for multiple answer
+ $cur_block = $choice['#']['flow_mat'][0];
+ // Reset $cur_choice to NULL because process_block is expecting an object
+ // for the second argument and not a string, which is what is was set as
+ // originally - CT 8/7/06
+ $cur_choice = null;
+ $this->process_block($cur_block, $cur_choice);
+ }
+ elseif (isset($choice['#']['response_label'])) {
+ // Reset $cur_choice to NULL because process_block is expecting an object
+ // for the second argument and not a string, which is what is was set as
+ // originally - CT 8/7/06
+ $cur_choice = null;
+ $this->process_block($choice, $cur_choice);
+ }
+ $choices[] = $cur_choice;
+ }
+}
+
+function process_matching_responses($bb_responses, &$responses) {
+ foreach($bb_responses as $bb_response) {
+ $response = NULL;
+ if (isset($bb_response['#']['conditionvar'][0]['#']['varequal'])) {
+ $response->correct = $bb_response['#']['conditionvar'][0]['#']['varequal'][0]['#'];
+ $response->ident = $bb_response['#']['conditionvar'][0]['#']['varequal'][0]['@']['respident'];
+ }
+ else {
+ $response->correct = 'Broken Question?';
+ $response->ident = 'Broken Question?';
+ }
+ $response->feedback = $bb_response['#']['displayfeedback'][0]['@']['linkrefid'];
+ $responses[] = $response;
+ }
+}
+
+function process_responses($bb_responses, &$responses) {
+ foreach($bb_responses as $bb_response) {
+ //Added this line to instantiate $response.
+ // Without instantiating the $response variable, the same object
+ // gets added to the array
+ $response = null;
+ if (isset($bb_response['@']['title'])) {
+ $response->title = $bb_response['@']['title'];
+ }
+ else {
+ $reponse->title = $bb_response['#']['displayfeedback'][0]['@']['linkrefid'];
+ }
+ $reponse->ident = array();
+ if (isset($bb_response['#']['conditionvar'][0]['#'])){//['varequal'][0]['#'])) {
+ $response->ident[0] = $bb_response['#']['conditionvar'][0]['#'];//['varequal'][0]['#'];
+ }
+ else if (isset($bb_response['#']['conditionvar'][0]['#']['other'][0]['#'])) {
+ $response->ident[0] = $bb_response['#']['conditionvar'][0]['#']['other'][0]['#'];
+ }
+
+ if (isset($bb_response['#']['conditionvar'][0]['#']['and'])){//[0]['#'])) {
+ $responseset = $bb_response['#']['conditionvar'][0]['#']['and'];//[0]['#']['varequal'];
+ foreach($responseset as $rs) {
+ $response->ident[] = $rs['#'];
+ if(!isset($response->feedback) and isset( $rs['@'] ) ) {
+ $response->feedback = $rs['@']['respident'];
+ }
+ }
+ }
+ else {
+ $response->feedback = $bb_response['#']['displayfeedback'][0]['@']['linkrefid'];
+ }
+
+ // determine what point value to give response
+ if (isset($bb_response['#']['setvar'])) {
+ switch ($bb_response['#']['setvar'][0]['#']) {
+ case "SCORE.max":
+ $response->fraction = 1;
+ break;
+ default:
+ // I have only seen this being 0 or unset
+ // there are probably fractional values of SCORE.max, but I'm not sure what they look like
+ $response->fraction = 0;
+ break;
+ }
+ }
+ else {
+ // just going to assume this is the case this is probably not correct.
+ $response->fraction = 0;
+ }
+
+ $responses[] = $response;
+ }
+}
+
+function process_feedback($feedbackset, &$feedbacks) {
+ foreach($feedbackset as $bb_feedback) {
+ // Added line $feedback=null so that $feedback does not get reused in the loop
+ // and added the the $feedbacks[] array multiple times
+ $feedback = null;
+ $feedback->ident = $bb_feedback['@']['ident'];
+ if (isset($bb_feedback['#']['flow_mat'][0])) {
+ $this->process_block($bb_feedback['#']['flow_mat'][0], $feedback);
+ }
+ elseif (isset($bb_feedback['#']['solution'][0]['#']['solutionmaterial'][0]['#']['flow_mat'][0])) {
+ $this->process_block($bb_feedback['#']['solution'][0]['#']['solutionmaterial'][0]['#']['flow_mat'][0], $feedback);
+ }
+ $feedbacks[] = $feedback;
+ }
+}
+
+//----------------------------------------
+// Process True / False Questions
+//----------------------------------------
+function process_tf($quest, &$questions) {
+ $question = $this->defaultquestion();
+
+ $question->qtype = TRUEFALSE;
+ $question->defaultgrade = 1;
+ $question->single = 1; // Only one answer is allowed
+ $question->image = ""; // No images with this format
+ $question->questiontext = addslashes($quest->QUESTION_BLOCK->text);
+ // put name in question object
+ $question->name = $question->questiontext;
+
+ // first choice is true, second is false.
+ if ($quest->responses[0]->fraction == 1) {
+ $correct = true;
+ }
+ else {
+ $correct = false;
+ }
+
+ foreach($quest->feedback as $fb) {
+ $fback->{$fb->ident} = $fb->text;
+ }
+
+ if ($correct) { // true is correct
+ $question->answer = 1;
+ $question->feedbacktrue = addslashes($fback->correct);
+ $question->feedbackfalse = addslashes($fback->incorrect);
+ } else { // false is correct
+ $question->answer = 0;
+ $question->feedbacktrue = addslashes($fback->incorrect);
+ $question->feedbackfalse = addslashes($fback->correct);
+ }
+ $questions[] = $question;
+}
+
+
+//----------------------------------------
+// Process Fill in the Blank
+//----------------------------------------
+function process_fblank($quest, &$questions) {
+ $question = $this->defaultquestion();
+ $question->qtype = SHORTANSWER;
+ $question->defaultgrade = 1;
+ $question->single = 1;
+ $question->usecase = 0;
+ $question->image = '';
+ $question->questiontext = addslashes($quest->QUESTION_BLOCK->text);
+ $question->name = $question->questiontext;
+ $answers = array();
+ $fractions = array();
+ $feedbacks = array();
+
+ // extract the feedback
+ $feedback = array();
+ foreach($quest->feedback as $fback) {
+ if (isset($fback->ident)) {
+ if ($fback->ident == 'correct' || $fback->ident == 'incorrect') {
+ $feedback[$fback->ident] = $fback->text;
+ }
+ }
+ }
+
+ foreach($quest->responses as $response) {
+ if(isset($response->title)) {
+ if (isset($response->ident[0]['varequal'][0]['#'])) {
+ //for BB Fill in the Blank, only interested in correct answers
+ if ($response->feedback = 'correct') {
+ $answers[] = addslashes($response->ident[0]['varequal'][0]['#']);
+ $fractions[] = 1;
+ if (isset($feedback['correct'])) {
+ $feedbacks[] = addslashes($feedback['correct']);
+ }
+ else {
+ $feedbacks[] = '';
+ }
+ }
+ }
+
+ }
+ }
+
+ //Adding catchall to so that students can see feedback for incorrect answers when they enter something the
+ //instructor did not enter
+ $answers[] = '*';
+ $fractions[] = 0;
+ if (isset($feedback['incorrect'])) {
+ $feedbacks[] = addslashes($feedback['incorrect']);
+ }
+ else {
+ $feedbacks[] = '';
+ }
+
+ $question->answer = $answers;
+ $question->fraction = $fractions;
+ $question->feedback = $feedbacks; // Changed to assign $feedbacks to $question->feedback instead of
+
+ if (!empty($question)) {
+ $questions[] = $question;
+ }
+
+}
+
+//----------------------------------------
+// Process Multiple Choice Questions
+//----------------------------------------
+function process_mc($quest, &$questions) {
+ $question = $this->defaultquestion();
+ $question->qtype = MULTICHOICE;
+ $question->defaultgrade = 1;
+ $question->single = 1;
+ $question->image = "";
+ $question->questiontext = addslashes($quest->QUESTION_BLOCK->text);
+ $question->name = $question->questiontext;
+
+ $feedback = array();
+ foreach($quest->feedback as $fback) {
+ $feedback[$fback->ident] = addslashes($fback->text);
+ }
+
+ foreach($quest->responses as $response) {
+ if (isset($response->title)) {
+ if ($response->title == 'correct') {
+ // only one answer possible for this qtype so first index is correct answer
+ $correct = $response->ident[0]['varequal'][0]['#'];
+ }
+ }
+ else {
+ // fallback method for when the title is not set
+ if ($response->feedback == 'correct') {
+ // only one answer possible for this qtype so first index is correct answer
+ $correct = $response->ident[0]['varequal'][0]['#']; // added [0]['varequal'][0]['#'] to $response->ident - CT 8/9/06
+ }
+ }
+ }
+
+ $i = 0;
+ foreach($quest->RESPONSE_BLOCK->choices as $response) {
+ $question->answer[$i] = addslashes($response->text);
+ if ($correct == $response->ident) {
+ $question->fraction[$i] = 1;
+ // this is a bit of a hack to catch the feedback... first we see if a 'correct' feedback exists
+ // then specific feedback for this question (maybe this should be switched?, but from my example
+ // question pools I have not seen response specific feedback, only correct or incorrect feedback
+ if (!empty($feedback['correct'])) {
+ $question->feedback[$i] = $feedback['correct'];
+ }
+ elseif (!empty($feedback[$i])) {
+ $question->feedback[$i] = $feedback[$i];
+ }
+ else {
+ // failsafe feedback (should be '' instead?)
+ $question->feedback[$i] = "correct";
+ }
+ }
+ else {
+ $question->fraction[$i] = 0;
+ if (!empty($feedback['incorrect'])) {
+ $question->feedback[$i] = $feedback['incorrect'];
+ }
+ elseif (!empty($feedback[$i])) {
+ $question->feedback[$i] = $feedback[$i];
+ }
+ else {
+ // failsafe feedback (should be '' instead?)
+ $question->feedback[$i] = 'incorrect';
+ }
+ }
+ $i++;
+ }
+
+ if (!empty($question)) {
+ $questions[] = $question;
+ }
+}
+
+//----------------------------------------
+// Process Multiple Choice Questions With Multiple Answers
+//----------------------------------------
+function process_ma($quest, &$questions) {
+ $question = $this->defaultquestion(); // copied this from process_mc
+ $question->questiontext = addslashes($quest->QUESTION_BLOCK->text);
+ $question->name = $question->questiontext;
+ $question->qtype = MULTICHOICE;
+ $question->defaultgrade = 1;
+ $question->single = 0; // More than one answer allowed
+ $question->image = ""; // No images with this format
+
+ $answers = $quest->responses;
+ $correct_answers = array();
+ foreach($answers as $answer) {
+ if($answer->title == 'correct') {
+ $answerset = $answer->ident[0]['and'][0]['#']['varequal'];
+ foreach($answerset as $ans) {
+ $correct_answers[] = $ans['#'];
+ }
+ }
+ }
+
+ foreach ($quest->feedback as $fb) {
+ $feedback->{$fb->ident} = addslashes(trim($fb->text));
+ }
+
+ $correct_answer_count = count($correct_answers);
+ $choiceset = $quest->RESPONSE_BLOCK->choices;
+ $i = 0;
+ foreach($choiceset as $choice) {
+ $question->answer[$i] = addslashes(trim($choice->text));
+ if (in_array($choice->ident, $correct_answers)) {
+ // correct answer
+ $question->fraction[$i] = floor(100000/$correct_answer_count)/100000; // strange behavior if we have more than 5 decimal places
+ $question->feedback[$i] = $feedback->correct;
+ }
+ else {
+ // wrong answer
+ $question->fraction[$i] = 0;
+ $question->feedback[$i] = $feedback->incorrect;
+ }
+ $i++;
+ }
+
+ $questions[] = $question;
+}
+
+//----------------------------------------
+// Process Essay Questions
+//----------------------------------------
+function process_essay($quest, &$questions) {
+// this should be rewritten to accomodate moodle 1.6 essay question type eventually
+
+ if (defined("ESSAY")) {
+ // treat as short answer
+ $question = $this->defaultquestion(); // copied this from process_mc
+ $question->qtype = ESSAY;
+ $question->defaultgrade = 1;
+ $question->usecase = 0; // Ignore case
+ $question->image = ""; // No images with this format
+ $question->questiontext = addslashes(trim($quest->QUESTION_BLOCK->text));
+ $question->name = $question->questiontext;
+
+ print $question->name;
+
+ $question->feedback = array();
+ // not sure where to get the correct answer from
+ foreach($quest->feedback as $feedback) {
+ // Added this code to put the possible solution that the
+ // instructor gives as the Moodle answer for an essay question
+ if ($feedback->ident == 'solution') {
+ $question->feedback = $feedback->text;
+ }
+ }
+ //Added because essay/questiontype.php:save_question_option is expecting a
+ //fraction property - CT 8/10/06
+ $question->fraction[] = 1;
+ if (!empty($question)) {
+ $questions[]=$question;
+ }
+ }
+ else {
+ print "Essay question types are not handled because the quiz question type 'Essay' does not exist in this installation of Moodle ";
+ print " Omitted Question: ".$quest->QUESTION_BLOCK->text.'
';
+ }
+}
+
+//----------------------------------------
+// Process Matching Questions
+//----------------------------------------
+function process_matching($quest, &$questions) {
+ if (defined("RENDEREDMATCH")) {
+ $question = $this->defaultquestion($this->defaultquestion());
+ $question->valid = true;
+ $question->qtype = RENDEREDMATCH;
+ $question->defaultgrade = 1;
+ $question->questiontext = addslashes($quest->QUESTION_BLOCK->text);
+ $question->name = $question->questiontext;
+
+ foreach($quest->RESPONSE_BLOCK->subquestions as $qid => $subq) {
+ foreach($quest->responses as $rid => $resp) {
+ if ($resp->ident == $subq->ident) {
+ $correct = addslashes($resp->correct);
+ $feedback = addslashes($resp->feedback);
+ }
+ }
+
+ foreach($subq->choices as $cid => $choice) {
+ if ($choice == $correct) {
+ $question->subquestions[] = addslashes($subq->text);
+ $question->subanswers[] = addslashes($quest->RIGHT_MATCH_BLOCK->matching_answerset[$cid]->text);
+ }
+ }
+ }
+
+ // check format
+ $status = true;
+ if ( count($quest->RESPONSE_BLOCK->subquestions) > count($quest->RIGHT_MATCH_BLOCK->matching_answerset) || count($question->subquestions) < 2) {
+ $status = false;
+ }
+ else {
+ // need to redo to make sure that no two questions have the same answer (rudimentary now)
+ foreach($question->subanswers as $qstn) {
+ if(isset($previous)) {
+ if ($qstn == $previous) {
+ $status = false;
+ }
+ }
+ $previous = $qstn;
+ if ($qstn == '') {
+ $status = false;
+ }
+ }
+ }
+
+ if ($status) {
+ $questions[] = $question;
+ }
+ else {
+ global $course, $CFG;
+ print '
';
+ print '
This matching question is malformed. Please ensure there are no blank answers, no two questions have the same answer, and/or there are correct answers for each question. There must be at least as many subanswers as subquestions, and at least one subquestion.
';
+
+ print "
Question:
".$quest->QUESTION_BLOCK->text;
+ if (isset($quest->QUESTION_BLOCK->file)) {
+ print ' There is a subfile contained in the zipfile that has been copied to course files: bb_import/'.basename($quest->QUESTION_BLOCK->file).'';
+ if (preg_match('/(gif|jpg|jpeg|png)$/i', $quest->QUESTION_BLOCK->file)) {
+ print '';
+ }
+ }
+ print "
";
+ print "
Subquestions:
";
+ foreach($quest->responses as $rs) {
+ $correct_responses->{$rs->ident} = $rs->correct;
+ }
+ foreach($quest->RESPONSE_BLOCK->subquestions as $subq) {
+ print '
'.$subq->text.'
';
+ foreach($subq->choices as $id=>$choice) {
+ print '
';
+ }
+ }
+ else {
+ print "Matching question types are not handled because the quiz question type 'Rendered Matching' does not exist in this installation of Moodle ";
+ print " Omitted Question: ".$quest->QUESTION_BLOCK->text.'
Sarissa is a utility class. Provides "static" methods for DOMDocument and
- * XMLHTTP objects, DOM Node serializatrion to XML strings and other goodies.
- * @constructor
- */
-function Sarissa(){};
-/** @private */
-Sarissa.PARSED_OK = "Document contains no parsing errors";
-/**
- * Tells you whether transformNode and transformNodeToObject are available. This functionality
- * is contained in sarissa_ieemu_xslt.js and is deprecated. If you want to control XSLT transformations
- * use the XSLTProcessor
- * @deprecated
- * @type boolean
- */
-Sarissa.IS_ENABLED_TRANSFORM_NODE = false;
-/**
- * tells you whether XMLHttpRequest (or equivalent) is available
- * @type boolean
- */
-Sarissa.IS_ENABLED_XMLHTTP = false;
-/**
- * tells you whether selectNodes/selectSingleNode is available
- * @type boolean
- */
-Sarissa.IS_ENABLED_SELECT_NODES = false;
-var _sarissa_iNsCounter = 0;
-var _SARISSA_IEPREFIX4XSLPARAM = "";
-var _SARISSA_HAS_DOM_IMPLEMENTATION = document.implementation && true;
-var _SARISSA_HAS_DOM_CREATE_DOCUMENT = _SARISSA_HAS_DOM_IMPLEMENTATION && document.implementation.createDocument;
-var _SARISSA_HAS_DOM_FEATURE = _SARISSA_HAS_DOM_IMPLEMENTATION && document.implementation.hasFeature;
-var _SARISSA_IS_MOZ = _SARISSA_HAS_DOM_CREATE_DOCUMENT && _SARISSA_HAS_DOM_FEATURE;
-var _SARISSA_IS_SAFARI = (navigator.userAgent && navigator.vendor && (navigator.userAgent.toLowerCase().indexOf("applewebkit") != -1 || navigator.vendor.indexOf("Apple") != -1));
-var _SARISSA_IS_IE = document.all && window.ActiveXObject && navigator.userAgent.toLowerCase().indexOf("msie") > -1 && navigator.userAgent.toLowerCase().indexOf("opera") == -1;
-if(!window.Node || !window.Node.ELEMENT_NODE){
- var Node = {ELEMENT_NODE: 1, ATTRIBUTE_NODE: 2, TEXT_NODE: 3, CDATA_SECTION_NODE: 4, ENTITY_REFERENCE_NODE: 5, ENTITY_NODE: 6, PROCESSING_INSTRUCTION_NODE: 7, COMMENT_NODE: 8, DOCUMENT_NODE: 9, DOCUMENT_TYPE_NODE: 10, DOCUMENT_FRAGMENT_NODE: 11, NOTATION_NODE: 12};
-};
-
-// IE initialization
-if(_SARISSA_IS_IE){
- // for XSLT parameter names, prefix needed by IE
- _SARISSA_IEPREFIX4XSLPARAM = "xsl:";
- // used to store the most recent ProgID available out of the above
- var _SARISSA_DOM_PROGID = "";
- var _SARISSA_XMLHTTP_PROGID = "";
- /**
- * Called when the Sarissa_xx.js file is parsed, to pick most recent
- * ProgIDs for IE, then gets destroyed.
- * @param idList an array of MSXML PROGIDs from which the most recent will be picked for a given object
- * @param enabledList an array of arrays where each array has two items; the index of the PROGID for which a certain feature is enabled
- */
- pickRecentProgID = function (idList, enabledList){
- // found progID flag
- var bFound = false;
- for(var i=0; i < idList.length && !bFound; i++){
- try{
- var oDoc = new ActiveXObject(idList[i]);
- o2Store = idList[i];
- bFound = true;
- for(var j=0;j");
- // don't use the same prefix again
- ++_sarissa_iNsCounter;
- }
- else
- oDoc.loadXML("<" + sName + "/>");
- };
- return oDoc;
- };
- // see non-IE version
- Sarissa.getParseErrorText = function (oDoc) {
- var parseErrorText = Sarissa.PARSED_OK;
- if(oDoc.parseError != 0){
- parseErrorText = "XML Parsing Error: " + oDoc.parseError.reason +
- "\nLocation: " + oDoc.parseError.url +
- "\nLine Number " + oDoc.parseError.line + ", Column " +
- oDoc.parseError.linepos +
- ":\n" + oDoc.parseError.srcText +
- "\n";
- for(var i = 0; i < oDoc.parseError.linepos;i++){
- parseErrorText += "-";
- };
- parseErrorText += "^\n";
- };
- return parseErrorText;
- };
- // see non-IE version
- Sarissa.setXpathNamespaces = function(oDoc, sNsSet) {
- oDoc.setProperty("SelectionLanguage", "XPath");
- oDoc.setProperty("SelectionNamespaces", sNsSet);
- };
- /**
- * Basic implementation of Mozilla's XSLTProcessor for IE.
- * Reuses the same XSLT stylesheet for multiple transforms
- * @constructor
- */
- XSLTProcessor = function(){
- this.template = new ActiveXObject(_SARISSA_XSLTEMPLATE_PROGID);
- this.processor = null;
- };
- /**
- * Impoprts the given XSLT DOM and compiles it to a reusable transform
- * @argument xslDoc The XSLT DOMDocument to import
- */
- XSLTProcessor.prototype.importStylesheet = function(xslDoc){
- // convert stylesheet to free threaded
- var converted = new ActiveXObject(_SARISSA_THREADEDDOM_PROGID);
- converted.loadXML(xslDoc.xml);
- this.template.stylesheet = converted;
- this.processor = this.template.createProcessor();
- // (re)set default param values
- this.paramsSet = new Array();
- };
- /**
- * Transform the given XML DOM
- * @argument sourceDoc The XML DOMDocument to transform
- * @return The transformation result as a DOM Document
- */
- XSLTProcessor.prototype.transformToDocument = function(sourceDoc){
- this.processor.input = sourceDoc;
- var outDoc = new ActiveXObject(_SARISSA_DOM_PROGID);
- this.processor.output = outDoc;
- this.processor.transform();
- return outDoc;
- };
- /**
- * Set global XSLT parameter of the imported stylesheet
- * @argument nsURI The parameter namespace URI
- * @argument name The parameter base name
- * @argument value The new parameter value
- */
- XSLTProcessor.prototype.setParameter = function(nsURI, name, value){
- /* nsURI is optional but cannot be null */
- if(nsURI){
- this.processor.addParameter(name, value, nsURI);
- }else{
- this.processor.addParameter(name, value);
- };
- /* update updated params for getParameter */
- if(!this.paramsSet[""+nsURI]){
- this.paramsSet[""+nsURI] = new Array();
- };
- this.paramsSet[""+nsURI][name] = value;
- };
- /**
- * Gets a parameter if previously set by setParameter. Returns null
- * otherwise
- * @argument name The parameter base name
- * @argument value The new parameter value
- * @return The parameter value if reviously set by setParameter, null otherwise
- */
- XSLTProcessor.prototype.getParameter = function(nsURI, name){
- nsURI = nsURI || "";
- if(nsURI in this.paramsSet && name in this.paramsSet[nsURI]){
- return this.paramsSet[nsURI][name];
- }else{
- return null;
- };
- };
-}
-else{ /* end IE initialization, try to deal with real browsers now ;-) */
- if(_SARISSA_HAS_DOM_CREATE_DOCUMENT){
- /**
- *
Ensures the document was loaded correctly, otherwise sets the
- * parseError to -1 to indicate something went wrong. Internal use
- */
- XMLDocument.prototype.parseError = 0;
-
- // NOTE: setting async to false will only work with documents
- // called over HTTP (meaning a server), not the local file system,
- // unless you are using Moz 1.4+.
- // BTW the try>catch block is for 1.4; I haven't found a way to check if
- // the property is implemented without
- // causing an error and I dont want to use user agent stuff for that...
- var _SARISSA_SYNC_NON_IMPLEMENTED = false;// ("async" in XMLDocument.prototype) ? false: true;
- /**
- *
Keeps a handle to the original load() method. Internal use and only
- * if Mozilla version is lower than 1.4
Overrides the original load method to provide synchronous loading for
- * Mozilla versions prior to 1.4, using an XMLHttpRequest object (if
- * async is set to false)
Factory method to obtain a new DOM Document object
- * @argument sUri the namespace of the root node (if any)
- * @argument sUri the local name of the root node (if any)
- * @returns a new DOM Document
- */
- Sarissa.getDomDocument = function(sUri, sName){
- return document.implementation.createDocument(sUri?sUri:"", sName?sName:"", null);
- };
- };
- };//if(_SARISSA_HAS_DOM_CREATE_DOCUMENT)
-};
-//==========================================
-// Common stuff
-//==========================================
-if(!window.DOMParser){
- /*
- * DOMParser is a utility class, used to construct DOMDocuments from XML strings
- * @constructor
- */
- DOMParser = function() {
- };
- if(_SARISSA_IS_SAFARI){
- /**
- * Construct a new DOM Document from the given XMLstring
- * @param sXml the given XML string
- * @param contentType the content type of the document the given string represents (one of text/xml, application/xml, application/xhtml+xml).
- * @return a new DOM Document from the given XML string
- */
- DOMParser.prototype.parseFromString = function(sXml, contentType){
- if(contentType.toLowerCase() != "application/xml"){
- throw "Cannot handle content type: \"" + contentType + "\"";
- };
- var xmlhttp = new XMLHttpRequest();
- xmlhttp.open("GET", "data:text/xml;charset=utf-8," + encodeURIComponent(str), false);
- xmlhttp.send(null);
- return xmlhttp.responseXML;
- };
- }else if(Sarissa.getDomDocument && Sarissa.getDomDocument() && "loadXML" in Sarissa.getDomDocument()){
- DOMParser.prototype.parseFromString = function(sXml, contentType){
- var doc = Sarissa.getDomDocument();
- doc.loadXML(sXml);
- return doc;
- };
- };
-};
-
-if(window.XMLHttpRequest){
- Sarissa.IS_ENABLED_XMLHTTP = true;
-}
-else if(_SARISSA_IS_IE){
- /**
- * Emulate XMLHttpRequest
- * @constructor
- */
- XMLHttpRequest = function() {
- return new ActiveXObject(_SARISSA_XMLHTTP_PROGID);
- };
- Sarissa.IS_ENABLED_XMLHTTP = true;
-};
-
-if(!window.document.importNode && _SARISSA_IS_IE){
- try{
- /**
- * Implements importNode for the current window document in IE using innerHTML.
- * Testing showed that DOM was multiple times slower than innerHTML for this,
- * sorry folks. If you encounter trouble (who knows what IE does behind innerHTML)
- * please gimme a call.
- * @param oNode the Node to import
- * @param bChildren whether to include the children of oNode
- * @returns the imported node for further use
- */
- window.document.importNode = function(oNode, bChildren){
- var importNode = document.createElement("div");
- if(bChildren)
- importNode.innerHTML = Sarissa.serialize(oNode);
- else
- importNode.innerHTML = Sarissa.serialize(oNode.cloneNode(false));
- return importNode.firstChild;
- };
- }catch(e){};
-};
-if(!Sarissa.getParseErrorText){
- /**
- *
Returns a human readable description of the parsing error. Usefull
- * for debugging. Tip: append the returned error string in a <pre>
- * element if you want to render it.
- *
Many thanks to Christian Stocker for the initial patch.
- * @argument oDoc The target DOM document
- * @returns The parsing error description of the target Document in
- * human readable form (preformated text)
- */
- Sarissa.getParseErrorText = function (oDoc){
- var parseErrorText = Sarissa.PARSED_OK;
- if(oDoc && oDoc.parseError && oDoc.parseError != 0){
- /*moz*/
- if(oDoc.documentElement.tagName == "parsererror"){
- parseErrorText = oDoc.documentElement.firstChild.data;
- parseErrorText += "\n" + oDoc.documentElement.firstChild.nextSibling.firstChild.data;
- }/*konq*/
- else{
- parseErrorText = Sarissa.getText(oDoc.documentElement);/*.getElementsByTagName("h1")[0], false) + "\n";
- parseErrorText += Sarissa.getText(oDoc.documentElement.getElementsByTagName("body")[0], false) + "\n";
- parseErrorText += Sarissa.getText(oDoc.documentElement.getElementsByTagName("pre")[0], false);*/
- };
- };
- return parseErrorText;
- };
-};
-Sarissa.getText = function(oNode, deep){
- var s = "";
- var nodes = oNode.childNodes;
- for(var i=0; i < nodes.length; i++){
- var node = nodes[i];
- var nodeType = node.nodeType;
- if(nodeType == Node.TEXT_NODE || nodeType == Node.CDATA_SECTION_NODE){
- s += node.data;
- }else if(deep == true
- && (nodeType == Node.ELEMENT_NODE
- || nodeType == Node.DOCUMENT_NODE
- || nodeType == Node.DOCUMENT_FRAGMENT_NODE)){
- s += Sarissa.getText(node, true);
- };
- };
- return s;
-};
-if(window.XMLSerializer){
- /**
- *
Factory method to obtain the serialization of a DOM Node
- * @returns the serialized Node as an XML string
- */
- Sarissa.serialize = function(oDoc){
- var s = null;
- if(oDoc){
- s = oDoc.innerHTML?oDoc.innerHTML:(new XMLSerializer()).serializeToString(oDoc);
- };
- return s;
- };
-}else{
- if(Sarissa.getDomDocument && (Sarissa.getDomDocument("","foo", null)).xml){
- // see non-IE version
- Sarissa.serialize = function(oDoc) {
- var s = null;
- if(oDoc){
- s = oDoc.innerHTML?oDoc.innerHTML:oDoc.xml;
- };
- return s;
- };
- /**
- * Utility class to serialize DOM Node objects to XML strings
- * @constructor
- */
- XMLSerializer = function(){};
- /**
- * Serialize the given DOM Node to an XML string
- * @param oNode the DOM Node to serialize
- */
- XMLSerializer.prototype.serializeToString = function(oNode) {
- return oNode.xml;
- };
- };
-};
-
-/**
- * strips tags from a markup string
- */
-Sarissa.stripTags = function (s) {
- return s.replace(/<[^>]+>/g,"");
-};
-/**
- *
Deletes all child nodes of the given node
- * @argument oNode the Node to empty
- */
-Sarissa.clearChildNodes = function(oNode) {
- // need to check for firstChild due to opera 8 bug with hasChildNodes
- while(oNode.firstChild){
- oNode.removeChild(oNode.firstChild);
- };
-};
-/**
- *
Copies the childNodes of nodeFrom to nodeTo
- *
Note: The second object's original content is deleted before
- * the copy operation, unless you supply a true third parameter
- * @argument nodeFrom the Node to copy the childNodes from
- * @argument nodeTo the Node to copy the childNodes to
- * @argument bPreserveExisting whether to preserve the original content of nodeTo, default is false
- */
-Sarissa.copyChildNodes = function(nodeFrom, nodeTo, bPreserveExisting) {
- if((!nodeFrom) || (!nodeTo)){
- throw "Both source and destination nodes must be provided";
- };
- if(!bPreserveExisting){
- Sarissa.clearChildNodes(nodeTo);
- };
- var ownerDoc = nodeTo.nodeType == Node.DOCUMENT_NODE ? nodeTo : nodeTo.ownerDocument;
- var nodes = nodeFrom.childNodes;
- if(ownerDoc.importNode && (!_SARISSA_IS_IE)) {
- for(var i=0;i < nodes.length;i++) {
- nodeTo.appendChild(ownerDoc.importNode(nodes[i], true));
- };
- }
- else{
- for(var i=0;i < nodes.length;i++) {
- nodeTo.appendChild(nodes[i].cloneNode(true));
- };
- };
-};
-
-/**
- *
Moves the childNodes of nodeFrom to nodeTo
- *
Note: The second object's original content is deleted before
- * the move operation, unless you supply a true third parameter
- * @argument nodeFrom the Node to copy the childNodes from
- * @argument nodeTo the Node to copy the childNodes to
- * @argument bPreserveExisting whether to preserve the original content of nodeTo, default is
- */
-Sarissa.moveChildNodes = function(nodeFrom, nodeTo, bPreserveExisting) {
- if((!nodeFrom) || (!nodeTo)){
- throw "Both source and destination nodes must be provided";
- };
- if(!bPreserveExisting){
- Sarissa.clearChildNodes(nodeTo);
- };
- var nodes = nodeFrom.childNodes;
- // if within the same doc, just move, else copy and delete
- if(nodeFrom.ownerDocument == nodeTo.ownerDocument){
- while(nodeFrom.firstChild){
- nodeTo.appendChild(nodeFrom.firstChild);
- };
- }else{
- var ownerDoc = nodeTo.nodeType == Node.DOCUMENT_NODE ? nodeTo : nodeTo.ownerDocument;
- if(ownerDoc.importNode && (!_SARISSA_IS_IE)) {
- for(var i=0;i < nodes.length;i++) {
- nodeTo.appendChild(ownerDoc.importNode(nodes[i], true));
- };
- }else{
- for(var i=0;i < nodes.length;i++) {
- nodeTo.appendChild(nodes[i].cloneNode(true));
- };
- };
- Sarissa.clearChildNodes(nodeFrom);
- };
-};
-
-/**
- *
Serialize any object to an XML string. All properties are serialized using the property name
- * as the XML element name. Array elements are rendered as array-item elements,
- * using their index/key as the value of the key attribute.
- * @argument anyObject the object to serialize
- * @argument objectName a name for that object
- * @return the XML serializationj of the given object as a string
- */
-Sarissa.xmlize = function(anyObject, objectName, indentSpace){
- indentSpace = indentSpace?indentSpace:'';
- var s = indentSpace + '<' + objectName + '>';
- var isLeaf = false;
- if(!(anyObject instanceof Object) || anyObject instanceof Number || anyObject instanceof String
- || anyObject instanceof Boolean || anyObject instanceof Date){
- s += Sarissa.escape(""+anyObject);
- isLeaf = true;
- }else{
- s += "\n";
- var itemKey = '';
- var isArrayItem = anyObject instanceof Array;
- for(var name in anyObject){
- s += Sarissa.xmlize(anyObject[name], (isArrayItem?"array-item key=\""+name+"\"":name), indentSpace + " ");
- };
- s += indentSpace;
- };
- return s += (objectName.indexOf(' ')!=-1?"\n":"" + objectName + ">\n");
-};
-
-/**
- * Escape the given string chacters that correspond to the five predefined XML entities
- * @param sXml the string to escape
- */
-Sarissa.escape = function(sXml){
- return sXml.replace(/&/g, "&")
- .replace(//g, ">")
- .replace(/"/g, """)
- .replace(/'/g, "'");
-};
-
-/**
- * Unescape the given string. This turns the occurences of the predefined XML
- * entities to become the characters they represent correspond to the five predefined XML entities
- * @param sXml the string to unescape
- */
-Sarissa.unescape = function(sXml){
- return sXml.replace(/'/g,"'")
- .replace(/"/g,"\"")
- .replace(/>/g,">")
- .replace(/</g,"<")
- .replace(/&/g,"&");
-};
+
+/**
+ * ====================================================================
+ * About
+ * ====================================================================
+ * Sarissa is an ECMAScript library acting as a cross-browser wrapper for native XML APIs.
+ * The library supports Gecko based browsers like Mozilla and Firefox,
+ * Internet Explorer (5.5+ with MSXML3.0+), Konqueror, Safari and a little of Opera
+ * @version 0.9.6.1
+ * @author: Manos Batsis, mailto: mbatsis at users full stop sourceforge full stop net
+ * ====================================================================
+ * Licence
+ * ====================================================================
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 or
+ * the GNU Lesser General Public License version 2.1 as published by
+ * the Free Software Foundation (your choice between the two).
+ *
+ * This program 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 or GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * or GNU Lesser General Public License along with this program; if not,
+ * write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ * or visit http://www.gnu.org
+ *
+ */
+/**
+ *
Sarissa is a utility class. Provides "static" methods for DOMDocument and
+ * XMLHTTP objects, DOM Node serializatrion to XML strings and other goodies.
+ * @constructor
+ */
+function Sarissa(){};
+/** @private */
+Sarissa.PARSED_OK = "Document contains no parsing errors";
+/**
+ * Tells you whether transformNode and transformNodeToObject are available. This functionality
+ * is contained in sarissa_ieemu_xslt.js and is deprecated. If you want to control XSLT transformations
+ * use the XSLTProcessor
+ * @deprecated
+ * @type boolean
+ */
+Sarissa.IS_ENABLED_TRANSFORM_NODE = false;
+/**
+ * tells you whether XMLHttpRequest (or equivalent) is available
+ * @type boolean
+ */
+Sarissa.IS_ENABLED_XMLHTTP = false;
+/**
+ * tells you whether selectNodes/selectSingleNode is available
+ * @type boolean
+ */
+Sarissa.IS_ENABLED_SELECT_NODES = false;
+var _sarissa_iNsCounter = 0;
+var _SARISSA_IEPREFIX4XSLPARAM = "";
+var _SARISSA_HAS_DOM_IMPLEMENTATION = document.implementation && true;
+var _SARISSA_HAS_DOM_CREATE_DOCUMENT = _SARISSA_HAS_DOM_IMPLEMENTATION && document.implementation.createDocument;
+var _SARISSA_HAS_DOM_FEATURE = _SARISSA_HAS_DOM_IMPLEMENTATION && document.implementation.hasFeature;
+var _SARISSA_IS_MOZ = _SARISSA_HAS_DOM_CREATE_DOCUMENT && _SARISSA_HAS_DOM_FEATURE;
+var _SARISSA_IS_SAFARI = (navigator.userAgent && navigator.vendor && (navigator.userAgent.toLowerCase().indexOf("applewebkit") != -1 || navigator.vendor.indexOf("Apple") != -1));
+var _SARISSA_IS_IE = document.all && window.ActiveXObject && navigator.userAgent.toLowerCase().indexOf("msie") > -1 && navigator.userAgent.toLowerCase().indexOf("opera") == -1;
+if(!window.Node || !window.Node.ELEMENT_NODE){
+ var Node = {ELEMENT_NODE: 1, ATTRIBUTE_NODE: 2, TEXT_NODE: 3, CDATA_SECTION_NODE: 4, ENTITY_REFERENCE_NODE: 5, ENTITY_NODE: 6, PROCESSING_INSTRUCTION_NODE: 7, COMMENT_NODE: 8, DOCUMENT_NODE: 9, DOCUMENT_TYPE_NODE: 10, DOCUMENT_FRAGMENT_NODE: 11, NOTATION_NODE: 12};
+};
+
+// IE initialization
+if(_SARISSA_IS_IE){
+ // for XSLT parameter names, prefix needed by IE
+ _SARISSA_IEPREFIX4XSLPARAM = "xsl:";
+ // used to store the most recent ProgID available out of the above
+ var _SARISSA_DOM_PROGID = "";
+ var _SARISSA_XMLHTTP_PROGID = "";
+ /**
+ * Called when the Sarissa_xx.js file is parsed, to pick most recent
+ * ProgIDs for IE, then gets destroyed.
+ * @param idList an array of MSXML PROGIDs from which the most recent will be picked for a given object
+ * @param enabledList an array of arrays where each array has two items; the index of the PROGID for which a certain feature is enabled
+ */
+ pickRecentProgID = function (idList, enabledList){
+ // found progID flag
+ var bFound = false;
+ for(var i=0; i < idList.length && !bFound; i++){
+ try{
+ var oDoc = new ActiveXObject(idList[i]);
+ o2Store = idList[i];
+ bFound = true;
+ for(var j=0;j");
+ // don't use the same prefix again
+ ++_sarissa_iNsCounter;
+ }
+ else
+ oDoc.loadXML("<" + sName + "/>");
+ };
+ return oDoc;
+ };
+ // see non-IE version
+ Sarissa.getParseErrorText = function (oDoc) {
+ var parseErrorText = Sarissa.PARSED_OK;
+ if(oDoc.parseError != 0){
+ parseErrorText = "XML Parsing Error: " + oDoc.parseError.reason +
+ "\nLocation: " + oDoc.parseError.url +
+ "\nLine Number " + oDoc.parseError.line + ", Column " +
+ oDoc.parseError.linepos +
+ ":\n" + oDoc.parseError.srcText +
+ "\n";
+ for(var i = 0; i < oDoc.parseError.linepos;i++){
+ parseErrorText += "-";
+ };
+ parseErrorText += "^\n";
+ };
+ return parseErrorText;
+ };
+ // see non-IE version
+ Sarissa.setXpathNamespaces = function(oDoc, sNsSet) {
+ oDoc.setProperty("SelectionLanguage", "XPath");
+ oDoc.setProperty("SelectionNamespaces", sNsSet);
+ };
+ /**
+ * Basic implementation of Mozilla's XSLTProcessor for IE.
+ * Reuses the same XSLT stylesheet for multiple transforms
+ * @constructor
+ */
+ XSLTProcessor = function(){
+ this.template = new ActiveXObject(_SARISSA_XSLTEMPLATE_PROGID);
+ this.processor = null;
+ };
+ /**
+ * Impoprts the given XSLT DOM and compiles it to a reusable transform
+ * @argument xslDoc The XSLT DOMDocument to import
+ */
+ XSLTProcessor.prototype.importStylesheet = function(xslDoc){
+ // convert stylesheet to free threaded
+ var converted = new ActiveXObject(_SARISSA_THREADEDDOM_PROGID);
+ converted.loadXML(xslDoc.xml);
+ this.template.stylesheet = converted;
+ this.processor = this.template.createProcessor();
+ // (re)set default param values
+ this.paramsSet = new Array();
+ };
+ /**
+ * Transform the given XML DOM
+ * @argument sourceDoc The XML DOMDocument to transform
+ * @return The transformation result as a DOM Document
+ */
+ XSLTProcessor.prototype.transformToDocument = function(sourceDoc){
+ this.processor.input = sourceDoc;
+ var outDoc = new ActiveXObject(_SARISSA_DOM_PROGID);
+ this.processor.output = outDoc;
+ this.processor.transform();
+ return outDoc;
+ };
+ /**
+ * Set global XSLT parameter of the imported stylesheet
+ * @argument nsURI The parameter namespace URI
+ * @argument name The parameter base name
+ * @argument value The new parameter value
+ */
+ XSLTProcessor.prototype.setParameter = function(nsURI, name, value){
+ /* nsURI is optional but cannot be null */
+ if(nsURI){
+ this.processor.addParameter(name, value, nsURI);
+ }else{
+ this.processor.addParameter(name, value);
+ };
+ /* update updated params for getParameter */
+ if(!this.paramsSet[""+nsURI]){
+ this.paramsSet[""+nsURI] = new Array();
+ };
+ this.paramsSet[""+nsURI][name] = value;
+ };
+ /**
+ * Gets a parameter if previously set by setParameter. Returns null
+ * otherwise
+ * @argument name The parameter base name
+ * @argument value The new parameter value
+ * @return The parameter value if reviously set by setParameter, null otherwise
+ */
+ XSLTProcessor.prototype.getParameter = function(nsURI, name){
+ nsURI = nsURI || "";
+ if(nsURI in this.paramsSet && name in this.paramsSet[nsURI]){
+ return this.paramsSet[nsURI][name];
+ }else{
+ return null;
+ };
+ };
+}
+else{ /* end IE initialization, try to deal with real browsers now ;-) */
+ if(_SARISSA_HAS_DOM_CREATE_DOCUMENT){
+ /**
+ *
Ensures the document was loaded correctly, otherwise sets the
+ * parseError to -1 to indicate something went wrong. Internal use
+ */
+ XMLDocument.prototype.parseError = 0;
+
+ // NOTE: setting async to false will only work with documents
+ // called over HTTP (meaning a server), not the local file system,
+ // unless you are using Moz 1.4+.
+ // BTW the try>catch block is for 1.4; I haven't found a way to check if
+ // the property is implemented without
+ // causing an error and I dont want to use user agent stuff for that...
+ var _SARISSA_SYNC_NON_IMPLEMENTED = false;// ("async" in XMLDocument.prototype) ? false: true;
+ /**
+ *
Keeps a handle to the original load() method. Internal use and only
+ * if Mozilla version is lower than 1.4
Overrides the original load method to provide synchronous loading for
+ * Mozilla versions prior to 1.4, using an XMLHttpRequest object (if
+ * async is set to false)
Factory method to obtain a new DOM Document object
+ * @argument sUri the namespace of the root node (if any)
+ * @argument sUri the local name of the root node (if any)
+ * @returns a new DOM Document
+ */
+ Sarissa.getDomDocument = function(sUri, sName){
+ return document.implementation.createDocument(sUri?sUri:"", sName?sName:"", null);
+ };
+ };
+ };//if(_SARISSA_HAS_DOM_CREATE_DOCUMENT)
+};
+//==========================================
+// Common stuff
+//==========================================
+if(!window.DOMParser){
+ /*
+ * DOMParser is a utility class, used to construct DOMDocuments from XML strings
+ * @constructor
+ */
+ DOMParser = function() {
+ };
+ if(_SARISSA_IS_SAFARI){
+ /**
+ * Construct a new DOM Document from the given XMLstring
+ * @param sXml the given XML string
+ * @param contentType the content type of the document the given string represents (one of text/xml, application/xml, application/xhtml+xml).
+ * @return a new DOM Document from the given XML string
+ */
+ DOMParser.prototype.parseFromString = function(sXml, contentType){
+ if(contentType.toLowerCase() != "application/xml"){
+ throw "Cannot handle content type: \"" + contentType + "\"";
+ };
+ var xmlhttp = new XMLHttpRequest();
+ xmlhttp.open("GET", "data:text/xml;charset=utf-8," + encodeURIComponent(str), false);
+ xmlhttp.send(null);
+ return xmlhttp.responseXML;
+ };
+ }else if(Sarissa.getDomDocument && Sarissa.getDomDocument() && "loadXML" in Sarissa.getDomDocument()){
+ DOMParser.prototype.parseFromString = function(sXml, contentType){
+ var doc = Sarissa.getDomDocument();
+ doc.loadXML(sXml);
+ return doc;
+ };
+ };
+};
+
+if(window.XMLHttpRequest){
+ Sarissa.IS_ENABLED_XMLHTTP = true;
+}
+else if(_SARISSA_IS_IE){
+ /**
+ * Emulate XMLHttpRequest
+ * @constructor
+ */
+ XMLHttpRequest = function() {
+ return new ActiveXObject(_SARISSA_XMLHTTP_PROGID);
+ };
+ Sarissa.IS_ENABLED_XMLHTTP = true;
+};
+
+if(!window.document.importNode && _SARISSA_IS_IE){
+ try{
+ /**
+ * Implements importNode for the current window document in IE using innerHTML.
+ * Testing showed that DOM was multiple times slower than innerHTML for this,
+ * sorry folks. If you encounter trouble (who knows what IE does behind innerHTML)
+ * please gimme a call.
+ * @param oNode the Node to import
+ * @param bChildren whether to include the children of oNode
+ * @returns the imported node for further use
+ */
+ window.document.importNode = function(oNode, bChildren){
+ var importNode = document.createElement("div");
+ if(bChildren)
+ importNode.innerHTML = Sarissa.serialize(oNode);
+ else
+ importNode.innerHTML = Sarissa.serialize(oNode.cloneNode(false));
+ return importNode.firstChild;
+ };
+ }catch(e){};
+};
+if(!Sarissa.getParseErrorText){
+ /**
+ *
Returns a human readable description of the parsing error. Usefull
+ * for debugging. Tip: append the returned error string in a <pre>
+ * element if you want to render it.
+ *
Many thanks to Christian Stocker for the initial patch.
+ * @argument oDoc The target DOM document
+ * @returns The parsing error description of the target Document in
+ * human readable form (preformated text)
+ */
+ Sarissa.getParseErrorText = function (oDoc){
+ var parseErrorText = Sarissa.PARSED_OK;
+ if(oDoc && oDoc.parseError && oDoc.parseError != 0){
+ /*moz*/
+ if(oDoc.documentElement.tagName == "parsererror"){
+ parseErrorText = oDoc.documentElement.firstChild.data;
+ parseErrorText += "\n" + oDoc.documentElement.firstChild.nextSibling.firstChild.data;
+ }/*konq*/
+ else{
+ parseErrorText = Sarissa.getText(oDoc.documentElement);/*.getElementsByTagName("h1")[0], false) + "\n";
+ parseErrorText += Sarissa.getText(oDoc.documentElement.getElementsByTagName("body")[0], false) + "\n";
+ parseErrorText += Sarissa.getText(oDoc.documentElement.getElementsByTagName("pre")[0], false);*/
+ };
+ };
+ return parseErrorText;
+ };
+};
+Sarissa.getText = function(oNode, deep){
+ var s = "";
+ var nodes = oNode.childNodes;
+ for(var i=0; i < nodes.length; i++){
+ var node = nodes[i];
+ var nodeType = node.nodeType;
+ if(nodeType == Node.TEXT_NODE || nodeType == Node.CDATA_SECTION_NODE){
+ s += node.data;
+ }else if(deep == true
+ && (nodeType == Node.ELEMENT_NODE
+ || nodeType == Node.DOCUMENT_NODE
+ || nodeType == Node.DOCUMENT_FRAGMENT_NODE)){
+ s += Sarissa.getText(node, true);
+ };
+ };
+ return s;
+};
+if(window.XMLSerializer){
+ /**
+ *
Factory method to obtain the serialization of a DOM Node
+ * @returns the serialized Node as an XML string
+ */
+ Sarissa.serialize = function(oDoc){
+ var s = null;
+ if(oDoc){
+ s = oDoc.innerHTML?oDoc.innerHTML:(new XMLSerializer()).serializeToString(oDoc);
+ };
+ return s;
+ };
+}else{
+ if(Sarissa.getDomDocument && (Sarissa.getDomDocument("","foo", null)).xml){
+ // see non-IE version
+ Sarissa.serialize = function(oDoc) {
+ var s = null;
+ if(oDoc){
+ s = oDoc.innerHTML?oDoc.innerHTML:oDoc.xml;
+ };
+ return s;
+ };
+ /**
+ * Utility class to serialize DOM Node objects to XML strings
+ * @constructor
+ */
+ XMLSerializer = function(){};
+ /**
+ * Serialize the given DOM Node to an XML string
+ * @param oNode the DOM Node to serialize
+ */
+ XMLSerializer.prototype.serializeToString = function(oNode) {
+ return oNode.xml;
+ };
+ };
+};
+
+/**
+ * strips tags from a markup string
+ */
+Sarissa.stripTags = function (s) {
+ return s.replace(/<[^>]+>/g,"");
+};
+/**
+ *
Deletes all child nodes of the given node
+ * @argument oNode the Node to empty
+ */
+Sarissa.clearChildNodes = function(oNode) {
+ // need to check for firstChild due to opera 8 bug with hasChildNodes
+ while(oNode.firstChild){
+ oNode.removeChild(oNode.firstChild);
+ };
+};
+/**
+ *
Copies the childNodes of nodeFrom to nodeTo
+ *
Note: The second object's original content is deleted before
+ * the copy operation, unless you supply a true third parameter
+ * @argument nodeFrom the Node to copy the childNodes from
+ * @argument nodeTo the Node to copy the childNodes to
+ * @argument bPreserveExisting whether to preserve the original content of nodeTo, default is false
+ */
+Sarissa.copyChildNodes = function(nodeFrom, nodeTo, bPreserveExisting) {
+ if((!nodeFrom) || (!nodeTo)){
+ throw "Both source and destination nodes must be provided";
+ };
+ if(!bPreserveExisting){
+ Sarissa.clearChildNodes(nodeTo);
+ };
+ var ownerDoc = nodeTo.nodeType == Node.DOCUMENT_NODE ? nodeTo : nodeTo.ownerDocument;
+ var nodes = nodeFrom.childNodes;
+ if(ownerDoc.importNode && (!_SARISSA_IS_IE)) {
+ for(var i=0;i < nodes.length;i++) {
+ nodeTo.appendChild(ownerDoc.importNode(nodes[i], true));
+ };
+ }
+ else{
+ for(var i=0;i < nodes.length;i++) {
+ nodeTo.appendChild(nodes[i].cloneNode(true));
+ };
+ };
+};
+
+/**
+ *
Moves the childNodes of nodeFrom to nodeTo
+ *
Note: The second object's original content is deleted before
+ * the move operation, unless you supply a true third parameter
+ * @argument nodeFrom the Node to copy the childNodes from
+ * @argument nodeTo the Node to copy the childNodes to
+ * @argument bPreserveExisting whether to preserve the original content of nodeTo, default is
+ */
+Sarissa.moveChildNodes = function(nodeFrom, nodeTo, bPreserveExisting) {
+ if((!nodeFrom) || (!nodeTo)){
+ throw "Both source and destination nodes must be provided";
+ };
+ if(!bPreserveExisting){
+ Sarissa.clearChildNodes(nodeTo);
+ };
+ var nodes = nodeFrom.childNodes;
+ // if within the same doc, just move, else copy and delete
+ if(nodeFrom.ownerDocument == nodeTo.ownerDocument){
+ while(nodeFrom.firstChild){
+ nodeTo.appendChild(nodeFrom.firstChild);
+ };
+ }else{
+ var ownerDoc = nodeTo.nodeType == Node.DOCUMENT_NODE ? nodeTo : nodeTo.ownerDocument;
+ if(ownerDoc.importNode && (!_SARISSA_IS_IE)) {
+ for(var i=0;i < nodes.length;i++) {
+ nodeTo.appendChild(ownerDoc.importNode(nodes[i], true));
+ };
+ }else{
+ for(var i=0;i < nodes.length;i++) {
+ nodeTo.appendChild(nodes[i].cloneNode(true));
+ };
+ };
+ Sarissa.clearChildNodes(nodeFrom);
+ };
+};
+
+/**
+ *
Serialize any object to an XML string. All properties are serialized using the property name
+ * as the XML element name. Array elements are rendered as array-item elements,
+ * using their index/key as the value of the key attribute.
+ * @argument anyObject the object to serialize
+ * @argument objectName a name for that object
+ * @return the XML serializationj of the given object as a string
+ */
+Sarissa.xmlize = function(anyObject, objectName, indentSpace){
+ indentSpace = indentSpace?indentSpace:'';
+ var s = indentSpace + '<' + objectName + '>';
+ var isLeaf = false;
+ if(!(anyObject instanceof Object) || anyObject instanceof Number || anyObject instanceof String
+ || anyObject instanceof Boolean || anyObject instanceof Date){
+ s += Sarissa.escape(""+anyObject);
+ isLeaf = true;
+ }else{
+ s += "\n";
+ var itemKey = '';
+ var isArrayItem = anyObject instanceof Array;
+ for(var name in anyObject){
+ s += Sarissa.xmlize(anyObject[name], (isArrayItem?"array-item key=\""+name+"\"":name), indentSpace + " ");
+ };
+ s += indentSpace;
+ };
+ return s += (objectName.indexOf(' ')!=-1?"\n":"" + objectName + ">\n");
+};
+
+/**
+ * Escape the given string chacters that correspond to the five predefined XML entities
+ * @param sXml the string to escape
+ */
+Sarissa.escape = function(sXml){
+ return sXml.replace(/&/g, "&")
+ .replace(//g, ">")
+ .replace(/"/g, """)
+ .replace(/'/g, "'");
+};
+
+/**
+ * Unescape the given string. This turns the occurences of the predefined XML
+ * entities to become the characters they represent correspond to the five predefined XML entities
+ * @param sXml the string to unescape
+ */
+Sarissa.unescape = function(sXml){
+ return sXml.replace(/'/g,"'")
+ .replace(/"/g,"\"")
+ .replace(/>/g,">")
+ .replace(/</g,"<")
+ .replace(/&/g,"&");
+};
//
\ No newline at end of file
diff --git a/theme/metal/fonts.css b/theme/metal/fonts.css
index 36b0afc6d5..9dfd6aa04b 100755
--- a/theme/metal/fonts.css
+++ b/theme/metal/fonts.css
@@ -1,4 +1,4 @@
-/* make some small fonts a little bigger */
-.logininfo, .helplink, .minicalendar *, .link, .footer {
- font-size: 9pt !important;
-}
+/* make some small fonts a little bigger */
+.logininfo, .helplink, .minicalendar *, .link, .footer {
+ font-size: 9pt !important;
+}