You can subscribe to this list here.
2005 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
(486) |
Jul
(201) |
Aug
(194) |
Sep
(87) |
Oct
(72) |
Nov
(72) |
Dec
(4) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2006 |
Jan
(6) |
Feb
(41) |
Mar
(22) |
Apr
(4) |
May
(12) |
Jun
|
Jul
|
Aug
(42) |
Sep
(21) |
Oct
(14) |
Nov
(10) |
Dec
|
2007 |
Jan
(14) |
Feb
(34) |
Mar
(61) |
Apr
(54) |
May
(140) |
Jun
(184) |
Jul
(164) |
Aug
(130) |
Sep
(241) |
Oct
(175) |
Nov
(148) |
Dec
(96) |
2008 |
Jan
(5) |
Feb
(38) |
Mar
(30) |
Apr
(46) |
May
(25) |
Jun
(22) |
Jul
(5) |
Aug
(17) |
Sep
(2) |
Oct
(100) |
Nov
(83) |
Dec
(33) |
2009 |
Jan
(127) |
Feb
(43) |
Mar
(86) |
Apr
(34) |
May
(50) |
Jun
(168) |
Jul
(48) |
Aug
(66) |
Sep
(38) |
Oct
(75) |
Nov
(113) |
Dec
(72) |
2010 |
Jan
(123) |
Feb
(68) |
Mar
(26) |
Apr
(11) |
May
(39) |
Jun
(131) |
Jul
(56) |
Aug
(79) |
Sep
(69) |
Oct
(17) |
Nov
(166) |
Dec
(32) |
2011 |
Jan
(21) |
Feb
|
Mar
|
Apr
|
May
(1) |
Jun
|
Jul
|
Aug
(2) |
Sep
|
Oct
(1) |
Nov
(8) |
Dec
|
2012 |
Jan
(2) |
Feb
|
Mar
|
Apr
(1) |
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
From: Chris S. <san...@us...> - 2005-09-17 11:31:12
|
Update of /cvsroot/stack/stack-1-0/scripts In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv11689/scripts Modified Files: stackDatabase.php stackQuestion.php stackWin.php Log Message: Index: stackDatabase.php =================================================================== RCS file: /cvsroot/stack/stack-1-0/scripts/stackDatabase.php,v retrieving revision 1.49 retrieving revision 1.50 diff -C2 -d -r1.49 -r1.50 *** stackDatabase.php 9 Sep 2005 11:14:59 -0000 1.49 --- stackDatabase.php 17 Sep 2005 11:31:04 -0000 1.50 *************** *** 1812,1816 **** // (2) Delete all attempt records ! $query = "DELETE FROM quiz_attempts WHERE subjectID = '$subjectID'"; $result = stack_db_query($query); --- 1812,1816 ---- // (2) Delete all attempt records ! $query = "DELETE FROM quizAttempts WHERE subjectID = '$subjectID'"; $result = stack_db_query($query); Index: stackWin.php =================================================================== RCS file: /cvsroot/stack/stack-1-0/scripts/stackWin.php,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** stackWin.php 30 Aug 2005 09:42:42 -0000 1.12 --- stackWin.php 17 Sep 2005 11:31:05 -0000 1.13 *************** *** 82,85 **** --- 82,88 ---- $debug = FALSE; + if (array_key_exists('debug',$_GET)) { + $debug = TRUE; + } $ret = FALSE; Index: stackQuestion.php =================================================================== RCS file: /cvsroot/stack/stack-1-0/scripts/stackQuestion.php,v retrieving revision 1.38 retrieving revision 1.39 diff -C2 -d -r1.38 -r1.39 *** stackQuestion.php 15 Sep 2005 11:27:11 -0000 1.38 --- stackQuestion.php 17 Sep 2005 11:31:04 -0000 1.39 *************** *** 593,596 **** --- 593,602 ---- $stackAnswerTest['Num_tol_absolute']['function'] = 'cas'; + $stackAnswerTest['Num_SAns>TAns']['imp'] = 'cas'; + $stackAnswerTest['Num_SAns>TAns']['function'] = 'ATGT'; + + $stackAnswerTest['Num_SAns>=TAns']['imp'] = 'cas'; + $stackAnswerTest['Num_SAns>=TAns']['function'] = 'ATGTE'; + $stackAnswerTest['String']['imp'] = 'php'; $stackAnswerTest['StringSloppy']['imp'] = 'php'; |
From: Chris S. <san...@us...> - 2005-09-15 12:09:05
|
Update of /cvsroot/stack/stack-1-0 In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv16939 Modified Files: quiz.php Log Message: Index: quiz.php =================================================================== RCS file: /cvsroot/stack/stack-1-0/quiz.php,v retrieving revision 1.40 retrieving revision 1.41 diff -C2 -d -r1.40 -r1.41 *** quiz.php 15 Sep 2005 08:50:41 -0000 1.40 --- quiz.php 15 Sep 2005 12:08:53 -0000 1.41 *************** *** 121,125 **** if (array_key_exists('quizid',$_POST)) { $quizid = $_POST['quizid']; ! // Check the $quizid is in the $subject, or we are the admin user. if (!stack_db_subject_quiz_contained($subjectID,$quizid) AND ( -1 != $user['id'] OR !$user['loggedin'] )) { --- 121,125 ---- if (array_key_exists('quizid',$_POST)) { $quizid = $_POST['quizid']; ! // Check the $quizid is in the $subject, or we are the admin user. if (!stack_db_subject_quiz_contained($subjectID,$quizid) AND ( -1 != $user['id'] OR !$user['loggedin'] )) { |
From: Chris S. <san...@us...> - 2005-09-15 11:27:19
|
Update of /cvsroot/stack/stack-1-0/scripts In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv7438/scripts Modified Files: stackQuestion.php Log Message: Index: stackQuestion.php =================================================================== RCS file: /cvsroot/stack/stack-1-0/scripts/stackQuestion.php,v retrieving revision 1.37 retrieving revision 1.38 diff -C2 -d -r1.37 -r1.38 *** stackQuestion.php 15 Sep 2005 10:30:27 -0000 1.37 --- stackQuestion.php 15 Sep 2005 11:27:11 -0000 1.38 *************** *** 1588,1592 **** // Add the $stackAnswerTest options if needed. foreach ($answertest as $prn => $anstest) { ! if ('cas' == $stackAnswerTest[$anstest]['imp'] and '' != $answertestopt[$prn]) { $all_locs[] = array('key'=> "AnsTestOptInst$prn", 'value'=>$answertestopt[$prn]); } --- 1588,1593 ---- // Add the $stackAnswerTest options if needed. foreach ($answertest as $prn => $anstest) { ! if (('cas-var' == $stackAnswerTest[$anstest]['imp'] OR 'cas' == $stackAnswerTest[$anstest]['imp']) ! and '' != $answertestopt[$prn]) { $all_locs[] = array('key'=> "AnsTestOptInst$prn", 'value'=>$answertestopt[$prn]); } *************** *** 1598,1602 **** // If the AnsTestOpts have been instantiated, update the values of these. foreach ($answertest as $prn => $anstest) { ! if ('cas' == $stackAnswerTest[$anstest]['imp'] and '' != $answertestopt[$prn]) { // Find the instantiated version of the AnsTestOpt, and use it. foreach($all_locs_Inst as $ln => $loc) { --- 1599,1604 ---- // If the AnsTestOpts have been instantiated, update the values of these. foreach ($answertest as $prn => $anstest) { ! if (('cas-var' == $stackAnswerTest[$anstest]['imp'] OR 'cas' == $stackAnswerTest[$anstest]['imp']) ! and '' != $answertestopt[$prn]) { // Find the instantiated version of the AnsTestOpt, and use it. foreach($all_locs_Inst as $ln => $loc) { *************** *** 1643,1648 **** $ta = $all_locs_Inst[$tan]['value']; $this_PRattempt = stack_apply_answertest($sa,$ta,$answertest[$prn],$answertestopt[$prn],$options,$errors); ! if (array_key_exists('error', $this_PRattempt['Ans'] )) { $NoErrors = FALSE; --- 1645,1652 ---- $ta = $all_locs_Inst[$tan]['value']; + //echo "$sa,$ta,{$answertest[$prn]},{$answertestopt[$prn]}"; $this_PRattempt = stack_apply_answertest($sa,$ta,$answertest[$prn],$answertestopt[$prn],$options,$errors); ! //show_array($this_PRattempt); ! if (array_key_exists('error', $this_PRattempt['Ans'] )) { $NoErrors = FALSE; |
From: Chris S. <san...@us...> - 2005-09-15 10:35:04
|
Update of /cvsroot/stack/stack-1-0/lang/en/doc In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv26546/lang/en/doc Modified Files: author_testsuite.php Log Message: Index: author_testsuite.php =================================================================== RCS file: /cvsroot/stack/stack-1-0/lang/en/doc/author_testsuite.php,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** author_testsuite.php 1 Sep 2005 08:13:57 -0000 1.10 --- author_testsuite.php 15 Sep 2005 10:34:56 -0000 1.11 *************** *** 236,240 **** // Now perform the tests, and display the results. ! $disp = 'LaTeX'; $errors = array(); $AnsTest = ''; --- 236,241 ---- // Now perform the tests, and display the results. ! $options = stack_options_set(NULL); ! $options['Display']='LaTeX'; $errors = array(); $AnsTest = ''; *************** *** 286,290 **** // (1) Apply the AnswerTest ! $this_attempt = stack_apply_answertest($ts['SAns'],$ts['TAns'],$ts['AnswerTest'],$ts['AnsTestOpt'],$disp,$err); // (2) Process $this_attempt --- 287,291 ---- // (1) Apply the AnswerTest ! $this_attempt = stack_apply_answertest($ts['SAns'],$ts['TAns'],$ts['AnswerTest'],$ts['AnsTestOpt'],$options,$err); // (2) Process $this_attempt *************** *** 309,313 **** if (''!=$dispans) { $locs = array(); ! $dispans = stack_castext_to_display('$$'.$dispans.'$$', $locs , $disp,$errors); // Remove <br clear="all" /> from the beginning. if ('<br clear="all" />'==substr($dispans,0,18)) { --- 310,314 ---- if (''!=$dispans) { $locs = array(); ! $dispans = stack_castext_to_display('$$'.$dispans.'$$', $locs , $options['Display'] ,$errors); // Remove <br clear="all" /> from the beginning. if ('<br clear="all" />'==substr($dispans,0,18)) { *************** *** 319,323 **** if (array_key_exists('FeedBack',$this_attempt)) { $locs = array(); ! $feedback = stack_castext_to_display($this_attempt['FeedBack'], $locs , $disp,$errors); } --- 320,324 ---- if (array_key_exists('FeedBack',$this_attempt)) { $locs = array(); ! $feedback = stack_castext_to_display($this_attempt['FeedBack'], $locs , $options['Display'] ,$errors); } |
From: Chris S. <san...@us...> - 2005-09-15 10:30:34
|
Update of /cvsroot/stack/stack-1-0/scripts In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv25590/scripts Modified Files: stackQuestion.php Log Message: Index: stackQuestion.php =================================================================== RCS file: /cvsroot/stack/stack-1-0/scripts/stackQuestion.php,v retrieving revision 1.36 retrieving revision 1.37 diff -C2 -d -r1.36 -r1.37 *** stackQuestion.php 13 Sep 2005 08:35:04 -0000 1.36 --- stackQuestion.php 15 Sep 2005 10:30:27 -0000 1.37 *************** *** 572,576 **** $stackAnswerTest['SA_factored']['function'] = 'ATFacForm'; ! $stackAnswerTest['SA_expanded']['imp'] = 'cas-var'; $stackAnswerTest['SA_expanded']['function'] = 'ATExpanded'; --- 572,576 ---- $stackAnswerTest['SA_factored']['function'] = 'ATFacForm'; ! $stackAnswerTest['SA_expanded']['imp'] = 'cas'; $stackAnswerTest['SA_expanded']['function'] = 'ATExpanded'; *************** *** 1268,1272 **** $disp = $options['Display']; ! // This is a general response for the Ans, in case of an error. $eans = array('value'=> $sa, 'display'=> $sa); --- 1268,1272 ---- $disp = $options['Display']; ! // This is a general response for the Ans, in case of an error. $eans = array('value'=> $sa, 'display'=> $sa); |
From: Chris S. <san...@us...> - 2005-09-15 10:15:10
|
Update of /cvsroot/stack/stack-1-0/scripts/install In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv22032/scripts/install Modified Files: stackUpdateDatabase.php Log Message: Index: stackUpdateDatabase.php =================================================================== RCS file: /cvsroot/stack/stack-1-0/scripts/install/stackUpdateDatabase.php,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** stackUpdateDatabase.php 5 Sep 2005 08:21:40 -0000 1.9 --- stackUpdateDatabase.php 15 Sep 2005 10:15:02 -0000 1.10 *************** *** 66,69 **** --- 66,75 ---- stack_mysqlcmd($query,$stack_mysql['user'],$error); + // + + $query = 'ALTER TABLE stackUser + ADD COLUMN `phone1` varchar(20) default NULL;'; + + stack_mysqlcmd($query,$stack_mysql['user'],$error); |
From: Chris S. <san...@us...> - 2005-09-15 08:50:53
|
Update of /cvsroot/stack/stack-1-0/html In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv3806/html Modified Files: quizchoose.html Log Message: Index: quizchoose.html =================================================================== RCS file: /cvsroot/stack/stack-1-0/html/quizchoose.html,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** quizchoose.html 12 Sep 2005 08:07:47 -0000 1.1 --- quizchoose.html 15 Sep 2005 08:50:41 -0000 1.2 *************** *** 13,17 **** <form name='quizform' action='quiz.php' method='POST'> ! <input type='hidden' name='returnurl' value ='<?php $returnurl ?>' /> <input type='hidden' name='userid' value='-1' /> <input type='hidden' name='quizid' value='-1' /> --- 13,17 ---- <form name='quizform' action='quiz.php' method='POST'> ! <input type='hidden' name='returnurl' value ='<?php echo $returnurl; ?>' /> <input type='hidden' name='userid' value='-1' /> <input type='hidden' name='quizid' value='-1' /> |
From: Chris S. <san...@us...> - 2005-09-15 08:50:53
|
Update of /cvsroot/stack/stack-1-0 In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv3806 Modified Files: choosequiz.php quiz.php Log Message: Index: choosequiz.php =================================================================== RCS file: /cvsroot/stack/stack-1-0/choosequiz.php,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** choosequiz.php 7 Sep 2005 14:28:58 -0000 1.2 --- choosequiz.php 15 Sep 2005 08:50:41 -0000 1.3 *************** *** 21,24 **** --- 21,27 ---- * to stackConfig.php which is an array of the subjectID numbers * of subjects you wish to be available through this page. + * + * eg $choosequiz_store = array('1','2'); + * where 1 & 2 aare the subjectID numbers you wish to release. */ Index: quiz.php =================================================================== RCS file: /cvsroot/stack/stack-1-0/quiz.php,v retrieving revision 1.39 retrieving revision 1.40 diff -C2 -d -r1.39 -r1.40 *** quiz.php 12 Sep 2005 08:07:47 -0000 1.39 --- quiz.php 15 Sep 2005 08:50:41 -0000 1.40 *************** *** 19,34 **** include($stack_root.'/frontend_general/process_input.php'); - ///////////////////////////////////////////////////////////// - // (1) For a quiz, the admin user should behave like a guest. - // We don't want lots of admin user quizzes to be stored. - // The user is not stored in the session, so it lasts only - // for this script. - ///////////////////////////////////////////////////////////// - - if ($user['id'] <= 0 or !$user['loggedin']) { - include_once($stack_root."/scripts/stackUser.php"); - $user = stack_user_guest(); - } - ////////////////////////////////////////////////////////// // (2) Assign default values to quiz specific variables. --- 19,22 ---- *************** *** 134,139 **** $quizid = $_POST['quizid']; ! // Check the $quizid is in the $subject ! if (!stack_db_subject_quiz_contained($subjectID,$quizid)) { echo "The quizID number is not linked to the subjectID numbers supplied."; die(); --- 122,127 ---- $quizid = $_POST['quizid']; ! // Check the $quizid is in the $subject, or we are the admin user. ! if (!stack_db_subject_quiz_contained($subjectID,$quizid) AND ( -1 != $user['id'] OR !$user['loggedin'] )) { echo "The quizID number is not linked to the subjectID numbers supplied."; die(); *************** *** 170,175 **** $subject_options = array(); ! if (array_key_exists('subjectOptions',$subject)){ ! $subject_options = $subject['subjectOptions']; } --- 158,165 ---- $subject_options = array(); ! if (is_array($subject)) { ! if (array_key_exists('subjectOptions',$subject)){ ! $subject_options = $subject['subjectOptions']; ! } } *************** *** 191,194 **** --- 181,198 ---- } + + ///////////////////////////////////////////////////////////// + // (1) For a quiz, the admin user should behave like a guest. + // We don't want lots of admin user quizzes to be stored. + // The user is not stored in the session, so it lasts only + // for this script. + ///////////////////////////////////////////////////////////// + + if ($user['id'] <= 0 or !$user['loggedin']) { + include_once($stack_root."/scripts/stackUser.php"); + $user = stack_user_guest(); + } + + // This is used by the remote calling functions. if ('review' == $action) { $student_user = $_POST['userid']; |
From: Chris S. <san...@us...> - 2005-09-13 08:48:18
|
Update of /cvsroot/stack/stack-1-0 In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv23612 Modified Files: user.php Log Message: Index: user.php =================================================================== RCS file: /cvsroot/stack/stack-1-0/user.php,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** user.php 12 Sep 2005 08:07:47 -0000 1.9 --- user.php 13 Sep 2005 08:48:10 -0000 1.10 *************** *** 89,93 **** include($stack_root.'/html/quizchoose.html'); ! $name = "{$user_stu[username]} ({$user_stu[firstname]} {$user_stu[lastname]})"; echo "<h1>Review the work of $name</h1>\n\n"; --- 89,93 ---- include($stack_root.'/html/quizchoose.html'); ! $name = "{$user_stu['username']} ({$user_stu['firstname']} {$user_stu['lastname']})"; echo "<h1>Review the work of $name</h1>\n\n"; |
From: Chris S. <san...@us...> - 2005-09-13 08:46:23
|
Update of /cvsroot/stack/stack-1-0/scripts/install In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv23182/scripts/install Modified Files: stacktest.php Log Message: Index: stacktest.php =================================================================== RCS file: /cvsroot/stack/stack-1-0/scripts/install/stacktest.php,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** stacktest.php 12 Sep 2005 08:18:03 -0000 1.11 --- stacktest.php 13 Sep 2005 08:46:12 -0000 1.12 *************** *** 119,125 **** $strout = stack_castext_inst($strin,$locals,$options,$err); - // $strout = stack_process_vars($locals,1321321,$options,$err); - // $strout = stack_maxima_rawsend("diff(cos(x^2),x);\n quit();"); - if ('' != $strout) { echo $strout; --- 119,122 ---- |
From: Chris S. <san...@us...> - 2005-09-13 08:35:19
|
Update of /cvsroot/stack/stack-1-0/scripts In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv20811 Modified Files: stackCAS.php stackQuestion.php Log Message: Index: stackCAS.php =================================================================== RCS file: /cvsroot/stack/stack-1-0/scripts/stackCAS.php,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** stackCAS.php 12 Sep 2005 08:07:47 -0000 1.3 --- stackCAS.php 13 Sep 2005 08:35:04 -0000 1.4 *************** *** 25,28 **** --- 25,29 ---- $loclistA = ''; $loclistB = ''; + $loclistC = ''; $cs ='cab:BLOCK([ RANDOM_SEED'; *************** *** 170,173 **** --- 171,175 ---- $loclistA = ''; $loclistB = ''; + $loclistC = ''; $cs ='cab:BLOCK([ RANDOM_SEED'; Index: stackQuestion.php =================================================================== RCS file: /cvsroot/stack/stack-1-0/scripts/stackQuestion.php,v retrieving revision 1.35 retrieving revision 1.36 diff -C2 -d -r1.35 -r1.36 *** stackQuestion.php 12 Sep 2005 08:07:47 -0000 1.35 --- stackQuestion.php 13 Sep 2005 08:35:04 -0000 1.36 *************** *** 1267,1270 **** --- 1267,1272 ---- global $stack_os,$stack_web_root,$stack_web_services,$stackAnswerTest; + $disp = $options['Display']; + // This is a general response for the Ans, in case of an error. $eans = array('value'=> $sa, 'display'=> $sa); |
From: pkiddie <pk...@us...> - 2005-09-12 09:48:54
|
Update of /cvsroot/stack/stack-1-0/scripts/rqp/moodle_16_rqp/quiz/questiontypes/rqp In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv16531/scripts/rqp/moodle_16_rqp/quiz/questiontypes/rqp Removed Files: uni_soap.php.tortoise.removed uni_soap.php5.tortoise.removed Log Message: Removed old code --- uni_soap.php5.tortoise.removed DELETED --- --- uni_soap.php.tortoise.removed DELETED --- |
From: pkiddie <pk...@us...> - 2005-09-12 09:47:18
|
Update of /cvsroot/stack/stack-1-0/scripts/rqp/moodle_16_rqp/quiz/db In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv16221/scripts/rqp/moodle_16_rqp/quiz/db Added Files: mysql.php mysql.sql postgres7.php postgres7.sql Log Message: Moodle V1.6 updated files - until new RQP code on Moodle CVS repository, overwrite latest distribution with these files --- NEW FILE: mysql.php --- <?php // $Id: mysql.php,v 1.1 2005/09/12 09:46:59 pkiddie Exp $ function quiz_upgrade($oldversion) { // This function does anything necessary to upgrade // older versions to match current functionality global $CFG, $QUIZ_QTYPES, $db; require_once("$CFG->dirroot/mod/quiz/locallib.php"); if ($oldversion < 2002101800) { execute_sql(" ALTER TABLE `quiz_attempts` ". " ADD `timestart` INT(10) UNSIGNED DEFAULT '0' NOT NULL AFTER `sumgrades` , ". " ADD `timefinish` INT(10) UNSIGNED DEFAULT '0' NOT NULL AFTER `timestart` "); execute_sql(" UPDATE `quiz_attempts` SET timestart = timemodified "); execute_sql(" UPDATE `quiz_attempts` SET timefinish = timemodified "); } if ($oldversion < 2002102101) { execute_sql(" DELETE FROM log_display WHERE module = 'quiz' "); execute_sql(" INSERT INTO log_display VALUES ('quiz', 'view', 'quiz', 'name') "); execute_sql(" INSERT INTO log_display VALUES ('quiz', 'report', 'quiz', 'name') "); execute_sql(" INSERT INTO log_display VALUES ('quiz', 'attempt', 'quiz', 'name') "); execute_sql(" INSERT INTO log_display VALUES ('quiz', 'submit', 'quiz', 'name') "); } if ($oldversion < 2002102600) { execute_sql(" ALTER TABLE `quiz_answers` CHANGE `feedback` `feedback` TEXT NOT NULL "); } if ($oldversion < 2002122300) { execute_sql("ALTER TABLE `quiz_grades` CHANGE `user` `userid` INT(10) UNSIGNED DEFAULT '0' NOT NULL "); execute_sql("ALTER TABLE `quiz_attempts` CHANGE `user` `userid` INT(10) UNSIGNED DEFAULT '0' NOT NULL "); } // prefixes required from here on, or use table_column() if ($oldversion < 2003010100) { execute_sql(" ALTER TABLE {$CFG->prefix}quiz ADD review TINYINT(4) UNSIGNED DEFAULT '0' NOT NULL AFTER `grademethod` "); } if ($oldversion < 2003010301) { table_column("quiz_truefalse", "true", "trueanswer", "INTEGER", "10", "UNSIGNED", "0", "NOT NULL", ""); table_column("quiz_truefalse", "false", "falseanswer", "INTEGER", "10", "UNSIGNED", "0", "NOT NULL", ""); table_column("quiz_questions", "type", "qtype", "INTEGER", "10", "UNSIGNED", "0", "NOT NULL", ""); } if ($oldversion < 2003022303) { modify_database ("", "CREATE TABLE `prefix_quiz_randommatch` ( `id` int(10) unsigned NOT NULL auto_increment, `question` int(10) unsigned NOT NULL default '0', `choose` INT UNSIGNED DEFAULT '4' NOT NULL, PRIMARY KEY ( `id` ) );"); } if ($oldversion < 2003030303) { table_column("quiz_questions", "", "defaultgrade", "INTEGER", "6", "UNSIGNED", "1", "NOT NULL", "image"); } if ($oldversion < 2003032601) { execute_sql(" ALTER TABLE `{$CFG->prefix}quiz_answers` ADD INDEX(question) "); execute_sql(" ALTER TABLE `{$CFG->prefix}quiz_attempts` ADD INDEX(quiz) "); execute_sql(" ALTER TABLE `{$CFG->prefix}quiz_attempts` ADD INDEX(userid) "); execute_sql(" ALTER TABLE `{$CFG->prefix}quiz_grades` ADD INDEX(quiz) "); execute_sql(" ALTER TABLE `{$CFG->prefix}quiz_grades` ADD INDEX(userid) "); execute_sql(" ALTER TABLE `{$CFG->prefix}quiz_question_grades` ADD INDEX(quiz) "); execute_sql(" ALTER TABLE `{$CFG->prefix}quiz_question_grades` ADD INDEX(question) "); execute_sql(" ALTER TABLE `{$CFG->prefix}quiz_randommatch` ADD INDEX(question) "); execute_sql(" ALTER TABLE `{$CFG->prefix}quiz_responses` ADD INDEX(attempt) "); execute_sql(" ALTER TABLE `{$CFG->prefix}quiz_responses` ADD INDEX(question) "); } if ($oldversion < 2003033100) { modify_database ("", "ALTER TABLE prefix_quiz_randommatch RENAME prefix_quiz_randomsamatch "); modify_database ("", "CREATE TABLE `prefix_quiz_match` ( `id` int(10) unsigned NOT NULL auto_increment, `question` int(10) unsigned NOT NULL default '0', `subquestions` varchar(255) NOT NULL default '', PRIMARY KEY (`id`), KEY `question` (`question`) );"); modify_database ("", "CREATE TABLE `prefix_quiz_match_sub` ( `id` int(10) unsigned NOT NULL auto_increment, `question` int(10) unsigned NOT NULL default '0', `questiontext` text NOT NULL, `answertext` varchar(255) NOT NULL default '', PRIMARY KEY (`id`), KEY `question` (`question`) );"); } if ($oldversion < 2003040901) { table_column("quiz", "", "shufflequestions", "INTEGER", "4", "UNSIGNED", "0", "NOT NULL", "review"); table_column("quiz", "", "shuffleanswers", "INTEGER", "4", "UNSIGNED", "0", "NOT NULL", "shufflequestions"); } if ($oldversion < 2003071001) { modify_database ("", " CREATE TABLE `prefix_quiz_numerical` ( `id` int(10) unsigned NOT NULL auto_increment, `question` int(10) unsigned NOT NULL default '0', `answer` int(10) unsigned NOT NULL default '0', `min` varchar(255) NOT NULL default '', `max` varchar(255) NOT NULL default '', PRIMARY KEY (`id`), KEY `answer` (`answer`) ) TYPE=MyISAM COMMENT='Options for numerical questions'; "); } if ($oldversion < 2003072400) { execute_sql(" INSERT INTO {$CFG->prefix}log_display VALUES ('quiz', 'review', 'quiz', 'name') "); } if ($oldversion < 2003072901) { modify_database ("", " CREATE TABLE `prefix_quiz_multianswers` ( `id` int(10) unsigned NOT NULL auto_increment, `question` int(10) unsigned NOT NULL default '0', `answers` varchar(255) NOT NULL default '', `positionkey` varchar(255) NOT NULL default '', `answertype` smallint(6) NOT NULL default '0', `norm` int(10) unsigned NOT NULL default '1', PRIMARY KEY (`id`), KEY `question` (`question`) ) TYPE=MyISAM COMMENT='Options for multianswer questions'; "); } if ($oldversion < 2003080301) { execute_sql(" ALTER TABLE {$CFG->prefix}quiz ADD eachattemptbuildsonthelast TINYINT(4) DEFAULT '0' NOT NULL AFTER `attempts` "); } if ($oldversion < 2003080400) { table_column("quiz", "eachattemptbuildsonthelast", "attemptonlast", "TINYINT", "4", "UNSIGNED", "0", "NOT NULL", ""); } if ($oldversion < 2003082300) { table_column("quiz_questions", "", "stamp", "varchar", "255", "", "", "not null", "qtype"); } if ($oldversion < 2003082301) { table_column("quiz_questions", "stamp", "stamp", "varchar", "255", "", "", "not null"); table_column("quiz_questions", "", "version", "integer", "10", "", "1", "not null", "stamp"); if ($questions = get_records("quiz_questions")) { foreach ($questions as $question) { $stamp = make_unique_id_code(); if (!set_field("quiz_questions", "stamp", $stamp, "id", $question->id)) { notify("Error while adding stamp to question id = $question->id"); } } } } if ($oldversion < 2003082700) { table_column("quiz_categories", "", "stamp", "varchar", "255", "", "", "not null"); if ($categories = get_records("quiz_categories")) { foreach ($categories as $category) { $stamp = make_unique_id_code(); if (!set_field("quiz_categories", "stamp", $stamp, "id", $category->id)) { notify("Error while adding stamp to category id = $category->id"); } } } } if ($oldversion < 2003111100) { $duplicates = get_records_sql("SELECT stamp as id,count(*) as cuenta FROM {$CFG->prefix}quiz_questions GROUP BY stamp HAVING count(*)>1"); if ($duplicates) { notify("You have some quiz questions with duplicate stamps IDs. Cleaning these up."); foreach ($duplicates as $duplicate) { $questions = get_records("quiz_questions","stamp",$duplicate->id); $add = 1; foreach ($questions as $question) { echo "Changing question id $question->id stamp to ".$duplicate->id.$add."<br />"; set_field("quiz_questions","stamp",$duplicate->id.$add,"id",$question->id); $add++; } } } else { notify("Checked your quiz questions for stamp duplication errors, but no problems were found.", "green"); } } if ($oldversion < 2004021300) { table_column("quiz_questions", "", "questiontextformat", "integer", "2", "", "0", "not null", "questiontext"); } if ($oldversion < 2004021900) { modify_database("","INSERT INTO prefix_log_display VALUES ('quiz', 'add', 'quiz', 'name');"); modify_database("","INSERT INTO prefix_log_display VALUES ('quiz', 'update', 'quiz', 'name');"); } if ($oldversion < 2004051700) { include_once("$CFG->dirroot/mod/quiz/lib.php"); quiz_refresh_events(); } if ($oldversion < 2004060200) { execute_sql(" ALTER TABLE {$CFG->prefix}quiz ADD timelimit INT(2) UNSIGNED DEFAULT '0' NOT NULL "); } if ($oldversion < 2004070700) { table_column("quiz", "", "password", "varchar", "255", "", "", "not null", ""); table_column("quiz", "", "subnet", "varchar", "255", "", "", "not null", ""); } if ($oldversion < 2004073001) { // Six new tables: // One table for handling units for numerical questions modify_database ("", " CREATE TABLE `prefix_quiz_numerical_units` ( `id` int(10) unsigned NOT NULL auto_increment, `question` int(10) unsigned NOT NULL default '0', `multiplier` decimal(40,20) NOT NULL default '1.00000000000000000000', `unit` varchar(50) NOT NULL default '', PRIMARY KEY (`id`) ) TYPE=MyISAM COMMENT='Optional unit options for numerical questions'; "); // Four tables for handling distribution and storage of // individual data for dataset dependent question types modify_database ("", " CREATE TABLE `prefix_quiz_attemptonlast_datasets` ( `id` int(10) unsigned NOT NULL auto_increment, `category` int(10) unsigned NOT NULL default '0', `userid` int(10) unsigned NOT NULL default '0', `datasetnumber` int(10) unsigned NOT NULL default '0', PRIMARY KEY (`id`), UNIQUE KEY `category` (`category`,`userid`) ) TYPE=MyISAM COMMENT='Dataset number for attemptonlast attempts per user'; "); modify_database ("", " CREATE TABLE `prefix_quiz_dataset_definitions` ( `id` int(10) unsigned NOT NULL auto_increment, `category` int(10) unsigned NOT NULL default '0', `name` varchar(255) NOT NULL default '', `type` int(10) NOT NULL default '0', `options` varchar(255) NOT NULL default '', `itemcount` int(10) unsigned NOT NULL default '0', PRIMARY KEY (`id`) ) TYPE=MyISAM COMMENT='Organises and stores properties for dataset items'; "); modify_database ("", " CREATE TABLE `prefix_quiz_dataset_items` ( `id` int(10) unsigned NOT NULL auto_increment, `definition` int(10) unsigned NOT NULL default '0', `number` int(10) unsigned NOT NULL default '0', `value` varchar(255) NOT NULL default '', PRIMARY KEY (`id`), KEY `definition` (`definition`) ) TYPE=MyISAM COMMENT='Individual dataset items'; "); modify_database ("", " CREATE TABLE `prefix_quiz_question_datasets` ( `id` int(10) unsigned NOT NULL auto_increment, `question` int(10) unsigned NOT NULL default '0', `datasetdefinition` int(10) unsigned NOT NULL default '0', PRIMARY KEY (`id`), KEY `question` (`question`,`datasetdefinition`) ) TYPE=MyISAM COMMENT='Many-many relation between questions and dataset definitions'; "); // One table for new question type calculated // - the first dataset dependent question type modify_database ("", " CREATE TABLE `prefix_quiz_calculated` ( `id` int(10) unsigned NOT NULL auto_increment, `question` int(10) unsigned NOT NULL default '0', `answer` int(10) unsigned NOT NULL default '0', `tolerance` varchar(20) NOT NULL default '0.0', `tolerancetype` int(10) NOT NULL default '1', `correctanswerlength` int(10) NOT NULL default '2', PRIMARY KEY (`id`), KEY `question` (`question`) ) TYPE=MyISAM COMMENT='Options for questions of type calculated'; "); } if ($oldversion < 2004111400) { table_column("quiz_responses", "answer", "answer", "text", "", "", "", "not null"); } if ($oldversion < 2004111700) { execute_sql("ALTER TABLE {$CFG->prefix}quiz DROP INDEX course;",false); execute_sql("ALTER TABLE {$CFG->prefix}quiz_calculated DROP INDEX answer;",false); execute_sql("ALTER TABLE {$CFG->prefix}quiz_categories DROP INDEX course;",false); execute_sql("ALTER TABLE {$CFG->prefix}quiz_dataset_definitions DROP INDEX category;",false); execute_sql("ALTER TABLE {$CFG->prefix}quiz_numerical DROP INDEX question;",false); execute_sql("ALTER TABLE {$CFG->prefix}quiz_numerical_units DROP INDEX question;",false); execute_sql("ALTER TABLE {$CFG->prefix}quiz_questions DROP INDEX category;",false); modify_database('','ALTER TABLE prefix_quiz ADD INDEX course (course);'); modify_database('','ALTER TABLE prefix_quiz_calculated ADD INDEX answer (answer);'); modify_database('','ALTER TABLE prefix_quiz_categories ADD INDEX course (course);'); modify_database('','ALTER TABLE prefix_quiz_dataset_definitions ADD INDEX category (category);'); modify_database('','ALTER TABLE prefix_quiz_numerical ADD INDEX question (question);'); modify_database('','ALTER TABLE prefix_quiz_numerical_units ADD INDEX question (question);'); modify_database('','ALTER TABLE prefix_quiz_questions ADD INDEX category (category);'); } if ($oldversion < 2004120501) { table_column("quiz_calculated", "", "correctanswerformat", "integer", "10", "", "2", "not null", "correctanswerlength"); } if ($oldversion < 2004121400) { // New field to determine popup window behaviour table_column("quiz", "", "popup", "integer", "4", "", "0", "not null", "subnet"); } if ($oldversion < 2005010201) { table_column('quiz_categories', '', 'parent'); table_column('quiz_categories', '', 'sortorder', 'integer', '10', '', '999'); } if ($oldversion < 2005010300) { table_column("quiz", "", "questionsperpage", "integer", "10", "", "0", "not null", "review"); } if ($oldversion < 2005012700) { table_column('quiz_grades', 'grade', 'grade', 'real', 2, ''); } if ($oldversion < 2005021400) { table_column("quiz", "", "decimalpoints", "integer", "4", "", "2", "not null", "grademethod"); } if($oldversion < 2005022800) { table_column('quiz_questions', '', 'hidden', 'integer', '1', 'unsigned', '0', 'not null', 'version'); table_column('quiz_responses', '', 'originalquestion', 'integer', '10', 'unsigned', '0', 'not null', 'question'); modify_database ('', "CREATE TABLE `prefix_quiz_question_version` ( `id` int(10) unsigned NOT NULL auto_increment, `quiz` int(10) unsigned NOT NULL default '0', `oldquestion` int(10) unsigned NOT NULL default '0', `newquestion` int(10) unsigned NOT NULL default '0', `userid` int(10) unsigned NOT NULL default '0', `timestamp` int(10) unsigned NOT NULL default '0', PRIMARY KEY (`id`) ) TYPE=MyISAM COMMENT='The mapping between old and new versions of a question';"); } if ($oldversion < 2005032000) { execute_sql(" INSERT INTO {$CFG->prefix}log_display VALUES ('quiz', 'editquestions', 'quiz', 'name') "); } if ($oldversion < 2005032300) { modify_database ('', 'ALTER TABLE prefix_quiz_question_version RENAME prefix_quiz_question_versions;'); } if ($oldversion < 2005041200) { // replace wiki-like with markdown include_once( "$CFG->dirroot/lib/wiki_to_markdown.php" ); $wtm = new WikiToMarkdown(); $sql = "select course from {$CFG->prefix}quiz_categories c, {$CFG->prefix}quiz_questions q "; $sql .= "where c.id = q.category "; $sql .= "and q.id = "; $wtm->update( 'quiz_questions', 'questiontext', 'questiontextformat', $sql ); } if ($oldversion < 2005041304) { // make random questions hidden modify_database('', "UPDATE prefix_quiz_questions SET hidden = '1' WHERE qtype ='".RANDOM."';"); } if ($oldversion < 2005042002) { table_column('quiz_answers', 'answer', 'answer', 'text', '', '', '', 'not null', ''); } if ($oldversion < 2005042400) { // Changes to quiz table // The bits of the optionflags field will hold various option flags table_column('quiz', '', 'optionflags', 'integer', '10', 'unsigned', '0', 'not null', 'timeclose'); // The penalty scheme table_column('quiz', '', 'penaltyscheme', 'integer', '4', 'unsigned', '0', 'not null', 'optionflags'); // The review options are now all stored in the bits of the review field table_column('quiz', 'review', 'review', 'integer', 10, 'unsigned', 0, 'not null', ''); /// Changes to quiz_attempts table // The preview flag marks teacher previews table_column('quiz_attempts', '', 'preview', 'tinyint', '2', 'unsigned', '0', 'not null', 'timemodified'); // The layout is the list of questions with inserted page breaks. table_column('quiz_attempts', '', 'layout', 'text', '', '', '', 'not null', 'timemodified'); // For old quiz attempts we will set this to the repaginated question list from $quiz->questions /// The following updates of field values require a loop through all quizzes // This is because earlier versions of mysql don't allow joins in UPDATE if ($quizzes = get_records('quiz')) { // turn reporting off temporarily to avoid one line output per set_field $olddebug = $db->debug; $db->debug = false; echo 'Now updating '.count($quizzes).' quizzes'; foreach ($quizzes as $quiz) { // repaginate if ($quiz->questionsperpage) { $quiz->questions = quiz_repaginate($quiz->questions, $quiz->questionsperpage); set_field('quiz', 'questions', $quiz->questions, 'id', $quiz->id); } set_field('quiz_attempts', 'layout', $quiz->questions, 'quiz', $quiz->id); // set preview flag if ($teachers = get_course_teachers($quiz->course)) { $teacherids = implode(',', array_keys($teachers)); execute_sql("UPDATE {$CFG->prefix}quiz_attempts SET preview = 1 WHERE userid IN ($teacherids)"); } // set review flags in quiz table $review = (QUIZ_REVIEW_IMMEDIATELY & (QUIZ_REVIEW_RESPONSES + QUIZ_REVIEW_SCORES)); if ($quiz->feedback) { $review += (QUIZ_REVIEW_IMMEDIATELY & QUIZ_REVIEW_FEEDBACK); } if ($quiz->correctanswers) { $review += (QUIZ_REVIEW_IMMEDIATELY & QUIZ_REVIEW_ANSWERS); } if ($quiz->review & 1) { $review += QUIZ_REVIEW_CLOSED; } if ($quiz->review & 2) { $review += QUIZ_REVIEW_OPEN; } set_field('quiz', 'review', $review, 'id', $quiz->id); } $db->debug = $olddebug; } // We can now drop the fields whose data has been moved to the review field execute_sql(" ALTER TABLE `{$CFG->prefix}quiz` DROP feedback"); execute_sql(" ALTER TABLE `{$CFG->prefix}quiz` DROP correctanswers"); /// Renaming tables // rename the quiz_question_grades table to quiz_question_instances modify_database ('', 'ALTER TABLE prefix_quiz_question_grades RENAME prefix_quiz_question_instances;'); // rename the quiz_responses table quiz_states modify_database ('', 'ALTER TABLE prefix_quiz_responses RENAME prefix_quiz_states;'); /// add columns to quiz_states table // The sequence number of the state. table_column('quiz_states', '', 'seq_number', 'integer', '6', 'unsigned', '0', 'not null', 'originalquestion'); // For existing states we leave this at 0 because in the old quiz code there was only one response allowed // The time the state was created. table_column('quiz_states', '', 'timestamp', 'integer', '10', 'unsigned', '0', 'not null', 'answer'); // For existing states we will below set this to the timemodified field of the attempt // The type of event that led to the creation of the state table_column('quiz_states', '', 'event', 'integer', '4', 'unsigned', '0', 'not null', 'timestamp'); // The raw grade table_column('quiz_states', '', 'raw_grade', 'varchar', '10', '', '', 'not null', 'grade'); // For existing states (no penalties) this is equal to the grade execute_sql("UPDATE {$CFG->prefix}quiz_states SET raw_grade = grade"); // The penalty that the response attracted table_column('quiz_states', '', 'penalty', 'varchar', '10', '', '0.0', 'not null', 'raw_grade'); // For existing states this can stay at 0 because penalties did not exist previously. /// New table for pointers to newest and newest graded states modify_database('', "CREATE TABLE `prefix_quiz_newest_states` ( `id` int(10) unsigned NOT NULL auto_increment, `attemptid` int(10) unsigned NOT NULL default '0', `questionid` int(10) unsigned NOT NULL default '0', `new` int(10) unsigned NOT NULL default '0', `newgraded` int(10) unsigned NOT NULL default '0', `sumpenalty` varchar(10) NOT NULL default '0.0', PRIMARY KEY (`id`), UNIQUE KEY `attemptid` (`attemptid`,`questionid`) ) TYPE=MyISAM COMMENT='Gives ids of the newest open and newest graded states';"); /// Now upgrade some fields in states and newest_states tables where necessary // to save time on large sites only do this for attempts that have not yet been finished. if ($attempts = get_records_select('quiz_attempts', 'timefinish = 0')) { echo 'Update the states for the '.count($attempts).' open attempts'; // turn reporting off temporarily to avoid one line output per set_field $olddebug = $db->debug; $db->debug = false; foreach ($attempts as $attempt) { quiz_upgrade_states($attempt); } $db->debug = $olddebug; } /// Entries for the log_display table modify_database('', " INSERT INTO prefix_log_display VALUES ('quiz', 'preview', 'quiz', 'name');"); modify_database('', " INSERT INTO prefix_log_display VALUES ('quiz', 'start attempt', 'quiz', 'name');"); modify_database('', " INSERT INTO prefix_log_display VALUES ('quiz', 'close attempt', 'quiz', 'name');"); /// update the default settings in $CFG $review = (QUIZ_REVIEW_IMMEDIATELY & (QUIZ_REVIEW_RESPONSES + QUIZ_REVIEW_SCORES)); if (!empty($CFG->quiz_feedback)) { $review += (QUIZ_REVIEW_IMMEDIATELY & QUIZ_REVIEW_FEEDBACK); } if (!empty($CFG->quiz_correctanswers)) { $review += (QUIZ_REVIEW_IMMEDIATELY & QUIZ_REVIEW_ANSWERS); } if (isset($CFG->quiz_review) and ($CFG->quiz_review & 1)) { $review += QUIZ_REVIEW_CLOSED; } if (isset($CFG->quiz_review) and ($CFG->quiz_review & 2)) { $review += QUIZ_REVIEW_OPEN; } set_config('quiz_review', $review); /// Use tolerance instead of min and max in numerical question type table_column('quiz_numerical', '', 'tolerance', 'varchar', '255', '', '0.0', 'not null', 'answer'); execute_sql("UPDATE {$CFG->prefix}quiz_numerical SET tolerance = (max-min)/2"); modify_database('', 'ALTER TABLE `prefix_quiz_numerical` DROP `min`'); // Replaced by tolerance modify_database('', 'ALTER TABLE `prefix_quiz_numerical` DROP `max`'); // Replaced by tolerance /// Tables for Remote Questions modify_database ('', "CREATE TABLE `prefix_quiz_rqp` ( `id` int(10) unsigned NOT NULL auto_increment, `question` int(10) unsigned NOT NULL default '0', `type` int(10) unsigned NOT NULL default '0', `source` longblob NOT NULL default '', `format` varchar(255) NOT NULL default '', `flags` tinyint(3) unsigned NOT NULL default '0', `maxscore` int(10) unsigned NOT NULL default '1', PRIMARY KEY (`id`), KEY `question` (`question`) ) TYPE=MyISAM COMMENT='Options for RQP questions';"); modify_database ('', "CREATE TABLE `prefix_quiz_rqp_type` ( `id` int(10) unsigned NOT NULL auto_increment, `name` varchar(255) NOT NULL default '', `rendering_server` varchar(255) NOT NULL default '', `cloning_server` varchar(255) NOT NULL default '', `flags` tinyint(3) NOT NULL default '0', PRIMARY KEY (`id`), UNIQUE KEY `name` (`name`) ) TYPE=MyISAM COMMENT='RQP question types and the servers to be used to process them';"); modify_database ('', "CREATE TABLE `prefix_quiz_rqp_states` ( `id` int(10) unsigned NOT NULL auto_increment, `stateid` int(10) unsigned NOT NULL default '0', `responses` text NOT NULL default '', `persistent_data` text NOT NULL default '', `template_vars` text NOT NULL default '', PRIMARY KEY (`id`) ) TYPE=MyISAM COMMENT='RQP question type specific state information';"); } if ($oldversion < 2005050300) { // length of question determines question numbering. Currently all questions require one // question number except for DESCRIPTION questions. table_column('quiz_questions', '', 'length', 'integer', '10', 'unsigned', '1', 'not null', 'qtype'); execute_sql("UPDATE {$CFG->prefix}quiz_questions SET length = 0 WHERE qtype = ".DESCRIPTION); } if ($oldversion < 2005050408) { table_column('quiz_questions', '', 'penalty', 'float', '', '', '0.1', 'not null', 'defaultgrade'); table_column('quiz_newest_states', 'new', 'newest', 'integer', '10', 'unsigned', '0', 'not null'); } if ($oldversion < 2005051400) { modify_database('', 'ALTER TABLE prefix_quiz_rqp_type RENAME prefix_quiz_rqp_types;'); modify_database('', "CREATE TABLE `prefix_quiz_rqp_servers` ( id int(10) unsigned NOT NULL auto_increment, typeid int(10) unsigned NOT NULL default '0', url varchar(255) NOT NULL default '', can_render tinyint(2) unsigned NOT NULL default '0', can_author tinyint(2) unsigned NOT NULL default '0', PRIMARY KEY (id) ) TYPE=MyISAM COMMENT='Information about RQP servers';"); if ($types = get_records('quiz_rqp_types')) { foreach($types as $type) { $server->typeid = $type->id; $server->url = $type->rendering_server; $server->can_render = 1; insert_record('quiz_rqp_servers', $server); } } modify_database('', 'ALTER TABLE prefix_quiz_rqp_types DROP rendering_server'); modify_database('', 'ALTER TABLE prefix_quiz_rqp_types DROP cloning_server'); modify_database('', 'ALTER TABLE prefix_quiz_rqp_types DROP flags'); } if ($oldversion < 2005051401) { // Some earlier changes are undone here, so we need another condition if ($oldversion >= 2005042900) { // Restore the answer field table_column('quiz_numerical', '', 'answer', 'integer', '10', 'unsigned', '0', 'not null', 'answers'); $singleanswer = array(); if ($numericals = get_records('quiz_numerical')) { $numericals = array_values($numericals); $n = count($numericals); for ($i = 0; $i < $n; $i++) { $numerical =& $numericals[$i]; if (strpos($numerical->answers, ',')) { // comma separated list? // Back this up to delete the record after the new ones are created $id = $numerical->id; unset($numerical->id); // We need to create a record for each answer id $answers = explode(',', $numerical->answers); foreach ($answers as $answer) { $numerical->answer = $answer; insert_record('quiz_numerical', $numerical); } // ... and get rid of the old record delete_records('quiz_numerical', 'id', $id); } else { $singleanswer[] = $numerical->id; } } } // Do all of these at once if (!empty($singleanswer)) { $singleanswer = implode(',', $singleanswer); modify_database('', "UPDATE prefix_quiz_numerical SET answer = answers WHERE id IN ($singleanswer);"); } // All answer fields are set, so we can delete the answers field modify_database('', 'ALTER TABLE `prefix_quiz_numerical` DROP `answers`'); // If the earlier changes weren't made we can safely do only the // bits here. } else { // Comma separated questionids will be stored as sequence table_column('quiz_multianswers', '', 'sequence', 'varchar', '255', '', '', 'not null', 'question'); // Change the type of positionkey to int, so that the sorting works! table_column('quiz_multianswers', 'positionkey', 'positionkey', 'integer', '10', 'unsigned', '0', 'not null', ''); table_column('quiz_questions', '', 'parent', 'integer', '10', 'unsigned', '0', 'not null', 'category'); modify_database('', "UPDATE prefix_quiz_questions SET parent = id WHERE qtype ='".RANDOM."';"); // Each multianswer record is converted to a question object and then // inserted as a new question into the quiz_questions table. // After that the question fields in the quiz_answers table and the // qtype specific tables are updated to point to the new question id. // Note: The quiz_numerical table is different as it stores one record // per defined answer (to allow different tolerance values for // different possible answers. (Currently multiple answers are // not supported by the numerical editing interface, but // all processing code does support that possibility. if ($multianswers = get_records_sql("SELECT m.id, q.category, " . "q.id AS parent, " . // question id (of multianswer question) as parent "q.name, q.questiontextformat, " . "m.norm AS defaultgrade, " . // norm is snow stored as defaultgrade "m.answertype AS qtype, " . // just rename this "q.version, q.hidden, m.answers, " . "m.positionkey " . "FROM {$CFG->prefix}quiz_questions q, " . " {$CFG->prefix}quiz_multianswers m " . "WHERE q.qtype = '".MULTIANSWER."' " . "AND q.id = m.question " . "ORDER BY q.id ASC, m.positionkey ASC")) { // ordered by positionkey $multianswers = array_values($multianswers); $n = count($multianswers); $parent = $multianswers[0]->parent; $sequence = array(); $positions = array(); // Turn reporting off temporarily to avoid one line output per set_field global $db; $olddebug = $db->debug; $db->debug = false; echo 'Now updating '.$n.' cloze questions.'; for ($i = 0; $i < $n; $i++) { // Backup these two values before unsetting the object fields $answers = $multianswers[$i]->answers; unset($multianswers[$i]->answers); $pos = $multianswers[$i]->positionkey; unset($multianswers[$i]->positionkey); // Needed for substituting multianswer ids with position keys in the $state->answer field $positions[$multianswers[$i]->id] = $pos; // Create questions for all the multianswer victims unset($multianswers[$i]->id); $multianswers[$i]->length = 0; $multianswers[$i]->questiontext = ''; $multianswers[$i]->stamp = make_unique_id_code(); // $multianswers[$i]->parent is set in the query // $multianswers[$i]->defaultgrade is set in the query // $multianswers[$i]->qtype is set in the query $id = insert_record('quiz_questions', $multianswers[$i]); $sequence[$pos] = $id; // Update the quiz_answers table to point to these new questions execute_sql("UPDATE {$CFG->prefix}quiz_answers SET question = '$id' WHERE id IN ($answers)", false); // Update the questiontype tables to point to these new questions if (SHORTANSWER == $multianswers[$i]->qtype) { execute_sql("UPDATE {$CFG->prefix}quiz_shortanswer SET question = '$id' WHERE answers = '$answers'", false); } else if (MULTICHOICE == $multianswers[$i]->qtype) { execute_sql("UPDATE {$CFG->prefix}quiz_multichoice SET question = '$id' WHERE answers = '$answers'", false); } else if (NUMERICAL == $multianswers[$i]->qtype) { execute_sql("UPDATE {$CFG->prefix}quiz_numerical SET question = '$id' WHERE answer IN ($answers)", false); } // Whenever we're through with the subquestions of one multianswer // question we delete the old records in the multianswers table, // store a new record with the sequence in the multianswers table // and point $parent to the next multianswer question. if (!isset($multianswers[$i+1]) || $parent != $multianswers[$i+1]->parent) { // Substituting multianswer ids with position keys in the $state->answer field if ($states = get_records('quiz_states', 'question', $parent)) { foreach ($states as $state) { $reg = array(); preg_match_all('/(?:^|,)([0-9]+)-([^,]*)/', $state->answer, $reg); $state->answer = ''; $m = count($reg[1]); for ($j = 0; $j < $m; $j++) { if (isset($positions[$reg[1][$j]])) { $state->answer .= $positions[$reg[1][$j]] . '-' . $reg[2][$j] . ','; } else { notify("Undefined multianswer id ({$reg[1][$j]}) used in state #{$state->id}!"); $state->answer .= $j+1 . '-' . $reg[2][$j] . ','; } } $state->answer = rtrim($state->answer, ','); // strip trailing comma update_record('quiz_states', $state); } } delete_records('quiz_multianswers', 'question', $parent); $multi = new stdClass; $multi->question = $parent; $multi->sequence = implode(',', $sequence); insert_record('quiz_multianswers', $multi); if (isset($multianswers[$i+1])) { $parent = $multianswers[$i+1]->parent; $sequence = array(); $positions = array(); } } } $db->debug = $olddebug; } // Remove redundant fields from quiz_multianswers modify_database('', 'ALTER TABLE `prefix_quiz_multianswers` DROP `answers`'); modify_database('', 'ALTER TABLE `prefix_quiz_multianswers` DROP `positionkey`'); modify_database('', 'ALTER TABLE `prefix_quiz_multianswers` DROP `answertype`'); modify_database('', 'ALTER TABLE `prefix_quiz_multianswers` DROP `norm`'); } } if ($oldversion < 2005052004) { // We need to remove some duplicate entries that may be present in some databases // due to a faulty restore script // Remove duplicate entries from quiz_numerical if ($dups = get_records_sql(" SELECT question, answer, count(*) as num FROM {$CFG->prefix}quiz_numerical GROUP BY question, answer HAVING count(*) > 1" )) { foreach ($dups as $dup) { $ids = get_records_sql(" SELECT id, id FROM {$CFG->prefix}quiz_numerical WHERE question = '$dup->question' AND answer = '$dup->answer'" ); $skip = true; foreach ($ids as $id) { if ($skip) { $skip = false; } else { delete_records('quiz_numerical','id', $id->id); } } } } // Remove duplicate entries from quiz_shortanswer if ($dups = get_records_sql(" SELECT question, answers, count(*) as num FROM {$CFG->prefix}quiz_shortanswer GROUP BY question, answers HAVING count(*) > 1" )) { foreach ($dups as $dup) { $ids = get_records_sql(" SELECT id, id FROM {$CFG->prefix}quiz_shortanswer WHERE question = '$dup->question' AND answers = '$dup->answers'" ); $skip = true; foreach ($ids as $id) { if ($skip) { $skip = false; } else { delete_records('quiz_shortanswer','id', $id->id); } } } } // Remove duplicate entries from quiz_multichoice if ($dups = get_records_sql(" SELECT question, answers, count(*) as num FROM {$CFG->prefix}quiz_multichoice GROUP BY question, answers HAVING count(*) > 1" )) { foreach ($dups as $dup) { $ids = get_records_sql(" SELECT id, id FROM {$CFG->prefix}quiz_multichoice WHERE question = '$dup->question' AND answers = '$dup->answers'" ); $skip = true; foreach ($ids as $id) { if ($skip) { $skip = false; } else { delete_records('quiz_multichoice','id', $id->id); } } } } } if ($oldversion < 2005060300) { //Search all the orphan categories (those whose course doesn't exist) //and process them, deleting or moving them to site course - Bug 2459 //Set debug to false $olddebug = $db->debug; $db->debug = false; //Iterate over all the quiz_categories records to get their course id if ($courses = get_records_sql ("SELECT DISTINCT course as id, course FROM {$CFG->prefix}quiz_categories")) { //Iterate over courses foreach ($courses as $course) { //If the course doesn't exist, orphan category found! //Process it with quiz_delete_course(). It will do all the hard work. if (!record_exists('course', 'id', $course->id)) { require_once("$CFG->dirroot/mod/quiz/lib.php"); quiz_delete_course($course); } } } //Reset rebug to its original state $db->debug = $olddebug; } if ($oldversion < 2005062600) { modify_database ('', " CREATE TABLE `prefix_quiz_essay` ( `id` int(10) unsigned NOT NULL auto_increment, `question` int(10) unsigned NOT NULL default '0', `answer` varchar(255) NOT NULL default '', PRIMARY KEY (`id`), KEY `question` (`question`) ) TYPE=MyISAM COMMENT='Options for essay questions'"); modify_database ('', " CREATE TABLE `prefix_quiz_essay_states` ( `id` int(10) unsigned NOT NULL auto_increment, `stateid` int(10) unsigned NOT NULL default '0', `graded` tinyint(4) unsigned NOT NULL default '0', `fraction` varchar(10) NOT NULL default '0.0', `response` text NOT NULL, PRIMARY KEY (`id`) ) TYPE=MyISAM COMMENT='essay question type specific state information'"); } if ($oldversion < 2005070202) { // add new unique id to prepare the way for lesson module to have its own attempts table table_column('quiz_attempts', '', 'uniqueid', 'integer', '10', 'unsigned', '0', 'not null', 'id'); // initially we can use the id as the unique id because no other modules use attempts yet. execute_sql("UPDATE {$CFG->prefix}quiz_attempts SET uniqueid = id", false); // we set $CFG->attemptuniqueid to the next available id $record = get_record_sql("SELECT max(id)+1 AS nextid FROM {$CFG->prefix}quiz_attempts"); set_config('attemptuniqueid', empty($record->nextid) ? 1 : $record->nextid); } if ($oldversion < 2005081100) { execute_sql('ALTER TABLE '.$CFG->prefix.'quiz_rqp_types ADD `studentDocs` VARCHAR( 255 ) NOT NULL'); execute_sql('ALTER TABLE '.$CFG->prefix.'quiz_rqp_types ADD `teacherDocs` VARCHAR( 255 ) NOT NULL'); execute_sql('ALTER TABLE '.$CFG->prefix.'quiz_rqp_types ADD `adminDocs` VARCHAR( 255 ) NOT NULL'); } if ($oldversion < 2005081106) { execute_sql('ALTER TABLE '.$CFG->prefix.'quiz_rqp_servers ADD `properties` TINYINT( 8 ) NOT NULL'); execute_sql('ALTER TABLE '.$CFG->prefix.'quiz_rqp_servers ADD `version` FLOAT( 4 ) NOT NULL'); execute_sql('ALTER TABLE '.$CFG->prefix.'quiz_rqp_servers ADD `details` VARCHAR( 255 ) NOT NULL'); execute_sql('ALTER TABLE '.$CFG->prefix.'quiz_rqp_servers DROP `can_render`'); execute_sql('ALTER TABLE '.$CFG->prefix.'quiz_rqp_servers DROP `can_author`'); execute_sql('CREATE TABLE '.$CFG->prefix.'quiz_rqp_mimetypes (id INT( 10 ) UNSIGNED PRIMARY KEY AUTO_INCREMENT, serverid INT( 10 ) UNSIGNED NOT NULL, mimetype VARCHAR( 50 ) NOT NULL)'); } if ($oldversion < 2005090303) { execute_sql('ALTER TABLE '.$CFG->prefix.'quiz_rqp DROP `flags`'); execute_sql('ALTER TABLE '.$CFG->prefix.'quiz_rqp DROP `format`'); execute_sql('ALTER TABLE '.$CFG->prefix.'quiz_rqp DROP `maxscore`'); execute_sql('ALTER TABLE '.$CFG->prefix."quiz_rqp ADD `template` SMALLINT( 1 ) DEFAULT '0' NOT NULL"); } if ($oldversion < 2005091200) { //Admin Options string execute_sql('ALTER TABLE '.$CFG->prefix."quiz_rqp_types ADD `options` longblob NOT NULL default ''"); //Course options - set by teacher execute_sql('CREATE TABLE '.$CFG->prefix."quiz_rqp_course_options (id INT( 10 ) UNSIGNED PRIMARY KEY AUTO_INCREMENT, courseid INT( 10 ) UNSIGNED NOT NULL, typeid INT( 10 ) UNSIGNED NOT NULL, options longblob NOT NULL default '')"); //User options - set by specific user execute_sql('CREATE TABLE '.$CFG->prefix."quiz_rqp_user_options (id INT( 10 ) UNSIGNED PRIMARY KEY AUTO_INCREMENT, userid INT( 10 ) UNSIGNED NOT NULL, typeid INT( 10 ) UNSIGNED NOT NULL, options longblob NOT NULL default '')"); //Quiz options execute_sql('ALTER TABLE '.$CFG->prefix."quiz_rqp ADD `options` longblob NOT NULL default ''"); } return true; } ?> --- NEW FILE: postgres7.php --- <?php // $Id: postgres7.php,v 1.1 2005/09/12 09:46:59 pkiddie Exp $ function quiz_upgrade($oldversion) { // This function does anything necessary to upgrade // older versions to match current functionality global $CFG; include_once("$CFG->dirroot/mod/quiz/locallib.php"); if ($oldversion < 2003010100) { execute_sql(" ALTER TABLE {$CFG->prefix}quiz ADD review integer DEFAULT '0' NOT NULL AFTER `grademethod` "); } if ($oldversion < 2003010301) { table_column("quiz_truefalse", "true", "trueanswer", "INTEGER", "10", "UNSIGNED", "0", "NOT NULL", ""); table_column("quiz_truefalse", "false", "falseanswer", "INTEGER", "10", "UNSIGNED", "0", "NOT NULL", ""); table_column("quiz_questions", "type", "qtype", "INTEGER", "10", "UNSIGNED", "0", "NOT NULL", ""); } [...975 lines suppressed...] //Course options - set by teacher modify_database('',"CREATE TABLE prefix_quiz_rqp_course_options (id SERIAL PRIMARY KEY, courseid integer NOT NULL default '0', typeid integer NOT NULL default '0', options TEXT NOT NULL default '');"); //User options - set by specific user modify_database('',"CREATE TABLE prefix_quiz_rqp_user_options (id SERIAL PRIMARY KEY, userid integer NOT NULL default '0', typeid integer NOT NULL default '0', options TEXT NOT NULL default '');"); //Quiz options modify_database('',"ALTER TABLE prefix_quiz_rqp ADD options TEXT NOT NULL default ''"); } return true; } ?> --- NEW FILE: mysql.sql --- -- phpMyAdmin SQL Dump -- version 2.6.0-pl1 -- http://www.phpmyadmin.net -- -- Host: localhost -- Generation Time: Jun 05, 2005 at 04:32 PM -- Server version: 4.0.15 -- PHP Version: 4.3.3 -- -- Database: `moodle15` -- -- -------------------------------------------------------- -- -- Table structure for table `prefix_quiz` -- CREATE TABLE prefix_quiz ( id int(10) unsigned NOT NULL auto_increment, course int(10) unsigned NOT NULL default '0', name varchar(255) NOT NULL default '', intro text NOT NULL, timeopen int(10) unsigned NOT NULL default '0', timeclose int(10) unsigned NOT NULL default '0', optionflags int(10) unsigned NOT NULL default '0', penaltyscheme int(4) unsigned NOT NULL default '0', attempts smallint(6) NOT NULL default '0', attemptonlast tinyint(4) NOT NULL default '0', grademethod tinyint(4) NOT NULL default '1', decimalpoints int(4) NOT NULL default '2', review int(10) unsigned NOT NULL default '0', questionsperpage int(10) NOT NULL default '0', shufflequestions tinyint(4) NOT NULL default '0', shuffleanswers tinyint(4) NOT NULL default '0', questions text NOT NULL, sumgrades int(10) NOT NULL default '0', grade int(10) NOT NULL default '0', timecreated int(10) unsigned NOT NULL default '0', timemodified int(10) unsigned NOT NULL default '0', timelimit int(2) unsigned NOT NULL default '0', password varchar(255) NOT NULL default '', subnet varchar(255) NOT NULL default '', popup tinyint(4) NOT NULL default '0', PRIMARY KEY (id), KEY course (course) ) TYPE=MyISAM COMMENT='Main information about each quiz'; -- -------------------------------------------------------- -- -- Table structure for table `prefix_quiz_answers` -- CREATE TABLE prefix_quiz_answers ( id int(10) unsigned NOT NULL auto_increment, question int(10) unsigned NOT NULL default '0', answer text NOT NULL, fraction varchar(10) NOT NULL default '0.0', feedback text NOT NULL, PRIMARY KEY (id), KEY question (question) ) TYPE=MyISAM COMMENT='Answers, with a fractional grade (0-1) and feedback'; -- -------------------------------------------------------- -- -- Table structure for table `prefix_quiz_attemptonlast_datasets` -- CREATE TABLE prefix_quiz_attemptonlast_datasets ( id int(10) unsigned NOT NULL auto_increment, category int(10) unsigned NOT NULL default '0', userid int(10) unsigned NOT NULL default '0', datasetnumber int(10) unsigned NOT NULL default '0', PRIMARY KEY (id), UNIQUE KEY category (category,userid) ) TYPE=MyISAM COMMENT='Dataset number for attemptonlast attempts per user'; -- -------------------------------------------------------- -- -- Table structure for table `prefix_quiz_attempts` -- CREATE TABLE prefix_quiz_attempts ( id int(10) unsigned NOT NULL auto_increment, quiz int(10) unsigned NOT NULL default '0', userid int(10) unsigned NOT NULL default '0', attempt smallint(6) NOT NULL default '0', sumgrades varchar(10) NOT NULL default '0.0', timestart int(10) unsigned NOT NULL default '0', timefinish int(10) unsigned NOT NULL default '0', timemodified int(10) unsigned NOT NULL default '0', layout text NOT NULL, preview tinyint(3) unsigned NOT NULL default '0', PRIMARY KEY (id), KEY quiz (quiz), KEY userid (userid) ) TYPE=MyISAM COMMENT='Stores various attempts on a quiz'; -- -------------------------------------------------------- -- -- Table structure for table `prefix_quiz_calculated` -- CREATE TABLE prefix_quiz_calculated ( id int(10) unsigned NOT NULL auto_increment, question int(10) unsigned NOT NULL default '0', answer int(10) unsigned NOT NULL default '0', tolerance varchar(20) NOT NULL default '0.0', tolerancetype int(10) NOT NULL default '1', correctanswerlength int(10) NOT NULL default '2', correctanswerformat int(10) NOT NULL default '2', PRIMARY KEY (id), KEY question (question), KEY answer (answer) ) TYPE=MyISAM COMMENT='Options for questions of type calculated'; -- -------------------------------------------------------- -- -- Table structure for table `prefix_quiz_categories` -- CREATE TABLE prefix_quiz_categories ( id int(10) unsigned NOT NULL auto_increment, course int(10) unsigned NOT NULL default '0', name varchar(255) NOT NULL default '', info text NOT NULL, publish tinyint(4) NOT NULL default '0', stamp varchar(255) NOT NULL default '', parent int(10) unsigned NOT NULL default '0', sortorder int(10) unsigned NOT NULL default '999', PRIMARY KEY (id), KEY course (course) ) TYPE=MyISAM COMMENT='Categories are for grouping questions'; -- -------------------------------------------------------- -- -- Table structure for table `prefix_quiz_dataset_definitions` -- CREATE TABLE prefix_quiz_dataset_definitions ( id int(10) unsigned NOT NULL auto_increment, category int(10) unsigned NOT NULL default '0', name varchar(255) NOT NULL default '', type int(10) NOT NULL default '0', options varchar(255) NOT NULL default '', itemcount int(10) unsigned NOT NULL default '0', PRIMARY KEY (id), KEY category (category) ) TYPE=MyISAM COMMENT='Organises and stores properties for dataset items'; -- -------------------------------------------------------- -- -- Table structure for table `prefix_quiz_dataset_items` -- CREATE TABLE prefix_quiz_dataset_items ( id int(10) unsigned NOT NULL auto_increment, definition int(10) unsigned NOT NULL default '0', number int(10) unsigned NOT NULL default '0', value varchar(255) NOT NULL default '', PRIMARY KEY (id), KEY definition (definition) ) TYPE=MyISAM COMMENT='Individual dataset items'; -- -------------------------------------------------------- -- -- Table structure for table `mdl_quiz_essay` -- CREATE TABLE `prefix_quiz_essay` ( `id` int(10) unsigned NOT NULL auto_increment, `question` int(10) unsigned NOT NULL default '0', `answer` varchar(255) NOT NULL default '', PRIMARY KEY (`id`), KEY `question` (`question`) ) TYPE=MyISAM COMMENT='Options for essay questions'; -- -------------------------------------------------------- -- -- Table structure for table `mdl_quiz_essay_states` -- CREATE TABLE `prefix_quiz_essay_states` ( `id` int(10) unsigned NOT NULL auto_increment, `stateid` int(10) unsigned NOT NULL default '0', `graded` tinyint(4) unsigned NOT NULL default '0', `fraction` varchar(10) NOT NULL default '0.0', `response` text NOT NULL, PRIMARY KEY (`id`) ) TYPE=MyISAM COMMENT='essay question type specific state information'; -- -------------------------------------------------------- -- -- Table structure for table `prefix_quiz_grades` -- CREATE TABLE prefix_quiz_grades ( id int(10) unsigned NOT NULL auto_increment, quiz int(10) unsigned NOT NULL default '0', userid int(10) unsigned NOT NULL default '0', grade double NOT NULL default '0', timemodified int(10) unsigned NOT NULL default '0', PRIMARY KEY (id), KEY quiz (quiz), KEY userid (userid) ) TYPE=MyISAM COMMENT='Final quiz grade (may be best of several attempts)'; -- -------------------------------------------------------- -- -- Table structure for table `prefix_quiz_match` -- CREATE TABLE prefix_quiz_match ( id int(10) unsigned NOT NULL auto_increment, question int(10) unsigned NOT NULL default '0', subquestions varchar(255) NOT NULL default '', PRIMARY KEY (id), KEY question (question) ) TYPE=MyISAM COMMENT='Defines fixed matching questions'; -- -------------------------------------------------------- -- -- Table structure for table `prefix_quiz_match_sub` -- CREATE TABLE prefix_quiz_match_sub ( id int(10) unsigned NOT NULL auto_increment, question int(10) unsigned NOT NULL default '0', questiontext text NOT NULL, answertext varchar(255) NOT NULL default '', PRIMARY KEY (id), KEY question (question) ) TYPE=MyISAM COMMENT='Defines the subquestions that make up a matching question'; -- -------------------------------------------------------- -- -- Table structure for table `prefix_quiz_multianswers` -- CREATE TABLE prefix_quiz_multianswers ( id int(10) unsigned NOT NULL auto_increment, question int(10) unsigned NOT NULL default '0', sequence varchar(255) NOT NULL default '', PRIMARY KEY (id), KEY question (question) ) TYPE=MyISAM COMMENT='Options for multianswer questions'; -- -------------------------------------------------------- -- -- Table structure for table `prefix_quiz_multichoice` -- CREATE TABLE prefix_quiz_multichoice ( id int(10) unsigned NOT NULL auto_increment, question int(10) unsigned NOT NULL default '0', layout tinyint(4) NOT NULL default '0', answers varchar(255) NOT NULL default '', single tinyint(4) NOT NULL default '0', PRIMARY KEY (id), KEY question (question) ) TYPE=MyISAM COMMENT='Options for multiple choice questions'; -- -------------------------------------------------------- -- -- Table structure for table `prefix_quiz_newest_states` -- CREATE TABLE prefix_quiz_newest_states ( id int(10) unsigned NOT NULL auto_increment, attemptid int(10) unsigned NOT NULL default '0', questionid int(10) unsigned NOT NULL default '0', newest int(10) unsigned NOT NULL default '0', newgraded int(10) unsigned NOT NULL default '0', sumpenalty varchar(10) NOT NULL default '0.0', PRIMARY KEY (id), UNIQUE KEY attemptid (attemptid,questionid) ) TYPE=MyISAM COMMENT='Gives ids of the newest open and newest graded states'; -- -------------------------------------------------------- -- -- Table structure for table `prefix_quiz_numerical` -- CREATE TABLE prefix_quiz_numerical ( id int(10) unsigned NOT NULL auto_increment, question int(10) unsigned NOT NULL default '0', answer int(10) unsigned NOT NULL default '0', tolerance varchar(255) NOT NULL default '0.0', PRIMARY KEY (id), KEY answer (answer), KEY question (question) ) TYPE=MyISAM COMMENT='Options for numerical questions'; -- -------------------------------------------------------- -- -- Table structure for table `prefix_quiz_numerical_units` -- ... [truncated message content] |
From: pkiddie <pk...@us...> - 2005-09-12 09:47:17
|
Update of /cvsroot/stack/stack-1-0/scripts/rqp/moodle_16_rqp/quiz/questiontypes/rqp In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv16221/scripts/rqp/moodle_16_rqp/quiz/questiontypes/rqp Added Files: RQPv1p0Client.php editquestion.php icon.gif lib.php nb_easyxml_lite.php nb_soapfuncs.php options.php questiontype.php rqp.html types.php uni_soap.php.tortoise.removed uni_soap.php5.tortoise.removed Log Message: Moodle V1.6 updated files - until new RQP code on Moodle CVS repository, overwrite latest distribution with these files --- NEW FILE: lib.php --- <?php // $Id: lib.php,v 1.1 2005/09/12 09:46:59 pkiddie Exp $ /** * Library of functions used by the RQP question type * * @version $Id: lib.php,v 1.1 2005/09/12 09:46:59 pkiddie Exp $ * @author Alex Smith and other members of the Serving Mathematics project * {@link http://maths.york.ac.uk/serving_maths} * @license http://www.gnu.org/copyleft/gpl.html GNU Public License * @package quiz */ define('RQP_SERVER_RENDERING', 1); define('RQP_SERVER_IMPLICITCLONING', 2); define('RQP_SERVER_EXPLICITCLONING', 4); define('RQP_SERVER_AUTHORING', 8); define('RQP_SERVER_ADMINOPTIONS', 16); define('RQP_SERVER_TEACHEROPTIONS', 32); define('RQP_SERVER_USEROPTIONS', 64); //Define RQP version <TODO>: Should this be in the client define ('RQP_VER','1.0'); /** * Checks the current version of PHP and uses the correct instance checking function, based * upon an instanced object and its parent class * * is_a is deprecated in PHP 5, in favour of instanceof * <TODO>PHP4 parser does not like 'instanceof' * Source: www.php.net * @param object $IIO_INSTANCE the instantiated object * @param string $IIO_CLASS the class to check inheritance for */ function is_instance_of($IIO_INSTANCE, $IIO_CLASS) { /*if(floor(phpversion()) > 4) { if($IIO_INSTANCE instanceof $IIO_CLASS){ return true; } else{ return false; } } else*/if(floor(phpversion()) > 3){ return is_a($IIO_INSTANCE, $IIO_CLASS); } else{ return false; } } /** * Create an option dialog and pass $optionType and $type to options.php script by GET method */ function quiz_rqp_optionsDialog($optionType, $type) { $jsOpenOptions = '<script language="javascript" type="text/javascript">'; $jsOpenOptions .= 'javascript:'; $jsOpenOptions .= "window.open('options.php?typeid=$type&optionstype=$optionType','optionspopup', 'left=20,top=20,width=500,height=500,toolbar=0,resizable=1')"; $jsOpenOptions .= '</script>'; echo $jsOpenOptions; } /** * Outputs a key-val array based upon the POSTed $form variables. Only ouputs those that * belong to a particualar $inputPrefix * * Used to initialise the $inputData RenderType parameter * HACK: Also responsible for passing a 'save' request to the RQP server, as STACK authoring form * does not know by itself when the authoring form has gone to completion. * * @param object $form The $form variables * @param string $inputPrefix The prefix by which to retreive the $form variables for * @return array the key-val array $inputData */ function quiz_rqp_parse_input(&$form, $inputPrefix) { foreach($form->$inputPrefix as $arrayKey=>$formField) { //Check that the form field is not an array of PHP values - otherwise we must serialise if (!is_array($formField)) { $inputData[] = array( 'key' => $arrayKey, 'val' => $formField ); } else { $inputData[] = array( 'key' => $arrayKey, 'val' => serialize($formField)); } } //HACK. Authoring form doesnt know when to end an authoring session on its own, so tell it to if (isset($form->save)) { $inputData[] = array( 'key' => 'save', 'val' => 'save'); } return $inputData; } /** * Creates a colon separated list of space separated values from an associative * array of arrays * * An associative array of values or an associative array of arrays is imploded * to a string by creating a colon separated list of space separated values. The * key is treated as the first value. The {@link quiz_rqp_explode} function can * restore the array from this string representation. * @return string The string representation of the array. This is a colon * separated list of space separated values. * @param array $array An associative array of single values or an associative * array of arrays to be imploded. */ function quiz_rqp_implode($array) { if (count($array) < 1) { return ''; } $str = ''; foreach ($array as $key => $val) { $str .= $key . ' '; if (is_array($val)) { if (count($val) > 0) { foreach ($val as $subval) { $str .= $subval . ' '; } // Remove the trailing space $str = substr($str, 0, -1); } } else { $str .= $val; } $str .= ':'; } // Remove the trailing semi-colon return substr($str, 0, -1); } /** * Recreates an associative array or an associative array of arrays from the * string representation * * Takes a colon separated list of space separated values as produced by * {@link quiz_rqp_implode} and recreates the array. If an array of single values * is expected then an error results if an element has more than one value. * Otherwise every value is an array. * @return array The associative array restored from the string. Every * element is a single value if $multi is false or an array * if $multi is true. * @param string $str The string to explode. This is a colon separated list of * space separated values. * @param boolean $multi Flag indicating if the values in the array are expected * to be of multiple cardinality (i.e. an array of arrays * is expected) or single values (i.e. an array of values). * The default is false indicating an array of single * values is expected. */ function quiz_rqp_explode($str, $multi=false) { // Explode by colon if ($str === '') { return array(); } $array = explode(':', $str); $n = count($array); $return = array(); for ($i = 0; $i < $n; $i++) { // Explode by space $array[$i] = explode(' ', $array[$i]); // Get the key $key = array_shift($array[$i]); if (array_key_exists($key, $return)) { // Element appears twice! return false; } // Save the element if ($multi) { $return[$key] = $array[$i]; } else if (count($array[$i]) > 1) { return false; } else { $return[$key] = $array[$i][0]; } } return $return; } function quiz_rqp_print_serverinfo($serverinfo) { $info->align = array('right', 'left'); $info->data = array(); // will hold the data for the info table $info->data[] = array('<b>'.get_string('name').':</b>',$serverinfo['type']); $info->data[] = array('<b>'.get_string('serveridentifier', 'quiz').':</b>',$serverinfo['version']); $info->data[] = array('<b><a href="'.$serverinfo['details'].'">'.get_string('description').'</a></b>'); print_table($info); } function quiz_rqp_debug_soap($item) { global $CFG; if ($CFG->debug) { echo 'Here is the dump of the soap fault:<pre>'; var_dump($item); echo '<pre>'; } } //Returns a server url given a specified type, by randomly selecting a server function quiz_rqp_get_server($typeid) { if (!$servers = get_records('quiz_rqp_servers', 'typeid', $typeid)) { return false; } shuffle($servers); return $servers[0]; } function quiz_rqp_get_server_old($typeid) { if (!array_key_exists($typeid, $remote_connections)) { // get the available servers if (!$servers = get_records('quiz_rqp_servers', 'typeid', $typeid)) { // we don't have a server for this question type return false; } // put them in a random order shuffle($servers); // go through them and try to connect to each until we are successful foreach ($servers as $server) { if ($remote_connections[$typeid] = rqp_connect($server->url)) { break; // we have a connection } else { // We have a dead server here, should somehow flag that } } } // check that we did get a connection if (!$remote_connections[$typeid]) { unset($remote_connections[$typeid]); return false; } return true; } ?> --- NEW FILE: nb_soapfuncs.php --- <?php /***************************************************************************** The purpose of this library is to provide a very simple, interoperable SOAP implentation for PHP that is not dependent on any optional libraries and can function with both PHP version 4.3 and PHP version 5. This library is expected to be used with generated code from ws_gen and requires nb_easyxml.php. *****************************************************************************/ class nbSOAPFault { var $faultcode; var $faultstring; var $faultdetail; function nbSOAPFault($faultcode, $faultstring, $faultdetail) { $this->faultcode = $faultcode; $this->faultstring = $faultstring; $this->faultdetail = $faultdetail; $this->faultactor = $_SERVER['PHP_SELF']; } function soapify() { $out = "<soap:Fault>\n"; $out .= "<faultcode>".$this->faultcode."</faultcode>\n"; $out .= "<faultstring>".$this->faultstring."</faultstring>\n"; $out .= "<faultactor>".$this->faultactor."</faultactor>\n"; $out .= "<faultdetail>".$this->faultdetail."</faultdetail>\n"; $out .= "</soap:Fault>"; return $out; } } function desoap_nbSOAPFault($xmp, $cp) { return new nbSOAPFault("","",""); } class nbSOAP { //# this is just a placeholder for now, eventually it will // hold serialization methods for inbuilt types and // the SOAP request functions. } // HTTP 1.1 version; under development, still to get proxy support and error reporting. function nbSOAP_request11($URI, $SOAPAction, $data, $timeLimit = 20) { $contents = ""; $urldata = parse_url($URI); if(!array_key_exists('port', $urldata)) $urldata['port']=80; // $request = "GET " . $urldata['path'] . " HTTP/1.1\r\n"; $request = "POST " . $urldata['path'] . " HTTP/1.1\r\n"; $request .= "Host: ". $urldata['host'] ."\r\n"; $request .= "Accept: */*\r\n"; $request .= "User-Agent: PHP-script\r\n"; $request .= "Content-Type: text/xml; charset=utf-8\r\n"; $request .= "Content-length: " . strlen($data) . "\r\n"; $request .= "SOAPAction: \"" . $SOAPAction . "\"\r\n\r\n"; $request .= $data; $startTime = time(); $sock = fsockopen($urldata['host'],$urldata['port'], $errno, $errmsg, $timeLimit); if($sock==FALSE) { $fault = new nbSOAPFault("Server", "Timed out trying to contact server.", "No response from server."); $fault = "<soap:Body>\n" . $fault->soapify() . "</soap:Body>\n"; return nbSOAP_Envelope($fault); } stream_set_timeout($sock, 2); stream_set_blocking($sock, false); //echo "<pre>".htmlentities($request)."</pre>"; // Uncomment this for debugging if($sock == false) { return false; } else { fputs($sock, $request); //# this part needs to properly check the length of response, and //# time out neatly if there's too long a delay. $headersComplete = false; $pageComplete = false; $cl = -1; while ((!feof($sock))&&(!$pageComplete)) { $contents .= fread($sock, 8192); $cl = strlen($contents); if(!$headersComplete) { //# remove any leading continues $headerEnd = strpos($contents,"\r\n\r\n"); while(($headerEnd != false)&&(!$headersComplete)) { //echo "<p><i><b>Hdrend</b><br/><pre>[" . htmlentities($contents) . "]</pre></i></p>"; $fle = strpos($contents,"\r\n"); // first line end $line = substr($contents, 0, $fle); list($protocol, $rcode) = split(" ", $line, 3); $rcode = intval($rcode); // ensure its an integer; if(($rcode >= 100)&&($rcode <= 199)) // informational, I'm not interested { $contents = substr($contents, $headerEnd+4); $headerEnd = strpos($contents,"\r\n\r\n"); } elseif($rcode == 200) { $headersComplete = true; // check for chunked encoding $clp = strpos($contents,"Transfer-Encoding:"); // check for content length $clp = strpos($contents,"Content-Length:"); if($clp != false) { $cle = strpos($contents,"\r\n",$clp); $contentLength = intval(trim(substr($contents, $clp+15, $cle-$clp-15))); $headerLength = $cle+4; } else // no content length { // should really check that it is either chunked or CloseConnection // and through an exception if not... $contentLength = -1; } } else { $fault = new nbSOAPFault("Server", "An http error was returned, http code $rcode", "An http error was returned, http code $rcode"); $fault = "<soap:Body>\n" . $fault->soapify() . "</soap:Body>\n"; return nbSOAP_Envelope($fault); } } } if($headersComplete) // not an else because I want it done if headersComplete just set { if(($contentLength!=-1)&&(strlen($contents)>=$contentLength+$headerLength)) $pageComplete = true; } $callTime = time()-$startTime; if($callTime >= $timeLimit) { $pageComplete = true; $fault = new nbSOAPFault("Server", "Timed out calling server.", "No response, or an incomplete response before the request timed out."); $fault = "<soap:Body>\n" . $fault->soapify() . "</soap:Body>\n"; return nbSOAP_Envelope($fault); } //echo "<p><i><pre>[" . htmlentities($contents) . "]</pre></i></p>"; } fclose($sock); } //echo "<pre>" . htmlentities($contents) . "</pre>"; // Uncomment this for debugging return $contents; } function nbSOAP_request10($URI, $SOAPAction, $data) { $contents = ""; $urldata = parse_url($URI); if(!array_key_exists('port', $urldata)) $urldata['port']=80; $request = "POST " . $urldata['path'] . " HTTP/1.0\r\n"; $request .= "Host: ". $urldata['host'] ."\r\n"; $request .= "Accept: */*\r\n"; $request .= "User-Agent: PHP-script\r\n"; $request .= "Content-Type: text/xml; charset=utf-8\r\n"; $request .= "Content-length: " . strlen($data) . "\r\n"; $request .= "SOAPAction: \"" . $SOAPAction . "\"\r\n\r\n"; $request .= $data; $sock = fsockopen($urldata['host'],$urldata['port'], $errno, $errmsg, 30); stream_set_blocking($sock, false); echo "<pre>".htmlentities($request)."</pre>"; // Uncomment this for debugging if($sock == false) { return false; } else { fputs($sock, $request); while (!feof($sock)) { $contents .= fread($sock, 8192); } fclose($sock); } echo "<pre>" . htmlentities($contents) . "</pre>"; // Uncomment this for debugging return $contents; } function nbSOAP_Envelope($body) { $body = trim($body); if(substr($body,0,10) != "<soap:Body") return false; $soapXML = "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n"; $soapXML .= "<soap:Envelope xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" "; $soapXML .= "xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\" xmlns:soap=\"http://schemas.xmlsoap.org/soap/envelope/\">\n"; $soapXML .= $body; $soapXML .= "\n</soap:Envelope>\n"; return $soapXML; } function encodeXMLSafeString($in) { // this is virtually the same as htmlspecialchars, however I've made my own version to // ensure it always matches the decodeXMLSafeString function. $plain = array("&", "<", ">", "\""); $code = array("&", "<", ">", """); return str_replace($plain, $code, strval($in)); } function decodeXMLSafeString($in) { $code = array("<", ">", """, "&"); $plain = array("<", ">", "\"", "&"); return str_replace($code, $plain, $in); } ?> --- NEW FILE: questiontype.php --- <?php // $Id: questiontype.php,v 1.1 2005/09/12 09:46:59 pkiddie Exp $ /** * This file defines the RQP question type class * * @version $Id: questiontype.php,v 1.1 2005/09/12 09:46:59 pkiddie Exp $ * @author Alex Smith and other members of the Serving Mathematics project * {@link http://maths.york.ac.uk/serving_maths} * @license http://www.gnu.org/copyleft/gpl.html GNU Public License * @package quiz */ require_once($CFG->dirroot . '/mod/quiz/questiontypes/rqp/lib.php'); //require_once($CFG->dirroot . '/mod/quiz/questiontypes/rqp/remote.php'); require_once($CFG->dirroot . '/mod/quiz/questiontypes/rqp/RQPv1p0Client.php'); /** * RQP question type class */ class quiz_rqp_qtype extends quiz_default_questiontype { /** * Name of the rqp question type * * @ return string 'rqp' */ function name() { return 'rqp'; } /** * * Save the RQP question * * We must only save the RQP question when the server has indicated to us that it is complete */ function save_question($question, &$form, $course) { if ($form->completion=='complete') { $question = parent::save_question($question, $form, $course); } return $question; } /** * Indicates to question.php that there are no more authoring rendering forms to process. * Authoring has reached completion */ function finished_edit_wizard(&$form) { return isset($form->backtoquiz); } /** * Echos any hidden fields at the bottom of the RQP script. * Custom definition from base questiontype.php */ function print_question_form_end($question, $submitscript='') { global $USER; echo '<tr valign="top"> <td colspan="2" align="center"> <input type="submit" '.$submitscript.' value="'.'edit'.'" /> '; if ($question->id) { // Switched off until bug 3445 is fixed // echo '<input type="submit" name="makecopy" '.$submitscript.' value="'.get_string("makecopy", "quiz").'" /> '; } echo '<input type="submit" name="save" value="'.'save'.'" /> <input type="submit" name="cancel" value="'.get_string("cancel").'" /> <input type="hidden" name="sesskey" value="'.$USER->sesskey.'" /> <input type="hidden" name="id" value="'.$question->id.'" /> <input type="hidden" name="qtype" value="'.$question->qtype.'" />'; // The following hidden field indicates that the versioning code should be turned on, i.e., // that old versions should be kept if necessary echo '<input type="hidden" name="versioning" value="on" /> </td></tr>'; } /** * Save the type-specific options * * This also saves additional information that it receives from * an RQP_itemInformation call to the RQP server */ function save_question_options($form) { global $CFG; require_once("RQPv1p0Client.php"); $rqpserver = new RQPv1p0(); //Create new instance of RQP web service consumer // Check source type if (!$type = get_record('quiz_rqp_types', 'id', $form->type)) { $result->notice = get_string('invalidsourcetype', 'quiz'); return $result; } if (!$server = quiz_rqp_get_server($type->id)) { $result->notice = get_string('noserverforrqptype', 'quiz'); return $result; } else { //Choose RQP server of correct type $rqpserver->Url = $server->url; //Take URL of server as one that is retrieved from random fn // Create the object to be stored in quiz_rqp table $options = new object; $options->question = $form->id; $options->type = $form->type; $options->source = $form->source; //Check source file and retrieve more fields from Item information call $itemResponse = $rqpserver->RQP_ItemInformation($form->source); //Check SOAP fault has not been returned if (is_instance_of($itemResponse,'nbSOAPFault')) { $result->notice = 'SOAP fault returned. Please try again!'; return $result; } if ($itemResponse['error']) { $result->notice = $item->error; return $result; } //Shouldnt return for a warning if ($itemResponse['warning']) { $result->notice = $item->warning; } if (!$itemResponse['itemProperties']['valid']) { $result->notice = 'item not valid'; //todo: translate return $result; } if ($itemResponse['itemProperties']['timeDependent']) { $result->noticeyesno = get_string('notimedependentitems', 'quiz'); } if ($itemResponse['itemProperties']['canComputerScore']) { $result->noticeyesno = get_string('nomanualmarkprovision', 'quiz'); } //itemProperties['adaptive'] ignored at the time being //Now perform the addition into the relevent fields $question = new object; //1. The quiz_questions table if ($question = get_record('quiz_questions', $form->id)) { $question->defaultgrade = $itemResponse['itemPropeties']['maxScore']; if (!update_record('quiz_questions', $question)) { $result->error = "Could not update quiz question to add default grade!"; return $result; } } //2. The quiz_rqp table // Save the options if ($old = get_record('quiz_rqp', 'question', $form->id)) { $old->type = $options->type; $old->source = $options->source; $old->template = $itemResponse['itemProperties']['template']; if (!update_record('quiz_rqp', $old)) { $result->error = "Could not update quiz rqp options! (id=$old->id)"; return $result; } } else { if (!insert_record('quiz_rqp', $options)) { $result->error = 'Could not insert quiz rqp options!'; return $result; } } return true; } } /** * Loads the question type specific options for the question. * * This function loads all question type specific options for the * question from the database into the $question->options field. * @return bool Indicates success or failure. * @param object $question The question object for the question. */ function get_question_options(&$question) { $options =& $question->options; if (!$options = get_record('quiz_rqp', 'question', $question->id)) { return false; } if (!$type = get_record('quiz_rqp_types', 'id', $options->type)) { return false; } //$options->type_name = $type->name; return true; } /** * Return a value or array of values which will give full marks if graded as * the $state->responses field * * The correct answers are obtained from the RQP server via the * RQP_SessionInformation operation * @return mixed An array of values giving the responses corresponding * to the (or a) correct answer to the question. * @param object $question The question for which the correct answer is to * be retrieved. * @param object $state The state object that corresponds to the question, * for which a correct answer is needed. */ function get_correct_responses(&$question, &$state) { $info = remote_session_info($question, $state); if (false === $info || is_soap_fault($info)) { return null; } return $info->correctResponses; } /** * Creates empty session and response information for the question * * This function is called to start a question session. Empty question type * specific session data and empty response data is added to the state object. * @return bool Indicates success or failure. * @param object $question The question for which the session is to be created. * @param object $state The state to create the session for. This is passed by * reference and will be updated. * @param object $cmoptions (not used) * @param object $attempt The attempt for which the session is to be * started. (not used) */ function create_session_and_responses(&$question, &$state, $cmoptions, $attempt) { $state->responses = array('' => ''); $state->options->persistent_data = ''; return true; } /** * Restores the session data and most recent responses for the given state * * This function loads any session data associated with the question session * in the given state from the quiz_rqp_states table into the state object. * @return bool Indicates success or failure. * @param object $question The question object for the question including any * question type specific information. * @param object $state The saved state to load the session for. This * object is updated to include the question * type specific session information and responses * (it is passed by reference). */ function restore_session_and_responses(&$question, &$state) { if (!$options = get_record('quiz_rqp_states', 'stateid', $state->id)) { return false; } //from lib.php $state->responses = quiz_rqp_explode($options->responses); $state->options->persistent_data = $options->persistent_data; return true; } /** * Saves the session data and responses for the question in a new state * * This function saves all session data from the state object into the * quiz_rqp_states table * @return bool Indicates success or failure. * @param object $question The question object for the question including * the question type specific information. * @param object $state The state for which the question type specific * data and responses should be saved. */ function save_session_and_responses(&$question, &$state) { //from lib.php $options->stateid = $state->id; $options->responses = quiz_rqp_implode($state->responses); $options->persistent_data = $state->options->persistent_data; if ($state->update) { if (!$options->id = get_field('quiz_rqp_states', 'id', 'stateid', $state->id)) { return false; } if (!update_record('quiz_rqp_states', $options)) { return false; } } else { if (!insert_record('quiz_rqp_states', $options)) { return false; } } return true; } /** * Prints the main content of the question including any interactions * * This function prints the main content of the question which it obtains * from the RQP server via the Render operation. It also updates * $state->options->persistent_data and $state->options->template_vars * with the values returned by the RQP server. * @param object $question The question to be rendered. * @param object $state The state to render the question in. The grading * information is in ->grade, ->raw_grade and * ->penalty. The current responses are in * ->responses. The last graded state is in * ->last_graded (hence the most recently graded * responses are in ->last_graded->responses). * @param object $cmoptions * @param object $options An object describing the rendering options. */ function print_question_formulation_and_controls(&$question, &$state, $cmoptions, $options) { global $CFG; require_once("RQPv1p0Client.php"); $rqpserver = new RQPv1p0(); //Create new instance of RQP web service consumer if (!$server = quiz_rqp_get_server($question->options->type)) { notify('No servers of specified type'); exit; } $rqpserver->Url = $server->url; // Use the render output created during grading if it exists if (isset($state->options->renderoutput)) { $output =& $state->options->renderoutput; // Initial render operation at beginning of session } else { //Initialise render parameters $render['source'] = $question->options->source; $render['options'] = array ( 'admin' => '' , 'teacher' => 'current quiz name', 'user' => '', 'user-agent' => '', 'accept' => '', 'language' => ''); $render['persistentData']= ''; $render['directives'] = array(''); $render['mimetypes'] = array('text/html'); $render['namePrefix'] = $question->name_prefix; //Must be name_prefix in order to process form fields $render['itemBase'] = ''; $render['resourceBase'] = $CFG->dataroot . '/moddata/quiz/rqp/resource/'; $render['tempfileBase'] = $CFG->dataroot . '/moddata/quiz/rqp/temp/'; $render['inputData']=array(); $output = $rqpserver->RQP_Render($render['source'],$render['options'], $render['persistentData'],$render['inputData'], $render['directives'],$render['mimetypes'], $render['namePrefix'],$render['itemBase'], $render['resourceBase'],$render['tempfileBase']); //Check SOAP fault has not been returned if (is_instance_of($output,'nbSOAPFault')) { notify('SOAP fault returned. Please try again!'); unset($output); exit; } } $state->options->persistent_data = $output->persistentData; //Echo all output params //1. Each head element if (!empty($output['head'])) { foreach($output['head'] as $htmlString) { echo($htmlString); } } //2. The title - most likely the question title if (!empty($output['output']['title'])) { echo '<h2>'. html_entity_decode($output['output']['title']) . '</h2><br />'; } //3. The question stem if (!empty($output['output']['stem'])) { echo '<div class="RQPstem">'; echo html_entity_decode($output['output']['stem']); echo '</div>'; } //3. The body - most likely interactions go here! if (!empty($output['output']['body'])) { echo html_entity_decode($output['output']['body']); } //4. Any feedback when required if ($options->feedback) { if (!empty($output['output']['feedback'])) { echo '<div class="RQPfeedback">'; echo html_entity_decode($output['output']['feedback']); echo '</div>'; } } //5. Any STACK responses if ($options->validation) { if (!empty($output['output']['response'])) { echo '<div class="RQPresponse">'; echo html_entity_decode($output['output']['response']); echo '</div>'; } } //6. Answer where required if (!empty($output['output']['answer'])) { echo '<div class="RQPanswer">'; echo html_entity_decode($output['output']['answer']); echo '</div>'; } //7. Solution to answering the question if ($options->correct_responses) { if (!empty($output['output']['solution'])) { echo '<div class="RQPsolution">'; echo html_entity_decode($output['output']['solution']); echo '</div>'; } } // Remove the render output created during grading (if any) unset($state->options->renderoutput); } /** * Prints the submit and validate buttons * @param object $question The question for which the buttons are to be printed * @param object $state The state the question is in (not used) * @param object $cmoptions * @param object $options An object describing the rendering options. * (not used. This function should only have been called * if the options were such that the buttons are required) */ function print_question_submit_buttons(&$question, &$state, $cmoptions, $options) { echo '<input type="submit" name="'; echo $question->name_prefix; echo 'validate" value="'; print_string('validate', 'quiz'); echo '" /> '; if ($cmoptions->optionflags & QUIZ_ADAPTIVE) { echo '<input type="submit" name="'; echo $question->name_prefix; echo 'mark" value="'; print_string('mark', 'quiz'); echo '" />'; } //QUIZ_ADAPTIVE flag ignored! } /** * Performs response processing and grading * * This function calls RQP_Render to perform response processing and grading * and updates the state accordingly. It also caches the rendering output in case * it is needed later. * @return boolean Indicates success or failure. * @param object $question The question to be graded. * @param object $state The state of the question to grade. The current * responses are in ->responses. The last graded state * is in ->last_graded (hence the most recently graded * responses are in ->last_graded->responses). The * question type specific information is also * included. The ->raw_grade and ->penalty fields * must be updated. The method is able to * close the question session (preventing any further * attempts at this question) by setting * $state->event to QUIZ_EVENTCLOSE. * @param object $cmoptions */ function grade_responses(&$question, &$state, $cmoptions) { global $CFG; require_once("RQPv1p0Client.php"); // Perform the grading and rendering // Make the code more readable $options =& $question->options; //Initialise render parameters $render['source'] = $options->source; $render['options'] = array ( 'admin' => '' , 'teacher' => 'current quiz name', 'user' => '', 'user-agent' => '', 'accept' => '', 'language' => ''); $render['persistentData']= ''; $render['directives'] = array(''); $render['mimetypes'] = array('text/html');; $render['namePrefix'] = $question->name_prefix; $render['itemBase'] = ''; $render['resourceBase'] = $CFG->dataroot . '/moddata/quiz/rqp/resource/'; $render['tempfileBase'] = $CFG->dataroot . '/moddata/quiz/rqp/temp/'; $render['inputData']=array(); // Add prefix to response variable names foreach ($state->responses as $key => $resp) { $render['inputData'][] = array( 'key' => $question->name_prefix . $key, 'val' => $resp); } if (QUIZ_EVENTGRADE == $state->event || QUIZ_EVENTCLOSE == $state->event) { $render['directives'][] = 'advanceState'; } $rqpserver = new RQPv1p0(); //Create new instance of RQP web service consumer if (!$server = quiz_rqp_get_server($options->type)) { notify('No servers of specified type'); exit; } $rqpserver->Url = $server->url; $output = $rqpserver->RQP_Render($render['source'],$render['options'], $render['persistentData'],$render['inputData'], $render['directives'],$render['mimetypes'], $render['namePrefix'],$render['itemBase'], $render['resourceBase'],$render['tempfileBase']); //Check SOAP fault has not been returned if (is_instance_of($output,'nbSOAPFault')) { notify('SOAP fault returned. Please try again!'); unset($output); return false; } $state->options->persistent_data = $output['persistentData']; // Save the rendering results for later - important $state->options->renderoutput = $output; if (isset($output['outcomeVars']['rawScore'])) { $state->raw_grade = (float) $output['outcomeVars']['rawScore']; if (isset($output['outcomeVars']['penalty'])) { $state->penalty = (float) $output['outcomeVars']['penalty'] * $question->maxgrade; } else { $state->penalty = 0; } } /*else if (isset($output['outcomeVars']['grade'])) { // This won't work quite as we would like but it is the best we can // do given that the server won't tell us the information we need $state->raw_grade = (float) $output['outcomeVars']['grade'];*/ else if (isset($output['outcomeVars']['score'])) { $state->raw_grade = (float) $output['outcomeVars']['score']; $state->penalty = 0; } else { $state->raw_grade = 0; $state->penalty = 0; } /*$state->raw_grade = ($state->raw_grade * ((float) $question->maxgrade)) / ((float) $question->options->maxscore); // <TODO>*/ $state->raw_grade = ($state->raw_grade * ((float) $question->maxgrade)) / ((float) $question->defaultgrade); return true; } /** * Includes configuration settings for the question type on the quiz admin * page * * Returns an array of objects describing the options for the question type * to be included on the quiz module admin page. * This is currently only a link to the server setup page types.php * @return array Array of objects describing the configuration options to * be included on the quiz module admin page. */ function get_config_options() { global $CFG; $link->name = 'managetypes'; $link->link = 'types.php'; return array($link); } } ////////////////////////////////////////////////////////////////////////// //// INITIATION - Without this line the question type is not in use... /// ////////////////////////////////////////////////////////////////////////// $QUIZ_QTYPES[RQP]= new quiz_rqp_qtype(); ?> --- NEW FILE: RQPv1p0Client.php --- <?php include("nb_easyxml_lite.php"); include("nb_soapfuncs.php"); /********* Data structures used by this web service ********* * * type ServerInformationDType{ * ['type']=>string * ['version']=>string * ['rqpVersion']=>string * ['details']=>anyURI * ['studentDocs']=>anyURI * ['teacherDocs']=>anyURI * ['adminDocs']=>anyURI * ['serverProperties']=>array(key=>val, ...) * ['mimetypes']=>array(string, ...) * ['resources']=>array(anyURI, ...) * } * * type ItemInformationDType{ * ['name']=>string * ['itemProperties']=>array(key=>val, ...) * ['error']=>string * ['warning']=>string * } * * type RenderDType{ * ['persistentData']=>string * ['outcomeVars']=>array(key=>val, ...) * ['onSubmit']=>string * ['head']=>array(string, ...) * ['output']=>array(key=>val, ...) * ['mimetype']=>string * ['files']=>array(anyURI, ...) * } * * * type input{ * ['key']=>string * ['val']=>string * } * * type CloneDType{ * ['clones']=>array(string, ...) * } * */ class RQPv1p0 { var $Url; /** * web service consumer method RQP_ServerInformation * * @return ServerInformationDType */ function RQP_ServerInformation() // returns a ServerInformationDType { $soapXML = "<soap:Body>\n"; $soapXML .= "<RQP_ServerInformation xmlns=\"http://mantis.york.ac.uk/rqp_v1p0\">\n"; $soapXML .= "</RQP_ServerInformation>\n"; $soapXML .= "</soap:Body>\n"; $soapXML = nbSOAP_Envelope($soapXML); // Send the request (syncronous http 1.0 only at the moment) $soapOut = nbSOAP_request11($this->Url, "http://mantis.york.ac.uk/rqp_v1p0/RQP_ServerInformation", $soapXML); // is it an error? $soapStart = strpos($soapOut, "<?xml"); if($soapStart==-1) return false; $xml = nb_easyxmldoc(substr($soapOut,$soapStart)); $body = $xml->findElement("Body", 0, "http://schemas.xmlsoap.org/soap/envelope/"); $cp = $xml->FindChildElement($body); if($cp==false) // empty soap:Body return null; $tn = $xml->getName($cp); if($tn=="Fault") // should really report it... return desoap_nbSOAPFault($xml, $cp); if($tn != "RQP_ServerInformationResponse") return null; $cp = $xml->FindChildElement($cp); if($cp==false) // empty value return null; $result = $this->desoap_ServerInformationDType($xml, $cp, "RQP_ServerInformation"); return $result; } /** * web service consumer method RQP_ItemInformation * * @param source : string * @return ItemInformationDType */ function RQP_ItemInformation($source) // returns a ItemInformationDType { $soapXML = "<soap:Body>\n"; $soapXML .= "<RQP_ItemInformation xmlns=\"http://mantis.york.ac.uk/rqp_v1p0\">\n"; // Parameter string source $soapXML .= $this->soapify_string($source, "source"); $soapXML .= "</RQP_ItemInformation>\n"; $soapXML .= "</soap:Body>\n"; $soapXML = nbSOAP_Envelope($soapXML); // Send the request (syncronous http 1.0 only at the moment) $soapOut = nbSOAP_request11($this->Url, "http://mantis.york.ac.uk/rqp_v1p0/RQP_ItemInformation", $soapXML); // is it an error? $soapStart = strpos($soapOut, "<?xml"); if($soapStart==-1) return false; $xml = nb_easyxmldoc(substr($soapOut,$soapStart)); $body = $xml->findElement("Body", 0, "http://schemas.xmlsoap.org/soap/envelope/"); $cp = $xml->FindChildElement($body); if($cp==false) // empty soap:Body return null; $tn = $xml->getName($cp); if($tn=="Fault") // should really report it... return desoap_nbSOAPFault($xml, $cp); if($tn != "RQP_ItemInformationResponse") return null; $cp = $xml->FindChildElement($cp); if($cp==false) // empty value return null; $result = $this->desoap_ItemInformationDType($xml, $cp, "RQP_ItemInformation"); return $result; } /** * web service consumer method RQP_Render * * @param source : string * @param options : kvPair[] * @param persistentData : string * @param inputData : input[] * @param directives : string[] * @param mimetypes : string[] * @param namePrefix : QName * @param itemBase : anyURI * @param resourceBase : anyURI * @param tempfileBase : anyURI * @return RenderDType */ function RQP_Render($source, $options, $persistentData, $inputData, $directives, $mimetypes, $namePrefix, $itemBase, $resourceBase, $tempfileBase) // returns a RenderDType { $soapXML = "<soap:Body>\n"; $soapXML .= "<RQP_Render xmlns=\"http://mantis.york.ac.uk/rqp_v1p0\">\n"; // Parameter string source $soapXML .= $this->soapify_string($source, "source"); // Parameter kvPair[] options $soapXML .= $this->soapify_kvPairArray($options, "options"); // Parameter string persistentData $soapXML .= $this->soapify_string($persistentData, "persistentData"); // Parameter input[] inputData $soapXML .= $this->soapify_inputArray($inputData, "inputData"); // Parameter string[] directives $soapXML .= $this->soapify_stringArray($directives, "directives"); // Parameter string[] mimetypes $soapXML .= $this->soapify_stringArray($mimetypes, "mimetypes"); // Parameter QName namePrefix $soapXML .= $this->soapify_QName($namePrefix, "namePrefix"); // Parameter anyURI itemBase $soapXML .= $this->soapify_anyURI($itemBase, "itemBase"); // Parameter anyURI resourceBase $soapXML .= $this->soapify_anyURI($resourceBase, "resourceBase"); // Parameter anyURI tempfileBase $soapXML .= $this->soapify_anyURI($tempfileBase, "tempfileBase"); $soapXML .= "</RQP_Render>\n"; $soapXML .= "</soap:Body>\n"; $soapXML = nbSOAP_Envelope($soapXML); // Send the request (syncronous http 1.0 only at the moment) $soapOut = nbSOAP_request11($this->Url, "http://mantis.york.ac.uk/rqp_v1p0/RQP_Render", $soapXML); // is it an error? $soapStart = strpos($soapOut, "<?xml"); if($soapStart==-1) return false; $xml = nb_easyxmldoc(substr($soapOut,$soapStart)); $body = $xml->findElement("Body", 0, "http://schemas.xmlsoap.org/soap/envelope/"); $cp = $xml->FindChildElement($body); if($cp==false) // empty soap:Body return null; $tn = $xml->getName($cp); if($tn=="Fault") // should really report it... return desoap_nbSOAPFault($xml, $cp); if($tn != "RQP_RenderResponse") return null; $cp = $xml->FindChildElement($cp); if($cp==false) // empty value return null; $result = $this->desoap_RenderDType($xml, $cp, "RQP_Render"); return $result; } /** * web service consumer method RQP_Clone * * @param source : string * @param number : int * @return CloneDType */ function RQP_Clone($source, $number) // returns a CloneDType { $soapXML = "<soap:Body>\n"; $soapXML .= "<RQP_Clone xmlns=\"http://mantis.york.ac.uk/rqp_v1p0\">\n"; // Parameter string source $soapXML .= $this->soapify_string($source, "source"); // Parameter int number $soapXML .= $this->soapify_int($number, "number"); $soapXML .= "</RQP_Clone>\n"; $soapXML .= "</soap:Body>\n"; $soapXML = nbSOAP_Envelope($soapXML); // Send the request (syncronous http 1.0 only at the moment) $soapOut = nbSOAP_request11($this->Url, "http://mantis.york.ac.uk/rqp_v1p0/RQP_Clone", $soapXML); // is it an error? $soapStart = strpos($soapOut, "<?xml"); if($soapStart==-1) return false; $xml = nb_easyxmldoc(substr($soapOut,$soapStart)); $body = $xml->findElement("Body", 0, "http://schemas.xmlsoap.org/soap/envelope/"); $cp = $xml->FindChildElement($body); if($cp==false) // empty soap:Body return null; $tn = $xml->getName($cp); if($tn=="Fault") // should really report it... return desoap_nbSOAPFault($xml, $cp); if($tn != "RQP_CloneResponse") return null; $cp = $xml->FindChildElement($cp); if($cp==false) // empty value return null; $result = $this->desoap_CloneDType($xml, $cp, "RQP_Clone"); return $result; } function soapify_ServerInformationDType($input, $name) { $ret = "<$name>"; $ret .= "\n"; if(array_key_exists('type', $input)) $ret .= $this->soapify_string($input['type'], "type"); if(array_key_exists('version', $input)) $ret .= $this->soapify_string($input['version'], "version"); if(array_key_exists('rqpVersion', $input)) $ret .= $this->soapify_string($input['rqpVersion'], "rqpVersion"); if(array_key_exists('details', $input)) $ret .= $this->soapify_anyURI($input['details'], "details"); if(array_key_exists('studentDocs', $input)) $ret .= $this->soapify_anyURI($input['studentDocs'], "studentDocs"); if(array_key_exists('teacherDocs', $input)) $ret .= $this->soapify_anyURI($input['teacherDocs'], "teacherDocs"); if(array_key_exists('adminDocs', $input)) $ret .= $this->soapify_anyURI($input['adminDocs'], "adminDocs"); if(array_key_exists('serverProperties', $input)) $ret .= $this->soapify_kvPairArray($input['serverProperties'], "serverProperties"); if(array_key_exists('mimetypes', $input)) $ret .= $this->soapify_stringArray($input['mimetypes'], "mimetypes"); if(array_key_exists('resources', $input)) $ret .= $this->soapify_anyURIArray($input['resources'], "resources"); $ret .= "\n"; $ret .= "</$name>\n"; return $ret; } function desoap_ServerInformationDType($xml, $idx, $name) { $ret = array(); $cidx = $xml->FindChildElement($idx); while($cidx != false) { $nm = $xml->getName($cidx); switch($nm) { // string type case "type": $ret['type'] = $xml->getContent($cidx); break; // string version case "version": $ret['version'] = $xml->getContent($cidx); break; // string rqpVersion case "rqpVersion": $ret['rqpVersion'] = $xml->getContent($cidx); break; // anyURI details case "details": $ret['details'] = $xml->getContent($cidx); break; // anyURI studentDocs case "studentDocs": $ret['studentDocs'] = $xml->getContent($cidx); break; // anyURI teacherDocs case "teacherDocs": $ret['teacherDocs'] = $xml->getContent($cidx); break; // anyURI adminDocs case "adminDocs": $ret['adminDocs'] = $xml->getContent($cidx); break; // kvPair[] serverProperties case "serverProperties": $ret['serverProperties'] = $this->desoap_kvPairArray($xml, $cidx, "serverProperties"); break; // string[] mimetypes case "mimetypes": $ret['mimetypes'] = $this->desoap_stringArray($xml, $cidx, "mimetypes"); break; // anyURI[] resources case "resources": $ret['resources'] = $this->desoap_anyURIArray($xml, $cidx, "resources"); break; } $cidx = $xml->FindNextPeer($cidx); } return $ret; } function soapify_ItemInformationDType($input, $name) { $ret = "<$name>"; $ret .= "\n"; if(array_key_exists('name', $input)) $ret .= $this->soapify_string($input['name'], "name"); if(array_key_exists('itemProperties', $input)) $ret .= $this->soapify_kvPairArray($input['itemProperties'], "itemProperties"); if(array_key_exists('error', $input)) $ret .= $this->soapify_string($input['error'], "error"); if(array_key_exists('warning', $input)) $ret .= $this->soapify_string($input['warning'], "warning"); $ret .= "\n"; $ret .= "</$name>\n"; return $ret; } function desoap_ItemInformationDType($xml, $idx, $name) { $ret = array(); $cidx = $xml->FindChildElement($idx); while($cidx != false) { $nm = $xml->getName($cidx); switch($nm) { // string name case "name": $ret['name'] = $xml->getContent($cidx); break; // kvPair[] itemProperties case "itemProperties": $ret['itemProperties'] = $this->desoap_kvPairArray($xml, $cidx, "itemProperties"); break; // string error case "error": $ret['error'] = $xml->getContent($cidx); break; // string warning case "warning": $ret['warning'] = $xml->getContent($cidx); break; } $cidx = $xml->FindNextPeer($cidx); } return $ret; } function soapify_string($input, $name) { $ret = "<$name>"; $ret .= encodeXMLSafeString($input); $ret .= "</$name>\n"; return $ret; } function desoap_string($xml, $idx, $name) { // ideally I should check element name is $name first $ret = decodeXMLSafeString($xml->getContent($idx)); return $ret; } function soapify_RenderDType($input, $name) { $ret = "<$name>"; $ret .= "\n"; if(array_key_exists('persistentData', $input)) $ret .= $this->soapify_string($input['persistentData'], "persistentData"); if(array_key_exists('outcomeVars', $input)) $ret .= $this->soapify_kvPairArray($input['outcomeVars'], "outcomeVars"); if(array_key_exists('onSubmit', $input)) $ret .= $this->soapify_string($input['onSubmit'], "onSubmit"); if(array_key_exists('head', $input)) $ret .= $this->soapify_stringArray($input['head'], "head"); if(array_key_exists('output', $input)) $ret .= $this->soapify_kvPairArray($input['output'], "output"); if(array_key_exists('mimetype', $input)) $ret .= $this->soapify_string($input['mimetype'], "mimetype"); if(array_key_exists('files', $input)) $ret .= $this->soapify_anyURIArray($input['files'], "files"); $ret .= "\n"; $ret .= "</$name>\n"; return $ret; } function desoap_RenderDType($xml, $idx, $name) { $ret = array(); $cidx = $xml->FindChildElement($idx); while($cidx != false) { $nm = $xml->getName($cidx); switch($nm) { // string persistentData case "persistentData": $ret['persistentData'] = $xml->getContent($cidx); break; // kvPair[] outcomeVars case "outcomeVars": $ret['outcomeVars'] = $this->desoap_kvPairArray($xml, $cidx, "outcomeVars"); break; // string onSubmit case "onSubmit": $ret['onSubmit'] = $xml->getContent($cidx); break; // string[] head case "head": $ret['head'] = $this->desoap_stringArray($xml, $cidx, "head"); break; // kvPair[] output case "output": $ret['output'] = $this->desoap_kvPairArray($xml, $cidx, "output"); break; // string mimetype case "mimetype": $ret['mimetype'] = $xml->getContent($cidx); break; // anyURI[] files case "files": $ret['files'] = $this->desoap_anyURIArray($xml, $cidx, "files"); break; } $cidx = $xml->FindNextPeer($cidx); } return $ret; } function soapify_kvPair($input, $name) { $ret = "<$name>"; $ret .= "\n"; if(array_key_exists('key', $input)) $ret .= $this->soapify_string($input['key'], "key"); if(array_key_exists('val', $input)) $ret .= $this->soapify_string($input['val'], "val"); $ret .= "\n"; $ret .= "</$name>\n"; return $ret; } function desoap_kvPair($xml, $idx, $name) { $ret = array(); $cidx = $xml->FindChildElement($idx); while($cidx != false) { $nm = $xml->getName($cidx); switch($nm) { // string key case "key": $ret['key'] = $xml->getContent($cidx); break; // string val case "val": $ret['val'] = $xml->getContent($cidx); break; } $cidx = $xml->FindNextPeer($cidx); } return $ret; } function soapify_input($input, $name) { $ret = "<$name>"; $ret .= "\n"; if(array_key_exists('key', $input)) $ret .= $this->soapify_string($input['key'], "key"); if(array_key_exists('val', $input)) $ret .= $this->soapify_string($input['val'], "val"); $ret .= "\n"; $ret .= "</$name>\n"; return $ret; } function desoap_input($xml, $idx, $name) { $ret = array(); $cidx = $xml->FindChildElement($idx); while($cidx != false) { $nm = $xml->getName($cidx); switch($nm) { // string key case "key": $ret['key'] = $xml->getContent($cidx); break; // string val case "val": $ret['val'] = $xml->getContent($cidx); break; } $cidx = $xml->FindNextPeer($cidx); } return $ret; } function soapify_QName($input, $name) { $ret = "<$name>"; $ret .= encodeXMLSafeString($input); $ret .= "</$name>\n"; return $ret; } function desoap_QName($xml, $idx, $name) { // ideally I should check element name is $name first $ret = decodeXMLSafeString($xml->getContent($idx)); return $ret; } function soapify_anyURI($input, $name) { $ret = "<$name>"; $ret .= encodeXMLSafeString($input); $ret .= "</$name>\n"; return $ret; } function desoap_anyURI($xml, $idx, $name) { // ideally I should check element name is $name first $ret = decodeXMLSafeString($xml->getContent($idx)); return $ret; } function soapify_CloneDType($input, $name) { $ret = "<$name>"; $ret .= "\n"; if(array_key_exists('clones', $input)) $ret .= $this->soapify_stringArray($input['clones'], "clones"); $ret .= "\n"; $ret .= "</$name>\n"; return $ret; } function desoap_CloneDType($xml, $idx, $name) { $ret = array(); $cidx = $xml->FindChildElement($idx); while($cidx != false) { $nm = $xml->getName($cidx); switch($nm) { // string[] clones case "clones": $ret['clones'] = $this->desoap_stringArray($xml, $cidx, "clones"); break; } $cidx = $xml->FindNextPeer($cidx); } return $ret; } function soapify_int($input, $name) { $ret = "<$name>"; $ret .= strval(intval($input)); $ret .= "</$name>\n"; return $ret; } function desoap_int($xml, $idx, $name) { // ideally I should check element name is $name first $ret = decodeXMLSafeString($xml->getContent($idx)); return $ret; } function soapify_kvPairArray($input, $name) { $ret = "<$name>\n"; if(is_array($input)) { reset($input); while(list($k, $v)=each($input)) { // manual changes to simplify PHP kvPair arrays start here $ret .= $this->soapify_kvPair(array("key"=>$k, "val"=>$v) , "kvPair") . "\n"; // manual changes to simplify PHP kvPair arrays end here } } else $ret .= $this->soapify_kvPair($input, "kvPair") . "\n"; $ret .= "</$name>\n"; return $ret; /*$ret = "<$name>\n"; if(is_array($input)) { reset($input); while(list($k, $v)=each($input)) { $ret .= $this->soapify_kvPair($v, "kvPair") . "\n"; } } else $ret .= $this->soapify_kvPair($input, "kvPair") . "\n"; $ret .= "</$name>\n"; return $ret;*/ ... [truncated message content] |
From: pkiddie <pk...@us...> - 2005-09-12 09:47:17
|
Update of /cvsroot/stack/stack-1-0/scripts/rqp/moodle_16_rqp In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv16221/scripts/rqp/moodle_16_rqp Added Files: latest rqp quiz module.txt Log Message: Moodle V1.6 updated files - until new RQP code on Moodle CVS repository, overwrite latest distribution with these files --- NEW FILE: latest rqp quiz module.txt --- The 'quiz' directory encloses all changes made to the RQP module within Moodle. To use, simply copy the quiz directory into the latest Moodle 1.6dev distribution. Moodle should automatically update all RQP databases where necessary. Currently RQP has been verified to work on a Windows IIS web server. |
From: pkiddie <pk...@us...> - 2005-09-12 09:47:17
|
Update of /cvsroot/stack/stack-1-0/scripts/rqp/moodle_16_rqp/quiz In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv16221/scripts/rqp/moodle_16_rqp/quiz Added Files: version.php Log Message: Moodle V1.6 updated files - until new RQP code on Moodle CVS repository, overwrite latest distribution with these files --- NEW FILE: version.php --- <?php // $Id: version.php,v 1.1 2005/09/12 09:46:59 pkiddie Exp $ //////////////////////////////////////////////////////////////////////////////// // Code fragment to define the version of quiz // This fragment is called by moodle_needs_upgrading() and /admin/index.php //////////////////////////////////////////////////////////////////////////////// $module->version = 2005091200; // The (date) version of this module $module->requires = 2005021600; // Requires this Moodle version $module->cron = 0; // How often should cron check this module (seconds)? ?> |
From: pkiddie <pk...@us...> - 2005-09-12 09:47:17
|
Update of /cvsroot/stack/stack-1-0/scripts/rqp/moodle_16_rqp/quiz/lang/en In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv16221/scripts/rqp/moodle_16_rqp/quiz/lang/en Added Files: quiz.php Log Message: Moodle V1.6 updated files - until new RQP code on Moodle CVS repository, overwrite latest distribution with these files --- NEW FILE: quiz.php --- <?php $string['backtoquestionlist'] = 'Back to Question List'; $string['changessaved'] = 'Grading Changes Saved'; $string['comments'] = 'Comments'; $string['editingessay'] = 'Editing Essay'; $string['essay'] = 'Essay'; $string['essayquestions'] = 'Essay Questions'; $string['gradeall'] = 'Grade All'; $string['gradeessays'] = 'Grade Essays'; $string['manualgrading'] = 'Manual grading'; $string['nocommentsyet'] = 'No comments yet.'; $string['noessayquestionsfound'] = 'No Essay Questions Found'; $string['essayonly'] = 'Manual grading is so far only implemented for essay questions'; $string['numungraded'] = '($a ungraded)'; $string['ungraded'] = 'Ungraded'; $string['missingitemtypeurl'] = 'You have not typed in a URL'; $string['incorrecturlused'] = 'Please ensure the URL you have typed in is of the correct form'; $string['nomorerqpservers'] = 'There are no more RQP servers'; $string['urlnotexists'] = 'This URL does not seem to be responding. Please ensure it is correct and try again'; $string['rqpservernewer'] = 'This server is running a newer version of RQP than Moodle'; $string['rqpserverolder'] = 'This server is running an older version of RQP than Moodle'; $string['serverexists'] = 'This server has already been added'; $string['serverinuse'] = 'This server is the last remaining $a type, which will make some existing questions unavailable.'; $string['adminOptions'] = 'Administrator Options'; $string['norqptype'] = 'No remote question type specified'; $string['invalidrqptype'] = 'Invalid remote question type'; $string['notloadoptions'] = 'Could not load the options for this question'; $string['noserverforrqptype'] = 'Could not retrieve server for this RQP type'; $string['invalidoptiontype'] = 'The type of options has not been specified'; ?> |
From: pkiddie <pk...@us...> - 2005-09-12 09:45:05
|
Update of /cvsroot/stack/stack-1-0/scripts/rqp/moodle_16_rqp/quiz/questiontypes/rqp In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv15818/rqp Log Message: Directory /cvsroot/stack/stack-1-0/scripts/rqp/moodle_16_rqp/quiz/questiontypes/rqp added to the repository |
From: pkiddie <pk...@us...> - 2005-09-12 09:44:32
|
Update of /cvsroot/stack/stack-1-0/scripts/rqp/moodle_16_rqp/quiz/lang/en In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv15702/en Log Message: Directory /cvsroot/stack/stack-1-0/scripts/rqp/moodle_16_rqp/quiz/lang/en added to the repository |
From: pkiddie <pk...@us...> - 2005-09-12 09:44:21
|
Update of /cvsroot/stack/stack-1-0/scripts/rqp/moodle_16_rqp/quiz/lang In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv15605/lang Log Message: Directory /cvsroot/stack/stack-1-0/scripts/rqp/moodle_16_rqp/quiz/lang added to the repository |
From: pkiddie <pk...@us...> - 2005-09-12 09:44:20
|
Update of /cvsroot/stack/stack-1-0/scripts/rqp/moodle_16_rqp/quiz/questiontypes In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv15605/questiontypes Log Message: Directory /cvsroot/stack/stack-1-0/scripts/rqp/moodle_16_rqp/quiz/questiontypes added to the repository |
From: pkiddie <pk...@us...> - 2005-09-12 09:44:20
|
Update of /cvsroot/stack/stack-1-0/scripts/rqp/moodle_16_rqp/quiz/db In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv15605/db Log Message: Directory /cvsroot/stack/stack-1-0/scripts/rqp/moodle_16_rqp/quiz/db added to the repository |
From: pkiddie <pk...@us...> - 2005-09-12 09:44:04
|
Update of /cvsroot/stack/stack-1-0/scripts/rqp/moodle_16_rqp/quiz In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv15566/quiz Log Message: Directory /cvsroot/stack/stack-1-0/scripts/rqp/moodle_16_rqp/quiz added to the repository |
From: pkiddie <pk...@us...> - 2005-09-12 09:43:45
|
Update of /cvsroot/stack/stack-1-0/scripts/rqp/moodle_16_rqp In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv15474/moodle_16_rqp Log Message: Directory /cvsroot/stack/stack-1-0/scripts/rqp/moodle_16_rqp added to the repository |
From: pkiddie <pk...@us...> - 2005-09-12 09:30:45
|
Update of /cvsroot/stack/stack-1-0/scripts/rqp/moodle/quiz/questiontypes In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv12543/questiontypes Log Message: Directory /cvsroot/stack/stack-1-0/scripts/rqp/moodle/quiz/questiontypes added to the repository |