From: pkiddie <pk...@us...> - 2005-08-30 13:52:03
|
Update of /cvsroot/stack/stack-1-0/scripts In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv15865/scripts Modified Files: stackAuthor.php stackDatabase.php stackQuiz.php stackXML.php Log Message: Instancing of new quiz moved to stackQuiz Order fields added to quiz_question db table Index: stackQuiz.php =================================================================== RCS file: /cvsroot/stack/stack-1-0/scripts/stackQuiz.php,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** stackQuiz.php 26 Aug 2005 15:33:43 -0000 1.9 --- stackQuiz.php 30 Aug 2005 13:51:55 -0000 1.10 *************** *** 449,452 **** --- 449,479 ---- } + /** + * Creates a new quiz with the mimimum fields. + * + * @param int $quizid ID the quiz is to be initialised with + * @return array $quiz Question with the mimimum fields + */ + function stack_quiz_new($quizid) { + + global $stack_web_url, $user; + + $quiz['quizid'] = $quizid; + + //Automatically generated quiz metadata added + $quiz['quizGUID'] = stack_generate_guid($stack_web_url); + $quiz['quizFormat'] = 'text/xml; charset="utf-8"'; + $quiz['quizPublisher'] = $stack_web_url; + $quiz['type'] = 'quiz'; + $quiz['quizUserLastEdited'] = $user['firstname']." ".$user['lastname']; + + if ($user['email']!='') + { + $quiz['questionUserLastEdited'].=' <'.$user['email'].'>'; + } + + return $quiz; + } + Index: stackXML.php =================================================================== RCS file: /cvsroot/stack/stack-1-0/scripts/stackXML.php,v retrieving revision 1.19 retrieving revision 1.20 diff -C2 -d -r1.19 -r1.20 *** stackXML.php 30 Aug 2005 12:20:29 -0000 1.19 --- stackXML.php 30 Aug 2005 13:51:55 -0000 1.20 *************** *** 103,107 **** $xmlDoc = &new DOMIT_Document(); //Required for some method calls $questionFrag = &new DOMIT_Element('assessmentItem'); ! show_array($question); //Construct main body of XML file //Iterate through each $stackQuestion field, and check for the presence in the instantiated $question --- 103,107 ---- $xmlDoc = &new DOMIT_Document(); //Required for some method calls $questionFrag = &new DOMIT_Element('assessmentItem'); ! //show_array($question); //Construct main body of XML file //Iterate through each $stackQuestion field, and check for the presence in the instantiated $question Index: stackDatabase.php =================================================================== RCS file: /cvsroot/stack/stack-1-0/scripts/stackDatabase.php,v retrieving revision 1.36 retrieving revision 1.37 diff -C2 -d -r1.36 -r1.37 *** stackDatabase.php 25 Aug 2005 16:15:07 -0000 1.36 --- stackDatabase.php 30 Aug 2005 13:51:54 -0000 1.37 *************** *** 1528,1539 **** /** * Add a questionID to a quiz * * @param int $quizid The quizid number of the quiz needed. * @param int $questionID The questionID of the question! * @return void */ ! function stack_db_quiz_add_question($quizid,$questionID) { ! $query = "INSERT INTO quiz_question (quizid, questionID) VALUES ('$quizid','$questionID')"; $result = stack_db_query($query); } --- 1528,1546 ---- /** * Add a questionID to a quiz + * Used in stackAuthor.php * * @param int $quizid The quizid number of the quiz needed. * @param int $questionID The questionID of the question! + * @param int $qord The order of the question in the quiz, optional * @return void */ ! function stack_db_quiz_add_question($quizid,$questionID,$qord='NULL') { ! if ($qord==='NULL') ! $query = "INSERT INTO quiz_question (quizid, questionID) VALUES ('$quizid','$questionID')"; ! ! else ! $query = "INSERT INTO quiz_question (quizid, questionID, qord) VALUES ('$quizid','$questionID','$qord')"; ! $result = stack_db_query($query); } Index: stackAuthor.php =================================================================== RCS file: /cvsroot/stack/stack-1-0/scripts/stackAuthor.php,v retrieving revision 1.33 retrieving revision 1.34 diff -C2 -d -r1.33 -r1.34 *** stackAuthor.php 30 Aug 2005 10:28:01 -0000 1.33 --- stackAuthor.php 30 Aug 2005 13:51:54 -0000 1.34 *************** *** 709,714 **** */ function stack_quiz_edit_form($quiz,&$errors,$PostTo = '') { ! ! //show_array($quiz); global $_PHP_SELF,$stackQuiz,$stackOptions, $stack_stand_alone; --- 709,714 ---- */ function stack_quiz_edit_form($quiz,&$errors,$PostTo = '') { ! ! show_array($quiz); global $_PHP_SELF,$stackQuiz,$stackOptions, $stack_stand_alone; *************** *** 736,741 **** echo "<input type='hidden' name='quiz[quizDateLastEdited]' value='$t' />\n ! <input type='hidden' name='quiz[quizGUID]' value='".sf($quiz,'quizGUID')."' />\n ! <input type='hidden' name='quiz[quizUserLastEdited]' value='".sf($quiz,'quizUserLastEdited')."' />\n <input type='hidden' name='quiz[quizPublisher]' value='".sf($quiz,'quizPublisher')."' />\n --- 736,740 ---- echo "<input type='hidden' name='quiz[quizDateLastEdited]' value='$t' />\n ! <input type='hidden' name='quiz[quizGUID]' value='".sf($quiz,'quizGUID')."' />\n <input type='hidden' name='quiz[quizUserLastEdited]' value='".sf($quiz,'quizUserLastEdited')."' />\n <input type='hidden' name='quiz[quizPublisher]' value='".sf($quiz,'quizPublisher')."' />\n |