From: Juliette W. <jv...@us...> - 2005-06-15 17:19:40
|
Update of /cvsroot/stack/stack-1-0 In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv31663 Modified Files: Tag: frontend_dev qb_preview.php question_bank.php Added Files: Tag: frontend_dev qb_export.php Log Message: Put export code into a separate file. It's a bit hard to test the preview code as it generates a whole host of warnings with the original clean version of STACK on my server. --- NEW FILE: qb_export.php --- <?php if ('export_xml_list'==$action) { $quiz = NULL; if (array_key_exists('checked',$_POST)) { if (is_array($_POST['checked'])) { foreach ($_POST['checked'] as $quID => $val) { if ('ticked' == $val) { $quiz[] = $quID; } } } } if (NULL == $quiz) { echo "<p>Could not get any ticked questions! Please try again.</p>"; $action = 'questionbank_screen'; } include_once("{$stack_root}/scripts/stackXML.php"); $name = stack_xml_write_quiz_file($quiz, "{$stack_root}/tmp/"); echo "<p>Please download the file <a href='{$stack_web_url}tmp/{$name}'>$name</a>.</p>"; } if ('export_xml'==$action) { echo "export_xml"; stack_question_validate($question,$errors); include_once("{$stack_root}/scripts/stackXML.php"); $name = stack_xml_write_question_file($question, "{$stack_root}/tmp/"); echo "<p>Please download the file <a href='{$stack_web_url}tmp/{$name}'>$name</a>.</p>"; } ?> Index: qb_preview.php =================================================================== RCS file: /cvsroot/stack/stack-1-0/Attic/qb_preview.php,v retrieving revision 1.1.2.1 retrieving revision 1.1.2.2 diff -C2 -d -r1.1.2.1 -r1.1.2.2 *** qb_preview.php 15 Jun 2005 16:58:36 -0000 1.1.2.1 --- qb_preview.php 15 Jun 2005 17:19:22 -0000 1.1.2.2 *************** *** 92,94 **** --- 92,116 ---- } + + //(4.3) Try the questions + if ('mark' == $action or 'validate' == $action) { + + $_SESSION['questionInst'] = $questionInst; + $_SESSION['question'] = $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>"; + + + //show_array($questionInst); + stack_question_inst_try_test($questionInst,$this_attempt,$options,$errors); + + //stack_question_inst_try($questionInst,$this_attempt,$options,$errors); + //stack_question_inst_show_sol($questionInst,$errors); + + } ?> Index: question_bank.php =================================================================== RCS file: /cvsroot/stack/stack-1-0/question_bank.php,v retrieving revision 1.3.2.8 retrieving revision 1.3.2.9 diff -C2 -d -r1.3.2.8 -r1.3.2.9 *** question_bank.php 15 Jun 2005 16:58:36 -0000 1.3.2.8 --- question_bank.php 15 Jun 2005 17:19:28 -0000 1.3.2.9 *************** *** 121,124 **** --- 121,130 ---- $questionInst = getQuestionInst(); } + + if (array_key_exists('bank_filter',$_POST)) { + $question_bank_filter = trim($_POST['bank_filter']); + } else { + $question_bank_filter = ''; + } *************** *** 131,160 **** // (2.5) Export a whole list of questions. ! if ('export_xml_list'==$action) { ! ! $quiz = NULL; ! if (array_key_exists('checked',$_POST)) { ! if (is_array($_POST['checked'])) { ! foreach ($_POST['checked'] as $quID => $val) { ! if ('ticked' == $val) { ! $quiz[] = $quID; ! } ! } ! } ! } ! ! if (NULL == $quiz) { ! echo "<p>Could not get any ticked questions! Please try again.</p>"; ! $action = 'questionbank_screen'; ! } ! } // (2.6) Filter questions in the question bank, based upon a regular expression. ! if (array_key_exists('bank_filter',$_POST)) { ! $question_bank_filter = trim($_POST['bank_filter']); ! } else { ! $question_bank_filter = ''; ! } // (2.7) action = edit_metadata --- 137,146 ---- // (2.5) Export a whole list of questions. ! include('qb_export.php'); ! // (2.6) Filter questions in the question bank, based upon a regular expression. ! // (2.7) action = edit_metadata *************** *** 191,195 **** // These branches need the question to be validated ! if ('edit' == $action or 'export_xml'==$action) { stack_question_validate($question,$errors); } --- 177,181 ---- // These branches need the question to be validated ! if ('edit' == $action) { stack_question_validate($question,$errors); } *************** *** 294,312 **** } - if ('export_xml' == $action) { - include_once("{$stack_root}/scripts/stackXML.php"); - - $name = stack_xml_write_question_file($question, "{$stack_root}/tmp/"); - - echo "<p>Please download the file <a href='{$stack_web_url}tmp/{$name}'>$name</a>.</p>"; - } - - if ('export_xml_list'==$action) { - include_once("{$stack_root}/scripts/stackXML.php"); - - $name = stack_xml_write_quiz_file($quiz, "{$stack_root}/tmp/"); - echo "<p>Please download the file <a href='{$stack_web_url}tmp/{$name}'>$name</a>.</p>"; - } include('html/pagefoot.php'); --- 280,284 ---- |