From: pkiddie <pk...@us...> - 2005-08-16 15:24:24
|
Update of /cvsroot/stack/stack-1-0 In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv12333 Modified Files: Tag: development_xmlrqp import.php question_bank.php Log Message: Index: import.php =================================================================== RCS file: /cvsroot/stack/stack-1-0/Attic/import.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 *** import.php 15 Aug 2005 16:09:23 -0000 1.1.2.1 --- import.php 16 Aug 2005 15:24:16 -0000 1.1.2.2 *************** *** 36,54 **** } ! if ($action=='import') ! { ! stack_display_qb_import($errors); ! } ! /** * 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' /> --- 36,87 ---- } ! $upload_successful = FALSE; ! if ($action == 'uploaded_xml') { ! if (array_key_exists('xmlfile',$_FILES)) { ! if (is_uploaded_file($_FILES['xmlfile']['tmp_name'])) { ! ! include_once("{$stack_root}/scripts/stackXML.php"); ! $qu = stack_xml_parse_file($_FILES['xmlfile']['tmp_name']); ! // If a single question has been uploaded, edit it, if multiple ! // questions store them in the database ! show_array($qu); ! ! if (array_key_exists('assessmentItem',$qu)) { ! $imported= $qu['assessmentItem']; ! //$action = 'edit'; ! //$upload_successful = TRUE; ! ! } else if (array_key_exists('mathQuiz',$qu)) { ! $imported = $qu['mathQuiz']; ! //We need to be able to discern between a quiz and a list of questions. ! //A quiz will have arraykeys other than assessment items ! } ! ! $upload_successful = TRUE; ! } ! } ! } ! switch ($action) { ! case 'import': ! stack_display_import($errors); ! break; ! ! case 'uploaded_xml': ! if ($upload_successful) { ! stack_display_show_imported($imported); ! } ! break; ! } ! /** * Displays the form for importing a file * @return void */ ! function stack_display_import($errors) { echo nsf($errors,'import'); echo "Select a file to upload and edit: <br /> ! <form enctype='multipart/form-data' action=\"import.php\"' method='POST'><br />\n <input type ='file' name='xmlfile' />\n <input type ='hidden' name='action' value='uploaded_xml' /> *************** *** 62,68 **** * @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>'; --- 95,105 ---- * @return void */ ! function stack_display_show_imported($imported) { ! show_array($imported); ! //if (array_key_exists('assessmentItem',$qu)) ! // { ! ! ! /*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>'; *************** *** 71,75 **** $errs = NULL; ! foreach ($quiz as $key => $qu) { stack_question_validate($quiz[$key],$errs[$key]); --- 108,112 ---- $errs = NULL; ! foreach ($question as $key => $qu) { stack_question_validate($quiz[$key],$errs[$key]); *************** *** 96,100 **** echo "</tbody></table>\n"; ! echo "<h2>Current database of questions</h2>"; } --- 133,137 ---- echo "</tbody></table>\n"; ! echo "<h2>Current database of questions</h2>";*/ } Index: question_bank.php =================================================================== RCS file: /cvsroot/stack/stack-1-0/question_bank.php,v retrieving revision 1.8.2.5 retrieving revision 1.8.2.6 diff -C2 -d -r1.8.2.5 -r1.8.2.6 *** question_bank.php 16 Aug 2005 09:45:04 -0000 1.8.2.5 --- question_bank.php 16 Aug 2005 15:24:16 -0000 1.8.2.6 *************** *** 152,155 **** --- 152,156 ---- if ('export_xml' == $action) { include_once("{$stack_root}/scripts/stackXML.php"); + show_array($question); stack_question_validate($question,$errors); $name = stack_xml_write_question_new($question, "{$stack_root}/tmp/"); |