if ($exam->custom_per_page == 0) { $exam->custom_per_page = 1; } // this should never be zero $num_pages = ceil($total / $exam->custom_per_page); } if ($exam->show_pagination) { echo WTPExam::paginator($total, @$in_progress); } $question_catids = array(); // used for category based pagination and category header $qct = 0; if (empty($exam->time_limit) or !empty($_POST['watupro_start_timer'])) { // on timed exams questions should not be shown before the timer starts foreach ($all_question as $ques) { echo watupro_cat_header($exam, $qct, $ques); if ($exam->single_page == WATUPRO_PAGINATE_CUSTOM_NUMBER) { echo watupro_paginate_header($exam, $qct, $num_pages); } $qct++; echo "<div class='watu-question' id='question-{$question_count}'>"; if (!$single_page and $cnt_questions > 1) { echo "<p class='watupro-qnum-info alignRight'>" . sprintf(__("Question Compeleted: %d out of %d", 'watupro'), $qct, $total) . "</p>"; } ?> <?php echo $_question->display($ques, $qct, $question_count, @$in_progress, $exam); ?> <?php $question_ids .= $ques->ID . ','; if ($exam->live_result) {
$_POST['watupro_current_taking_id'] = $GLOBALS['watupro_taking_id'] = $taking_id; // needed in personality quizzes and shortcodes $_watu->this_quiz = $exam; $total = $score = $achieved = $max_points = 0; $result = $unresolved_questions = $current_text = ''; $user_grade_ids = array(); // used in personality quizzes (Intelligence module) $question_catids = array(); // used for category based pagination foreach ($all_question as $qct => $ques) { if (empty($ques->is_survey)) { $total++; } // the two rows below are about the category headers if (!$ques->exclude_on_final_screen) { $result .= watupro_cat_header($exam, $qct, $ques, 'submit'); if (!in_array($ques->cat_id, $question_catids)) { $question_catids[] = $ques->cat_id; } } $qct++; $question_content = $ques->question; // fill the gaps need to replace gaps if ($ques->answer_type == 'gaps') { $question_content = preg_replace("/{{{([^}}}])*}}}/", "_____", $question_content); } $ansArr = is_array(@$_POST["answer-" . $ques->ID]) ? $_POST["answer-" . $ques->ID] : array(); // points and correct calculation list($points, $correct) = WTPQuestion::calc_answer($ques, $ansArr, $ques->q_answers, $user_grade_ids); $max_points += WTPQuestion::max_points($ques); // handle sorting personalities