get_results($wpdb->prepare("SELECT ID,question,explanation FROM wp_quiz_question WHERE quiz_id=%d ORDER BY ID", $quiz_id)); if($all_question) { if(!isset($GLOBALS['quizzin_client_includes_loaded'])) { ?> " . t('All the questions in the quiz along with their answers are shown below. Your answers are bolded. The correct answers have a green background while the incorrect ones have a red background.') . "

"; foreach ($all_question as $ques) { $result .= "
"; $result .= "
". stripslashes($ques->question) . "
\n"; $all_answers = $wpdb->get_results("SELECT ID,answer,correct FROM wp_quiz_answer WHERE question_id={$ques->ID} ORDER BY sort_order"); $correct = false; $result .= ""; if(!$_REQUEST["answer-" . $ques->ID]) $result .= "

" . t('Question was not answered') . "

"; $result .= "

" . stripslashes($ques->explanation) . "

"; $result .= "
"; $total++; } //Find scoring details of this guy. $percent = number_format($score / $total * 100, 2); //0-9 10-19%, 20-29%, 30-39% 40-49% $all_rating = array(t('Failed'), t('Failed'), t('Failed'), t('Failed'), t('Just Passed'), // 100% More than 100%?! t('Satisfactory'), t('Competent'), t('Good'), t('Very Good'),t('Excellent'), t('Unbeatable'), t('Cheater')); $grade = intval($percent / 10); if($percent == 100) $grade = 9; if($score == $total) $grade = 10; $rating = $all_rating[$grade]; $quiz_details = $wpdb->get_row($wpdb->prepare("SELECT name,final_screen, description FROM wp_quiz_quiz WHERE ID=%d", $quiz_id)); $replace_these = array('%%SCORE%%', '%%TOTAL%%', '%%PERCENTAGE%%', '%%GRADE%%', '%%RATING%%', '%%CORRECT_ANSWERS%%', '%%WRONG_ANSWERS%%', '%%QUIZ_NAME%%', '%%DESCRIPTION%%'); $with_these = array($score, $total, $percent, $grade, $rating, $score, $total-$score, stripslashes($quiz_details->name), stripslashes($quiz_details->description)); // Show the results print str_replace($replace_these, $with_these, stripslashes($quiz_details->final_screen)); if(get_option('quizzin_show_answers')) print '
' . $result; } else { // Show The Quiz. $single_page = get_option('quizzin_single_page'); ?>
"; echo "
". stripslashes($ques->question) . "

"; echo ""; $dans = $wpdb->get_results("SELECT ID,answer FROM wp_quiz_answer WHERE question_id={$ques->ID} ORDER BY sort_order"); foreach ($dans as $ans) { echo ""; echo "
"; } echo "
"; $question_count++; } ?>
>" />
" />