From 03f5a0f87cb64e701afda419b787e6a0cf2a8d6e Mon Sep 17 00:00:00 2001 From: skodak Date: Wed, 20 Sep 2006 19:46:52 +0000 Subject: [PATCH] major whitespace cleanup - fixed \r\n line-ending --- auth/fc/Readme.txt | 142 +- auth/fc/fcFPP.php | 434 +- auth/fc/lib.php | 308 +- lang/README.txt | 46 +- lang/en_utf8/help/assignment/quickgrade.html | 20 +- lang/en_utf8/help/lesson/importppt.html | 36 +- lang/en_utf8/help/lesson/questionoption.html | 56 +- lang/en_utf8/help/lesson/questiontypes.html | 450 +- lang/en_utf8/help/uploadgroups.html | 68 +- lang/en_utf8/lams.php | 56 +- login/change_password_form.html | 130 +- mod/assignment/type/upload/mod.html | 164 +- mod/chat/db/oci8po.sql | 266 +- mod/chat/gui_header_js/chatmsg.php | 4 +- mod/chat/gui_sockets/chatinput.php | 144 +- mod/choice/db/oci8po.sql | 186 +- .../preset/Image Gallery/addtemplate.html | 14 +- mod/data/preset/Image Gallery/csstemplate.css | 80 +- mod/data/preset/Image Gallery/jstemplate.js | 80 +- .../preset/Image Gallery/listtemplate.html | 16 +- .../Image Gallery/listtemplateheader.html | 2 +- .../preset/Image Gallery/singletemplate.html | 14 +- mod/forum/db/oci8po.sql | 2 +- mod/hotpot/hotpot-full.js | 5756 ++++++++--------- mod/hotpot/report/click/report.php | 1080 ++-- mod/hotpot/template/v6.php | 2890 ++++----- mod/journal/db/mysql.sql | 118 +- mod/journal/db/oci8po.sql | 178 +- mod/resource/db/mysql.sql | 80 +- mod/resource/db/oci8po.sql | 90 +- mod/scorm/aicc.php | 706 +- mod/scorm/api.php | 148 +- mod/scorm/coefficientconfirm.php | 214 +- mod/scorm/coefficientsetting.php | 228 +- mod/scorm/datamodel.php | 112 +- mod/scorm/index.php | 190 +- mod/scorm/loadSCO.php | 226 +- mod/scorm/mod.html | 900 +-- mod/scorm/sequencinglib.php | 1028 +-- mod/scorm/styles.php | 166 +- mod/scorm/suspend.php | 58 +- mod/survey/db/mysql.sql | 386 +- mod/survey/db/oci8po.sql | 454 +- question/format/blackboard_6/format.php | 1818 +++--- .../format/learnwise/learnwise-example.xml | 290 +- question/format/webct/TODO.txt | 14 +- sso/hive/expired.php | 94 +- sso/hive/lib.php | 158 +- sso/hive/login.php | 46 +- theme/chameleon/pix/mod/README.txt | 84 +- theme/chameleon/ui/css_query.js | 712 +- theme/chameleon/ui/sarissa.js | 1294 ++-- theme/metal/fonts.css | 8 +- 53 files changed, 11122 insertions(+), 11122 deletions(-) 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.

+ diff --git a/lang/en_utf8/help/lesson/importppt.html b/lang/en_utf8/help/lesson/importppt.html index f3595ddcd2..a2bfd247ad 100644 --- a/lang/en_utf8/help/lesson/importppt.html +++ b/lang/en_utf8/help/lesson/importppt.html @@ -1,18 +1,18 @@ -

Import PowerPoint HTML

-

HOW TO USE

-

All of the PowerPoint slides get imported as Branch Tables with Previous and Next answers.

-

-

    -
  1. Open up your PowerPoint presentation.
  2. -
  3. Save it As a Web Page (no special options)
  4. -
  5. 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.
  6. -
  7. Go to your moodle site and add a new lesson.
  8. -
  9. After saving the lesson settings you should see 4 options under "What would you like to do first?" Click on "Import PowerPoint"
  10. -
  11. Use to the "Browse..." button to find your zip file from step 3. Then click on "Upload this file"
  12. -
  13. If everything worked, the next screen should just display a continue button.
  14. -
-

-

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.

+

+

    +
  1. Open up your PowerPoint presentation.
  2. +
  3. Save it As a Web Page (no special options)
  4. +
  5. 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.
  6. +
  7. Go to your moodle site and add a new lesson.
  8. +
  9. After saving the lesson settings you should see 4 options under "What would you like to do first?" Click on "Import PowerPoint"
  10. +
  11. Use to the "Browse..." button to find your zip file from step 3. Then click on "Upload this file"
  12. +
  13. If everything worked, the next screen should just display a continue button.
  14. +
+

+

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.

+

 

+ diff --git a/lang/en_utf8/help/lesson/questionoption.html b/lang/en_utf8/help/lesson/questionoption.html index 0b5714d025..ae15a80dff 100644 --- a/lang/en_utf8/help/lesson/questionoption.html +++ b/lang/en_utf8/help/lesson/questionoption.html @@ -1,28 +1,28 @@ -

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.

- -
    -
  1. 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.)

  2. - -
  3. -

    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.

    -
  4. -
-

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.

+ +
    +
  1. 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.)

  2. + +
  3. +

    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.

    +
  4. +
+

The other Question Types do not use the Question Option.

diff --git a/lang/en_utf8/help/lesson/questiontypes.html b/lang/en_utf8/help/lesson/questiontypes.html index 35772e4ddd..3e32316648 100644 --- a/lang/en_utf8/help/lesson/questiontypes.html +++ b/lang/en_utf8/help/lesson/questiontypes.html @@ -1,225 +1,225 @@ -

Question Types

- -

The types of Questions currently supported by the Lesson module are: - -

    -
  1. 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).

  2. - -
  3. 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 (++).

      -

      Example 6.

      -
        -
      • Answer 3: ++(yellow|black|orange|green|black|pink)/i
      • -
      • student answer: "it's blue, orange and white"
      • -
      • Response 3: One or more colors are wrong!
      • -
      • Jump 3: this page
      -

      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 .^$*()[]+?|

      -
    • -
    -
  4. - -
  5. 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.

  6. - -
  7. 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.

  8. - -
  9. 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!).

  10. - - +

    Question Types

    + +

    The types of Questions currently supported by the Lesson module are: + +

      +
    1. 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).

    2. + +
    3. 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 (++).

        +

        Example 6.

        +
          +
        • Answer 3: ++(yellow|black|orange|green|black|pink)/i
        • +
        • student answer: "it's blue, orange and white"
        • +
        • Response 3: One or more colors are wrong!
        • +
        • Jump 3: this page
        +

        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 .^$*()[]+?|

        +
      • +
      +
    4. + +
    5. 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.

    6. + +
    7. 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.

    8. + +
    9. 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!).

    10. + + diff --git a/lang/en_utf8/help/uploadgroups.html b/lang/en_utf8/help/uploadgroups.html index 035edc50da..d5db116059 100644 --- a/lang/en_utf8/help/uploadgroups.html +++ b/lang/en_utf8/help/uploadgroups.html @@ -1,34 +1,34 @@ -

      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 &#44 - 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 &#44 - 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 @@ - - -

      -username)) { - $frm->username = ""; - } - if (empty($frm->password)) { - $frm->password = ""; - } - if (empty($frm->newpassword1)) { - $frm->newpassword1 = ""; - } - if (empty($frm->newpassword2)) { - $frm->newpassword2 = ""; - } -?> -
      - - - - - - - - - - - - - - - - - - - - - - - - - - -
      : - username)) { ?> - " /> - - username)?> - - username)) { formerr($err->username); } ?> -
      :" /> - password)) { formerr($err->password); } ?> -
      :" /> - newpassword1)) { formerr($err->newpassword1); } ?> -
      (): ()" /> - newpassword2)) { formerr($err->newpassword2); } ?> -
      - " />
      -
      + + +

      +username)) { + $frm->username = ""; + } + if (empty($frm->password)) { + $frm->password = ""; + } + if (empty($frm->newpassword1)) { + $frm->newpassword1 = ""; + } + if (empty($frm->newpassword2)) { + $frm->newpassword2 = ""; + } +?> +
      + + + + + + + + + + + + + + + + + + + + + + + + + + +
      : + username)) { ?> + " /> + + username)?> + + username)) { formerr($err->username); } ?> +
      :" /> + password)) { formerr($err->password); } ?> +
      :" /> + newpassword1)) { formerr($err->newpassword1); } ?> +
      (): ()" /> + newpassword2)) { formerr($err->newpassword2); } ?> +
      + " />
      +
      diff --git a/mod/assignment/type/upload/mod.html b/mod/assignment/type/upload/mod.html index e8e1258e5c..ab27e9dd2f 100644 --- a/mod/assignment/type/upload/mod.html +++ b/mod/assignment/type/upload/mod.html @@ -1,82 +1,82 @@ -resubmit)) { - $form->resubmit = 0; //upload&rev: =1 - } - if (empty($form->maxbytes)) { - $form->maxbytes = $CFG->assignment_maxbytes; - } - if (empty($form->emailteachers)) { - $form->emailteachers = ''; - } - //allow multiple files (from new upload type) - if (empty($form->var1)) { - $form->var1 = 0; - } - //email to students (from upload&review) - if (empty($form->var2)) { - $form->var2 = ''; - } - -?> - - - - - - - - - - - - - - - - - - - - - - - - - - -
      : - maxbytes, $this->course->maxbytes); - choose_from_menu ($choices, "maxbytes", $form->maxbytes, ""); - ?> -
      : - var1, ""); - ?> -
      : - resubmit, ""); //that's how it's un U&R - // choose_from_menu($options, "var2", $form->var2, ""); - helpbutton("resubmit", get_string("allowresubmit", "assignment"), "assignment"); - ?> -
      : - emailteachers, ""); - helpbutton("emailteachers", get_string("emailteachers", "assignment"), "assignment"); - ?> -
      : - var2, ""); - // choose_from_menu($options, "emailstudents", $form->emailstudents, ""); - helpbutton("emailstudents", get_string("emailstudents", "assignment"), "assignment"); - ?> -
      - -
      -
      -" /> -
      +resubmit)) { + $form->resubmit = 0; //upload&rev: =1 + } + if (empty($form->maxbytes)) { + $form->maxbytes = $CFG->assignment_maxbytes; + } + if (empty($form->emailteachers)) { + $form->emailteachers = ''; + } + //allow multiple files (from new upload type) + if (empty($form->var1)) { + $form->var1 = 0; + } + //email to students (from upload&review) + if (empty($form->var2)) { + $form->var2 = ''; + } + +?> + + + + + + + + + + + + + + + + + + + + + + + + + + +
      : + maxbytes, $this->course->maxbytes); + choose_from_menu ($choices, "maxbytes", $form->maxbytes, ""); + ?> +
      : + var1, ""); + ?> +
      : + resubmit, ""); //that's how it's un U&R + // choose_from_menu($options, "var2", $form->var2, ""); + helpbutton("resubmit", get_string("allowresubmit", "assignment"), "assignment"); + ?> +
      : + emailteachers, ""); + helpbutton("emailteachers", get_string("emailteachers", "assignment"), "assignment"); + ?> +
      : + var2, ""); + // choose_from_menu($options, "emailstudents", $form->emailstudents, ""); + helpbutton("emailstudents", get_string("emailstudents", "assignment"), "assignment"); + ?> +
      + +
      +
      +" /> +
      diff --git a/mod/chat/db/oci8po.sql b/mod/chat/db/oci8po.sql index 2e4d3bf498..4710792cc5 100755 --- a/mod/chat/db/oci8po.sql +++ b/mod/chat/db/oci8po.sql @@ -1,133 +1,133 @@ -rem -rem Table structure for table chat -rem - -drop TABLE prefix_chat; -CREATE TABLE prefix_chat ( - id number(10) primary key, - course number(10) default '0' not null, - name varchar2(255) default '' not null, - intro varchar2(1024) NOT NULL, - keepdays number(11) default '0' not null, - studentlogs number(4) default '0' not null, - chattime number(10) default '0' not null, - schedule number(4) default '0' not null, - timemodified number(10) default '0' not null -); - - -COMMENT on table prefix_chat is 'Each of these is a chat room'; - -drop sequence p_chat_seq; -create sequence p_chat_seq; - -create or replace trigger p_chat_trig - before insert on prefix_chat - referencing new as new_row - for each row - begin - select p_chat_seq.nextval into :new_row.id from dual; - end; -. -/ - -insert into prefix_chat(course,name,intro,keepdays,studentlogs,chattime,schedule,timemodified) values(1,'name 1','intro 1',1,1,1,1,1); -insert into prefix_chat(course,name,intro,keepdays,studentlogs,chattime,schedule,timemodified) values(2,'name 2','intro 2',2,2,2,2,2); -insert into prefix_chat(course,name,intro,keepdays,studentlogs,chattime,schedule,timemodified) values(3,'name 3','intro 3',3,3,3,3,3); -insert into prefix_chat(course,name,intro,keepdays,studentlogs,chattime,schedule,timemodified) values(4,'name 4','intro 4',4,4,4,4,4); - -select * from prefix_chat; - -rem -------------------------------------------------------- -rem -rem Table structure for table chat_messages -rem - -drop TABLE prefix_chat_messages; -CREATE TABLE prefix_chat_messages ( - id number(10) primary key, - chatid number(10) default '0' not null, - userid number(10) default '0' not null, - system number(1) default '0' not null, - message varchar2(1024) NOT NULL, - timestamp number(10) default '0' not null -); - -COMMENT on table prefix_chat_messages is 'Stores all the actual chat messages'; - -create index timemodifiedchat on prefix_chat_messages(timestamp,chatid); - -drop sequence p_chat_messages_seq; -create sequence p_chat_messages_seq; - -create or replace trigger p_chat_messages_trig - before insert on prefix_chat_messages - referencing new as new_row - for each row - begin - select p_chat_messages_seq.nextval into :new_row.id from dual; - end; -. -/ - -insert into prefix_chat_messages (chatid,userid,system,message,timestamp) values(1,1,1,'message1',1); -insert into prefix_chat_messages (chatid,userid,system,message,timestamp) values(2,2,2,'message2',2); -insert into prefix_chat_messages (chatid,userid,system,message,timestamp) values(3,3,3,'message3',3); -insert into prefix_chat_messages (chatid,userid,system,message,timestamp) values(4,4,4,'message4',4); - -select * from prefix_chat_messages; - -rem -------------------------------------------------------- - -rem -rem Table structure for table chat_users -rem - -drop TABLE prefix_chat_users; -CREATE TABLE prefix_chat_users ( - id number(10) primary key, - chatid number(11) default '0' not null, - userid number(11) default '0' not null, - version varchar2(16) default '' not null, - ip varchar2(15) default '' not null, - firstping number(10) default '0' not null, - lastping number(10) default '0' not null, - lastmessageping number(10) default '0' not null, - sid varchar2(32) default '' not null, - course number(10) default '0' not null, - lang varchar2(10) default '' not null -); - -create index userid on prefix_chat_users(userid); -create index lastping on prefix_chat_users(lastping); - -drop sequence p_chat_users_seq; -create sequence p_chat_users_seq; - -create or replace trigger p_chat_users_trig - before insert on prefix_chat_users - referencing new as new_row - for each row - begin - select p_chat_users_seq.nextval into :new_row.id from dual; - end; -. -/ - -COMMENT on table prefix_chat_users is 'Keeps track of which users are in which chat rooms'; - -insert into prefix_chat_users (chatid,userid,version,ip,firstping,lastping,lastmessageping,sid) values(1,1,'version1','ip1',1,1,1,'sid1'); -insert into prefix_chat_users (chatid,userid,version,ip,firstping,lastping,lastmessageping,sid) values(2,2,'version2','ip2',2,2,2,'sid2'); -insert into prefix_chat_users (chatid,userid,version,ip,firstping,lastping,lastmessageping,sid) values(3,3,'version3','ip3',3,3,3,'sid3'); -insert into prefix_chat_users (chatid,userid,version,ip,firstping,lastping,lastmessageping,sid) values(4,4,'version4','ip4',4,4,4,'sid4'); - -select * from prefix_chat_users; - -delete from prefix_log_display where module='chat'; - -INSERT INTO prefix_log_display (module, action, mtable, field) VALUES ('chat', 'view', 'chat', 'name'); -INSERT INTO prefix_log_display (module, action, mtable, field) VALUES ('chat', 'add', 'chat', 'name'); -INSERT INTO prefix_log_display (module, action, mtable, field) VALUES ('chat', 'update', 'chat', 'name'); -INSERT INTO prefix_log_display (module, action, mtable, field) VALUES ('chat', 'report', 'chat', 'name'); - -select * from prefix_log_display where module='chat' order by 1,2,3,4; +rem +rem Table structure for table chat +rem + +drop TABLE prefix_chat; +CREATE TABLE prefix_chat ( + id number(10) primary key, + course number(10) default '0' not null, + name varchar2(255) default '' not null, + intro varchar2(1024) NOT NULL, + keepdays number(11) default '0' not null, + studentlogs number(4) default '0' not null, + chattime number(10) default '0' not null, + schedule number(4) default '0' not null, + timemodified number(10) default '0' not null +); + + +COMMENT on table prefix_chat is 'Each of these is a chat room'; + +drop sequence p_chat_seq; +create sequence p_chat_seq; + +create or replace trigger p_chat_trig + before insert on prefix_chat + referencing new as new_row + for each row + begin + select p_chat_seq.nextval into :new_row.id from dual; + end; +. +/ + +insert into prefix_chat(course,name,intro,keepdays,studentlogs,chattime,schedule,timemodified) values(1,'name 1','intro 1',1,1,1,1,1); +insert into prefix_chat(course,name,intro,keepdays,studentlogs,chattime,schedule,timemodified) values(2,'name 2','intro 2',2,2,2,2,2); +insert into prefix_chat(course,name,intro,keepdays,studentlogs,chattime,schedule,timemodified) values(3,'name 3','intro 3',3,3,3,3,3); +insert into prefix_chat(course,name,intro,keepdays,studentlogs,chattime,schedule,timemodified) values(4,'name 4','intro 4',4,4,4,4,4); + +select * from prefix_chat; + +rem -------------------------------------------------------- +rem +rem Table structure for table chat_messages +rem + +drop TABLE prefix_chat_messages; +CREATE TABLE prefix_chat_messages ( + id number(10) primary key, + chatid number(10) default '0' not null, + userid number(10) default '0' not null, + system number(1) default '0' not null, + message varchar2(1024) NOT NULL, + timestamp number(10) default '0' not null +); + +COMMENT on table prefix_chat_messages is 'Stores all the actual chat messages'; + +create index timemodifiedchat on prefix_chat_messages(timestamp,chatid); + +drop sequence p_chat_messages_seq; +create sequence p_chat_messages_seq; + +create or replace trigger p_chat_messages_trig + before insert on prefix_chat_messages + referencing new as new_row + for each row + begin + select p_chat_messages_seq.nextval into :new_row.id from dual; + end; +. +/ + +insert into prefix_chat_messages (chatid,userid,system,message,timestamp) values(1,1,1,'message1',1); +insert into prefix_chat_messages (chatid,userid,system,message,timestamp) values(2,2,2,'message2',2); +insert into prefix_chat_messages (chatid,userid,system,message,timestamp) values(3,3,3,'message3',3); +insert into prefix_chat_messages (chatid,userid,system,message,timestamp) values(4,4,4,'message4',4); + +select * from prefix_chat_messages; + +rem -------------------------------------------------------- + +rem +rem Table structure for table chat_users +rem + +drop TABLE prefix_chat_users; +CREATE TABLE prefix_chat_users ( + id number(10) primary key, + chatid number(11) default '0' not null, + userid number(11) default '0' not null, + version varchar2(16) default '' not null, + ip varchar2(15) default '' not null, + firstping number(10) default '0' not null, + lastping number(10) default '0' not null, + lastmessageping number(10) default '0' not null, + sid varchar2(32) default '' not null, + course number(10) default '0' not null, + lang varchar2(10) default '' not null +); + +create index userid on prefix_chat_users(userid); +create index lastping on prefix_chat_users(lastping); + +drop sequence p_chat_users_seq; +create sequence p_chat_users_seq; + +create or replace trigger p_chat_users_trig + before insert on prefix_chat_users + referencing new as new_row + for each row + begin + select p_chat_users_seq.nextval into :new_row.id from dual; + end; +. +/ + +COMMENT on table prefix_chat_users is 'Keeps track of which users are in which chat rooms'; + +insert into prefix_chat_users (chatid,userid,version,ip,firstping,lastping,lastmessageping,sid) values(1,1,'version1','ip1',1,1,1,'sid1'); +insert into prefix_chat_users (chatid,userid,version,ip,firstping,lastping,lastmessageping,sid) values(2,2,'version2','ip2',2,2,2,'sid2'); +insert into prefix_chat_users (chatid,userid,version,ip,firstping,lastping,lastmessageping,sid) values(3,3,'version3','ip3',3,3,3,'sid3'); +insert into prefix_chat_users (chatid,userid,version,ip,firstping,lastping,lastmessageping,sid) values(4,4,'version4','ip4',4,4,4,'sid4'); + +select * from prefix_chat_users; + +delete from prefix_log_display where module='chat'; + +INSERT INTO prefix_log_display (module, action, mtable, field) VALUES ('chat', 'view', 'chat', 'name'); +INSERT INTO prefix_log_display (module, action, mtable, field) VALUES ('chat', 'add', 'chat', 'name'); +INSERT INTO prefix_log_display (module, action, mtable, field) VALUES ('chat', 'update', 'chat', 'name'); +INSERT INTO prefix_log_display (module, action, mtable, field) VALUES ('chat', 'report', 'chat', 'name'); + +select * from prefix_log_display where module='chat' order by 1,2,3,4; diff --git a/mod/chat/gui_header_js/chatmsg.php b/mod/chat/gui_header_js/chatmsg.php index b2f9f5d206..678b075cfe 100644 --- a/mod/chat/gui_header_js/chatmsg.php +++ b/mod/chat/gui_header_js/chatmsg.php @@ -1,2 +1,2 @@ - - + + diff --git a/mod/chat/gui_sockets/chatinput.php b/mod/chat/gui_sockets/chatinput.php index 6cef94d8ea..d89c9e5c3e 100644 --- a/mod/chat/gui_sockets/chatinput.php +++ b/mod/chat/gui_sockets/chatinput.php @@ -1,72 +1,72 @@ -lang); - - ob_start(); - ?> - - - -
      - >> - -
      - -
      chat_serverhost:$CFG->chat_serverport/"; ?>" method="get" target="empty" id="sendform"> - - - - -
      - - - +lang); + + ob_start(); + ?> + + + +
      + >> + +
      + +
      chat_serverhost:$CFG->chat_serverport/"; ?>" method="get" target="empty" id="sendform"> + + + + +
      + + + diff --git a/mod/choice/db/oci8po.sql b/mod/choice/db/oci8po.sql index 658cb6b35d..ca6c9057f4 100755 --- a/mod/choice/db/oci8po.sql +++ b/mod/choice/db/oci8po.sql @@ -1,93 +1,93 @@ -rem -rem Table structure for table choice -rem - -drop TABLE prefix_choice; -CREATE TABLE prefix_choice ( - id number(10) primary key, - course number(10) default '0' not null, - name varchar2(255) default '' not null, - text varchar2(1024) NOT NULL, - format number(2) default '0' not null, - answer1 varchar2(255) default 'Yes' not null, - answer2 varchar2(255) default 'No' not null, - answer3 varchar2(255) default NULL, - answer4 varchar2(255) default NULL, - answer5 varchar2(255) default NULL, - answer6 varchar2(255) default NULL, - publish number(2) default '0' not null, - timemodified number(10) default '0' not null -); - -COMMENT on table prefix_choice is 'Available choices are stored here.'; - -drop sequence p_choice_seq; -create sequence p_choice_seq; - -create or replace trigger p_choice_trig - before insert on prefix_choice - referencing new as new_row - for each row - begin - select p_choice_seq.nextval into :new_row.id from dual; - end; -. -/ - -insert into prefix_choice(course,name,text,format,answer1,answer2,answer3,answer4,answer5,answer6,publish,timemodified) values(1,'name1','text1',1,'1','1','1','1','1','1',1,1); -insert into prefix_choice(course,name,text,format,answer1,answer2,answer3,answer4,answer5,answer6,publish,timemodified) values(2,'name2','text2',2,'2','2','2','2','2','2',2,2); -insert into prefix_choice(course,name,text,format,answer1,answer2,answer3,answer4,answer5,answer6,publish,timemodified) values(3,'name3','text3',3,'3','3','3','3','3','3',3,3); -insert into prefix_choice(course,name,text,format,answer1,answer2,answer3,answer4,answer5,answer6,publish,timemodified) values(4,'name4','text4',4,'4','4','4','4','4','4',4,4); - -select * from prefix_choice order by 1,2; - -rem -------------------------------------------------------- - -rem -rem Table structure for table choice_answers -rem - -drop TABLE prefix_choice_answers; -CREATE TABLE prefix_choice_answers ( - id number(10) primary key, - choice number(10) default '0' not null, - userid number(10) default '0' not null, - answer number(4) default '0' not null, - timemodified number(10) default '0' not null -); - -comment on table prefix_choice_answers is 'Answers for each choice'; - -drop sequence p_choice_answers_seq; -create sequence p_choice_answers_seq; - -create or replace trigger p_choice_answers_trig - before insert on prefix_choice_answers - referencing new as new_row - for each row - begin - select p_choice_answers_seq.nextval into :new_row.id from dual; - end; -. -/ - -insert into prefix_choice_answers (choice,userid,answer,timemodified) values(1,1,1,1); -insert into prefix_choice_answers (choice,userid,answer,timemodified) values(2,2,2,2); -insert into prefix_choice_answers (choice,userid,answer,timemodified) values(3,3,3,3); -insert into prefix_choice_answers (choice,userid,answer,timemodified) values(4,4,4,4); - -select * from prefix_choice_answers order by 1,2; - -rem -rem Dumping data for table log_display -rem - -delete from prefix_log_display where module = 'choice'; -INSERT INTO prefix_log_display (module, action, mtable, field) VALUES ('choice', 'view', 'choice', 'name'); -INSERT INTO prefix_log_display (module, action, mtable, field) VALUES ('choice', 'update', 'choice', 'name'); -INSERT INTO prefix_log_display (module, action, mtable, field) VALUES ('choice', 'add', 'choice', 'name'); -INSERT INTO prefix_log_display (module, action, mtable, field) VALUES ('choice', 'report', 'choice', 'name'); - - - - +rem +rem Table structure for table choice +rem + +drop TABLE prefix_choice; +CREATE TABLE prefix_choice ( + id number(10) primary key, + course number(10) default '0' not null, + name varchar2(255) default '' not null, + text varchar2(1024) NOT NULL, + format number(2) default '0' not null, + answer1 varchar2(255) default 'Yes' not null, + answer2 varchar2(255) default 'No' not null, + answer3 varchar2(255) default NULL, + answer4 varchar2(255) default NULL, + answer5 varchar2(255) default NULL, + answer6 varchar2(255) default NULL, + publish number(2) default '0' not null, + timemodified number(10) default '0' not null +); + +COMMENT on table prefix_choice is 'Available choices are stored here.'; + +drop sequence p_choice_seq; +create sequence p_choice_seq; + +create or replace trigger p_choice_trig + before insert on prefix_choice + referencing new as new_row + for each row + begin + select p_choice_seq.nextval into :new_row.id from dual; + end; +. +/ + +insert into prefix_choice(course,name,text,format,answer1,answer2,answer3,answer4,answer5,answer6,publish,timemodified) values(1,'name1','text1',1,'1','1','1','1','1','1',1,1); +insert into prefix_choice(course,name,text,format,answer1,answer2,answer3,answer4,answer5,answer6,publish,timemodified) values(2,'name2','text2',2,'2','2','2','2','2','2',2,2); +insert into prefix_choice(course,name,text,format,answer1,answer2,answer3,answer4,answer5,answer6,publish,timemodified) values(3,'name3','text3',3,'3','3','3','3','3','3',3,3); +insert into prefix_choice(course,name,text,format,answer1,answer2,answer3,answer4,answer5,answer6,publish,timemodified) values(4,'name4','text4',4,'4','4','4','4','4','4',4,4); + +select * from prefix_choice order by 1,2; + +rem -------------------------------------------------------- + +rem +rem Table structure for table choice_answers +rem + +drop TABLE prefix_choice_answers; +CREATE TABLE prefix_choice_answers ( + id number(10) primary key, + choice number(10) default '0' not null, + userid number(10) default '0' not null, + answer number(4) default '0' not null, + timemodified number(10) default '0' not null +); + +comment on table prefix_choice_answers is 'Answers for each choice'; + +drop sequence p_choice_answers_seq; +create sequence p_choice_answers_seq; + +create or replace trigger p_choice_answers_trig + before insert on prefix_choice_answers + referencing new as new_row + for each row + begin + select p_choice_answers_seq.nextval into :new_row.id from dual; + end; +. +/ + +insert into prefix_choice_answers (choice,userid,answer,timemodified) values(1,1,1,1); +insert into prefix_choice_answers (choice,userid,answer,timemodified) values(2,2,2,2); +insert into prefix_choice_answers (choice,userid,answer,timemodified) values(3,3,3,3); +insert into prefix_choice_answers (choice,userid,answer,timemodified) values(4,4,4,4); + +select * from prefix_choice_answers order by 1,2; + +rem +rem Dumping data for table log_display +rem + +delete from prefix_log_display where module = 'choice'; +INSERT INTO prefix_log_display (module, action, mtable, field) VALUES ('choice', 'view', 'choice', 'name'); +INSERT INTO prefix_log_display (module, action, mtable, field) VALUES ('choice', 'update', 'choice', 'name'); +INSERT INTO prefix_log_display (module, action, mtable, field) VALUES ('choice', 'add', 'choice', 'name'); +INSERT INTO prefix_log_display (module, action, mtable, field) VALUES ('choice', 'report', 'choice', 'name'); + + + + diff --git a/mod/data/preset/Image Gallery/addtemplate.html b/mod/data/preset/Image Gallery/addtemplate.html index e8d8d15e30..605ee0c9cd 100644 --- a/mod/data/preset/Image Gallery/addtemplate.html +++ b/mod/data/preset/Image Gallery/addtemplate.html @@ -1,8 +1,8 @@ -
      - - - -
      Title: [[title]]
      Caption: [[caption]]
      -
      -[[image]] +
      + + + +
      Title: [[title]]
      Caption: [[caption]]
      +
      +[[image]]
      \ No newline at end of file diff --git a/mod/data/preset/Image Gallery/csstemplate.css b/mod/data/preset/Image Gallery/csstemplate.css index 5274dda597..ad3482603c 100644 --- a/mod/data/preset/Image Gallery/csstemplate.css +++ b/mod/data/preset/Image Gallery/csstemplate.css @@ -1,41 +1,41 @@ -/****** List View CSS ******/ - -#pictures { - width: 750px; -} - -.picture { - padding: 5px; - border-style: solid; - border-width: thin; - border-color: #779; - background-color: white; - - display:table-cell;display:inline-table;display:inline-block; -} - -.pictureframe { - padding: 5px; - - display:table-cell;display:inline-table;display:inline-block; -} - -.picturediv { - display: inline; - width: 150px; - height: 200px; -} - -.inline { - display: inline; -} - -/***** Single View CSS *****/ - -.caption { - font-style: italic; -} - -#singleimage { - width: 700px; +/****** List View CSS ******/ + +#pictures { + width: 750px; +} + +.picture { + padding: 5px; + border-style: solid; + border-width: thin; + border-color: #779; + background-color: white; + + display:table-cell;display:inline-table;display:inline-block; +} + +.pictureframe { + padding: 5px; + + display:table-cell;display:inline-table;display:inline-block; +} + +.picturediv { + display: inline; + width: 150px; + height: 200px; +} + +.inline { + display: inline; +} + +/***** Single View CSS *****/ + +.caption { + font-style: italic; +} + +#singleimage { + width: 700px; } \ No newline at end of file diff --git a/mod/data/preset/Image Gallery/jstemplate.js b/mod/data/preset/Image Gallery/jstemplate.js index cc0db7797e..1d9adf5f5c 100644 --- a/mod/data/preset/Image Gallery/jstemplate.js +++ b/mod/data/preset/Image Gallery/jstemplate.js @@ -1,41 +1,41 @@ -var maxHeight = 550; -var maxListHeight = 120; - -function init() { - if (document.getElementById("singleimage")) single(); - /*else if (document.getElementById("pictures")) list();*/ -} - -function list() { - imageDivs = document.getElementsByName("listimage"); - for (i=0; i < imageDivs.length; i++) { - currentHeight = imageDivs[i].offsetHeight; - currentWidth = imageDivs[i].offsetWidth; - - if (currentHeight > maxListHeight) { - ratio = maxListHeight / currentHeight; - imageDivs[i].style.width = (currentWidth*ratio) + 'px'; - imageDivs[i].style.height = (currentHeight*ratio) + 'px'; - imageDivs[i].firstChild.style.height = '100%'; - imageDivs[i].firstChild.style.width = '100%'; - } - } -} - -function single() { - var imageDiv = document.getElementById("singleimage"); - - if (imageDiv) { - currentHeight = imageDiv.offsetHeight; - currentWidth = imageDiv.offsetWidth; - - if (currentHeight > maxHeight) { - ratio = maxHeight / currentHeight; - imageDiv.style.width = (currentWidth*ratio) + 'px'; - imageDiv.style.height = (currentHeight*ratio) + 'px'; - - } - } -} - +var maxHeight = 550; +var maxListHeight = 120; + +function init() { + if (document.getElementById("singleimage")) single(); + /*else if (document.getElementById("pictures")) list();*/ +} + +function list() { + imageDivs = document.getElementsByName("listimage"); + for (i=0; i < imageDivs.length; i++) { + currentHeight = imageDivs[i].offsetHeight; + currentWidth = imageDivs[i].offsetWidth; + + if (currentHeight > maxListHeight) { + ratio = maxListHeight / currentHeight; + imageDivs[i].style.width = (currentWidth*ratio) + 'px'; + imageDivs[i].style.height = (currentHeight*ratio) + 'px'; + imageDivs[i].firstChild.style.height = '100%'; + imageDivs[i].firstChild.style.width = '100%'; + } + } +} + +function single() { + var imageDiv = document.getElementById("singleimage"); + + if (imageDiv) { + currentHeight = imageDiv.offsetHeight; + currentWidth = imageDiv.offsetWidth; + + if (currentHeight > maxHeight) { + ratio = maxHeight / currentHeight; + imageDiv.style.width = (currentWidth*ratio) + 'px'; + imageDiv.style.height = (currentHeight*ratio) + 'px'; + + } + } +} + window.onload = init; \ No newline at end of file diff --git a/mod/data/preset/Image Gallery/listtemplate.html b/mod/data/preset/Image Gallery/listtemplate.html index 5b245ce68d..9ff4101817 100644 --- a/mod/data/preset/Image Gallery/listtemplate.html +++ b/mod/data/preset/Image Gallery/listtemplate.html @@ -1,8 +1,8 @@ -
      -
      - - - -
      [[image]]
      ##edit## ##delete## ##approve##
      -
      -
      +
      +
      + + + +
      [[image]]
      ##edit## ##delete## ##approve##
      +
      +
      diff --git a/mod/data/preset/Image Gallery/listtemplateheader.html b/mod/data/preset/Image Gallery/listtemplateheader.html index c6f6f2e3e4..4d9dbaee05 100644 --- a/mod/data/preset/Image Gallery/listtemplateheader.html +++ b/mod/data/preset/Image Gallery/listtemplateheader.html @@ -1,2 +1,2 @@ -
      +
      \ No newline at end of file diff --git a/mod/data/preset/Image Gallery/singletemplate.html b/mod/data/preset/Image Gallery/singletemplate.html index 07b687c0bf..474d66105f 100644 --- a/mod/data/preset/Image Gallery/singletemplate.html +++ b/mod/data/preset/Image Gallery/singletemplate.html @@ -1,8 +1,8 @@ -
      - - - - - -

      [[title]]

      [[image]]
      [[caption]]
      ##Edit## ##More## ##Delete## ##Approve##
      +
      + + + + + +

      [[title]]

      [[image]]
      [[caption]]
      ##Edit## ##More## ##Delete## ##Approve##
      \ No newline at end of file diff --git a/mod/forum/db/oci8po.sql b/mod/forum/db/oci8po.sql index 86d18a6ba1..d112bb7e31 100755 --- a/mod/forum/db/oci8po.sql +++ b/mod/forum/db/oci8po.sql @@ -214,4 +214,4 @@ INSERT INTO prefix_log_display (module, action, mtable, field) VALUES ('forum', INSERT INTO prefix_log_display (module, action, mtable, field) VALUES ('forum', 'subscribe', 'forum', 'name'); INSERT INTO prefix_log_display (module, action, mtable, field) VALUES ('forum', 'unsubscribe', 'forum', 'name'); -select * from prefix_log_display where module = 'forum'; +select * from prefix_log_display where module = 'forum'; diff --git a/mod/hotpot/hotpot-full.js b/mod/hotpot/hotpot-full.js index de87cbdc9f..3c01ae0469 100644 --- a/mod/hotpot/hotpot-full.js +++ b/mod/hotpot/hotpot-full.js @@ -1,2878 +1,2878 @@ - + diff --git a/mod/hotpot/report/click/report.php b/mod/hotpot/report/click/report.php index 9ca0dc58a3..f3428e6f05 100644 --- a/mod/hotpot/report/click/report.php +++ b/mod/hotpot/report/click/report.php @@ -1,540 +1,540 @@ -create_clickreport_table($hotpot, $cm, $course, $users, $attempts, $questions, $options, $tables); - // print the tables - $this->print_report($course, $hotpot, $tables, $options); - return true; - } - function create_clickreport_table(&$hotpot, &$cm, &$course, &$users, &$attempts, &$questions, &$options, &$tables) { - global $CFG; - $is_html = ($options['reportformat']=='htm'); - // time and date format strings // date format strings - $strftimetime = '%H:%M:%S'; - $strftimedate = get_string('strftimedate'); - // get the current time and max execution time - $start_report_time = microtime(); - $max_execution_time = ini_get('max_execution_time'); - $correct = get_string('reportcorrectsymbol', 'hotpot'); - $wrong = get_string('reportwrongsymbol', 'hotpot'); - $nottried = get_string('reportnottriedsymbol', 'hotpot'); - // shortcuts for font tags - $blank = $is_html ? ' ' : ""; - // store question count - $questioncount = count($questions); - // array to map columns onto question ids ($col => $id) - $questionids = array_keys($questions); - // store exercise type - $exercisetype = $this->get_exercisetype($questions, $questionids, $blank); - // initialize details ('events' must go last) - $details = array('checks', 'status', 'answers', 'changes', 'hints', 'clues', 'events'); - // initialize $table - unset($table); - $table->border = 1; - $table->width = '100%'; - // initialize legend, if necessary - if (!empty($options['reportshowlegend'])) { - $table->legend = array(); - } - // start $table headings - $this->set_head($options, $table, 'exercise'); - $this->set_head($options, $table, 'user'); - $this->set_head($options, $table, 'attempt'); - $this->set_head($options, $table, 'click'); - // store clicktype column number - $clicktype_col = count($table->head)-1; - // finish $table headings - $this->set_head($options, $table, 'details', $exercisetype, $details, $questioncount); - $this->set_head($options, $table, 'totals', $exercisetype); - // set align and wrap - $this->set_align_and_wrap($table); - // is link to review allowed? - $allow_review = ($is_html && (has_capability('mod/hotpot:viewreport',get_context_instance(CONTEXT_COURSE, $course->id)) || $hotpot->review)); - // initialize array of data values - $this->data = array(); - // set exercise data values - $this->set_data_exercise($cm, $course, $hotpot, $questions, $questionids, $questioncount, $blank); - // add details of users' responses - foreach ($users as $user) { - $this->set_data_user($options, $course, $user); - unset($clickreportid); - foreach ($user->attempts as $attempt) { - // initialize totals for - $click = array( - 'qnumber' => array(), - 'correct' => array(), - 'wrong' => array(), - 'answers' => array(), - 'hints' => array(), - 'clues' => array(), - 'changes' => array(), - 'checks' => array(), - 'events' => array(), - 'score' => array(), - 'weighting' => array() - ); - $clicktypes = array(); - // is the start of a new attempt? - // (clicks in the same attempt have the same clickreportid) - if (!isset($clickreportid) || $clickreportid != $attempt->clickreportid) { - $clickcount = 1; - $clickreportid = $attempt->clickreportid; - // initialize totals for all clicks in this attempt - $clicks = $click; // $click has just been initialized - $this->set_data_attempt($attempt, $strftimedate, $strftimetime, $blank); - } - $cells = array(); - $this->set_data($cells, 'exercise'); - $this->set_data($cells, 'user'); - $this->set_data($cells, 'attempt'); - // get responses to questions in this attempt - foreach ($attempt->responses as $response) { - // set $q(uestion number) - $q = array_search($response->question, $questionids); - $click['qnumber'][$q] = true; - // was this question answered correctly? - if ($answer = hotpot_strings($response->correct)) { - // mark the question as correctly answered - if (empty($clicks['correct'][$q])) { - $click['correct'][$q] = true; - $clicks['correct'][$q] = true; - } - // unset 'wrong' flags, if necessary - if (isset($click['wrong'][$q])) { - unset($click['wrong'][$q]); - } - if (isset($clicks['wrong'][$q])) { - unset($clicks['wrong'][$q]); - } - // otherwise, was the question answered wrongly? - } else if ($answer = hotpot_strings($response->wrong)) { - // mark the question as wrongly answered - $click['wrong'][$q] = true; - $clicks['wrong'][$q] = true; - } else { // not correct or wrong (curious?!) - unset($answer); - } - if (!empty($click['correct'][$q]) || !empty($click['wrong'][$q])) { - $click['score'][$q] = $response->score; - $clicks['score'][$q] = $response->score; - $weighting = isset($response->weighting) ? $response->weighting : 100; - $click['weighting'][$q] = $weighting; - $clicks['weighting'][$q] =$weighting; - } - foreach($details as $detail) { - switch ($detail) { - case 'answers': - if (isset($answer) && is_string($answer) && !empty($answer)) { - $click[$detail][$q] = $answer; - } - break; - case 'hints': - case 'clues': - case 'checks': - if (isset($response->$detail) && is_numeric($response->$detail) && $response->$detail>0) { - if (!isset($click[$detail][$q]) || $click[$detail][$q] < $response->$detail) { - $click[$detail][$q] = $response->$detail; - } - } - break; - } - } // end foreach $detail - } // end foreach $response - $click['types'] = array(); - $this->data['details'] = array(); - foreach($details as $detail) { - for ($q=0; $q<$questioncount; $q++) { - switch ($detail) { - case 'status': - if (isset($clicks['correct'][$q])) { - $this->data['details'][] = $correct; - } else if (isset($clicks['wrong'][$q])) { - $this->data['details'][] = $wrong; - } else if (isset($click['qnumber'][$q])) { - $this->data['details'][] = $nottried; - } else { // this question did not appear in this attempt - $this->data['details'][] = $blank; - } - break; - case 'answers': - case 'hints': - case 'clues': - case 'checks': - if (!isset($clicks[$detail][$q])) { - if (!isset($click[$detail][$q])) { - $this->data['details'][] = $blank; - } else { - $clicks[$detail][$q] = $click[$detail][$q]; - if ($detail=='answers') { - $this->set_legend($table, $q, $click[$detail][$q], $questions[$questionids[$q]]); - } - $this->data['details'][] = $click[$detail][$q]; - $this->update_event_count($click, $detail, $q); - } - } else { - if (!isset($click[$detail][$q])) { - $this->data['details'][] = $blank; - } else { - $difference = ''; - if ($detail=='answers') { - if ($click[$detail][$q] != $clicks[$detail][$q]) { - $pattern = '/^'.preg_quote($clicks[$detail][$q], '/').',/'; - $difference = preg_replace($pattern, '', $click[$detail][$q], 1); - } - } else { // hints, clues, checks - if ($click[$detail][$q] > $clicks[$detail][$q]) { - $difference = $click[$detail][$q] - $clicks[$detail][$q]; - } - } - if ($difference) { - $clicks[$detail][$q] = $click[$detail][$q]; - $click[$detail][$q] = $difference; - if ($detail=='answers') { - $this->set_legend($table, $q, $difference, $questions[$questionids[$q]]); - } - $this->data['details'][] = $difference; - $this->update_event_count($click, $detail, $q); - } else { - unset($click[$detail][$q]); - $this->data['details'][] = $blank; - } - } - } - break; - case 'changes': - case 'events': - if (empty($click[$detail][$q])) { - $this->data['details'][] = $blank; - } else { - $this->data['details'][] = $click[$detail][$q]; - } - break; - default: - // do nothing - break; - } // end switch - } // for $q - } // foreach $detail - // set data cell values for - $this->set_data_click( - $allow_review ? ''.$clickcount.'' : $clickcount, - trim(userdate($attempt->timefinish, $strftimetime)), - $exercisetype, - $click - ); - $this->set_data($cells, 'click'); - $this->set_data($cells, 'details'); - $this->set_data_totals($click, $clicks, $questioncount, $blank, $attempt); - $this->set_data($cells, 'totals'); - $table->data[] = $cells; - $clickcount++; - } // end foreach $attempt - // insert 'tabledivider' between users - $table->data[] = 'hr'; - } // end foreach $user - // remove final 'hr' from data rows - array_pop($table->data); - if ($is_html && $CFG->hotpot_showtimes) { - $count = count($users); - $duration = sprintf("%0.3f", microtime_diff($start_report_time, microtime())); - print "$count users processed in $duration seconds (".sprintf("%0.3f", $duration/$count).' secs/user)
      '."\n"; - } - $tables[] = &$table; - $this->create_legend_table($tables, $table); - } // end function - function get_exercisetype(&$questions, &$questionids, &$blank) { - if (empty($questions)) { - $type = $blank; - } else { - switch ($questions[$questionids[0]]->type) { - case HOTPOT_JCB: - $type = "JCB"; - break; - case HOTPOT_JCLOZE : - $type = "JCloze"; - break; - case HOTPOT_JCROSS : - $type = "JCross"; - break; - case HOTPOT_JMATCH : - $type = "JMatch"; - break; - case HOTPOT_JMIX : - $type = "JMix"; - break; - case HOTPOT_JQUIZ : - $type = "JQuiz"; - break; - case HOTPOT_TEXTOYS_RHUBARB : - $type = "Rhubarb"; - break; - case HOTPOT_TEXTOYS_SEQUITUR : - $type = "Sequitur"; - break; - default: - $type = $blank; - } - } - return $type; - } - function set_head(&$options, &$table, $zone, $exercisetype='', $details=array(), $questioncount=0) { - if (empty($table->head)) { - $table->head = array(); - } - switch ($zone) { - case 'exercise': - array_push($table->head, - get_string('reportcoursename', 'hotpot'), - get_string('reportsectionnumber', 'hotpot'), - get_string('reportexercisenumber', 'hotpot'), - get_string('reportexercisename', 'hotpot'), - get_string('reportexercisetype', 'hotpot'), - get_string('reportnumberofquestions', 'hotpot') - ); - break; - case 'user': - array_push($table->head, - get_string('reportstudentid', 'hotpot'), - get_string('reportlogindate', 'hotpot'), - get_string('reportlogintime', 'hotpot'), - get_string('reportlogofftime', 'hotpot') - ); - break; - case 'attempt': - array_push($table->head, - get_string('reportattemptnumber', 'hotpot'), - get_string('reportattemptstart', 'hotpot'), - get_string('reportattemptfinish', 'hotpot') - ); - break; - case 'click': - array_push($table->head, - get_string('reportclicknumber', 'hotpot'), - get_string('reportclicktime', 'hotpot'), - get_string('reportclicktype', 'hotpot') - ); - break; - case 'details': - foreach($details as $detail) { - if ($exercisetype=='JQuiz' && $detail=='clues') { - $detail = 'showanswer'; - } - $detail = get_string("report$detail", 'hotpot'); - for ($i=0; $i<$questioncount; $i++) { - $str = get_string('questionshort', 'hotpot', $i+1); - if ($i==0 || $options['reportformat']!='htm') { - $str = "$detail $str"; - } - $table->head[] = $str; - } - } - break; - case 'totals': - $reportpercentscore =get_string('reportpercentscore', 'hotpot'); - if (!function_exists('clean_getstring_data')) { // Moodle 1.4 (and less) - $reportpercentscore = str_replace('%', '%%', $reportpercentscore); - } - array_push($table->head, - get_string('reportthisclick', 'hotpot', get_string('reportquestionstried', 'hotpot')), - get_string('reportsofar', 'hotpot', get_string('reportquestionstried', 'hotpot')), - get_string('reportthisclick', 'hotpot', get_string('reportright', 'hotpot')), - get_string('reportthisclick', 'hotpot', get_string('reportwrong', 'hotpot')), - get_string('reportthisclick', 'hotpot', get_string('reportnottried', 'hotpot')), - get_string('reportsofar', 'hotpot', get_string('reportright', 'hotpot')), - get_string('reportsofar', 'hotpot', get_string('reportwrong', 'hotpot')), - get_string('reportsofar', 'hotpot', get_string('reportnottried', 'hotpot')), - get_string('reportthisclick', 'hotpot', get_string('reportanswers', 'hotpot')), - get_string('reportthisclick', 'hotpot', get_string('reporthints', 'hotpot')), - get_string('reportthisclick', 'hotpot', get_string($exercisetype=='JQuiz' ? 'reportshowanswer' : 'reportclues', 'hotpot')), - get_string('reportthisclick', 'hotpot', get_string('reportevents', 'hotpot')), - get_string('reportsofar', 'hotpot', get_string('reporthints', 'hotpot')), - get_string('reportsofar', 'hotpot', get_string($exercisetype=='JQuiz' ? 'reportshowanswer' : 'reportclues', 'hotpot')), - get_string('reportthisclick', 'hotpot', get_string('reportrawscore', 'hotpot')), - get_string('reportthisclick', 'hotpot', get_string('reportmaxscore', 'hotpot')), - get_string('reportthisclick', 'hotpot', $reportpercentscore), - get_string('reportsofar', 'hotpot', get_string('reportrawscore', 'hotpot')), - get_string('reportsofar', 'hotpot', get_string('reportmaxscore', 'hotpot')), - get_string('reportsofar', 'hotpot', $reportpercentscore), - get_string('reporthotpotscore', 'hotpot') - ); - break; - } // end switch - } - function set_align_and_wrap(&$table) { - $count = count($table->head); - for ($i=0; $i<$count; $i++) { - if ($i==0 || $i==1 || $i==2 || $i==4 || $i==5 || $i>=7) { - // numeric (and short text) columns - $table->align[] = 'center'; - $table->wrap[] = ''; - } else { - // text columns - $table->align[] = 'left'; - $table->wrap[] = 'nowrap'; - } - } - } - function set_data_exercise(&$cm, &$course, &$hotpot, &$questions, &$questionids, &$questioncount, &$blank) { - // get exercise details (course name, section number, activity number, quiztype and question count) - $record = get_record("course_sections", "id", $cm->section); - $this->data['exercise'] = array( - 'course' => $course->shortname, - 'section' => empty($record) ? $blank : $record->section+1, - 'number' => empty($record) ? $blank : array_search($cm->id, explode(',', $record->sequence))+1, - 'name' => $hotpot->name, - 'type' => $this->get_exercisetype($questions, $questionids, $blank), - 'questioncount' => $questioncount - ); - } - function set_data_user(&$options, &$course, &$user) { - global $CFG; - // shortcut to first attempt record (which also hold user info) - $attempt = &$user->attempts[0]; - $idnumber = $attempt->idnumber; - if (empty($idnumber)) { - $idnumber = fullname($attempt); - } - if ($options['reportformat']=='htm') { - $idnumber = ''.$idnumber.''; - } - $this->data['user'] = array( - 'idnumber' => $idnumber, - ); - } - function set_data_attempt(&$attempt, &$strftimedate, &$strftimetime, &$blank) { - global $CFG; - $records = get_records_sql_menu(" - SELECT userid, MAX(time) AS logintime - FROM {$CFG->prefix}log - WHERE userid=$attempt->userid AND action='login' AND time<$attempt->timestart - GROUP BY userid - "); - if (empty($records)) { - $logindate = $blank; - $logintime = $blank; - } else { - $logintime = $records[$attempt->userid]; - $logindate = trim(userdate($logintime, $strftimedate)); - $logintime = trim(userdate($logintime, $strftimetime)); - } - $records = get_records_sql_menu(" - SELECT userid, MIN(time) AS logouttime - FROM {$CFG->prefix}log - WHERE userid=$attempt->userid AND action='logout' AND time>$attempt->cr_timefinish - GROUP BY userid - "); - if (empty($records)) { - $logouttime = $blank; - } else { - $logouttime = $records[$attempt->userid]; - $logouttime = trim(userdate($logouttime, $strftimetime)); - } - $this->data['attempt'] = array( - 'logindate' => $logindate, - 'logintime' => $logintime, - 'logouttime' => $logouttime, - 'number' => $attempt->attempt, - 'start' => trim(userdate($attempt->timestart, $strftimetime)), - 'finish' => trim(userdate($attempt->cr_timefinish, $strftimetime)), - ); - } - function set_data_click($number, $time, $exercisetype, $click) { - $types = array(); - foreach (array_keys($click['types']) as $type) { - if ($exercisetype=='JQuiz' && $type=='clues') { - $type = 'showanswer'; - } else { - // remove final 's' - $type = substr($type, 0, strlen($type)-1); - } - // $types[] = get_string($type, 'hotpot'); - $types[] = $type; - } - $this->data['click'] = array( - 'number' => $number, - 'time' => $time, - 'type' => empty($types) ? '??' : implode(',', $types) - ); - } - function set_data_totals(&$click, &$clicks, &$questioncount, &$blank, &$attempt) { - $count= array( - 'click' => array( - 'correct' => count($click['correct']), - 'wrong' => count($click['wrong']), - 'answers' => count($click['answers']), - 'hints' => array_sum($click['hints']), - 'clues' => array_sum($click['clues']), - 'events' => array_sum($click['events']), - 'score' => array_sum($click['score']), - 'maxscore' => array_sum($click['weighting']), - ), - 'clicks' => array( - 'correct' => count($clicks['correct']), - 'wrong' => count($clicks['wrong']), - 'answers' => count($clicks['answers']), - 'hints' => array_sum($clicks['hints']), - 'clues' => array_sum($clicks['clues']), - 'score' => array_sum($clicks['score']), - 'maxscore' => array_sum($clicks['weighting']), - ) - ); - foreach ($count as $period=>$values) { - $count[$period]['nottried'] = $questioncount - ($values['correct'] + $values['wrong']); - $count[$period]['percent'] = empty($values['maxscore']) ? $blank : round(100 * $values['score'] / $values['maxscore'], 0); - // blank out zero click values - if ($period=='click') { - foreach ($values as $detail=>$value) { - if ($detail=='answers' || $detail=='hints' || $detail=='clues' || $detail=='events') { - if (empty($value)) { - $count[$period][$detail] = $blank; - } - } - } - } - } - $this->data['totals'] = array( - $count['click']['answers'], // "q's tried" - $count['clicks']['answers'], // "q's tried so far" - $count['click']['correct'], // "right" - $count['click']['wrong'], // "wrong" - $count['click']['nottried'], // "not tried" - $count['clicks']['correct'], // "right so far" - $count['clicks']['wrong'], // "wrong so far" - $count['clicks']['nottried'], // "not tried so far" - $count['click']['answers'], // "answers", - $count['click']['hints'], // "hints", - $count['click']['clues'], // "clues", - $count['click']['events'], // "answers", - $count['clicks']['hints'], // "hints so far", - $count['clicks']['clues'], // "clues so far", - $count['click']['score'], // 'raw score', - $count['click']['maxscore'], // 'max score', - $count['click']['percent'], // '% score' - $count['clicks']['score'], // 'raw score, - $count['clicks']['maxscore'], // 'max score, - $count['clicks']['percent'], // '% score - $attempt->score // 'hotpot score' - ); - } - function update_event_count(&$click, $detail, $q) { - if ($detail=='checks' || $detail=='hints' || $detail=='clues') { - $click['types'][$detail] = true; - } - if ($detail=='answers' || $detail=='hints' || $detail=='clues') { - $click['events'][$q] = isset($click['events'][$q]) ? $click['events'][$q]+1 : 1; - } - if ($detail=='answers') { - $click['changes'][$q] = isset($click['changes'][$q]) ? $click['changes'][$q]+1 : 1; - } - } - function set_data(&$cells, $zone) { - foreach ($this->data[$zone] as $name=>$value) { - $cells[] = $value; - } - } -} // end class -?> +create_clickreport_table($hotpot, $cm, $course, $users, $attempts, $questions, $options, $tables); + // print the tables + $this->print_report($course, $hotpot, $tables, $options); + return true; + } + function create_clickreport_table(&$hotpot, &$cm, &$course, &$users, &$attempts, &$questions, &$options, &$tables) { + global $CFG; + $is_html = ($options['reportformat']=='htm'); + // time and date format strings // date format strings + $strftimetime = '%H:%M:%S'; + $strftimedate = get_string('strftimedate'); + // get the current time and max execution time + $start_report_time = microtime(); + $max_execution_time = ini_get('max_execution_time'); + $correct = get_string('reportcorrectsymbol', 'hotpot'); + $wrong = get_string('reportwrongsymbol', 'hotpot'); + $nottried = get_string('reportnottriedsymbol', 'hotpot'); + // shortcuts for font tags + $blank = $is_html ? ' ' : ""; + // store question count + $questioncount = count($questions); + // array to map columns onto question ids ($col => $id) + $questionids = array_keys($questions); + // store exercise type + $exercisetype = $this->get_exercisetype($questions, $questionids, $blank); + // initialize details ('events' must go last) + $details = array('checks', 'status', 'answers', 'changes', 'hints', 'clues', 'events'); + // initialize $table + unset($table); + $table->border = 1; + $table->width = '100%'; + // initialize legend, if necessary + if (!empty($options['reportshowlegend'])) { + $table->legend = array(); + } + // start $table headings + $this->set_head($options, $table, 'exercise'); + $this->set_head($options, $table, 'user'); + $this->set_head($options, $table, 'attempt'); + $this->set_head($options, $table, 'click'); + // store clicktype column number + $clicktype_col = count($table->head)-1; + // finish $table headings + $this->set_head($options, $table, 'details', $exercisetype, $details, $questioncount); + $this->set_head($options, $table, 'totals', $exercisetype); + // set align and wrap + $this->set_align_and_wrap($table); + // is link to review allowed? + $allow_review = ($is_html && (has_capability('mod/hotpot:viewreport',get_context_instance(CONTEXT_COURSE, $course->id)) || $hotpot->review)); + // initialize array of data values + $this->data = array(); + // set exercise data values + $this->set_data_exercise($cm, $course, $hotpot, $questions, $questionids, $questioncount, $blank); + // add details of users' responses + foreach ($users as $user) { + $this->set_data_user($options, $course, $user); + unset($clickreportid); + foreach ($user->attempts as $attempt) { + // initialize totals for + $click = array( + 'qnumber' => array(), + 'correct' => array(), + 'wrong' => array(), + 'answers' => array(), + 'hints' => array(), + 'clues' => array(), + 'changes' => array(), + 'checks' => array(), + 'events' => array(), + 'score' => array(), + 'weighting' => array() + ); + $clicktypes = array(); + // is the start of a new attempt? + // (clicks in the same attempt have the same clickreportid) + if (!isset($clickreportid) || $clickreportid != $attempt->clickreportid) { + $clickcount = 1; + $clickreportid = $attempt->clickreportid; + // initialize totals for all clicks in this attempt + $clicks = $click; // $click has just been initialized + $this->set_data_attempt($attempt, $strftimedate, $strftimetime, $blank); + } + $cells = array(); + $this->set_data($cells, 'exercise'); + $this->set_data($cells, 'user'); + $this->set_data($cells, 'attempt'); + // get responses to questions in this attempt + foreach ($attempt->responses as $response) { + // set $q(uestion number) + $q = array_search($response->question, $questionids); + $click['qnumber'][$q] = true; + // was this question answered correctly? + if ($answer = hotpot_strings($response->correct)) { + // mark the question as correctly answered + if (empty($clicks['correct'][$q])) { + $click['correct'][$q] = true; + $clicks['correct'][$q] = true; + } + // unset 'wrong' flags, if necessary + if (isset($click['wrong'][$q])) { + unset($click['wrong'][$q]); + } + if (isset($clicks['wrong'][$q])) { + unset($clicks['wrong'][$q]); + } + // otherwise, was the question answered wrongly? + } else if ($answer = hotpot_strings($response->wrong)) { + // mark the question as wrongly answered + $click['wrong'][$q] = true; + $clicks['wrong'][$q] = true; + } else { // not correct or wrong (curious?!) + unset($answer); + } + if (!empty($click['correct'][$q]) || !empty($click['wrong'][$q])) { + $click['score'][$q] = $response->score; + $clicks['score'][$q] = $response->score; + $weighting = isset($response->weighting) ? $response->weighting : 100; + $click['weighting'][$q] = $weighting; + $clicks['weighting'][$q] =$weighting; + } + foreach($details as $detail) { + switch ($detail) { + case 'answers': + if (isset($answer) && is_string($answer) && !empty($answer)) { + $click[$detail][$q] = $answer; + } + break; + case 'hints': + case 'clues': + case 'checks': + if (isset($response->$detail) && is_numeric($response->$detail) && $response->$detail>0) { + if (!isset($click[$detail][$q]) || $click[$detail][$q] < $response->$detail) { + $click[$detail][$q] = $response->$detail; + } + } + break; + } + } // end foreach $detail + } // end foreach $response + $click['types'] = array(); + $this->data['details'] = array(); + foreach($details as $detail) { + for ($q=0; $q<$questioncount; $q++) { + switch ($detail) { + case 'status': + if (isset($clicks['correct'][$q])) { + $this->data['details'][] = $correct; + } else if (isset($clicks['wrong'][$q])) { + $this->data['details'][] = $wrong; + } else if (isset($click['qnumber'][$q])) { + $this->data['details'][] = $nottried; + } else { // this question did not appear in this attempt + $this->data['details'][] = $blank; + } + break; + case 'answers': + case 'hints': + case 'clues': + case 'checks': + if (!isset($clicks[$detail][$q])) { + if (!isset($click[$detail][$q])) { + $this->data['details'][] = $blank; + } else { + $clicks[$detail][$q] = $click[$detail][$q]; + if ($detail=='answers') { + $this->set_legend($table, $q, $click[$detail][$q], $questions[$questionids[$q]]); + } + $this->data['details'][] = $click[$detail][$q]; + $this->update_event_count($click, $detail, $q); + } + } else { + if (!isset($click[$detail][$q])) { + $this->data['details'][] = $blank; + } else { + $difference = ''; + if ($detail=='answers') { + if ($click[$detail][$q] != $clicks[$detail][$q]) { + $pattern = '/^'.preg_quote($clicks[$detail][$q], '/').',/'; + $difference = preg_replace($pattern, '', $click[$detail][$q], 1); + } + } else { // hints, clues, checks + if ($click[$detail][$q] > $clicks[$detail][$q]) { + $difference = $click[$detail][$q] - $clicks[$detail][$q]; + } + } + if ($difference) { + $clicks[$detail][$q] = $click[$detail][$q]; + $click[$detail][$q] = $difference; + if ($detail=='answers') { + $this->set_legend($table, $q, $difference, $questions[$questionids[$q]]); + } + $this->data['details'][] = $difference; + $this->update_event_count($click, $detail, $q); + } else { + unset($click[$detail][$q]); + $this->data['details'][] = $blank; + } + } + } + break; + case 'changes': + case 'events': + if (empty($click[$detail][$q])) { + $this->data['details'][] = $blank; + } else { + $this->data['details'][] = $click[$detail][$q]; + } + break; + default: + // do nothing + break; + } // end switch + } // for $q + } // foreach $detail + // set data cell values for + $this->set_data_click( + $allow_review ? ''.$clickcount.'' : $clickcount, + trim(userdate($attempt->timefinish, $strftimetime)), + $exercisetype, + $click + ); + $this->set_data($cells, 'click'); + $this->set_data($cells, 'details'); + $this->set_data_totals($click, $clicks, $questioncount, $blank, $attempt); + $this->set_data($cells, 'totals'); + $table->data[] = $cells; + $clickcount++; + } // end foreach $attempt + // insert 'tabledivider' between users + $table->data[] = 'hr'; + } // end foreach $user + // remove final 'hr' from data rows + array_pop($table->data); + if ($is_html && $CFG->hotpot_showtimes) { + $count = count($users); + $duration = sprintf("%0.3f", microtime_diff($start_report_time, microtime())); + print "$count users processed in $duration seconds (".sprintf("%0.3f", $duration/$count).' secs/user)
      '."\n"; + } + $tables[] = &$table; + $this->create_legend_table($tables, $table); + } // end function + function get_exercisetype(&$questions, &$questionids, &$blank) { + if (empty($questions)) { + $type = $blank; + } else { + switch ($questions[$questionids[0]]->type) { + case HOTPOT_JCB: + $type = "JCB"; + break; + case HOTPOT_JCLOZE : + $type = "JCloze"; + break; + case HOTPOT_JCROSS : + $type = "JCross"; + break; + case HOTPOT_JMATCH : + $type = "JMatch"; + break; + case HOTPOT_JMIX : + $type = "JMix"; + break; + case HOTPOT_JQUIZ : + $type = "JQuiz"; + break; + case HOTPOT_TEXTOYS_RHUBARB : + $type = "Rhubarb"; + break; + case HOTPOT_TEXTOYS_SEQUITUR : + $type = "Sequitur"; + break; + default: + $type = $blank; + } + } + return $type; + } + function set_head(&$options, &$table, $zone, $exercisetype='', $details=array(), $questioncount=0) { + if (empty($table->head)) { + $table->head = array(); + } + switch ($zone) { + case 'exercise': + array_push($table->head, + get_string('reportcoursename', 'hotpot'), + get_string('reportsectionnumber', 'hotpot'), + get_string('reportexercisenumber', 'hotpot'), + get_string('reportexercisename', 'hotpot'), + get_string('reportexercisetype', 'hotpot'), + get_string('reportnumberofquestions', 'hotpot') + ); + break; + case 'user': + array_push($table->head, + get_string('reportstudentid', 'hotpot'), + get_string('reportlogindate', 'hotpot'), + get_string('reportlogintime', 'hotpot'), + get_string('reportlogofftime', 'hotpot') + ); + break; + case 'attempt': + array_push($table->head, + get_string('reportattemptnumber', 'hotpot'), + get_string('reportattemptstart', 'hotpot'), + get_string('reportattemptfinish', 'hotpot') + ); + break; + case 'click': + array_push($table->head, + get_string('reportclicknumber', 'hotpot'), + get_string('reportclicktime', 'hotpot'), + get_string('reportclicktype', 'hotpot') + ); + break; + case 'details': + foreach($details as $detail) { + if ($exercisetype=='JQuiz' && $detail=='clues') { + $detail = 'showanswer'; + } + $detail = get_string("report$detail", 'hotpot'); + for ($i=0; $i<$questioncount; $i++) { + $str = get_string('questionshort', 'hotpot', $i+1); + if ($i==0 || $options['reportformat']!='htm') { + $str = "$detail $str"; + } + $table->head[] = $str; + } + } + break; + case 'totals': + $reportpercentscore =get_string('reportpercentscore', 'hotpot'); + if (!function_exists('clean_getstring_data')) { // Moodle 1.4 (and less) + $reportpercentscore = str_replace('%', '%%', $reportpercentscore); + } + array_push($table->head, + get_string('reportthisclick', 'hotpot', get_string('reportquestionstried', 'hotpot')), + get_string('reportsofar', 'hotpot', get_string('reportquestionstried', 'hotpot')), + get_string('reportthisclick', 'hotpot', get_string('reportright', 'hotpot')), + get_string('reportthisclick', 'hotpot', get_string('reportwrong', 'hotpot')), + get_string('reportthisclick', 'hotpot', get_string('reportnottried', 'hotpot')), + get_string('reportsofar', 'hotpot', get_string('reportright', 'hotpot')), + get_string('reportsofar', 'hotpot', get_string('reportwrong', 'hotpot')), + get_string('reportsofar', 'hotpot', get_string('reportnottried', 'hotpot')), + get_string('reportthisclick', 'hotpot', get_string('reportanswers', 'hotpot')), + get_string('reportthisclick', 'hotpot', get_string('reporthints', 'hotpot')), + get_string('reportthisclick', 'hotpot', get_string($exercisetype=='JQuiz' ? 'reportshowanswer' : 'reportclues', 'hotpot')), + get_string('reportthisclick', 'hotpot', get_string('reportevents', 'hotpot')), + get_string('reportsofar', 'hotpot', get_string('reporthints', 'hotpot')), + get_string('reportsofar', 'hotpot', get_string($exercisetype=='JQuiz' ? 'reportshowanswer' : 'reportclues', 'hotpot')), + get_string('reportthisclick', 'hotpot', get_string('reportrawscore', 'hotpot')), + get_string('reportthisclick', 'hotpot', get_string('reportmaxscore', 'hotpot')), + get_string('reportthisclick', 'hotpot', $reportpercentscore), + get_string('reportsofar', 'hotpot', get_string('reportrawscore', 'hotpot')), + get_string('reportsofar', 'hotpot', get_string('reportmaxscore', 'hotpot')), + get_string('reportsofar', 'hotpot', $reportpercentscore), + get_string('reporthotpotscore', 'hotpot') + ); + break; + } // end switch + } + function set_align_and_wrap(&$table) { + $count = count($table->head); + for ($i=0; $i<$count; $i++) { + if ($i==0 || $i==1 || $i==2 || $i==4 || $i==5 || $i>=7) { + // numeric (and short text) columns + $table->align[] = 'center'; + $table->wrap[] = ''; + } else { + // text columns + $table->align[] = 'left'; + $table->wrap[] = 'nowrap'; + } + } + } + function set_data_exercise(&$cm, &$course, &$hotpot, &$questions, &$questionids, &$questioncount, &$blank) { + // get exercise details (course name, section number, activity number, quiztype and question count) + $record = get_record("course_sections", "id", $cm->section); + $this->data['exercise'] = array( + 'course' => $course->shortname, + 'section' => empty($record) ? $blank : $record->section+1, + 'number' => empty($record) ? $blank : array_search($cm->id, explode(',', $record->sequence))+1, + 'name' => $hotpot->name, + 'type' => $this->get_exercisetype($questions, $questionids, $blank), + 'questioncount' => $questioncount + ); + } + function set_data_user(&$options, &$course, &$user) { + global $CFG; + // shortcut to first attempt record (which also hold user info) + $attempt = &$user->attempts[0]; + $idnumber = $attempt->idnumber; + if (empty($idnumber)) { + $idnumber = fullname($attempt); + } + if ($options['reportformat']=='htm') { + $idnumber = ''.$idnumber.''; + } + $this->data['user'] = array( + 'idnumber' => $idnumber, + ); + } + function set_data_attempt(&$attempt, &$strftimedate, &$strftimetime, &$blank) { + global $CFG; + $records = get_records_sql_menu(" + SELECT userid, MAX(time) AS logintime + FROM {$CFG->prefix}log + WHERE userid=$attempt->userid AND action='login' AND time<$attempt->timestart + GROUP BY userid + "); + if (empty($records)) { + $logindate = $blank; + $logintime = $blank; + } else { + $logintime = $records[$attempt->userid]; + $logindate = trim(userdate($logintime, $strftimedate)); + $logintime = trim(userdate($logintime, $strftimetime)); + } + $records = get_records_sql_menu(" + SELECT userid, MIN(time) AS logouttime + FROM {$CFG->prefix}log + WHERE userid=$attempt->userid AND action='logout' AND time>$attempt->cr_timefinish + GROUP BY userid + "); + if (empty($records)) { + $logouttime = $blank; + } else { + $logouttime = $records[$attempt->userid]; + $logouttime = trim(userdate($logouttime, $strftimetime)); + } + $this->data['attempt'] = array( + 'logindate' => $logindate, + 'logintime' => $logintime, + 'logouttime' => $logouttime, + 'number' => $attempt->attempt, + 'start' => trim(userdate($attempt->timestart, $strftimetime)), + 'finish' => trim(userdate($attempt->cr_timefinish, $strftimetime)), + ); + } + function set_data_click($number, $time, $exercisetype, $click) { + $types = array(); + foreach (array_keys($click['types']) as $type) { + if ($exercisetype=='JQuiz' && $type=='clues') { + $type = 'showanswer'; + } else { + // remove final 's' + $type = substr($type, 0, strlen($type)-1); + } + // $types[] = get_string($type, 'hotpot'); + $types[] = $type; + } + $this->data['click'] = array( + 'number' => $number, + 'time' => $time, + 'type' => empty($types) ? '??' : implode(',', $types) + ); + } + function set_data_totals(&$click, &$clicks, &$questioncount, &$blank, &$attempt) { + $count= array( + 'click' => array( + 'correct' => count($click['correct']), + 'wrong' => count($click['wrong']), + 'answers' => count($click['answers']), + 'hints' => array_sum($click['hints']), + 'clues' => array_sum($click['clues']), + 'events' => array_sum($click['events']), + 'score' => array_sum($click['score']), + 'maxscore' => array_sum($click['weighting']), + ), + 'clicks' => array( + 'correct' => count($clicks['correct']), + 'wrong' => count($clicks['wrong']), + 'answers' => count($clicks['answers']), + 'hints' => array_sum($clicks['hints']), + 'clues' => array_sum($clicks['clues']), + 'score' => array_sum($clicks['score']), + 'maxscore' => array_sum($clicks['weighting']), + ) + ); + foreach ($count as $period=>$values) { + $count[$period]['nottried'] = $questioncount - ($values['correct'] + $values['wrong']); + $count[$period]['percent'] = empty($values['maxscore']) ? $blank : round(100 * $values['score'] / $values['maxscore'], 0); + // blank out zero click values + if ($period=='click') { + foreach ($values as $detail=>$value) { + if ($detail=='answers' || $detail=='hints' || $detail=='clues' || $detail=='events') { + if (empty($value)) { + $count[$period][$detail] = $blank; + } + } + } + } + } + $this->data['totals'] = array( + $count['click']['answers'], // "q's tried" + $count['clicks']['answers'], // "q's tried so far" + $count['click']['correct'], // "right" + $count['click']['wrong'], // "wrong" + $count['click']['nottried'], // "not tried" + $count['clicks']['correct'], // "right so far" + $count['clicks']['wrong'], // "wrong so far" + $count['clicks']['nottried'], // "not tried so far" + $count['click']['answers'], // "answers", + $count['click']['hints'], // "hints", + $count['click']['clues'], // "clues", + $count['click']['events'], // "answers", + $count['clicks']['hints'], // "hints so far", + $count['clicks']['clues'], // "clues so far", + $count['click']['score'], // 'raw score', + $count['click']['maxscore'], // 'max score', + $count['click']['percent'], // '% score' + $count['clicks']['score'], // 'raw score, + $count['clicks']['maxscore'], // 'max score, + $count['clicks']['percent'], // '% score + $attempt->score // 'hotpot score' + ); + } + function update_event_count(&$click, $detail, $q) { + if ($detail=='checks' || $detail=='hints' || $detail=='clues') { + $click['types'][$detail] = true; + } + if ($detail=='answers' || $detail=='hints' || $detail=='clues') { + $click['events'][$q] = isset($click['events'][$q]) ? $click['events'][$q]+1 : 1; + } + if ($detail=='answers') { + $click['changes'][$q] = isset($click['changes'][$q]) ? $click['changes'][$q]+1 : 1; + } + } + function set_data(&$cells, $zone) { + foreach ($this->data[$zone] as $name=>$value) { + $cells[] = $value; + } + } +} // end class +?> diff --git a/mod/hotpot/template/v6.php b/mod/hotpot/template/v6.php index 4389b59da2..ae78f14d6f 100644 --- a/mod/hotpot/template/v6.php +++ b/mod/hotpot/template/v6.php @@ -1,1445 +1,1445 @@ -parent = &$parent; - - $get_js = optional_param('js', false); - $get_css = optional_param('css', false); - - if (!empty($get_css)) { - // set $this->css - $this->v6_expand_StyleSheet(); - - } else if (!empty($get_js)) { - // set $this->js - $this->read_template($this->parent->draganddrop.$this->parent->quiztype.'6.js_', 'js'); - - } else { - // set $this->html - $this->read_template($this->parent->draganddrop.$this->parent->quiztype.'6.ht_', 'html'); - } - - // expand special strings, if any - $pattern = ''; - switch ($this->parent->quiztype) { - case 'jcloze': - $pattern = '/\[(PreloadImageList)\]/'; - break; - case 'jcross': - $pattern = '/\[(PreloadImageList|ShowHideClueList)\]/'; - break; - case 'jmatch': - $pattern = '/\[(PreloadImageList|QsToShow|FixedArray|DragArray)\]/'; - break; - case 'jmix': - $pattern = '/\[(PreloadImageList|SegmentArray|AnswerArray)\]/'; - break; - case 'jquiz': - $pattern = '/\[(PreloadImageList|QsToShow)\]/'; - break; - } - if (!empty($pattern)) { - $this->expand_strings('html', $pattern); - } - } - - // captions and messages - - function v6_expand_AlsoCorrect() { - return $this->parent->xml_value('hotpot-config-file,'.$this->parent->quiztype.',also-correct'); - } - function v6_expand_CapitalizeFirst() { - return $this->bool_value('hotpot-config-file,'.$this->parent->quiztype.',capitalize-first-letter'); - } - function v6_expand_CheckCaption() { - return $this->parent->xml_value('hotpot-config-file,global,check-caption'); - } - function v6_expand_CorrectIndicator() { - return $this->js_value('hotpot-config-file,global,correct-indicator'); - } - function v6_expand_Back() { - return $this->int_value('hotpot-config-file,global,include-back'); - } - function v6_expand_BackCaption() { - return $this->parent->xml_value('hotpot-config-file,global,back-caption'); - } - function v6_expand_ClickToAdd() { - return $this->parent->xml_value('hotpot-config-file,'.$this->parent->quiztype.',click-to-add'); - } - function v6_expand_ClueCaption() { - return $this->parent->xml_value('hotpot-config-file,global,clue-caption'); - } - function v6_expand_Clues() { - return $this->int_value('hotpot-config-file,'.$this->parent->quiztype.',include-clues'); - } - function v6_expand_Contents() { - return $this->int_value('hotpot-config-file,global,include-contents'); - } - function v6_expand_ContentsCaption() { - return $this->parent->xml_value('hotpot-config-file,global,contents-caption'); - } - function v6_expand_GuessCorrect() { - return $this->js_value('hotpot-config-file,'.$this->parent->quiztype.',guess-correct'); - } - function v6_expand_GuessIncorrect() { - return $this->js_value('hotpot-config-file,'.$this->parent->quiztype.',guess-incorrect'); - } - function v6_expand_Hint() { - return $this->int_value('hotpot-config-file,'.$this->parent->quiztype.',include-hint'); - } - function v6_expand_HintCaption() { - return $this->parent->xml_value('hotpot-config-file,global,hint-caption'); - } - function v6_expand_IncorrectIndicator() { - return $this->js_value('hotpot-config-file,global,incorrect-indicator'); - } - function v6_expand_LastQCaption() { - return $this->parent->xml_value('hotpot-config-file,global,last-q-caption'); - } - function v6_expand_NextCorrect() { - $value = $this->js_value('hotpot-config-file,'.$this->parent->quiztype.',next-correct-part'); - if (empty($value)) { // jquiz - $value = $this->js_value('hotpot-config-file,'.$this->parent->quiztype.',next-correct-letter'); - } - return $value; - } - function v6_expand_NextEx() { - return $this->int_value('hotpot-config-file,global,include-next-ex'); - } - function v6_expand_NextExCaption() { - return $this->parent->xml_value('hotpot-config-file,global,next-ex-caption'); - } - function v6_expand_NextQCaption() { - return $this->parent->xml_value('hotpot-config-file,global,next-q-caption'); - } - function v6_expand_OKCaption() { - return $this->parent->xml_value('hotpot-config-file,global,ok-caption'); - } - function v6_expand_Restart() { - return $this->int_value('hotpot-config-file,'.$this->parent->quiztype.',include-restart'); - } - function v6_expand_RestartCaption() { - return $this->parent->xml_value('hotpot-config-file,global,restart-caption'); - } - function v6_expand_ShowAllQuestionsCaption() { - return $this->js_value('hotpot-config-file,global,show-all-questions-caption'); - } - function v6_expand_ShowOneByOneCaption() { - return $this->js_value('hotpot-config-file,global,show-one-by-one-caption'); - } - function v6_expand_TheseAnswersToo() { - return $this->js_value('hotpot-config-file,'.$this->parent->quiztype.',also-correct'); - } - function v6_expand_ThisMuch() { - return $this->js_value('hotpot-config-file,'.$this->parent->quiztype.',this-much-correct'); - } - function v6_expand_Undo() { - return $this->int_value('hotpot-config-file,'.$this->parent->quiztype.',include-undo'); - } - function v6_expand_UndoCaption() { - return $this->parent->xml_value('hotpot-config-file,global,undo-caption'); - } - function v6_expand_YourScoreIs() { - return $this->js_value('hotpot-config-file,global,your-score-is'); - } - - // reading - - function v6_expand_Reading() { - return $this->int_value('data,reading,include-reading'); - } - function v6_expand_ReadingText() { - $title = $this->v6_expand_ReadingTitle(); - $value = $this->parent->xml_value('data,reading,reading-text'); - $value = empty($value) ? '' : ('
      '.$value.'
      '); - return $title.$value; - } - function v6_expand_ReadingTitle() { - $value = $this->parent->xml_value('data,reading,reading-title'); - return empty($value) ? '' : ('

      '.$value.'

      '); - } - - // timer - - function v6_expand_Timer() { - return $this->int_value('data,timer,include-timer'); - } - function v6_expand_JSTimer() { - return $this->read_template('hp6timer.js_'); - } - function v6_expand_Seconds() { - return $this->parent->xml_value('data,timer,seconds'); - } - - // send results - - function v6_expand_SendResults() { - return $this->parent->xml_value('hotpot-config-file,'.$this->parent->quiztype.',send-email'); - } - function v6_expand_JSSendResults() { - return $this->read_template('hp6sendresults.js_'); - } - function v6_expand_FormMailURL() { - return $this->parent->xml_value('hotpot-config-file,global,formmail-url'); - } - function v6_expand_EMail() { - return $this->parent->xml_value('hotpot-config-file,global,email'); - } - function v6_expand_NamePlease() { - return $this->js_value('hotpot-config-file,global,name-please'); - } - - // preload images - - function v6_expand_PreloadImages() { - $value = $this->v6_expand_PreloadImageList(); - return empty($value) ? false : true; - } - function v6_expand_PreloadImageList() { - - // check it has not been set already - if (!isset($this->PreloadImageList)) { - - // the list of image urls - $list = array(); - - // extract tags - $img_tag = htmlspecialchars('|<img.*?src="(.*?)".*?>|is'); - if (preg_match_all($img_tag, $this->parent->source, $matches)) { - $list = $matches[1]; - - // remove duplicates - $list = array_unique($list); - } - - // convert to comma delimited string - $this->PreloadImageList = empty($list) ? '' : "'".implode(',', $list)."'"; - } - return $this->PreloadImageList; - } - - // html files (all quiz types) - - function v6_expand_PlainTitle() { - return $this->parent->xml_value('data,title'); - } - function v6_expand_ExerciseSubtitle() { - return $this->parent->xml_value('hotpot-config-file,'.$this->parent->quiztype.',exercise-subtitle'); - } - function v6_expand_Instructions() { - return $this->parent->xml_value('hotpot-config-file,'.$this->parent->quiztype.',instructions'); - } - function v6_expand_DublinCoreMetadata() { - $dc = ''."\n"; - if (is_string($this->parent->xml_value('rdf:RDF,rdf:Description'))) { - // do nothing (there is no more dc info) - } else { - $dc .= ''."\n"; - $dc .= ''."\n"; - } - return $dc; - } - function v6_expand_FullVersionInfo() { - global $CFG; - require_once($CFG->hotpotroot.DIRECTORY_SEPARATOR.'version.php'); // set $module - return $this->parent->xml_value('version').'.x (Moodle '.$CFG->release.', hotpot-module '.$this->parent->obj_value($module, 'release').')'; - } - function v6_expand_HeaderCode() { - return $this->parent->xml_value('hotpot-config-file,global,header-code'); - } - function v6_expand_StyleSheet() { - $this->read_template('hp6.cs_', 'css'); - $this->css = hotpot_convert_stylesheets_urls($this->parent->get_baseurl(), $this->parent->reference, $this->css); - return $this->css; - } - - // stylesheet (hp6.cs_) - - function v6_expand_PageBGColor() { - return $this->parent->xml_value('hotpot-config-file,global,page-bg-color'); - } - function v6_expand_GraphicURL() { - return $this->parent->xml_value('hotpot-config-file,global,graphic-url'); - } - function v6_expand_ExBGColor() { - return $this->parent->xml_value('hotpot-config-file,global,ex-bg-color'); - } - - function v6_expand_FontFace() { - return $this->parent->xml_value('hotpot-config-file,global,font-face'); - } - function v6_expand_FontSize() { - return $this->parent->xml_value('hotpot-config-file,global,font-size'); - } - function v6_expand_TextColor() { - return $this->parent->xml_value('hotpot-config-file,global,text-color'); - } - function v6_expand_TitleColor() { - return $this->parent->xml_value('hotpot-config-file,global,title-color'); - } - function v6_expand_LinkColor() { - return $this->parent->xml_value('hotpot-config-file,global,link-color'); - } - function v6_expand_VLinkColor() { - return $this->parent->xml_value('hotpot-config-file,global,vlink-color'); - } - - function v6_expand_NavTextColor() { - return $this->parent->xml_value('hotpot-config-file,global,page-bg-color'); - } - function v6_expand_NavBarColor() { - return $this->parent->xml_value('hotpot-config-file,global,nav-bar-color'); - } - function v6_expand_NavLightColor() { - $color = $this->parent->xml_value('hotpot-config-file,global,nav-bar-color'); - return $this->get_halfway_color($color, '#ffffff'); - } - function v6_expand_NavShadeColor() { - $color = $this->parent->xml_value('hotpot-config-file,global,nav-bar-color'); - return $this->get_halfway_color($color, '#000000'); - } - - function v6_expand_FuncLightColor() { // top-left of buttons - $color = $this->parent->xml_value('hotpot-config-file,global,ex-bg-color'); - return $this->get_halfway_color($color, '#ffffff'); - } - function v6_expand_FuncShadeColor() { // bottom right of buttons - $color = $this->parent->xml_value('hotpot-config-file,global,ex-bg-color'); - return $this->get_halfway_color($color, '#000000'); - } - - // navigation buttons - - function v6_expand_NavButtons() { - $back = $this->v6_expand_Back(); - $next_ex = $this->v6_expand_NextEx(); - $contents = $this->v6_expand_Contents(); - return (empty($back) && empty($next_ex) && empty($contents) ? false : true); - } - function v6_expand_NavBarJS() { - return $this->v6_expand_NavButtons(); - } - - // js files (all quiz types) - - function v6_expand_JSBrowserCheck() { - return $this->read_template('hp6browsercheck.js_'); - } - function v6_expand_JSButtons() { - return $this->read_template('hp6buttons.js_'); - } - function v6_expand_JSCard() { - return $this->read_template('hp6card.js_'); - } - function v6_expand_JSCheckShortAnswer() { - return $this->read_template('hp6checkshortanswer.js_'); - } - function v6_expand_JSHotPotNet() { - return $this->read_template('hp6hotpotnet.js_'); - } - function v6_expand_JSShowMessage() { - return $this->read_template('hp6showmessage.js_'); - } - function v6_expand_JSUtilities() { - return $this->read_template('hp6utilities.js_'); - } - - // js files - - function v6_expand_JSJCloze6() { - return $this->read_template('jcloze6.js_'); - } - function v6_expand_JSJCross6() { - return $this->read_template('jcross6.js_'); - } - function v6_expand_JSJMatch6() { - return $this->read_template('jmatch6.js_'); - } - function v6_expand_JSJMix6() { - return $this->read_template('jmix6.js_'); - } - function v6_expand_JSJQuiz6() { - return $this->read_template('jquiz6.js_'); - } - - // drag and drop - - function v6_expand_JSDJMatch6() { - return $this->read_template('djmatch6.js_'); - } - function v6_expand_JSDJMix6() { - return $this->read_template('djmix6.js_'); - } - - // what are these for? - - function v6_expand_JSFJMatch6() { - return $this->read_template('fjmatch6.js_'); - } - function v6_expand_JSFJMix6() { - return $this->read_template('fjmix6.js_'); - } - - // jmatch6.js_ - - function v6_expand_ShuffleQs() { - return $this->bool_value('hotpot-config-file,'.$this->parent->quiztype.',shuffle-questions'); - } - function v6_expand_QsToShow() { - $i = $this->parent->xml_value('hotpot-config-file,'.$this->parent->quiztype.',show-limited-questions'); - if ($i) { - $i = $this->parent->xml_value('hotpot-config-file,'.$this->parent->quiztype.',questions-to-show'); - } - if (empty($i)) { - $i = 0; - switch ($this->parent->quiztype) { - case 'jmatch': - $values = $this->parent->xml_values('data,matching-exercise,pair'); - $i = count($values); - break; - case 'jquiz': - while ($this->parent->xml_value('data,questions,question-record', "[$i]['#']['question'][0]['#']")) { - $i++; - } - break; - } // end switch - } - return $i; - } - function v6_expand_MatchDivItems() { - $l_items = array(); - $r_items = array(); - $this->get_jmatch_items($l_items, $r_items); - - $l_keys = $this->shuffle_jmatch_items($l_items); - $r_keys = $this->shuffle_jmatch_items($r_items); - - $options = ''; - foreach ($r_keys as $key) { - $options .= ''."\n"; - } - - $str = ''; - foreach ($l_keys as $key) { - $str .= ''.$l_items[$key]['text'][0]['#'].''; - $str .= ''; - $str .= ''; - } - return $str; - } - - // jmix6.js_ - - function v6_expand_Punctuation() { - $tags = 'data,jumbled-order-exercise'; - $chars = array_merge( - $this->jmix_Punctuation("$tags,main-order,segment"), - $this->jmix_Punctuation("$tags,alternate") - ); - $chars = array_unique($chars); - $chars = implode('', $chars); - $chars = $this->js_safe($chars, true); - return $chars; - } - function jmix_Punctuation($tags) { - $chars = array(); - - // all punctutation except '&#;' (because they are used in html entities) - $ENTITIES = $this->jmix_encode_punctuation('!"$%'."'".'()*+,-./:<=>?@[\]^_`{|}~'); - $pattern = "/&#x([0-9A-F]+);/i"; - $i = 0; - - // get next segment (or alternate answer) - while ($value = $this->parent->xml_value($tags, "[$i]['#']")) { - - // convert low-ascii punctuation to entities - $value = strtr($value, $ENTITIES); - - // extract all hex HTML entities - if (preg_match_all($pattern, $value, $matches)) { - - // loop through hex entities - $m_max = count($matches[0]); - for ($m=0; $m<$m_max; $m++) { - - // convert to hex number - eval('$hex=0x'.$matches[1][$m].';'); - - // is this a punctuation character? - if ( - ($hex>=0x0020 && $hex<=0x00BF) || // ascii punctuation - ($hex>=0x2000 && $hex<=0x206F) || // general punctuation - ($hex>=0x3000 && $hex<=0x303F) || // CJK punctuation - ($hex>=0xFE30 && $hex<=0xFE4F) || // CJK compatability - ($hex>=0xFE50 && $hex<=0xFE6F) || // small form variants - ($hex>=0xFF00 && $hex<=0xFF40) || // halfwidth and fullwidth forms (1) - ($hex>=0xFF5B && $hex<=0xFF65) || // halfwidth and fullwidth forms (2) - ($hex>=0xFFE0 && $hex<=0xFFEE) // halfwidth and fullwidth forms (3) - ) { - // add this character - $chars[] = $matches[0][$m]; - } - } - } - $i++; - } - - return $chars; - } - function v6_expand_OpenPunctuation() { - $tags = 'data,jumbled-order-exercise'; - $chars = array_merge( - $this->jmix_OpenPunctuation("$tags,main-order,segment"), - $this->jmix_OpenPunctuation("$tags,alternate") - ); - $chars = array_unique($chars); - $chars = implode('', $chars); - $chars = $this->js_safe($chars, true); - return $chars; - } - function jmix_OpenPunctuation($tags) { - $chars = array(); - - // unicode punctuation designations (pi="initial quote", ps="open") - // http://www.sql-und-xml.de/unicode-database/pi.html - // http://www.sql-und-xml.de/unicode-database/ps.html - $pi = '0022|0027|00AB|2018|201B|201C|201F|2039'; - $ps = '0028|005B|007B|0F3A|0F3C|169B|201A|201E|2045|207D|208D|2329|23B4|2768|276A|276C|276E|2770|2772|2774|27E6|27E8|27EA|2983|2985|2987|2989|298B|298D|298F|2991|2993|2995|2997|29D8|29DA|29FC|3008|300A|300C|300E|3010|3014|3016|3018|301A|301D|FD3E|FE35|FE37|FE39|FE3B|FE3D|FE3F|FE41|FE43|FE47|FE59|FE5B|FE5D|FF08|FF3B|FF5B|FF5F|FF62'; - $pattern = "/(&#x($pi|$ps);)/i"; - - $ENTITIES = $this->jmix_encode_punctuation('"'."'".'(<[{'); - - $i = 0; - while ($value = $this->parent->xml_value($tags, "[$i]['#']")) { - $value = strtr($value, $ENTITIES); - if (preg_match_all($pattern, $value, $matches)) { - $chars = array_merge($chars, $matches[0]); - } - $i++; - } - - return $chars; - } - function jmix_encode_punctuation($str) { - $ENTITIES = array(); - $i_max = strlen($str); - for ($i=0; $i<$i_max; $i++) { - $ENTITIES[$str{$i}] = '&#x'.sprintf('%04X', ord($str{$i})).';'; - } - return $ENTITIES; - } - function v6_expand_ExerciseTitle() { - return $this->parent->xml_value('data,title'); - } - - // Jmix specials - - function v6_expand_SegmentArray() { - - $segments = array(); - $values = array(); - $VALUES = array(); - - // XML tags to the start of a segment - $tags = 'data,jumbled-order-exercise,main-order,segment'; - - $i = 0; - while ($value = $this->parent->xml_value($tags, "[$i]['#']")) { - $VALUE = strtoupper($value); - $key = array_search($VALUE, $VALUES); - if (is_numeric($key)) { - $segments[] = $key; - } else { - $segments[] = $i; - $values[$i] = $value; - $VALUES[$i] = $VALUE; - } - $i++; - } - - $this->seed_random_number_generator(); - $keys = array_keys($segments); - shuffle($keys); - - $str = ''; - for($i=0; $ijs_safe($values[$key], true)."';\n"; - $str .= "Segments[$i][1] = ".($key+1).";\n"; - $str .= "Segments[$i][2] = 0;\n"; - } - return $str; - } - function v6_expand_AnswerArray() { - - $segments = array(); - $values = array(); - $VALUES = array(); - $escapedvalues = array(); - - // XML tags to the start of a segment - $tags = 'data,jumbled-order-exercise,main-order,segment'; - - $i = 0; - while ($value = $this->parent->xml_value($tags, "[$i]['#']")) { - $VALUE = strtoupper($value); - $key = array_search($VALUE, $VALUES); - if (is_numeric($key)) { - $segments[] = $key+1; - } else { - $segments[] = $i+1; - $values[$i] = $value; - $VALUES[$i] = $VALUE; - $escapedvalues[] = preg_quote($value, '/'); - } - $i++; - } - - // start the answers array - $a = 0; - $str = 'Answers['.($a++).'] = new Array('.implode(',', $segments).");\n"; - - // pattern to match the next part of an alternate answer - $pattern = '/^('.implode('|', $escapedvalues).')\\s*/i'; - - // XML tags to the start of an alternate answer - $tags = 'data,jumbled-order-exercise,alternate'; - - $i = 0; - while ($value = $this->parent->xml_value($tags, "[$i]['#']")) { - $segments = array(); - while (strlen($value) && preg_match($pattern, $value, $matches)) { - $key = array_search($matches[1], $values); - if (is_numeric($key)) { - $segments[] = $key+1; - $value = substr($value, strlen($matches[0])); - } else { - // invalid alternate sequence - $segments = array(); - break; - } - } - if (count($segments)) { - $str .= 'Answers['.($a++).'] = new Array('.implode(',', $segments).");\n"; - } - $i++; - } - return $str; - } - - // =============================================================== - - // JMix (jmix6.js_) - - function v6_expand_RemainingWords() { - return $this->parent->xml_value('hotpot-config-file,'.$this->parent->quiztype.',remaining-words'); - } - function v6_expand_TimesUp() { - return $this->parent->xml_value('hotpot-config-file,global,times-up'); - } - - // nav bar - - function v6_expand_NavBar($navbarid='') { - $this->navbarid = $navbarid; - - $tag = 'navbar'; - $this->read_template('hp6navbar.ht_', $tag); - - unset($this->navbarid); - - return $this->$tag; - } - function v6_expand_TopNavBar() { - return $this->v6_expand_NavBar('TopNavBar'); - } - function v6_expand_BottomNavBar() { - return $this->v6_expand_NavBar('BottomNavBar'); - } - - // hp6navbar.ht_ - - function v6_expand_NavBarID() { - // $this->navbarid is set in "$this->v6_expand_NavBar" - return empty($this->navbarid) ? '' : $this->navbarid; - } - function v6_expand_ContentsURL() { - $url = $this->parent->xml_value('hotpot-config-file,global,contents-url'); - if ($url) { - $url = hotpot_convert_navbutton_url($this->parent->get_baseurl(), $this->parent->reference, $url, $this->parent->course); - } - return $url; - } - function v6_expand_NextExURL() { - $url = $this->parent->xml_value('hotpot-config-file,'.$this->parent->quiztype.',next-ex-url'); - if ($url) { - $url = hotpot_convert_navbutton_url($this->parent->get_baseurl(), $this->parent->reference, $url, $this->parent->course); - } - return $url; - } - - // conditional blocks - - function v6_expand_ShowAnswer() { - return $this->int_value('hotpot-config-file,'.$this->parent->quiztype.',include-show-answer'); - } - function v6_expand_Slide() { - return true; // whats's this (JMatch drag and drop) - } - - // specials (JMatch) - - function v6_expand_FixedArray() { - $l_items = array(); - $r_items = array(); - $this->get_jmatch_items($l_items, $r_items); - - $str = ''; - foreach ($l_items as $i=>$item) { - $str .= "F[$i] = new Array();\n"; - $str .= "F[$i][0] = '".$this->js_safe($item['text'][0]['#'], true)."';\n"; - $str .= "F[$i][1] = ".($i+1).";\n"; - } - return $str; - } - function v6_expand_DragArray() { - $l_items = array(); - $r_items = array(); - $this->get_jmatch_items($l_items, $r_items); - - $str = ''; - foreach ($r_items as $i=>$item) { - $str .= "D[$i] = new Array();\n"; - $str .= "D[$i][0] = '".$this->js_safe($item['text'][0]['#'], true)."';\n"; - $str .= "D[$i][1] = ".($i+1).";\n"; - $str .= "D[$i][2] = 0;\n"; - } - return $str; - } - - function get_jmatch_items(&$l_items, &$r_items) { - $tags = 'data,matching-exercise,pair'; - $i = 0; - while($item = $this->parent->xml_value($tags,"[$i]['#']['left-item'][0]['#']")) { - if (!empty($item['text'][0]['#'])) { - $l_items[] = $item; - } - $i++; - } - $i = 0; - while($item = $this->parent->xml_value($tags,"[$i]['#']['right-item'][0]['#']")) { - if (!empty($item['text'][0]['#'])) { - $r_items[] = $item; - } - $i++; - } - } - function shuffle_jmatch_items(&$items) { - // get moveable items - $moveable_keys = array(); - for($i=0; $iseed_random_number_generator(); - shuffle($moveable_keys); - - $keys = array(); - for($i=0, $ii=0; $iparent->quiztype) { - case 'jcloze': - $tags = 'data,gap-fill,question-record'; - while (($question="[$q]['#']") && $this->parent->xml_value($tags, $question)) { - $a = 0; - $aa = 0; - while (($answer=$question."['answer'][$a]['#']") && $this->parent->xml_value($tags, $answer)) { - $text = $this->js_value($tags, $answer."['text'][0]['#']", true); - if (strlen($text)) { - if ($aa==0) { // first time only - $str .= "\n"; - $str .= "I[$q] = new Array();\n"; - $str .= "I[$q][1] = new Array();\n"; - } - $str .= "I[$q][1][$aa] = new Array();\n"; - $str .= "I[$q][1][$aa][0] = '$text';\n"; - $aa++; - } - $a++; - } - // add clue, if any answers were found - if ($aa) { - $clue = $this->js_value($tags, $question."['clue'][0]['#']", true); - $str .= "I[$q][2] = '$clue';\n"; - } - $q++; - } - break; - case 'jquiz': - $str .= "I=new Array();\n"; - $tags = 'data,questions,question-record'; - while (($question="[$q]['#']") && $this->parent->xml_value($tags, $question)) { - - $question_type = $this->int_value($tags, $question."['question-type'][0]['#']"); - $weighting = $this->int_value($tags, $question."['weighting'][0]['#']"); - $clue = $this->js_value($tags, $question."['clue'][0]['#']", true); - - $answers = $question."['answers'][0]['#']"; - - $a = 0; - $aa = 0; - while (($answer = $answers."['answer'][$a]['#']") && $this->parent->xml_value($tags, $answer)) { - $text = $this->js_value($tags, $answer."['text'][0]['#']", true); - $feedback = $this->js_value($tags, $answer."['feedback'][0]['#']", true); - $correct = $this->int_value($tags, $answer."['correct'][0]['#']"); - $percent = $this->int_value($tags, $answer."['percent-correct'][0]['#']"); - $include = $this->int_value($tags, $answer."['include-in-mc-options'][0]['#']"); - if (strlen($text)) { - if ($aa==0) { // first time only - $str .= "\n"; - $str .= "I[$q] = new Array();\n"; - $str .= "I[$q][0] = $weighting;\n"; - $str .= "I[$q][1] = '$clue';\n"; - $str .= "I[$q][2] = '".($question_type-1)."';\n"; - $str .= "I[$q][3] = new Array();\n"; - } - $str .= "I[$q][3][$aa] = new Array('$text','$feedback',$correct,$percent,$include);\n"; - $aa++; - } - $a++; - } - $q++; - } - break; - } - return $str; - } - - function v6_expand_ClozeBody() { - $str = ''; - - // get drop down list of words, if required - $dropdownlist = ''; - if ($this->v6_use_DropDownList()) { - $this->v6_set_WordList(); - foreach ($this->wordlist as $word) { - $dropdownlist .= ''; - } - } - - // cache clues flag and caption - $includeclues = $this->v6_expand_Clues(); - $cluecaption = $this->v6_expand_ClueCaption(); - - // detect if cloze starts with gap - $strpos = strpos($this->parent->source, ''); - if (is_numeric($strpos)) { - $startwithgap = true; - } else { - $startwithgap = false; - } - - // initialize loop values - $q = 0; - $tags = 'data,gap-fill'; - $question_record = "$tags,question-record"; - - // loop through text and gaps - do { - $text = $this->parent->xml_value($tags, "[0]['#'][$q]"); - $gap = ''; - if (($question="[$q]['#']") && $this->parent->xml_value($question_record, $question)) { - $gap .= ''; - if ($this->v6_use_DropDownList()) { - $gap .= ''; - } else { - // minimum gap size - $gapsize = 6; - - // increase gap size to length of longest answer for this gap - $a = 0; - while (($answer=$question."['answer'][$a]['#']") && $this->parent->xml_value($question_record, $answer)) { - $answertext = $this->parent->xml_value($question_record, $answer."['text'][0]['#']"); - $answertext = preg_replace('|&[#a-zA-Z0-9]+;|', 'x', $answertext); - $gapsize = max($gapsize, strlen($answertext)); - $a++; - } - - $gap .= ''; - } - if ($includeclues) { - $clue = $this->parent->xml_value($question_record, $question."['clue'][0]['#']"); - if (strlen($clue)) { - $gap .= ''; - } - } - $gap .= ''; - } - if ($startwithgap) { - $str .= "$gap$text"; - } else { - $str .= "$text$gap"; - } - $q++; - } while (strlen($text) || strlen($gap)); - - return $str; - } - - // JCloze quiztype - - function v6_expand_WordList() { - $str = ''; - if ($this->v6_include_WordList()) { - $this->v6_set_WordList(); - $str = implode('    ', $this->wordlist); - } - return $str; - } - function v6_include_WordList() { - return $this->int_value('hotpot-config-file,'.$this->parent->quiztype.',include-word-list'); - } - function v6_use_DropDownList() { - return $this->int_value('hotpot-config-file,'.$this->parent->quiztype.',use-drop-down-list'); - } - function v6_set_WordList() { - - if (isset($this->wordlist)) { - // do nothing - } else { - $this->wordlist = array(); - - // is the wordlist required - if ($this->v6_include_WordList() || $this->v6_use_DropDownList()) { - - $q = 0; - $tags = 'data,gap-fill,question-record'; - while (($question="[$q]['#']") && $this->parent->xml_value($tags, $question)) { - $a = 0; - $aa = 0; - while (($answer=$question."['answer'][$a]['#']") && $this->parent->xml_value($tags, $answer)) { - $text = $this->parent->xml_value($tags, $answer."['text'][0]['#']"); - $correct = $this->int_value($tags, $answer."['correct'][0]['#']"); - if ($text && $correct) { // $correct is always true - $this->wordlist[] = $text; - $aa++; - } - $a++; - } - $q++; - } - $this->wordlist = array_unique($this->wordlist); - sort($this->wordlist); - } - } - } - function v6_expand_Keypad() { - $str = ''; - if ($this->int_value('hotpot-config-file,'.$this->parent->quiztype.',include-keypad')) { - - // these characters must always be in the keypad - $chars = array(); - $this->add_keypad_chars($chars, $this->parent->xml_value('hotpot-config-file,global,keypad-characters')); - - // append other characters used in the answers - $tags = ''; - switch ($this->parent->quiztype) { - case 'jcloze': - $tags = 'data,gap-fill,question-record'; - break; - case 'jquiz': - $tags = 'data,questions,question-record'; - break; - } - if ($tags) { - $q = 0; - while (($question="[$q]['#']") && $this->parent->xml_value($tags, $question)) { - - if ($this->parent->quiztype=='jquiz') { - $answers = $question."['answers'][0]['#']"; - } else { - $answers = $question; - } - - $a = 0; - while (($answer=$answers."['answer'][$a]['#']") && $this->parent->xml_value($tags, $answer)) { - $this->add_keypad_chars($chars, $this->parent->xml_value($tags, $answer."['text'][0]['#']")); - $a++; - } - $q++; - } - } - - // remove duplicate characters and sort - $chars = array_unique($chars); - usort($chars, "hotpot_sort_keypad_chars"); - - // create keypad buttons for each character - $str .= '
      '; - foreach ($chars as $char) { - $str .= ""; - } - $str .= '
      '; - } - return $str; - } - function add_keypad_chars(&$chars, $text) { - if (preg_match_all('|&[^;]+;|i', $text, $more_chars)) { - $chars = array_merge($chars, $more_chars[0]); - } - } - function v6_expand_Correct() { - return $this->js_value('hotpot-config-file,'.$this->parent->quiztype.',guesses-correct'); - } - function v6_expand_Incorrect() { - return $this->js_value('hotpot-config-file,'.$this->parent->quiztype.',guesses-incorrect'); - } - function v6_expand_GiveHint() { - return $this->js_value('hotpot-config-file,'.$this->parent->quiztype.',next-correct-letter'); - } - function v6_expand_CaseSensitive() { - return $this->bool_value('hotpot-config-file,'.$this->parent->quiztype.',case-sensitive'); - } - - // JCross quiztype - - function v6_expand_CluesAcrossLabel() { - return $this->js_value('hotpot-config-file,'.$this->parent->quiztype.',clues-across'); - } - function v6_expand_CluesDownLabel() { - return $this->js_value('hotpot-config-file,'.$this->parent->quiztype.',clues-down'); - } - function v6_expand_EnterCaption() { - return $this->js_value('hotpot-config-file,'.$this->parent->quiztype.',enter-caption'); - } - function v6_expand_ShowHideClueList() { - $value = $this->int_value('hotpot-config-file,'.$this->parent->quiztype.',include-clue-list'); - return empty($value) ? ' style="display: none;"' : ''; - } - - // JCross specials - - function v6_expand_CluesDown() { - return $this->v6_expand_jcross_clues('D'); - } - function v6_expand_CluesAcross() { - return $this->v6_expand_jcross_clues('A'); - } - function v6_expand_jcross_clues($direction) { - // $direction: A(cross) or D(own) - $row = NULL; - $r_max = 0; - $c_max = 0; - $this->v6_get_jcross_grid($row, $r_max, $c_max); - - $i = 0; // clue index; - $str = ''; - for($r=0; $r<=$r_max; $r++) { - for($c=0; $c<=$c_max; $c++) { - $aword = $this->get_jcross_aword($row, $r, $r_max, $c, $c_max); - $dword = $this->get_jcross_dword($row, $r, $r_max, $c, $c_max); - if ($aword || $dword) { - $i++; // increment clue index - - // get the definition for this word - $def = ''; - $word = ($direction=='A') ? $aword : $dword; - $clues = $this->parent->xml_values('data,crossword,clues,item'); - foreach ($clues as $clue) { - if ($clue['word'][0]['#']==$word) { - $def = $clue['def'][0]['#']; - $def = strtr($def, array('<'=>'<', '>'=>'>', "\n"=>'
      ')); - break; - } - } - - if (!empty($def)) { - $str .= ''.$i.'. '.$def.''; - } - } - } - } - return $str; - } - - // jcross6.js_ - - function v6_expand_LetterArray() { - $row = NULL; - $r_max = 0; - $c_max = 0; - $this->v6_get_jcross_grid($row, $r_max, $c_max); - - $str = ''; - for($r=0; $r<=$r_max; $r++) { - $str .= "L[$r] = new Array("; - for($c=0; $c<=$c_max; $c++) { - $str .= ($c>0 ? ',' : '')."'".$this->js_safe($row[$r]['cell'][$c]['#'], true)."'"; - } - $str .= ");\n"; - } - return $str; - } - function v6_expand_GuessArray() { - $row = NULL; - $r_max = 0; - $c_max = 0; - $this->v6_get_jcross_grid($row, $r_max, $c_max); - - $str = ''; - for($r=0; $r<=$r_max; $r++) { - $str .= "G[$r] = new Array('".str_repeat("','", $c_max)."');\n"; - } - return $str; - } - function v6_expand_ClueNumArray() { - $row = NULL; - $r_max = 0; - $c_max = 0; - $this->v6_get_jcross_grid($row, $r_max, $c_max); - - $i = 0; // clue index - $str = ''; - for($r=0; $r<=$r_max; $r++) { - $str .= "CL[$r] = new Array("; - for($c=0; $c<=$c_max; $c++) { - if ($c>0) { - $str .= ','; - } - $aword = $this->get_jcross_aword($row, $r, $r_max, $c, $c_max); - $dword = $this->get_jcross_dword($row, $r, $r_max, $c, $c_max); - if (empty($aword) && empty($dword)) { - $str .= 0; - } else { - $i++; // increment the clue index - $str .= $i; - } - } - $str .= ");\n"; - } - return $str; - } - function v6_expand_GridBody() { - $row = NULL; - $r_max = 0; - $c_max = 0; - $this->v6_get_jcross_grid($row, $r_max, $c_max); - - $i = 0; // clue index; - $str = ''; - for($r=0; $r<=$r_max; $r++) { - $str .= ''; - for($c=0; $c<=$c_max; $c++) { - if (empty($row[$r]['cell'][$c]['#'])) { - $str .= ' '; - } else { - $aword = $this->get_jcross_aword($row, $r, $r_max, $c, $c_max); - $dword = $this->get_jcross_dword($row, $r, $r_max, $c, $c_max); - if (empty($aword) && empty($dword)) { - $str .= ' '; - } else { - $i++; // increment clue index - $str .= ''.$i.'   '; - } - } - } - $str .= ''; - } - return $str; - } - function v6_get_jcross_grid(&$row, &$r_max, &$c_max) { - $row = $this->parent->xml_values('data,crossword,grid,row'); - $r_max = 0; - $c_max = 0; - if (isset($row) && is_array($row)) { - for($r=0; $rget_jcross_word($row, $r, $r_max, $c, $c_max, true); - } - return $str; - } - function get_jcross_aword(&$row, $r, $r_max, $c, $c_max) { - $str = ''; - if (($c==0 || empty($row[$r]['cell'][$c-1]['#'])) && $c<$c_max && !empty($row[$r]['cell'][$c+1]['#'])) { - $str = $this->get_jcross_word($row, $r, $r_max, $c, $c_max, false); - } - return $str; - } - function get_jcross_word(&$row, $r, $r_max, $c, $c_max, $go_down=false) { - $str = ''; - while ($r<=$r_max && $c<=$c_max && !empty($row[$r]['cell'][$c]['#'])) { - $str .= $row[$r]['cell'][$c]['#']; - if ($go_down) { - $r++; - } else { - $c++; - } - } - return $str; - } - - // specials (JQuiz) - - function v6_expand_QuestionOutput() { - $str = ''; - $str .= '
        '."\n"; - - $q = 0; - $tags = 'data,questions,question-record'; - while (($question="[$q]['#']") && $this->parent->xml_value($tags, $question)) { - - // get question - $question_text = $this->parent->xml_value($tags, $question."['question'][0]['#']"); - $question_type = $this->parent->xml_value($tags, $question."['question-type'][0]['#']"); - - // check we have a question - if ($question_text && $question_type) { - - $str .= '
      '; - } 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); - -?> - +id, "scorm", "view all", "index.php?id=$course->id", ""); + + $strscorm = get_string("modulename", "scorm"); + $strscorms = get_string("modulenameplural", "scorm"); + $strweek = get_string("week"); + $strtopic = get_string("topic"); + $strname = get_string("name"); + $strsummary = get_string("summary"); + $strreport = get_string("report",'scorm'); + $strlastmodified = get_string("lastmodified"); + + print_header_simple("$strscorms", "", "$strscorms", + "", "", true, "", navmenu($course)); + + if ($course->format == "weeks" or $course->format == "topics") { + $sortorder = "cw.section ASC"; + } else { + $sortorder = "m.timemodified DESC"; + } + + if (! $scorms = get_all_instances_in_course("scorm", $course)) { + notice("There are no scorms", "../../course/view.php?id=$course->id"); + exit; + } + + if ($course->format == "weeks") { + $table->head = array ($strweek, $strname, $strsummary, $strreport); + $table->align = array ("center", "left", "left", "left"); + } else if ($course->format == "topics") { + $table->head = array ($strtopic, $strname, $strsummary, $strreport); + $table->align = array ("center", "left", "left", "left"); + } else { + $table->head = array ($strlastmodified, $strname, $strsummary, $strreport); + $table->align = array ("left", "left", "left", "left"); + } + + foreach ($scorms as $scorm) { + + $context = get_context_instance(CONTEXT_MODULE,$scorm->coursemodule); + $tt = ""; + if ($course->format == "weeks" or $course->format == "topics") { + if ($scorm->section) { + $tt = "$scorm->section"; + } + } else { + $tt = userdate($scorm->timemodified); + } + $report = ' '; + if (has_capability('mod/scorm:viewreport', $context)) { + $trackedusers = get_record('scorm_scoes_track', 'scormid', $scorm->id, '', '', '', '', 'count(distinct(userid)) as c'); + if ($trackedusers->c > 0) { + $reportshow = ''.get_string('viewallreports','scorm',$trackedusers->c).'
      '; + } 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'); -?> - - - - -
      - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
      : - -
      :
      - -
      - summary); ?> -
      - : - -   - id.'&choose=form.reference', - 'coursefiles', $strchooseafile, 500, 750, $strchooseafile); - require_once($repositoryconfigfile); - if ($CFG->repositoryactivate) { - button_to_popup_window ($repositorybrowser.'?choose=form.reference', - 'browserepository', $strbrowserepository, 500, 750, $strbrowserepository); - } - helpbutton('package', get_string('coursepacket', 'scorm'), 'scorm', true); - ?> -
      : - grademethod, '','checkscormform(this,0,document.form.maxgrade);'); - helpbutton('grademethod', get_string('grademethod','scorm'), 'scorm'); - ?> -
      : - =1; $i--) { - $grades[$i] = $i; - } - $disabled = $form->grademethod=='0'; - choose_from_menu($grades, 'maxgrade', (int) $form->maxgrade, '','','0',false,$disabled); - helpbutton('maxgrade', get_string('maximumgrade'), 'scorm'); - ?> -
      : - scorm_maxattempts; $i++) { - if ($i == 1) { - $attempts[$i] = $i . ' ' . get_string('attempt','scorm'); - } else { - $attempts[$i] = $i . ' ' . get_string('attempts','scorm'); - } - } - choose_from_menu($attempts, 'maxattempt', (int) $form->maxattempt, get_string('nolimit','scorm'),'checkscormform(this,1,document.form.whatgrade);'); - helpbutton('maxattempt', get_string('maximumattempts','scorm'), 'scorm'); - ?> -
      : - maxattempt === 1; - choose_from_menu($SCORM_WHAT_GRADE, 'whatgrade', (int) $form->whatgrade, '','','0',false,$disabled); - helpbutton('whatgrade', get_string('whatgrade','scorm'), 'scorm'); - ?> -

      : - - - -
      -
      - - - - - - - - - - - - - - - - - -
      : - auto,''); - helpbutton('autocontinue', get_string('autocontinue','scorm'), 'scorm', true); - ?> -
      : - hidebrowse, ''); - helpbutton('browsemode', get_string('hidebrowse','scorm'), 'scorm', true); - ?> -
      : - hidetoc, ''); - ?> -
      : - hidenav, ''); - ?> -
      -
      -
      : - - - -
      -
      - - - - - - - - - - -
      - -
      - -
      - - -
      - -
      :
      - popup == 0) ? "checked=\"checked\"" : "" ?> - onclick="return lockoptions('form', 'popup[1]', popupitems);" - /> - -
      - popup == 1) ? 'checked="checked"' : '' ?> - onclick="return lockoptions('form', 'popup[1]', popupitems);" - /> - -
      - $value) { - echo "\n"; - echo "$name." alt=\"$name\" />\n"; - $stringname = "str$name"; - echo $$stringname."
      \n"; - } - ?> - -
      -
      -
      - -
      - - - - - format == 'scorm') && ((count($scorms) == 0) || ($form->instance == $coursescorm->id))) { - ?> - - - - - - - - - - - -
      - - -
      -
      +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'); +?> + + + + +
      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      : + +
      :
      + +
      + summary); ?> +
      + : + +   + id.'&choose=form.reference', + 'coursefiles', $strchooseafile, 500, 750, $strchooseafile); + require_once($repositoryconfigfile); + if ($CFG->repositoryactivate) { + button_to_popup_window ($repositorybrowser.'?choose=form.reference', + 'browserepository', $strbrowserepository, 500, 750, $strbrowserepository); + } + helpbutton('package', get_string('coursepacket', 'scorm'), 'scorm', true); + ?> +
      : + grademethod, '','checkscormform(this,0,document.form.maxgrade);'); + helpbutton('grademethod', get_string('grademethod','scorm'), 'scorm'); + ?> +
      : + =1; $i--) { + $grades[$i] = $i; + } + $disabled = $form->grademethod=='0'; + choose_from_menu($grades, 'maxgrade', (int) $form->maxgrade, '','','0',false,$disabled); + helpbutton('maxgrade', get_string('maximumgrade'), 'scorm'); + ?> +
      : + scorm_maxattempts; $i++) { + if ($i == 1) { + $attempts[$i] = $i . ' ' . get_string('attempt','scorm'); + } else { + $attempts[$i] = $i . ' ' . get_string('attempts','scorm'); + } + } + choose_from_menu($attempts, 'maxattempt', (int) $form->maxattempt, get_string('nolimit','scorm'),'checkscormform(this,1,document.form.whatgrade);'); + helpbutton('maxattempt', get_string('maximumattempts','scorm'), 'scorm'); + ?> +
      : + maxattempt === 1; + choose_from_menu($SCORM_WHAT_GRADE, 'whatgrade', (int) $form->whatgrade, '','','0',false,$disabled); + helpbutton('whatgrade', get_string('whatgrade','scorm'), 'scorm'); + ?> +

      : + + + +
      +
      + + + + + + + + + + + + + + + + + +
      : + auto,''); + helpbutton('autocontinue', get_string('autocontinue','scorm'), 'scorm', true); + ?> +
      : + hidebrowse, ''); + helpbutton('browsemode', get_string('hidebrowse','scorm'), 'scorm', true); + ?> +
      : + hidetoc, ''); + ?> +
      : + hidenav, ''); + ?> +
      +
      +
      : + + + +
      +
      + + + + + + + + + + +
      + +
      + +
      + + +
      + +
      :
      + popup == 0) ? "checked=\"checked\"" : "" ?> + onclick="return lockoptions('form', 'popup[1]', popupitems);" + /> + +
      + popup == 1) ? 'checked="checked"' : '' ?> + onclick="return lockoptions('form', 'popup[1]', popupitems);" + /> + +
      + $value) { + echo "\n"; + echo "$name." alt=\"$name\" />\n"; + $stringname = "str$name"; + echo $$stringname."
      \n"; + } + ?> + +
      +
      +
      + +
      + + + + + format == 'scorm') && ((count($scorms) == 0) || ($form->instance == $coursescorm->id))) { + ?> + + + + + + + + + + + +
      + + +
      +
      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 ''; - - print ""; - 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.
      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 "
      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 '
        • '; - if ($choice == $correct_responses->{$subq->ident}) { - print ''; - } - else { - print ''; - } - print $quest->RIGHT_MATCH_BLOCK->matching_answerset[$id]->text.'
        • '; - } - print '
        '; - } - print '
      Feedback:
        '; - foreach($quest->feedback as $fb) { - print '
      • '.$fb->ident.': '.$fb->text.'
      • '; - } - 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 ''; + + print ""; + 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.
      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 "
      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 '
        • '; + if ($choice == $correct_responses->{$subq->ident}) { + print ''; + } + else { + print ''; + } + print $quest->RIGHT_MATCH_BLOCK->matching_answerset[$id]->text.'
        • '; + } + print '
        '; + } + print '
      Feedback:
        '; + foreach($quest->feedback as $fb) { + print '
      • '.$fb->ident.': '.$fb->text.'
      • '; + } + 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 +?> diff --git a/question/format/learnwise/learnwise-example.xml b/question/format/learnwise/learnwise-example.xml index ec82e58960..2752495790 100644 --- a/question/format/learnwise/learnwise-example.xml +++ b/question/format/learnwise/learnwise-example.xml @@ -1,145 +1,145 @@ - - - Maths - - - The ages, in years, of 10 horses in a field were 3, 3, 4, 5, 7, 7, 7, 8, 8, 8,<p> -Which one of the following is true? - 1 - mean = (3+3+4+5+7+7+7+8+8+8)/10 = 6<p> -median = 7 i.e the middle number<p> -range = 8-3 = 5 - - - - - - - - - At a college, students are given a points score calculated from their GCSE grades.<p> -Someone with 4 A grades and 4 B grades gains a score of 36 points.<br>Someone with 2 A grades and 4 B grades gains a score of 26 points.<br>Someone with 3 A grades and 3 B grades would have a score of - 1 - 4A + 4B = 36 and 2A + 4B = 26<p>solving simultaneously gives A = 5 and B = 4 - - - - - - - - - A sequence consists of adding the previous three terms together to form the next term. The first three terms of the sequence are 1, 2, 3.<p> -What is the sixth term in the sequence? - 1 - 1, 2, 3, 6, 11, ... - - - - - - - - - The value of an item is described as decreasing exponentially. Which description below best matches this statement? - 1 - No hint - you either know this or you don't! - - - - - - - - - Consider the statement<p> -"Schools with high numbers of pupils on free school meals do not do well in league tables."<p> -Which of the following statements follows logically from the one above? - 1 - Factors other than the number of pupils on free school meals affect how well a school does in league tables. - - - - - - - - - The force between two point electric charges is inversely proportional to the square of their distance apart. What effect does doubling this distance have on the force? - 1 - Inversely proportional means that increasing the distance decreases the force.<br>2 squared gives 4. - - - - - - - - - Two of the five playing cards that Colin has are aces. He shuffles the five cards, then puts them face down on the table. Madge takes a card and then another. The probability that she now has <b>both</b> of the aces is - 1 - 2/5 x 1/4 - - - - - - - - - A college's guidelines say that classes must have a minimum of 12 students and a maximum of 20 students. For what numbers of students studying a particular subject is it impossible to run classes without breaking the guidelines? - 1 - between 12 and 20 students - one class<br> -between 24 and 36 students - two classes<br> -between 36 and 40 students - two classes - - - - - - - - - The ages of two friends are in the ratio 3:4. In 8 years time their ages will be in the ratio 5:6. How old are they now? - 1 - (12+8):(16+8) = 20:24 = 5:6 - - - - - - - - - A heavy construction vehicle travels for 40 minutes between sites, at an average speed of 16 km per second. The distance between sites is - 1 - 16/60 x 40 - - - - - - - - - Which of the following are features of a Virtual Learning Environment? (Select all that apply) - - - - - - - - - - - Which of the following may a Virtual Learning Environment be used for? (Select all that apply) - - - - - - - - - + + + Maths + + + The ages, in years, of 10 horses in a field were 3, 3, 4, 5, 7, 7, 7, 8, 8, 8,<p> +Which one of the following is true? + 1 + mean = (3+3+4+5+7+7+7+8+8+8)/10 = 6<p> +median = 7 i.e the middle number<p> +range = 8-3 = 5 + + + + + + + + + At a college, students are given a points score calculated from their GCSE grades.<p> +Someone with 4 A grades and 4 B grades gains a score of 36 points.<br>Someone with 2 A grades and 4 B grades gains a score of 26 points.<br>Someone with 3 A grades and 3 B grades would have a score of + 1 + 4A + 4B = 36 and 2A + 4B = 26<p>solving simultaneously gives A = 5 and B = 4 + + + + + + + + + A sequence consists of adding the previous three terms together to form the next term. The first three terms of the sequence are 1, 2, 3.<p> +What is the sixth term in the sequence? + 1 + 1, 2, 3, 6, 11, ... + + + + + + + + + The value of an item is described as decreasing exponentially. Which description below best matches this statement? + 1 + No hint - you either know this or you don't! + + + + + + + + + Consider the statement<p> +"Schools with high numbers of pupils on free school meals do not do well in league tables."<p> +Which of the following statements follows logically from the one above? + 1 + Factors other than the number of pupils on free school meals affect how well a school does in league tables. + + + + + + + + + The force between two point electric charges is inversely proportional to the square of their distance apart. What effect does doubling this distance have on the force? + 1 + Inversely proportional means that increasing the distance decreases the force.<br>2 squared gives 4. + + + + + + + + + Two of the five playing cards that Colin has are aces. He shuffles the five cards, then puts them face down on the table. Madge takes a card and then another. The probability that she now has <b>both</b> of the aces is + 1 + 2/5 x 1/4 + + + + + + + + + A college's guidelines say that classes must have a minimum of 12 students and a maximum of 20 students. For what numbers of students studying a particular subject is it impossible to run classes without breaking the guidelines? + 1 + between 12 and 20 students - one class<br> +between 24 and 36 students - two classes<br> +between 36 and 40 students - two classes + + + + + + + + + The ages of two friends are in the ratio 3:4. In 8 years time their ages will be in the ratio 5:6. How old are they now? + 1 + (12+8):(16+8) = 20:24 = 5:6 + + + + + + + + + A heavy construction vehicle travels for 40 minutes between sites, at an average speed of 16 km per second. The distance between sites is + 1 + 16/60 x 40 + + + + + + + + + Which of the following are features of a Virtual Learning Environment? (Select all that apply) + + + + + + + + + + + Which of the following may a Virtual Learning Environment be used for? (Select all that apply) + + + + + + + + + diff --git a/question/format/webct/TODO.txt b/question/format/webct/TODO.txt index c095ac7f5a..6471b6b491 100644 --- a/question/format/webct/TODO.txt +++ b/question/format/webct/TODO.txt @@ -1,7 +1,7 @@ -- Ajouter un espace après un symbole <= s'il préfixe une parenthèse ouvrante. -- Gérer 'and', 'or', ... comme &&, || -- Ne pas mettre de '$' sur les @param si aucun nom de variable n'esp spécifié. -- Ajouter OneTrueBrace pour les if, while, for, else ... (Gustavo Carreno , Richard Bateman , Yaroslav Shvetsov , Chris Small ) -- Remove blank lines (Sergio Marchesini ) -- Forcer une ligne vide après une déclaration de fonction (Richard Bateman ) - +- Ajouter un espace apr�s un symbole <= s'il pr�fixe une parenth�se ouvrante. +- G�rer 'and', 'or', ... comme &&, || +- Ne pas mettre de '$' sur les @param si aucun nom de variable n'esp sp�cifi�. +- Ajouter OneTrueBrace pour les if, while, for, else ... (Gustavo Carreno , Richard Bateman , Yaroslav Shvetsov , Chris Small ) +- Remove blank lines (Sergio Marchesini ) +- Forcer une ligne vide apr�s une d�claration de fonction (Richard Bateman ) + diff --git a/sso/hive/expired.php b/sso/hive/expired.php index 31dcfe3fa4..af4c20105f 100644 --- a/sso/hive/expired.php +++ b/sso/hive/expired.php @@ -1,47 +1,47 @@ - -
      - - - - - -
      - - - - - - - - - -
      - : - - " /> -
      - : - - " /> -
      -
      - " /> -
      -
      -
      - + +
      + + + + + +
      + + + + + + + + + +
      + : + + " /> +
      + : + + " /> +
      +
      + " /> +
      +
      +
      + diff --git a/sso/hive/lib.php b/sso/hive/lib.php index 90c123d0c9..758d603d84 100755 --- a/sso/hive/lib.php +++ b/sso/hive/lib.php @@ -1,79 +1,79 @@ -sso = 'hive'; - // $CFG->hiveprotocol = 'http'; - // $CFG->hiveport = '80'; - // $CFG->hivehost = 'turkey.harvestroad.com.au'; - // $CFG->hivepath = '/cgi-bin/hive/hive.cgi'; - // $CFG->hivecbid = '28'; - -function sso_user_login($username, $password) { - - global $CFG, $SESSION; - - include($CFG->libdir.'/snoopy/Snoopy.class.inc'); - - if (empty($CFG->hivehost)) { - return false; // Hive config variables not configured yet - } - -/// Set up Snoopy - - $snoopy = new Snoopy; - - $submit_url = $CFG->hiveprotocol .'://'. $CFG->hivehost .':'. $CFG->hiveport .''. $CFG->hivepath ; - - $submit_vars['HIVE_UNAME'] = $username; - $submit_vars['HIVE_UPASS'] = $password; - $submit_vars['HIVE_ENDUSER']= $username; - $submit_vars['HIVE_REQ'] = '2112'; - $submit_vars['HIVE_REF'] = 'hin:hive@API Login 3'; - $submit_vars['HIVE_RET'] = 'ORG'; - $submit_vars['HIVE_REM'] = ''; - $submit_vars['HIVE_PROD'] = '0'; - $submit_vars['HIVE_USERIP'] = getremoteaddr(); - - -/// We use POST to call Hive with a bit more security - $snoopy->submit($submit_url,$submit_vars); - -/// Extract HIVE_SESSION from headers - - foreach ($snoopy->headers as $header) { - if (strpos($header, 'HIVE_SESSION=') !== false) { - $header = explode('HIVE_SESSION=', $header); - if (count($header) > 1) { - $cookie = explode(';', $header[1]); - $cookie = $cookie[0]; - $SESSION->HIVE_SESSION = $cookie; - return true; - } - } - } - -/// Try again with the guest username and password - - $submit_vars['HIVE_UNAME'] = $CFG->hiveusername; - $submit_vars['HIVE_UPASS'] = $CFG->hivepassword; - $submit_vars['HIVE_ENDUSER']= $CFG->hiveusername; - $snoopy->submit($submit_url,$submit_vars); - foreach ($snoopy->headers as $header) { - if (strpos($header, 'HIVE_SESSION=') !== false) { - $header = explode('HIVE_SESSION=', $header); - if (count($header) > 1) { - $cookie = explode(';', $header[1]); - $cookie = $cookie[0]; - $SESSION->HIVE_SESSION = $cookie; - return true; - } - } - } - - return false; // No cookie found -} - -?> +sso = 'hive'; + // $CFG->hiveprotocol = 'http'; + // $CFG->hiveport = '80'; + // $CFG->hivehost = 'turkey.harvestroad.com.au'; + // $CFG->hivepath = '/cgi-bin/hive/hive.cgi'; + // $CFG->hivecbid = '28'; + +function sso_user_login($username, $password) { + + global $CFG, $SESSION; + + include($CFG->libdir.'/snoopy/Snoopy.class.inc'); + + if (empty($CFG->hivehost)) { + return false; // Hive config variables not configured yet + } + +/// Set up Snoopy + + $snoopy = new Snoopy; + + $submit_url = $CFG->hiveprotocol .'://'. $CFG->hivehost .':'. $CFG->hiveport .''. $CFG->hivepath ; + + $submit_vars['HIVE_UNAME'] = $username; + $submit_vars['HIVE_UPASS'] = $password; + $submit_vars['HIVE_ENDUSER']= $username; + $submit_vars['HIVE_REQ'] = '2112'; + $submit_vars['HIVE_REF'] = 'hin:hive@API Login 3'; + $submit_vars['HIVE_RET'] = 'ORG'; + $submit_vars['HIVE_REM'] = ''; + $submit_vars['HIVE_PROD'] = '0'; + $submit_vars['HIVE_USERIP'] = getremoteaddr(); + + +/// We use POST to call Hive with a bit more security + $snoopy->submit($submit_url,$submit_vars); + +/// Extract HIVE_SESSION from headers + + foreach ($snoopy->headers as $header) { + if (strpos($header, 'HIVE_SESSION=') !== false) { + $header = explode('HIVE_SESSION=', $header); + if (count($header) > 1) { + $cookie = explode(';', $header[1]); + $cookie = $cookie[0]; + $SESSION->HIVE_SESSION = $cookie; + return true; + } + } + } + +/// Try again with the guest username and password + + $submit_vars['HIVE_UNAME'] = $CFG->hiveusername; + $submit_vars['HIVE_UPASS'] = $CFG->hivepassword; + $submit_vars['HIVE_ENDUSER']= $CFG->hiveusername; + $snoopy->submit($submit_url,$submit_vars); + foreach ($snoopy->headers as $header) { + if (strpos($header, 'HIVE_SESSION=') !== false) { + $header = explode('HIVE_SESSION=', $header); + if (count($header) > 1) { + $cookie = explode(';', $header[1]); + $cookie = $cookie[0]; + $SESSION->HIVE_SESSION = $cookie; + return true; + } + } + } + + return false; // No cookie found +} + +?> diff --git a/sso/hive/login.php b/sso/hive/login.php index cc83319ed3..5bd14c3866 100644 --- a/sso/hive/login.php +++ b/sso/hive/login.php @@ -1,23 +1,23 @@ -username, $frm->password)) { - - /// reopen Hive - redirect($CFG->wwwroot.'/mod/resource/type/repository/hive/openlitebrowse.php'); - } else { - redirect($CFG->wwwroot.'/sso/hive/expired.php'); - } - -?> - +username, $frm->password)) { + + /// reopen Hive + redirect($CFG->wwwroot.'/mod/resource/type/repository/hive/openlitebrowse.php'); + } else { + redirect($CFG->wwwroot.'/sso/hive/expired.php'); + } + +?> + diff --git a/theme/chameleon/pix/mod/README.txt b/theme/chameleon/pix/mod/README.txt index 5d28268194..5e54d21397 100644 --- a/theme/chameleon/pix/mod/README.txt +++ b/theme/chameleon/pix/mod/README.txt @@ -1,42 +1,42 @@ -ACTIVITY MODULES ----------------- - -These are main modules in Moodle, allowing various activities. - - -Each of these modules contains a number of expected components: - - mod.html: a form to setup/update a module instance - - version.php: defines some meta-info and provides upgrading code - - icon.gif: a 16x16 icon for the module - - db/mysql.sql: an SQL dump of all the required db tables and data - - index.php: a page to list all instances in a course - - view.php: a page to view a particular instance - - lib.php: any/all functions defined by the module should be in here. - constants should be defined using MODULENAME_xxxxxx - functions should be defined using modulename_xxxxxx - - There are a number of standard functions: - - modulename_add_instance() - modulename_update_instance() - modulename_delete_instance() - - modulename_user_complete() - modulename_user_outline() - - modulename_cron() - - modulename_print_recent_activity() - - -If you are a developer and interested in developing new Modules see: - - Moodle Documentation: http://moodle.org/doc - Moodle Community: http://moodle.org/community +ACTIVITY MODULES +---------------- + +These are main modules in Moodle, allowing various activities. + + +Each of these modules contains a number of expected components: + + mod.html: a form to setup/update a module instance + + version.php: defines some meta-info and provides upgrading code + + icon.gif: a 16x16 icon for the module + + db/mysql.sql: an SQL dump of all the required db tables and data + + index.php: a page to list all instances in a course + + view.php: a page to view a particular instance + + lib.php: any/all functions defined by the module should be in here. + constants should be defined using MODULENAME_xxxxxx + functions should be defined using modulename_xxxxxx + + There are a number of standard functions: + + modulename_add_instance() + modulename_update_instance() + modulename_delete_instance() + + modulename_user_complete() + modulename_user_outline() + + modulename_cron() + + modulename_print_recent_activity() + + +If you are a developer and interested in developing new Modules see: + + Moodle Documentation: http://moodle.org/doc + Moodle Community: http://moodle.org/community diff --git a/theme/chameleon/ui/css_query.js b/theme/chameleon/ui/css_query.js index 1fcab4a10e..7a6efee85b 100644 --- a/theme/chameleon/ui/css_query.js +++ b/theme/chameleon/ui/css_query.js @@ -1,356 +1,356 @@ -/* - cssQuery, version 2.0.2 (2005-08-19) - Copyright: 2004-2005, Dean Edwards (http://dean.edwards.name/) - License: http://creativecommons.org/licenses/LGPL/2.1/ -*/ - -// the following functions allow querying of the DOM using CSS selectors -var cssQuery = function() { -var version = "2.0.2"; - -// ----------------------------------------------------------------------- -// main query function -// ----------------------------------------------------------------------- - -var $COMMA = /\s*,\s*/; -var cssQuery = function($selector, $$from) { -try { - var $match = []; - var $useCache = arguments.callee.caching && !$$from; - var $base = ($$from) ? ($$from.constructor == Array) ? $$from : [$$from] : [document]; - // process comma separated selectors - var $$selectors = parseSelector($selector).split($COMMA), i; - for (i = 0; i < $$selectors.length; i++) { - // convert the selector to a stream - $selector = _toStream($$selectors[i]); - // faster chop if it starts with id (MSIE only) - if (isMSIE && $selector.slice(0, 3).join("") == " *#") { - $selector = $selector.slice(2); - $$from = _msie_selectById([], $base, $selector[1]); - } else $$from = $base; - // process the stream - var j = 0, $token, $filter, $arguments, $cacheSelector = ""; - while (j < $selector.length) { - $token = $selector[j++]; - $filter = $selector[j++]; - $cacheSelector += $token + $filter; - // some pseudo-classes allow arguments to be passed - // e.g. nth-child(even) - $arguments = ""; - if ($selector[j] == "(") { - while ($selector[j++] != ")" && j < $selector.length) { - $arguments += $selector[j]; - } - $arguments = $arguments.slice(0, -1); - $cacheSelector += "(" + $arguments + ")"; - } - // process a token/filter pair use cached results if possible - $$from = ($useCache && cache[$cacheSelector]) ? - cache[$cacheSelector] : select($$from, $token, $filter, $arguments); - if ($useCache) cache[$cacheSelector] = $$from; - } - $match = $match.concat($$from); - } - delete cssQuery.error; - return $match; -} catch ($error) { - cssQuery.error = $error; - return []; -}}; - -// ----------------------------------------------------------------------- -// public interface -// ----------------------------------------------------------------------- - -cssQuery.toString = function() { - return "function cssQuery() {\n [version " + version + "]\n}"; -}; - -// caching -var cache = {}; -cssQuery.caching = false; -cssQuery.clearCache = function($selector) { - if ($selector) { - $selector = _toStream($selector).join(""); - delete cache[$selector]; - } else cache = {}; -}; - -// allow extensions -var modules = {}; -var loaded = false; -cssQuery.addModule = function($name, $script) { - if (loaded) eval("$script=" + String($script)); - modules[$name] = new $script();; -}; - -// hackery -cssQuery.valueOf = function($code) { - return $code ? eval($code) : this; -}; - -// ----------------------------------------------------------------------- -// declarations -// ----------------------------------------------------------------------- - -var selectors = {}; -var pseudoClasses = {}; -// a safari bug means that these have to be declared here -var AttributeSelector = {match: /\[([\w-]+(\|[\w-]+)?)\s*(\W?=)?\s*([^\]]*)\]/}; -var attributeSelectors = []; - -// ----------------------------------------------------------------------- -// selectors -// ----------------------------------------------------------------------- - -// descendant selector -selectors[" "] = function($results, $from, $tagName, $namespace) { - // loop through current selection - var $element, i, j; - for (i = 0; i < $from.length; i++) { - // get descendants - var $subset = getElementsByTagName($from[i], $tagName, $namespace); - // loop through descendants and add to results selection - for (j = 0; ($element = $subset[j]); j++) { - if (thisElement($element) && compareNamespace($element, $namespace)) - $results.push($element); - } - } -}; - -// ID selector -selectors["#"] = function($results, $from, $id) { - // loop through current selection and check ID - var $element, j; - for (j = 0; ($element = $from[j]); j++) if ($element.id == $id) $results.push($element); -}; - -// class selector -selectors["."] = function($results, $from, $className) { - // create a RegExp version of the class - $className = new RegExp("(^|\\s)" + $className + "(\\s|$)"); - // loop through current selection and check class - var $element, i; - for (i = 0; ($element = $from[i]); i++) - if ($className.test($element.className)) $results.push($element); -}; - -// pseudo-class selector -selectors[":"] = function($results, $from, $pseudoClass, $arguments) { - // retrieve the cssQuery pseudo-class function - var $test = pseudoClasses[$pseudoClass], $element, i; - // loop through current selection and apply pseudo-class filter - if ($test) for (i = 0; ($element = $from[i]); i++) - // if the cssQuery pseudo-class function returns "true" add the element - if ($test($element, $arguments)) $results.push($element); -}; - -// ----------------------------------------------------------------------- -// pseudo-classes -// ----------------------------------------------------------------------- - -pseudoClasses["link"] = function($element) { - var $document = getDocument($element); - if ($document.links) for (var i = 0; i < $document.links.length; i++) { - if ($document.links[i] == $element) return true; - } -}; - -pseudoClasses["visited"] = function($element) { - // can't do this without jiggery-pokery -}; - -// ----------------------------------------------------------------------- -// DOM traversal -// ----------------------------------------------------------------------- - -// IE5/6 includes comments (LOL) in it's elements collections. -// so we have to check for this. the test is tagName != "!". LOL (again). -var thisElement = function($element) { - return ($element && $element.nodeType == 1 && $element.tagName != "!") ? $element : null; -}; - -// return the previous element to the supplied element -// previousSibling is not good enough as it might return a text or comment node -var previousElementSibling = function($element) { - while ($element && ($element = $element.previousSibling) && !thisElement($element)) continue; - return $element; -}; - -// return the next element to the supplied element -var nextElementSibling = function($element) { - while ($element && ($element = $element.nextSibling) && !thisElement($element)) continue; - return $element; -}; - -// return the first child ELEMENT of an element -// NOT the first child node (though they may be the same thing) -var firstElementChild = function($element) { - return thisElement($element.firstChild) || nextElementSibling($element.firstChild); -}; - -var lastElementChild = function($element) { - return thisElement($element.lastChild) || previousElementSibling($element.lastChild); -}; - -// return child elements of an element (not child nodes) -var childElements = function($element) { - var $childElements = []; - $element = firstElementChild($element); - while ($element) { - $childElements.push($element); - $element = nextElementSibling($element); - } - return $childElements; -}; - -// ----------------------------------------------------------------------- -// browser compatibility -// ----------------------------------------------------------------------- - -// all of the functions in this section can be overwritten. the default -// configuration is for IE. The functions below reflect this. standard -// methods are included in a separate module. It would probably be better -// the other way round of course but this makes it easier to keep IE7 trim. - -var isMSIE = true; - -var isXML = function($element) { - var $document = getDocument($element); - return (typeof $document.mimeType == "unknown") ? - /\.xml$/i.test($document.URL) : - Boolean($document.mimeType == "XML Document"); -}; - -// return the element's containing document -var getDocument = function($element) { - return $element.ownerDocument || $element.document; -}; - -var getElementsByTagName = function($element, $tagName) { - return ($tagName == "*" && $element.all) ? $element.all : $element.getElementsByTagName($tagName); -}; - -var compareTagName = function($element, $tagName, $namespace) { - if ($tagName == "*") return thisElement($element); - if (!compareNamespace($element, $namespace)) return false; - if (!isXML($element)) $tagName = $tagName.toUpperCase(); - return $element.tagName == $tagName; -}; - -var compareNamespace = function($element, $namespace) { - return !$namespace || ($namespace == "*") || ($element.scopeName == $namespace); -}; - -var getTextContent = function($element) { - return $element.innerText; -}; - -function _msie_selectById($results, $from, id) { - var $match, i, j; - for (i = 0; i < $from.length; i++) { - if ($match = $from[i].all.item(id)) { - if ($match.id == id) $results.push($match); - else if ($match.length != null) { - for (j = 0; j < $match.length; j++) { - if ($match[j].id == id) $results.push($match[j]); - } - } - } - } - return $results; -}; - -// for IE5.0 -if (![].push) Array.prototype.push = function() { - for (var i = 0; i < arguments.length; i++) { - this[this.length] = arguments[i]; - } - return this.length; -}; - -// ----------------------------------------------------------------------- -// query support -// ----------------------------------------------------------------------- - -// select a set of matching elements. -// "from" is an array of elements. -// "token" is a character representing the type of filter -// e.g. ">" means child selector -// "filter" represents the tag name, id or class name that is being selected -// the function returns an array of matching elements -var $NAMESPACE = /\|/; -function select($$from, $token, $filter, $arguments) { - if ($NAMESPACE.test($filter)) { - $filter = $filter.split($NAMESPACE); - $arguments = $filter[0]; - $filter = $filter[1]; - } - var $results = []; - if (selectors[$token]) { - selectors[$token]($results, $$from, $filter, $arguments); - } - return $results; -}; - -// ----------------------------------------------------------------------- -// parsing -// ----------------------------------------------------------------------- - -// convert css selectors to a stream of tokens and filters -// it's not a real stream. it's just an array of strings. -var $STANDARD_SELECT = /^[^\s>+~]/; -var $$STREAM = /[\s#.:>+~()@]|[^\s#.:>+~()@]+/g; -function _toStream($selector) { - if ($STANDARD_SELECT.test($selector)) $selector = " " + $selector; - return $selector.match($$STREAM) || []; -}; - -var $WHITESPACE = /\s*([\s>+~(),]|^|$)\s*/g; -var $IMPLIED_ALL = /([\s>+~,]|[^(]\+|^)([#.:@])/g; -var parseSelector = function($selector) { - return $selector - // trim whitespace - .replace($WHITESPACE, "$1") - // e.g. ".class1" --> "*.class1" - .replace($IMPLIED_ALL, "$1*$2"); -}; - -var Quote = { - toString: function() {return "'"}, - match: /^('[^']*')|("[^"]*")$/, - test: function($string) { - return this.match.test($string); - }, - add: function($string) { - return this.test($string) ? $string : this + $string + this; - }, - remove: function($string) { - return this.test($string) ? $string.slice(1, -1) : $string; - } -}; - -var getText = function($text) { - return Quote.remove($text); -}; - -var $ESCAPE = /([\/()[\]?{}|*+-])/g; -function regEscape($string) { - return $string.replace($ESCAPE, "\\$1"); -}; - -// ----------------------------------------------------------------------- -// modules -// ----------------------------------------------------------------------- - -// -------- >> insert modules here for packaging << -------- \\ - -loaded = true; - -// ----------------------------------------------------------------------- -// return the query function -// ----------------------------------------------------------------------- - -return cssQuery; - -}(); // cssQuery +/* + cssQuery, version 2.0.2 (2005-08-19) + Copyright: 2004-2005, Dean Edwards (http://dean.edwards.name/) + License: http://creativecommons.org/licenses/LGPL/2.1/ +*/ + +// the following functions allow querying of the DOM using CSS selectors +var cssQuery = function() { +var version = "2.0.2"; + +// ----------------------------------------------------------------------- +// main query function +// ----------------------------------------------------------------------- + +var $COMMA = /\s*,\s*/; +var cssQuery = function($selector, $$from) { +try { + var $match = []; + var $useCache = arguments.callee.caching && !$$from; + var $base = ($$from) ? ($$from.constructor == Array) ? $$from : [$$from] : [document]; + // process comma separated selectors + var $$selectors = parseSelector($selector).split($COMMA), i; + for (i = 0; i < $$selectors.length; i++) { + // convert the selector to a stream + $selector = _toStream($$selectors[i]); + // faster chop if it starts with id (MSIE only) + if (isMSIE && $selector.slice(0, 3).join("") == " *#") { + $selector = $selector.slice(2); + $$from = _msie_selectById([], $base, $selector[1]); + } else $$from = $base; + // process the stream + var j = 0, $token, $filter, $arguments, $cacheSelector = ""; + while (j < $selector.length) { + $token = $selector[j++]; + $filter = $selector[j++]; + $cacheSelector += $token + $filter; + // some pseudo-classes allow arguments to be passed + // e.g. nth-child(even) + $arguments = ""; + if ($selector[j] == "(") { + while ($selector[j++] != ")" && j < $selector.length) { + $arguments += $selector[j]; + } + $arguments = $arguments.slice(0, -1); + $cacheSelector += "(" + $arguments + ")"; + } + // process a token/filter pair use cached results if possible + $$from = ($useCache && cache[$cacheSelector]) ? + cache[$cacheSelector] : select($$from, $token, $filter, $arguments); + if ($useCache) cache[$cacheSelector] = $$from; + } + $match = $match.concat($$from); + } + delete cssQuery.error; + return $match; +} catch ($error) { + cssQuery.error = $error; + return []; +}}; + +// ----------------------------------------------------------------------- +// public interface +// ----------------------------------------------------------------------- + +cssQuery.toString = function() { + return "function cssQuery() {\n [version " + version + "]\n}"; +}; + +// caching +var cache = {}; +cssQuery.caching = false; +cssQuery.clearCache = function($selector) { + if ($selector) { + $selector = _toStream($selector).join(""); + delete cache[$selector]; + } else cache = {}; +}; + +// allow extensions +var modules = {}; +var loaded = false; +cssQuery.addModule = function($name, $script) { + if (loaded) eval("$script=" + String($script)); + modules[$name] = new $script();; +}; + +// hackery +cssQuery.valueOf = function($code) { + return $code ? eval($code) : this; +}; + +// ----------------------------------------------------------------------- +// declarations +// ----------------------------------------------------------------------- + +var selectors = {}; +var pseudoClasses = {}; +// a safari bug means that these have to be declared here +var AttributeSelector = {match: /\[([\w-]+(\|[\w-]+)?)\s*(\W?=)?\s*([^\]]*)\]/}; +var attributeSelectors = []; + +// ----------------------------------------------------------------------- +// selectors +// ----------------------------------------------------------------------- + +// descendant selector +selectors[" "] = function($results, $from, $tagName, $namespace) { + // loop through current selection + var $element, i, j; + for (i = 0; i < $from.length; i++) { + // get descendants + var $subset = getElementsByTagName($from[i], $tagName, $namespace); + // loop through descendants and add to results selection + for (j = 0; ($element = $subset[j]); j++) { + if (thisElement($element) && compareNamespace($element, $namespace)) + $results.push($element); + } + } +}; + +// ID selector +selectors["#"] = function($results, $from, $id) { + // loop through current selection and check ID + var $element, j; + for (j = 0; ($element = $from[j]); j++) if ($element.id == $id) $results.push($element); +}; + +// class selector +selectors["."] = function($results, $from, $className) { + // create a RegExp version of the class + $className = new RegExp("(^|\\s)" + $className + "(\\s|$)"); + // loop through current selection and check class + var $element, i; + for (i = 0; ($element = $from[i]); i++) + if ($className.test($element.className)) $results.push($element); +}; + +// pseudo-class selector +selectors[":"] = function($results, $from, $pseudoClass, $arguments) { + // retrieve the cssQuery pseudo-class function + var $test = pseudoClasses[$pseudoClass], $element, i; + // loop through current selection and apply pseudo-class filter + if ($test) for (i = 0; ($element = $from[i]); i++) + // if the cssQuery pseudo-class function returns "true" add the element + if ($test($element, $arguments)) $results.push($element); +}; + +// ----------------------------------------------------------------------- +// pseudo-classes +// ----------------------------------------------------------------------- + +pseudoClasses["link"] = function($element) { + var $document = getDocument($element); + if ($document.links) for (var i = 0; i < $document.links.length; i++) { + if ($document.links[i] == $element) return true; + } +}; + +pseudoClasses["visited"] = function($element) { + // can't do this without jiggery-pokery +}; + +// ----------------------------------------------------------------------- +// DOM traversal +// ----------------------------------------------------------------------- + +// IE5/6 includes comments (LOL) in it's elements collections. +// so we have to check for this. the test is tagName != "!". LOL (again). +var thisElement = function($element) { + return ($element && $element.nodeType == 1 && $element.tagName != "!") ? $element : null; +}; + +// return the previous element to the supplied element +// previousSibling is not good enough as it might return a text or comment node +var previousElementSibling = function($element) { + while ($element && ($element = $element.previousSibling) && !thisElement($element)) continue; + return $element; +}; + +// return the next element to the supplied element +var nextElementSibling = function($element) { + while ($element && ($element = $element.nextSibling) && !thisElement($element)) continue; + return $element; +}; + +// return the first child ELEMENT of an element +// NOT the first child node (though they may be the same thing) +var firstElementChild = function($element) { + return thisElement($element.firstChild) || nextElementSibling($element.firstChild); +}; + +var lastElementChild = function($element) { + return thisElement($element.lastChild) || previousElementSibling($element.lastChild); +}; + +// return child elements of an element (not child nodes) +var childElements = function($element) { + var $childElements = []; + $element = firstElementChild($element); + while ($element) { + $childElements.push($element); + $element = nextElementSibling($element); + } + return $childElements; +}; + +// ----------------------------------------------------------------------- +// browser compatibility +// ----------------------------------------------------------------------- + +// all of the functions in this section can be overwritten. the default +// configuration is for IE. The functions below reflect this. standard +// methods are included in a separate module. It would probably be better +// the other way round of course but this makes it easier to keep IE7 trim. + +var isMSIE = true; + +var isXML = function($element) { + var $document = getDocument($element); + return (typeof $document.mimeType == "unknown") ? + /\.xml$/i.test($document.URL) : + Boolean($document.mimeType == "XML Document"); +}; + +// return the element's containing document +var getDocument = function($element) { + return $element.ownerDocument || $element.document; +}; + +var getElementsByTagName = function($element, $tagName) { + return ($tagName == "*" && $element.all) ? $element.all : $element.getElementsByTagName($tagName); +}; + +var compareTagName = function($element, $tagName, $namespace) { + if ($tagName == "*") return thisElement($element); + if (!compareNamespace($element, $namespace)) return false; + if (!isXML($element)) $tagName = $tagName.toUpperCase(); + return $element.tagName == $tagName; +}; + +var compareNamespace = function($element, $namespace) { + return !$namespace || ($namespace == "*") || ($element.scopeName == $namespace); +}; + +var getTextContent = function($element) { + return $element.innerText; +}; + +function _msie_selectById($results, $from, id) { + var $match, i, j; + for (i = 0; i < $from.length; i++) { + if ($match = $from[i].all.item(id)) { + if ($match.id == id) $results.push($match); + else if ($match.length != null) { + for (j = 0; j < $match.length; j++) { + if ($match[j].id == id) $results.push($match[j]); + } + } + } + } + return $results; +}; + +// for IE5.0 +if (![].push) Array.prototype.push = function() { + for (var i = 0; i < arguments.length; i++) { + this[this.length] = arguments[i]; + } + return this.length; +}; + +// ----------------------------------------------------------------------- +// query support +// ----------------------------------------------------------------------- + +// select a set of matching elements. +// "from" is an array of elements. +// "token" is a character representing the type of filter +// e.g. ">" means child selector +// "filter" represents the tag name, id or class name that is being selected +// the function returns an array of matching elements +var $NAMESPACE = /\|/; +function select($$from, $token, $filter, $arguments) { + if ($NAMESPACE.test($filter)) { + $filter = $filter.split($NAMESPACE); + $arguments = $filter[0]; + $filter = $filter[1]; + } + var $results = []; + if (selectors[$token]) { + selectors[$token]($results, $$from, $filter, $arguments); + } + return $results; +}; + +// ----------------------------------------------------------------------- +// parsing +// ----------------------------------------------------------------------- + +// convert css selectors to a stream of tokens and filters +// it's not a real stream. it's just an array of strings. +var $STANDARD_SELECT = /^[^\s>+~]/; +var $$STREAM = /[\s#.:>+~()@]|[^\s#.:>+~()@]+/g; +function _toStream($selector) { + if ($STANDARD_SELECT.test($selector)) $selector = " " + $selector; + return $selector.match($$STREAM) || []; +}; + +var $WHITESPACE = /\s*([\s>+~(),]|^|$)\s*/g; +var $IMPLIED_ALL = /([\s>+~,]|[^(]\+|^)([#.:@])/g; +var parseSelector = function($selector) { + return $selector + // trim whitespace + .replace($WHITESPACE, "$1") + // e.g. ".class1" --> "*.class1" + .replace($IMPLIED_ALL, "$1*$2"); +}; + +var Quote = { + toString: function() {return "'"}, + match: /^('[^']*')|("[^"]*")$/, + test: function($string) { + return this.match.test($string); + }, + add: function($string) { + return this.test($string) ? $string : this + $string + this; + }, + remove: function($string) { + return this.test($string) ? $string.slice(1, -1) : $string; + } +}; + +var getText = function($text) { + return Quote.remove($text); +}; + +var $ESCAPE = /([\/()[\]?{}|*+-])/g; +function regEscape($string) { + return $string.replace($ESCAPE, "\\$1"); +}; + +// ----------------------------------------------------------------------- +// modules +// ----------------------------------------------------------------------- + +// -------- >> insert modules here for packaging << -------- \\ + +loaded = true; + +// ----------------------------------------------------------------------- +// return the query function +// ----------------------------------------------------------------------- + +return cssQuery; + +}(); // cssQuery diff --git a/theme/chameleon/ui/sarissa.js b/theme/chameleon/ui/sarissa.js index 7b2cd2646f..a6e138189b 100644 --- a/theme/chameleon/ui/sarissa.js +++ b/theme/chameleon/ui/sarissa.js @@ -1,648 +1,648 @@ - -/** - * ==================================================================== - * 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

      - * @private - */ - Sarissa.__handleLoad__ = function(oDoc){ - if (!oDoc.documentElement || oDoc.documentElement.tagName == "parsererror") - oDoc.parseError = -1; - Sarissa.__setReadyState__(oDoc, 4); - }; - /** - *

      Attached by an event handler to the load event. Internal use.

      - * @private - */ - _sarissa_XMLDocument_onload = function(){ - Sarissa.__handleLoad__(this); - }; - /** - *

      Sets the readyState property of the given DOM Document object. - * Internal use.

      - * @private - * @argument oDoc the DOM Document object to fire the - * readystatechange event - * @argument iReadyState the number to change the readystate property to - */ - Sarissa.__setReadyState__ = function(oDoc, iReadyState){ - oDoc.readyState = iReadyState; - if (oDoc.onreadystatechange != null && typeof oDoc.onreadystatechange == "function") - oDoc.onreadystatechange(); - }; - Sarissa.getDomDocument = function(sUri, sName){ - var oDoc = document.implementation.createDocument(sUri?sUri:"", sName?sName:"", null); - oDoc.addEventListener("load", _sarissa_XMLDocument_onload, false); - return oDoc; - }; - if(window.XMLDocument){ - /** - *

      Emulate IE's onreadystatechange attribute

      - */ - XMLDocument.prototype.onreadystatechange = null; - /** - *

      Emulates IE's readyState property, which always gives an integer from 0 to 4:

      - *
      • 1 == LOADING,
      • - *
      • 2 == LOADED,
      • - *
      • 3 == INTERACTIVE,
      • - *
      • 4 == COMPLETED
      - */ - XMLDocument.prototype.readyState = 0; - /** - *

      Emulate IE's parseError attribute

      - */ - 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

      - * @private - */ - XMLDocument.prototype._sarissa_load = XMLDocument.prototype.load; - - /** - *

      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)

      - * @returns the DOM Object as it was before the load() call (may be empty) - */ - XMLDocument.prototype.load = function(sURI) { - var oDoc = document.implementation.createDocument("", "", null); - Sarissa.copyChildNodes(this, oDoc); - this.parseError = 0; - Sarissa.__setReadyState__(this, 1); - try { - if(this.async == false && _SARISSA_SYNC_NON_IMPLEMENTED) { - var tmp = new XMLHttpRequest(); - tmp.open("GET", sURI, false); - tmp.send(null); - Sarissa.__setReadyState__(this, 2); - Sarissa.copyChildNodes(tmp.responseXML, this); - Sarissa.__setReadyState__(this, 3); - } - else { - this._sarissa_load(sURI); - }; - } - catch (objException) { - this.parseError = -1; - } - finally { - if(this.async == false){ - Sarissa.__handleLoad__(this); - }; - }; - return oDoc; - }; - - - }//if(window.XMLDocument) - else if(document.implementation && document.implementation.hasFeature && document.implementation.hasFeature('LS', '3.0')){ - Document.prototype.async = true; - Document.prototype.onreadystatechange = null; - Document.prototype.parseError = 0; - Document.prototype.load = function(sURI) { - var parser = document.implementation.createLSParser(this.async ? document.implementation.MODE_ASYNCHRONOUS : document.implementation.MODE_SYNCHRONOUS, null); - if(this.async){ - var self = this; - parser.addEventListener("load", - function(e) { - self.readyState = 4; - Sarissa.copyChildNodes(e.newDocument, self.documentElement, false); - self.onreadystatechange.call(); - }, - false); - }; - try { - var oDoc = parser.parseURI(sURI); - } - catch(e){ - this.parseError = -1; - }; - if(!this.async) - Sarissa.copyChildNodes(oDoc, this.documentElement, false); - return oDoc; - }; - /** - *

      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":"\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

      + * @private + */ + Sarissa.__handleLoad__ = function(oDoc){ + if (!oDoc.documentElement || oDoc.documentElement.tagName == "parsererror") + oDoc.parseError = -1; + Sarissa.__setReadyState__(oDoc, 4); + }; + /** + *

      Attached by an event handler to the load event. Internal use.

      + * @private + */ + _sarissa_XMLDocument_onload = function(){ + Sarissa.__handleLoad__(this); + }; + /** + *

      Sets the readyState property of the given DOM Document object. + * Internal use.

      + * @private + * @argument oDoc the DOM Document object to fire the + * readystatechange event + * @argument iReadyState the number to change the readystate property to + */ + Sarissa.__setReadyState__ = function(oDoc, iReadyState){ + oDoc.readyState = iReadyState; + if (oDoc.onreadystatechange != null && typeof oDoc.onreadystatechange == "function") + oDoc.onreadystatechange(); + }; + Sarissa.getDomDocument = function(sUri, sName){ + var oDoc = document.implementation.createDocument(sUri?sUri:"", sName?sName:"", null); + oDoc.addEventListener("load", _sarissa_XMLDocument_onload, false); + return oDoc; + }; + if(window.XMLDocument){ + /** + *

      Emulate IE's onreadystatechange attribute

      + */ + XMLDocument.prototype.onreadystatechange = null; + /** + *

      Emulates IE's readyState property, which always gives an integer from 0 to 4:

      + *
      • 1 == LOADING,
      • + *
      • 2 == LOADED,
      • + *
      • 3 == INTERACTIVE,
      • + *
      • 4 == COMPLETED
      + */ + XMLDocument.prototype.readyState = 0; + /** + *

      Emulate IE's parseError attribute

      + */ + 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

      + * @private + */ + XMLDocument.prototype._sarissa_load = XMLDocument.prototype.load; + + /** + *

      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)

      + * @returns the DOM Object as it was before the load() call (may be empty) + */ + XMLDocument.prototype.load = function(sURI) { + var oDoc = document.implementation.createDocument("", "", null); + Sarissa.copyChildNodes(this, oDoc); + this.parseError = 0; + Sarissa.__setReadyState__(this, 1); + try { + if(this.async == false && _SARISSA_SYNC_NON_IMPLEMENTED) { + var tmp = new XMLHttpRequest(); + tmp.open("GET", sURI, false); + tmp.send(null); + Sarissa.__setReadyState__(this, 2); + Sarissa.copyChildNodes(tmp.responseXML, this); + Sarissa.__setReadyState__(this, 3); + } + else { + this._sarissa_load(sURI); + }; + } + catch (objException) { + this.parseError = -1; + } + finally { + if(this.async == false){ + Sarissa.__handleLoad__(this); + }; + }; + return oDoc; + }; + + + }//if(window.XMLDocument) + else if(document.implementation && document.implementation.hasFeature && document.implementation.hasFeature('LS', '3.0')){ + Document.prototype.async = true; + Document.prototype.onreadystatechange = null; + Document.prototype.parseError = 0; + Document.prototype.load = function(sURI) { + var parser = document.implementation.createLSParser(this.async ? document.implementation.MODE_ASYNCHRONOUS : document.implementation.MODE_SYNCHRONOUS, null); + if(this.async){ + var self = this; + parser.addEventListener("load", + function(e) { + self.readyState = 4; + Sarissa.copyChildNodes(e.newDocument, self.documentElement, false); + self.onreadystatechange.call(); + }, + false); + }; + try { + var oDoc = parser.parseURI(sURI); + } + catch(e){ + this.parseError = -1; + }; + if(!this.async) + Sarissa.copyChildNodes(oDoc, this.documentElement, false); + return oDoc; + }; + /** + *

      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":"\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; +} -- 2.39.5