From: Chris S. <san...@us...> - 2005-09-04 21:26:27
|
Update of /cvsroot/stack/stack-1-0/scripts In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv3193/scripts Modified Files: stackAuthor.php stackDatabase.php stackFrontend.php stackQuiz.php stackSubject.php Log Message: Index: stackQuiz.php =================================================================== RCS file: /cvsroot/stack/stack-1-0/scripts/stackQuiz.php,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** stackQuiz.php 4 Sep 2005 19:24:58 -0000 1.11 --- stackQuiz.php 4 Sep 2005 21:26:18 -0000 1.12 *************** *** 179,187 **** /** * Displays the student quiz selection screen * @param array $quize_store The list of quizzes * @param $user * @return void */ ! function stack_quiz_student_select($quiz_store, $user,$review=FALSE) { global $stack_root; require_once("{$stack_root}/html/quizjava.html"); --- 179,188 ---- /** * Displays the student quiz selection screen + * @param int $subjectID * @param array $quize_store The list of quizzes * @param $user * @return void */ ! function stack_quiz_student_select($subjectID, $quiz_store, $user, $review=FALSE) { global $stack_root; require_once("{$stack_root}/html/quizjava.html"); *************** *** 192,198 **** if (is_array($quiz_store)) { echo "<script language=\"javascript\"> ! function quizreview(u,n) { ! document.forms.quizform.userid.value = u; ! document.forms.quizform.quizid.value = n; document.forms.quizform.submit(); } --- 193,200 ---- if (is_array($quiz_store)) { echo "<script language=\"javascript\"> ! function quizreview(u,n,m) { ! document.forms.quizform.userid.value = u; ! document.forms.quizform.quizid.value = n; ! document.forms.quizform.subjectID.value = m; document.forms.quizform.submit(); } *************** *** 201,204 **** --- 203,207 ---- <input type='hidden' name='userid' value='-1'> <input type='hidden' name='quizid' value='-1'> + <input type='hidden' name='subjectID' value='-1'> <input type='hidden' name='action' value='review'>"; echo "\n<table cellpadding='2'>\n"; *************** *** 210,214 **** if (is_array($user)) { if (array_key_exists('id',$user)) { ! $userinfo = stack_db_quiz_quizattempt_getlast($qID,$user['id']); if (is_array($userinfo)) { if (NULL != $userinfo['mark']) { --- 213,217 ---- if (is_array($user)) { if (array_key_exists('id',$user)) { ! $userinfo = stack_db_quiz_quizattempt_getlast($subjectID,$qID,$user['id']); if (is_array($userinfo)) { if (NULL != $userinfo['mark']) { *************** *** 221,225 **** if ($review) { $uID = $user['id']; ! echo "<tr><td><a href=\"javascript:quizreview('$uID','$qID');\">{$qname}</a></td>\n"; } else { echo "<tr><td><a href=\"javascript:takeaction('continue_quiz','$qID');\">{$qname}</a></td>\n"; --- 224,228 ---- if ($review) { $uID = $user['id']; ! echo "<tr><td><a href=\"javascript:quizreview('$uID','$qID','$subjectID');\">{$qname}</a></td>\n"; } else { echo "<tr><td><a href=\"javascript:takeaction('continue_quiz','$qID');\">{$qname}</a></td>\n"; *************** *** 243,247 **** * @return void */ ! function stack_quiz_report($quizid) { global $stack_web_url; --- 246,250 ---- * @return void */ ! function stack_quiz_report($quizid,$subjectID) { global $stack_web_url; *************** *** 298,303 **** $username = $this_user['name']; echo "<tr>\n"; ! echo " <td><a href=\"javascript:quizreview('$userid','$quizid');\">$username</a></td>\n"; ! $userinfo = stack_db_quiz_quizattempt_getlast($quizid,$userid); if (is_array($userinfo)) { --- 301,306 ---- $username = $this_user['name']; echo "<tr>\n"; ! echo " <td><a href=\"javascript:quizreview('$userid','$quizid','$subjectID');\">$username</a></td>\n"; ! $userinfo = stack_db_quiz_quizattempt_getlast($subjectID,$quizid,$userid); if (is_array($userinfo)) { *************** *** 344,350 **** echo "<script language=\"javascript\"> ! function quizreview(u,n) { document.forms.quiztryform.userid.value = u; document.forms.quiztryform.quizid.value = n; document.forms.quiztryform.submit(); } --- 347,354 ---- echo "<script language=\"javascript\"> ! function quizreview(u,n,m) { document.forms.quiztryform.userid.value = u; document.forms.quiztryform.quizid.value = n; + document.forms.quiztryform.subjectID.value = m; document.forms.quiztryform.submit(); } *************** *** 352,355 **** --- 356,360 ---- <p>\n<form name='quiztryform' action='{$stack_web_url}quiz.php' method='POST'> <input type='hidden' name='quizid' value='-1' /> + <input type='hidden' name='subjectID' value='-1' /> <input type='hidden' name='userid' value='-1' /> <input type='hidden' name='action' value='review' /> Index: stackDatabase.php =================================================================== RCS file: /cvsroot/stack/stack-1-0/scripts/stackDatabase.php,v retrieving revision 1.41 retrieving revision 1.42 diff -C2 -d -r1.41 -r1.42 *** stackDatabase.php 4 Sep 2005 19:24:57 -0000 1.41 --- stackDatabase.php 4 Sep 2005 21:26:18 -0000 1.42 *************** *** 170,174 **** if(0 != mysql_num_rows($result)) { - echo "<h2>Question bank</h2>\n"; echo "<font size='-2'>Search the question bank using comma separated lists of search terms in the Name and Keywords fields. Choose to match either 'Any' or 'All' of these to display the questions. Leave both blank to display all questions in the question bank. White space is ignored.</font>"; echo "<form name='stackquestionsform' action='{$_PHP_SELF}' method='POST'>\n"; --- 170,173 ---- *************** *** 1537,1541 **** if ('' == $quizid) { $new_quiz = TRUE; ! } else if(!stack_db_confirm_quiz_exists($quizid)) { $new_quiz = TRUE; } --- 1536,1540 ---- if ('' == $quizid) { $new_quiz = TRUE; ! } else if(!stack_db_quiz_confirm_exists($quizid)) { $new_quiz = TRUE; } *************** *** 1669,1675 **** * @return void */ ! function stack_db_quiz_quizattempt_store($quizid,$userID,$seed) { ! $query = "INSERT INTO quizAttempts (quizid, userID, Seed ) VALUES ('$quizid','$userID','$seed')"; $result = stack_db_query($query); } --- 1668,1674 ---- * @return void */ ! function stack_db_quiz_quizattempt_store($subjectID,$quizid,$userID,$seed) { ! $query = "INSERT INTO quizAttempts (subjectID, quizid, userID, Seed ) VALUES ('$subjectID', '$quizid','$userID','$seed')"; $result = stack_db_query($query); } *************** *** 1708,1720 **** * Return the last attempt at a quiz. An array containing the seed and mark are returned. * ! * @param int $quizid The $quizid number. ! * @param int $userID The $userID number. * @return array $userinfo */ ! function stack_db_quiz_quizattempt_getlast($quizid,$userID) { $userinfo = NULL; ! $query = "SELECT Seed, Mark, MaxMark, SolRequest FROM quizAttempts WHERE quizid = '$quizid' and userID = '$userID'"; $result = stack_db_query($query); --- 1707,1720 ---- * Return the last attempt at a quiz. An array containing the seed and mark are returned. * ! * @param int $subjectID The $subjectID number. ! * @param int $quizid The $quizid number. ! * @param int $userID The $userID number. * @return array $userinfo */ ! function stack_db_quiz_quizattempt_getlast($subjectID,$quizid,$userID) { $userinfo = NULL; ! $query = "SELECT Seed, Mark, MaxMark, SolRequest FROM quizAttempts WHERE subjectID = '$subjectID' and quizid = '$quizid' and userID = '$userID'"; $result = stack_db_query($query); *************** *** 1777,1780 **** --- 1777,1787 ---- $result = stack_db_query($query); + // (2) Delete all attempt records + $query = "DELETE FROM quiz_attempts WHERE subjectID = '$subjectID'"; + $result = stack_db_query($query); + + // (3) Delete all user registrations + $query = "DELETE FROM user_subject WHERE subjectID = '$subjectID'"; + $result = stack_db_query($query); } Index: stackSubject.php =================================================================== RCS file: /cvsroot/stack/stack-1-0/scripts/stackSubject.php,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** stackSubject.php 4 Sep 2005 19:24:58 -0000 1.1 --- stackSubject.php 4 Sep 2005 21:26:18 -0000 1.2 *************** *** 206,212 **** } </script> ! <p>\n<form name='subjectform' action='index.php' method='POST'> ! <input type='hidden' name='subjectID' value='-1'> ! <input type='hidden' name='action' value='choose_quiz'>"; echo "\n<table cellpadding='2'>\n"; echo "\n<tr>\n <th>{$stackSubject['subjectName']['descript']}</th>\n"; --- 206,213 ---- } </script> ! <form name='subjectform' action='index.php' method='POST'> ! <input type='hidden' name='subjectID' value='-1'> ! <input type='hidden' name='action' value='choose_quiz'>"; ! echo "\n<table cellpadding='2'>\n"; echo "\n<tr>\n <th>{$stackSubject['subjectName']['descript']}</th>\n"; Index: stackAuthor.php =================================================================== RCS file: /cvsroot/stack/stack-1-0/scripts/stackAuthor.php,v retrieving revision 1.39 retrieving revision 1.40 diff -C2 -d -r1.39 -r1.40 *** stackAuthor.php 4 Sep 2005 19:24:57 -0000 1.39 --- stackAuthor.php 4 Sep 2005 21:26:18 -0000 1.40 *************** *** 1207,1210 **** --- 1207,1211 ---- $t = time(); $dts = strftime('%c',$t); // Format the string. + $subjectID=$subject['subjectID']; //Does the subject have options set? *************** *** 1217,1220 **** --- 1218,1223 ---- $optval = stack_options_formvals_set($subject_options); + + // Timestamp this edit echo "<form name='stacksubjecteditform' action='$PostTo' method='POST'>\n"; *************** *** 1255,1259 **** stack_options_edit_form($options_headings,$options_list,$optval,$fieldname,''); - echo "<p><b>Quizzes attached to this subject:</b><br />(An empty order field indicates they are attached but hidden)"; --- 1258,1261 ---- *************** *** 1261,1265 **** if (is_array($subject['quizzes'])) { echo "\n<table>\n"; ! echo "<tr><th>Drop</th><th>Order</th><th>Quiz no.</th><th>Name</th></tr>\n"; foreach ($subject['quizzes'] as $qn => $qu) { $qID = $qu['quizid']; --- 1263,1267 ---- if (is_array($subject['quizzes'])) { echo "\n<table>\n"; ! echo "<tr>\n <th>Drop</th>\n <th>Order</th>\n <th>Quiz no.</th><th>Name</th><th></th>\n</tr>\n"; foreach ($subject['quizzes'] as $qn => $qu) { $qID = $qu['quizid']; *************** *** 1275,1282 **** $qkw = ''; } ! echo "<tr><td><input type=\"checkbox\" name=\"subject[quizzes][$qn][drop]\" value=\"ticked\" /></td>\n"; ! echo "<td><input type=\"text\" name=\"subject[quizzes][$qn][order]\" size=\"3\" value=\"{$qo}\" /></td>\n"; ! echo "<td><input type=\"hidden\" name=\"subject[quizzes][$qn][quizid]\" value=\"{$qID}\" />$qID</td>"; ! echo "<td>$qname</td><td>$qkw</td> </tr>\n"; } --- 1277,1284 ---- $qkw = ''; } ! echo "<tr>\n <td><input type=\"checkbox\" name=\"subject[quizzes][$qn][drop]\" value=\"ticked\" /></td>\n"; ! echo " <td><input type=\"text\" name=\"subject[quizzes][$qn][order]\" size=\"3\" value=\"{$qo}\" /></td>\n"; ! echo " <td><input type=\"hidden\" name=\"subject[quizzes][$qn][quizid]\" value=\"{$qID}\" />$qID</td>\n"; ! echo " <td>$qname</td>\n <td>$qkw</td>\n <td><a href=\"javascript:quizreview($qID,$subjectID);\">Review</a></td>\n</tr>\n"; } Index: stackFrontend.php =================================================================== RCS file: /cvsroot/stack/stack-1-0/scripts/stackFrontend.php,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** stackFrontend.php 4 Sep 2005 19:24:57 -0000 1.2 --- stackFrontend.php 4 Sep 2005 21:26:18 -0000 1.3 *************** *** 243,247 **** echo "<td><a href=\"javascript:takeaction('quiz_edit','$qID');\">edit</a></td>\n"; echo "<td><a href=\"javascript:quiztry('continue_quiz','$qID');\">try</a></td>\n"; - echo "<td><a href=\"javascript:takeaction('quiz_report','$qID');\">results</a></td>\n"; echo "<td><a href=\"javascript:takeaction('quiz_xml','$qID');\">xml</a></td>\n"; echo "<td><a href=\"javascript:takeaction('quiz_delete','$qID');\"><font color='red'>del</font></a></td></tr>\n"; --- 243,246 ---- |