From: pkiddie <pk...@us...> - 2005-08-22 17:20:37
|
Update of /cvsroot/stack/stack-1-0/frontend_general In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv3139/frontend_general Modified Files: Tag: development_xmlrqp qb_display.php Log Message: Code comments added Schema version checking added to index.php Index: qb_display.php =================================================================== RCS file: /cvsroot/stack/stack-1-0/frontend_general/qb_display.php,v retrieving revision 1.5 retrieving revision 1.5.2.1 diff -C2 -d -r1.5 -r1.5.2.1 *** qb_display.php 14 Jul 2005 18:44:54 -0000 1.5 --- qb_display.php 22 Aug 2005 17:20:18 -0000 1.5.2.1 *************** *** 1,155 **** ! <?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> ! * A copy of the license is in your STACK distribution called ! * license.txt. If you are missing this file you can obtain ! * it from: ! * http://www.stack.bham.ac.uk/license.txt ! * <br> ! * Copyright (c) 2005, Christopher James Sangwin ! * ! * This file contains display functions used by question_bank.php ! * ! * ! * @author Chris Sangwin C.J...@bh... ! * @author Laura Naismith L.N...@bh... ! * @author Juliette White jv...@jv... ! * ! * @package frontend ! * @subpackage Stack ! * ! */ ! ! /** ! * Displays the main question bank page ! * @param bool $admin TRUE if the user is the admin user, FALSE otherwise ! * @param array $question_bank_filter The question bank filter ! * @return void ! */ ! function stack_display_qb_main($admin, $question_bank_filter) { ! global $stack_root; ! $options = ''; ! include("{$stack_root}/html/qselectform.php"); ! ! if ($admin) { ! stack_db_listquestions('edit',$question_bank_filter); ! } else { ! stack_db_listquestions('try',$question_bank_filter); ! } ! ! echo "<p><a href=\"javascript:SelectQs('export_xml_list');\">Export selected as XML</a> "; ! echo "<p><a href=\"javascript:SelectQs('edit_metadata');\">Edit metadata</a> "; ! } ! ! ! /** ! * Displays the form for editting a question ! * @param array $question The question to edit ! * @param array $errors The question bank filter ! * @return void ! */ ! function stack_display_qb_edit($question, $errors) { ! global $stack_root; ! include_once("{$stack_root}/scripts/stackAuthor.php"); ! include("{$stack_root}/html/qselectform.php"); ! stack_question_edit_form($question,$errors); ! ! echo "<p><a href=\"javascript:HelpPopup('all','author_questionfields');\">Help with question fields.</a>\n ! <a href=\"javascript:HelpPopup('all','author_options');\">Help with options.</a>\n ! <a href=\"javascript:HelpPopup('all','author_answertest');\">Help with answer tests.</a>\n ! <a href=\"javascript:HelpPopup('all','author_potresp');\">Help with potential responses.</a></p>"; ! } ! ! ! /** ! * Displays the edit metadate form ! * @param array $question_bank_filter The question bank filter to apply ! * @return void ! */ ! function stack_display_qb_edit_metadata($question_bank_filter) { ! global $stack_root; ! include("{$stack_root}/html/qselectform.php"); ! ! stack_db_listquestions('edit_metadata',$question_bank_filter); ! echo "<p><a href=\"javascript:SelectQs('edit_metadata');\">Edit metadata</a> "; ! } ! ! ! /** ! * Displays the form for importing a file ! * @return void ! */ ! function stack_display_qb_import($errors) { ! echo nsf($errors,'import'); ! echo "Select a file to upload and edit: ! <br /> ! <form enctype='multipart/form-data' action=\"question_bank.php\"' method='POST'><br />\n ! <input type ='file' name='xmlfile' />\n ! <input type ='hidden' name='action' value='uploaded_xml' /> ! <input type ='submit' name='go' value='Upload'> ! </form>\n\n"; ! } ! ! /** ! * Displays the imported questions ! * @param array $quiz The imported quiz ! * @return void ! */ ! function stack_display_qb_show_imported($quiz) { ! ! echo "<h2>Details of questions uploaded</h2>"; ! echo '<table><thead><tr>'; ! echo '<th>ID</th><th>Name</th> <th>Description</th> <th>Key words</th> <th></th>'; ! echo '</tr></thead><tbody>'; ! ! $errs = NULL; ! ! foreach ($quiz as $key => $qu) { ! ! stack_question_validate($quiz[$key],$errs[$key]); ! $qu['questionID'] = stack_db_question_add($qu); ! echo "<tr>\n <td>".sf($qu,'questionID')."</td> <td>".sf($qu,'questionName')." </td> <td>".sf($qu,'questionDescription')." </td> <td>".sf($qu,'questionKeywords')." </td>"; ! $errc = FALSE; ! if (nsf($errs,$key)) { ! if (is_array($errs[$key])) { ! $errc = TRUE; ! } ! } ! if ($errc) { ! echo "<td><font color=\"red\">Invalid question</font></td>"; ! echo "</tr></tbody></table>\n\n"; ! echo stack_question_errstr($errs[$key]); ! echo "\n\n<table><thead><tr>"; ! echo '<th>ID</th><th>Name</th> <th>Description</th> <th>Key words</th> <th></th>'; ! echo '</tr></thead><tbody>'; ! } else { ! echo "<td><font color=\"greed\">Valid question</font></td>"; ! } ! echo "</tr>\n"; ! } ! ! echo "</tbody></table>\n"; ! echo "<h2>Current database of questions</h2>"; ! } ! ! ! /** ! * Displays the preview of a question ! * @return void ! */ ! function stack_display_qb_preview($questionInst) { ! echo "<center><table bgcolor='#CCCCCC' width='100%' cellpadding='2'> ! <td align='left'> ! ! <b>Question: ".sf($questionInst,'questionName')."</b> (".sf($questionInst,'questionID'); ! echo ")</td><td align='right'>"; ! echo "<a href=\"javascript:HelpPopup('student','');\">Help</a></td></tr></table></center>"; ! } ! ! ?> --- 1,192 ---- ! <?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> ! ! * A copy of the license is in your STACK distribution called ! ! * license.txt. If you are missing this file you can obtain ! ! * it from: ! ! * http://www.stack.bham.ac.uk/license.txt ! ! * <br> ! ! * Copyright (c) 2005, Christopher James Sangwin ! ! * ! ! * This file contains display functions used by question_bank.php ! ! * - Removed import references - now factored out to import.php ! ! * ! ! * ! ! * @author Chris Sangwin C.J...@bh... ! ! * @author Laura Naismith L.N...@bh... ! ! * @author Juliette White jv...@jv... ! ! * ! ! * @package frontend ! ! * @subpackage Stack ! ! * ! ! */ ! ! ! ! /** ! ! * Displays the main question bank page ! ! * @param bool $admin TRUE if the user is the admin user, FALSE otherwise ! ! * @param array $question_bank_filter The question bank filter ! ! * @return void ! ! */ ! ! function stack_display_qb_main($admin, $question_bank_filter) { ! ! global $stack_root; ! ! $options = ''; ! ! include("{$stack_root}/html/qselectform.php"); ! ! ! ! if ($admin) { ! ! stack_db_listquestions('edit',$question_bank_filter); ! ! } else { ! ! stack_db_listquestions('try',$question_bank_filter); ! ! } ! ! ! ! echo "<p><a href=\"javascript:SelectQs('export_xml_list');\">Export selected as XML</a> "; ! ! echo "<p><a href=\"javascript:SelectQs('edit_metadata');\">Edit metadata</a> "; ! ! } ! ! ! ! ! ! /** ! ! * Displays the form for editting a question ! ! * @param array $question The question to edit ! ! * @param array $errors The question bank filter ! ! * @return void ! ! */ ! ! function stack_display_qb_edit($question, $errors) { ! ! global $stack_root; ! ! include_once("{$stack_root}/scripts/stackAuthor.php"); ! ! include("{$stack_root}/html/qselectform.php"); ! ! stack_question_edit_form($question,$errors); ! ! ! ! echo "<p><a href=\"javascript:HelpPopup('all','author_questionfields');\">Help with question fields.</a>\n ! ! <a href=\"javascript:HelpPopup('all','author_options');\">Help with options.</a>\n ! ! <a href=\"javascript:HelpPopup('all','author_answertest');\">Help with answer tests.</a>\n ! ! <a href=\"javascript:HelpPopup('all','author_potresp');\">Help with potential responses.</a></p>"; ! ! } ! ! ! ! ! ! /** ! ! * Displays the edit metadate form ! ! * @param array $question_bank_filter The question bank filter to apply ! ! * @return void ! ! */ ! ! function stack_display_qb_edit_metadata($question_bank_filter) { ! ! global $stack_root; ! ! include("{$stack_root}/html/qselectform.php"); ! ! ! ! stack_db_listquestions('edit_metadata',$question_bank_filter); ! ! echo "<p><a href=\"javascript:SelectQs('edit_metadata');\">Edit metadata</a> "; ! ! } ! ! /** ! ! * Displays the preview of a question ! ! * @return void ! ! */ ! ! function stack_display_qb_preview($questionInst) { ! ! echo "<center><table bgcolor='#CCCCCC' width='100%' cellpadding='2'> ! ! <td align='left'> ! ! ! ! <b>Question: ".sf($questionInst,'questionName')."</b> (".sf($questionInst,'questionID'); ! ! echo ")</td><td align='right'>"; ! ! echo "<a href=\"javascript:HelpPopup('student','');\">Help</a></td></tr></table></center>"; ! ! } ! ! ! ! ?> ! |