From: Chris S. <san...@us...> - 2005-06-20 12:25:47
|
Update of /cvsroot/stack/stack-1-0 In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv13988 Modified Files: Tag: frontend_dev editquiz.php Log Message: Index: editquiz.php =================================================================== RCS file: /cvsroot/stack/stack-1-0/editquiz.php,v retrieving revision 1.10.2.10 retrieving revision 1.10.2.11 diff -C2 -d -r1.10.2.10 -r1.10.2.11 *** editquiz.php 17 Jun 2005 16:25:26 -0000 1.10.2.10 --- editquiz.php 20 Jun 2005 12:25:26 -0000 1.10.2.11 *************** *** 58,68 **** } //////////////////////////////////////////////// // (2) Take any actions required on entry to the page //////////////////////////////////////////////// - // TO DO: Much of this code would be better replaced by a switch statement - // with the functions factored out - // Possible values of $action are // quiz_edit Edit a quiz --- 58,70 ---- } + // Work out the correct value for any filter to be applied to the question + // bank. This is not needed by all actions, but it is harmless to set it. + $question_bank_filter = stack_get_questionbank_filter(); + + //////////////////////////////////////////////// // (2) Take any actions required on entry to the page //////////////////////////////////////////////// // Possible values of $action are // quiz_edit Edit a quiz *************** *** 106,137 **** } ! $question_bank_filter = stack_get_qb_filter($filter_source); ! ! if ('quiz_delete' == $action and $quizid != '') { ! stack_db_quiz_delete($quizid); ! $action = 'quiz_choose'; ! } ! ! if ('filter' == $action and $quizid != '') { ! $action = 'quiz_edit_addqs'; ! stack_set_session_question_bank_filter($question_bank_filter); } ! if ('quiz_edit' == $action) { ! // Do we need to add questions to the quiz? ! if (array_key_exists('questionsToAdd',$_POST)) { ! $quiz['questionsToAdd'] = array_keys($_POST['questionsToAdd']); ! } ! } ! if ('quiz_edit' == $action or 'quiz_edit_addqs' == $action) { ! stack_quiz_edit($quiz,$errors); ! } ! if ('quiz_new' == $action) { ! $quiz['quizid'] = $quizid; ! $action = 'quiz_edit'; ! } //////////////////////////////////////////////// --- 108,136 ---- } ! ! if ('quiz_delete' == $action and $quizid != '') { ! stack_db_quiz_delete($quizid); ! $action = 'quiz_choose'; } + if ('quiz_edit' == $action) { + // Do we need to add questions to the quiz? + if (array_key_exists('questionsToAdd',$_POST)) { + $quiz['questionsToAdd'] = array_keys($_POST['questionsToAdd']); + } + } ! if ('quiz_edit' == $action or 'quiz_edit_addqs' == $action) { ! stack_quiz_edit($quiz,$errors); ! } ! if ('filter' == $action and '' != $quizid ) { ! $action = 'quiz_edit_addqs'; ! } ! if ('quiz_new' == $action) { ! $quiz['quizid'] = $quizid; ! $action = 'quiz_edit'; ! } //////////////////////////////////////////////// *************** *** 152,155 **** --- 151,156 ---- stack_display_editquiz_add_questions($PostTo, $quizid, $question_bank_filter); break; + case 'quiz_xml'; + echo "This feature is not yet implemented."; } |