From: Chris S. <san...@us...> - 2005-09-07 14:19:47
|
Update of /cvsroot/stack/stack-1-0 In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv19268 Modified Files: index.php quiz.php Added Files: choosequiz.php Log Message: --- NEW FILE: choosequiz.php --- <?php /** * * Welcome to STACK. A system for teaching and assessment using a * computer algebra kernel. * <br> * This file is licensed under the GPL License. * <br> * Copyright (c) 2005, Christopher James Sangwin * * @author Chris Sangwin C.J...@bh... * * @package Stack */ session_start(); require_once('stackConfig.php'); require_once('stackLib.php'); $user = stack_user_guest(); if (array_key_exists('subjectID',$_GET)) { $subjectID = $_GET['subjectID']; // Check this is permitted. $subject = stack_db_subject_get($subjectID,FALSE); $_SESSION['subject'] = $subject; } else if (array_key_exists('subject',$_SESSION)) { $subject = $_SESSION['subject']; $subjectID = $subject['subjectID']; } else { echo "You need to supply details of a STACK subjectID number."; die(); } echo "<table width='100%'>\n<tr>\n <td align='left'><h1>STACK quizzes</h1></td>\n"; echo " <td align='right'><img src='pics/logo.png' alt='STACK logo' /></td>\n</tr>\n</table>"; echo $subject['subjectHTMLHead']; $quiz_store = stack_db_subject_quiz_list_student($subjectID); stack_quiz_student_select($subjectID,$quiz_store, $user, FALSE, "choosequiz.php"); echo $subject['subjectHTMLFoot']; Index: quiz.php =================================================================== RCS file: /cvsroot/stack/stack-1-0/quiz.php,v retrieving revision 1.34 retrieving revision 1.35 diff -C2 -d -r1.34 -r1.35 *** quiz.php 5 Sep 2005 13:26:22 -0000 1.34 --- quiz.php 7 Sep 2005 14:19:35 -0000 1.35 *************** *** 63,66 **** --- 63,74 ---- } + // We need to be able to exit this page in flexible ways. + $returnurl = 'index.php?action=choose_quiz'; + if (array_key_exists('returnurl',$_POST)) { + if ('' != $_POST['returnurl']) { + $returnurl = $_POST['returnurl']; + } + } + // Now datetime $tnow = time(); *************** *** 575,578 **** --- 583,588 ---- // Now display each question, each with a form fragment. echo "<form name='quizform' action='$PostTo' method='POST'>\n"; + echo "<input type='hidden' name='returnurl' value ='$returnurl' />"; + foreach ($quizInst as $key => $qInst) { *************** *** 735,739 **** } ! echo "<tr><td><a href='index.php?action=choose_quiz'>".get_string('Home','stack','')."</a></td> <td>".get_string('STACKHomePage','stack','')."</td></tr>\n"; echo "</table>"; --- 745,749 ---- } ! echo "<tr><td><a href='$returnurl'>".get_string('Home','stack','')."</a></td> <td>".get_string('STACKHomePage','stack','')."</td></tr>\n"; echo "</table>"; Index: index.php =================================================================== RCS file: /cvsroot/stack/stack-1-0/index.php,v retrieving revision 1.29 retrieving revision 1.30 diff -C2 -d -r1.29 -r1.30 *** index.php 4 Sep 2005 21:26:18 -0000 1.29 --- index.php 7 Sep 2005 14:19:35 -0000 1.30 *************** *** 101,104 **** --- 101,105 ---- } + $subjectID = ''; if ('choose_quiz' == $action) { if (array_key_exists('subjectID',$_POST)) { *************** *** 157,161 **** break; case 'choose_quiz': ! if ('' == $subjectID) { echo "Please choose a subject first."; } else { --- 158,162 ---- break; case 'choose_quiz': ! if ('' === $subjectID) { echo "Please choose a subject first."; } else { |