From: Chris S. <san...@us...> - 2005-09-05 13:26:30
|
Update of /cvsroot/stack/stack-1-0/scripts In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv13315/scripts Modified Files: stackDatabase.php Log Message: Index: stackDatabase.php =================================================================== RCS file: /cvsroot/stack/stack-1-0/scripts/stackDatabase.php,v retrieving revision 1.45 retrieving revision 1.46 diff -C2 -d -r1.45 -r1.46 *** stackDatabase.php 5 Sep 2005 09:40:32 -0000 1.45 --- stackDatabase.php 5 Sep 2005 13:26:22 -0000 1.46 *************** *** 180,184 **** --- 180,186 ---- echo '<tbody>'; + $trcol = FALSE; for ($i = 0; $i < mysql_num_rows($result); $i++) { + $trcol = !$trcol; $row = mysql_fetch_row($result); *************** *** 196,204 **** // Display each row of the table if ('edit_metadata' != $action) { ! echo "\n<tr>"; ! echo("<td><input type='checkbox' name='checked[{$row[0]}]' value='ticked' /></td>\n"); ! echo('<td>' . $row[0] . '</td>'); ! echo('<td>' . $qname . '</td>'); ! echo('<td>' . $qkeywords . '</td>'); echo "\n<td nowrap='nowrap'><a href=\"javascript:SelectQ('$row[0]','edit_from_db');\">edit</a> <a href=\"javascript:SelectQ('$row[0]','preview_from_db');\">try</a> --- 198,210 ---- // Display each row of the table if ('edit_metadata' != $action) { ! if ($trcol) { ! echo "\n<tr bgcolor='#DDDDDD'>\n"; ! } else { ! echo "\n<tr bgcolor='#DDDDFF'>\n"; ! } ! echo(" <td><input type='checkbox' name='checked[{$row[0]}]' value='ticked' /></td>\n"); ! echo(' <td>' . $row[0] . "</td>\n"); ! echo(' <td>' . $qname . "</td>\n"); ! echo(' <td>' . $qkeywords . "</td>\n"); echo "\n<td nowrap='nowrap'><a href=\"javascript:SelectQ('$row[0]','edit_from_db');\">edit</a> <a href=\"javascript:SelectQ('$row[0]','preview_from_db');\">try</a> *************** *** 215,220 **** // Descriptions on a new line. if ($filter['show_descript']) { ! echo "<tr><td></td>\n"; ! echo "<td colspan='4'><font size='1'>".stripslashes($row[2])."</font></td></tr>\n"; } --- 221,235 ---- // Descriptions on a new line. if ($filter['show_descript']) { ! if ($trcol) { ! echo "\n<tr bgcolor='#DDDDDD'>\n"; ! } else { ! echo "\n<tr bgcolor='#DDDDFF'>\n"; ! } ! echo "<td></td>\n"; ! echo " <td colspan='3'><font size='1'>".stripslashes($row[2])."</font></td>\n"; ! // Show which quizzes a question is used. ! $usage = stack_db_quiz_question_use_report($row[0]); ! echo " <td colspan='2'><font size='1'>$usage</font></td>\n"; ! echo "</tr>\n"; } *************** *** 1619,1622 **** --- 1634,1664 ---- /** + * Provides a string report on which quizzes a question is used in. + * Used in stackAuthor.php + * + * @param int $questionID The questionID of the question! + * @return string $usages + */ + function stack_db_quiz_question_use_report($questionID) { + + $query = "SELECT quizid FROM quiz_question WHERE questionID = '$questionID';"; + $result = stack_db_query($query); + + if(0 != mysql_num_rows($result)) { + + $usages = 'Quiz ID(s):'; + for ($i = 0; $i < mysql_num_rows($result); $i++) { + $row = mysql_fetch_row($result); + $usages .= ' '.$row[0]; + } + } else { + $usages = '[Unused]'; + } + + return $usages; + } + + + /** * Drop a questionID from a quiz * *************** *** 1691,1702 **** * Record the fact the student has seen the solutions. * ! * @param int $quizid The $quizid number. ! * @param int $userID The $userID number. ! * @param int $seed The $seed used to generate the questions. * @return void */ ! function stack_db_quiz_quizattempt_seensol($quizid,$userID,$seed) { ! $query = "UPDATE quizAttempts SET SolRequest = '1' WHERE quizid='$quizid' AND userID='$userID' AND Seed='$seed';"; $result = stack_db_query($query); } --- 1733,1745 ---- * Record the fact the student has seen the solutions. * ! * @param int $subjectID The $quizid number. ! * @param int $quizid The $quizid number. ! * @param int $userID The $userID number. ! * @param int $seed The $seed used to generate the questions. * @return void */ ! function stack_db_quiz_quizattempt_seensol($subjectID,$quizid,$userID,$seed) { ! $query = "UPDATE quizAttempts SET SolRequest = '1' WHERE subjectID = '$subjectID' AND quizid='$quizid' AND userID='$userID' AND Seed='$seed';"; $result = stack_db_query($query); } |