body.php
4 years ago
content.php
5 years ago
no_course_belongs.php
5 years ago
previous-attempts.php
4 years ago
single_quiz_contents.php
4 years ago
top.php
4 years ago
body.php
489 lines
| 1 | <?php |
| 2 | /** |
| 3 | * @package TutorLMS/Templates |
| 4 | * @version 1.5.7 |
| 5 | */ |
| 6 | |
| 7 | |
| 8 | global $post; |
| 9 | $currentPost = $post; |
| 10 | |
| 11 | $quiz_id = get_the_ID(); |
| 12 | $is_started_quiz = tutor_utils()->is_started_quiz(); |
| 13 | |
| 14 | $previous_attempts = tutor_utils()->quiz_attempts(); |
| 15 | $attempted_count = is_array( $previous_attempts ) ? count( $previous_attempts ) : 0; |
| 16 | $questions_order = tutor_utils()->get_quiz_option( $quiz_id, 'questions_order', 'rand' ); |
| 17 | $attempts_allowed = tutor_utils()->get_quiz_option( $quiz_id, 'attempts_allowed', 0 ); |
| 18 | $passing_grade = tutor_utils()->get_quiz_option( $quiz_id, 'passing_grade', 0 ); |
| 19 | $feedback_mode = tutor_utils()->get_quiz_option( $quiz_id, 'feedback_mode', 0 ); |
| 20 | |
| 21 | $attempt_remaining = $attempts_allowed - $attempted_count; |
| 22 | $quiz_answers = array(); |
| 23 | ?> |
| 24 | |
| 25 | <div id="tutor-quiz-body" class="tutor-quiz-body tutor-quiz-body-<?php the_ID(); ?>"> |
| 26 | <?php |
| 27 | |
| 28 | do_action( 'tutor_quiz/body/before', $quiz_id ); |
| 29 | |
| 30 | if ( $is_started_quiz ) { |
| 31 | $quiz_attempt_info = tutor_utils()->quiz_attempt_info( $is_started_quiz->attempt_info ); |
| 32 | $quiz_attempt_info['date_time_now'] = date( 'Y-m-d H:i:s', tutor_time() ); |
| 33 | |
| 34 | $time_limit_seconds = tutor_utils()->avalue_dot( 'time_limit.time_limit_seconds', $quiz_attempt_info ); |
| 35 | $question_layout_view = tutor_utils()->get_quiz_option( $quiz_id, 'question_layout_view' ); |
| 36 | ! $question_layout_view ? $question_layout_view = 'single_question' : 0; |
| 37 | |
| 38 | $hide_quiz_time_display = (bool) tutor_utils()->avalue_dot( 'hide_quiz_time_display', $quiz_attempt_info ); |
| 39 | $hide_question_number_overview = (bool) tutor_utils()->avalue_dot( 'hide_question_number_overview', $quiz_attempt_info ); |
| 40 | $hide_previous_button = (bool) tutor_utils()->get_option( 'quiz_previous_button_disabled', false ); |
| 41 | |
| 42 | $remaining_time_secs = ( strtotime( $is_started_quiz->attempt_started_at ) + $time_limit_seconds ) - strtotime( $quiz_attempt_info['date_time_now'] ); |
| 43 | |
| 44 | $remaining_time_context = tutor_utils()->seconds_to_time_context( $remaining_time_secs ); |
| 45 | $questions = tutor_utils()->get_random_questions_by_quiz(); |
| 46 | ?> |
| 47 | |
| 48 | <div class="quiz-head-meta-info"> |
| 49 | <?php if ( ! $hide_quiz_time_display ): ?> |
| 50 | <div class="time-remaining"> |
| 51 | <?php _e( 'Time remaining : ', 'tutor' ); ?> |
| 52 | <span id="tutor-quiz-time-update" data-attempt-settings="<?php echo esc_attr( json_encode( $is_started_quiz ) ); ?>" data-attempt-meta="<?php echo esc_attr( json_encode( $quiz_attempt_info ) ); ?>"> |
| 53 | <?php echo $remaining_time_context; ?> |
| 54 | </span> |
| 55 | </div> |
| 56 | <?php endif; ?> |
| 57 | </div> |
| 58 | |
| 59 | <?php |
| 60 | if ( is_array( $questions ) && count( $questions ) ) { |
| 61 | ?> |
| 62 | <div id="tutor-quiz-attempt-questions-wrap" data-question-layout-view="<?php echo esc_attr( $question_layout_view ); ?>"> |
| 63 | |
| 64 | <?php |
| 65 | if ( $question_layout_view === 'question_pagination' ) { |
| 66 | $question_i = 0; |
| 67 | ?> |
| 68 | <div class="tutor-quiz-questions-pagination"> |
| 69 | <ul> |
| 70 | <?php |
| 71 | foreach ( $questions as $question ) { |
| 72 | $question_i++; |
| 73 | echo '<li><a href="#quiz-attempt-single-question-' . $question->question_id . '" class="tutor-quiz-question-paginate-item">' . $question_i . '</a> </li>'; |
| 74 | } |
| 75 | ?> |
| 76 | </ul> |
| 77 | </div> |
| 78 | <?php |
| 79 | } |
| 80 | ?> |
| 81 | |
| 82 | <div id="tutor-quiz-time-expire-wrapper" data-attempt-allowed="<?php esc_attr_e( $attempts_allowed ); ?>" data-attempt-remaining="<?php esc_attr_e( $attempt_remaining ); ?>"> |
| 83 | <div class="tutor-alert"> |
| 84 | <div class="text"> |
| 85 | |
| 86 | </div> |
| 87 | <div> |
| 88 | <form id="tutor-start-quiz" method="post"> |
| 89 | <?php wp_nonce_field( tutor()->nonce_action, tutor()->nonce ); ?> |
| 90 | |
| 91 | <input type="hidden" value="<?php echo esc_attr( $quiz_id ); ?>" name="quiz_id"/> |
| 92 | <input type="hidden" value="tutor_start_quiz" name="tutor_action"/> |
| 93 | |
| 94 | <button type="submit" class="tutor-button button-warning" name="start_quiz_btn" value="start_quiz"> |
| 95 | <?php _e( 'Reattempt', 'tutor' ); ?> |
| 96 | </button> |
| 97 | </form> |
| 98 | </div> |
| 99 | </div> |
| 100 | </div> |
| 101 | |
| 102 | <form id="tutor-answering-quiz" method="post"> |
| 103 | <?php wp_nonce_field( tutor()->nonce_action, tutor()->nonce ); ?> |
| 104 | <input type="hidden" value="<?php echo esc_attr( $is_started_quiz->attempt_id ); ?>" name="attempt_id"/> |
| 105 | <input type="hidden" value="tutor_answering_quiz_question" name="tutor_action"/> |
| 106 | <?php |
| 107 | $question_i = 0; |
| 108 | foreach ( $questions as $question ) { |
| 109 | $question_i++; |
| 110 | $question_settings = maybe_unserialize( $question->question_settings ); |
| 111 | |
| 112 | $style_display = ( $question_layout_view !== 'question_below_each_other' && $question_i == 1 ) ? 'block' : 'none'; |
| 113 | if ( $question_layout_view === 'question_below_each_other' ) { |
| 114 | $style_display = 'block'; |
| 115 | } |
| 116 | |
| 117 | $next_question = isset( $questions[ $question_i ] ) ? $questions[ $question_i ] : false; |
| 118 | $previous_question = $question_i > 1 ? $questions[ $question_i - 1 ] : false; |
| 119 | $next_question_id = $next_question ? "data-next-question-id=#quiz-attempt-single-question-{$next_question->question_id}" : ''; |
| 120 | ?> |
| 121 | <div id="quiz-attempt-single-question-<?php echo esc_attr( $question->question_id ); ?>" class="quiz-attempt-single-question quiz-attempt-single-question-<?php echo $question_i; ?>" style="display: <?php echo $style_display; ?> ;" <?php echo esc_attr( $next_question_id ); ?> data-quiz-feedback-mode="<?php echo esc_attr( $feedback_mode ); ?>" > |
| 122 | |
| 123 | <input type="hidden" name="attempt[<?php echo esc_attr( $is_started_quiz->attempt_id ); ?>][quiz_question_ids][]" value="<?php echo $question->question_id; ?>" /> |
| 124 | <?php |
| 125 | |
| 126 | |
| 127 | |
| 128 | $question_type = $question->question_type; |
| 129 | |
| 130 | $rand_choice = false; |
| 131 | if ( $question_type == 'single_choice' || $question_type == 'multiple_choice' ) { |
| 132 | $choice = maybe_unserialize( $question->question_settings ); |
| 133 | if ( isset( $choice['randomize_question'] ) ) { |
| 134 | $rand_choice = $choice['randomize_question'] == 1 ? true : false; |
| 135 | } |
| 136 | } |
| 137 | |
| 138 | $answers = tutor_utils()->get_answers_by_quiz_question( $question->question_id, $rand_choice ); |
| 139 | $show_question_mark = (bool) tutor_utils()->avalue_dot( 'show_question_mark', $question_settings ); |
| 140 | $answer_required = (bool) tutils()->array_get( 'answer_required', $question_settings ); |
| 141 | |
| 142 | echo '<h4 class="question-text">'; |
| 143 | if ( ! $hide_question_number_overview ) { |
| 144 | echo $question_i . '. '; |
| 145 | } |
| 146 | echo stripslashes( $question->question_title ); |
| 147 | echo '</h4>'; |
| 148 | |
| 149 | if ( $show_question_mark ) { |
| 150 | echo '<p class="question-marks"> ' . __( 'Marks : ', 'tutor' ) . $question->question_mark . ' </p>'; |
| 151 | } |
| 152 | |
| 153 | $question_description = nl2br( stripslashes( $question->question_description ) ); |
| 154 | if ( $question_description ) { |
| 155 | echo '<p class="question-description">' . $question_description . '</p>'; |
| 156 | } |
| 157 | ?> |
| 158 | |
| 159 | <div class="tutor-quiz-answers-wrap question-type-<?php echo esc_attr( $question_type ); ?> <?php echo $answer_required ? 'quiz-answer-required' : ''; ?> "> |
| 160 | <?php |
| 161 | if ( is_array( $answers ) && count( $answers ) ) { |
| 162 | foreach ( $answers as $answer ) { |
| 163 | $answer_title = stripslashes( $answer->answer_title ); |
| 164 | $answer->is_correct ? $quiz_answers[] = $answer->answer_id : 0; |
| 165 | |
| 166 | if ( $question_type === 'true_false' || $question_type === 'single_choice' ) { |
| 167 | ?> |
| 168 | <label class="answer-view-<?php echo $answer->answer_view_format; ?>"> |
| 169 | <div class="quiz-answer-input-body"> |
| 170 | <?php |
| 171 | if ( $answer->answer_view_format === 'image' || $answer->answer_view_format === 'text_image' ) { |
| 172 | ?> |
| 173 | <div class="quiz-answer-image-wrap"> |
| 174 | <img src="<?php echo esc_url( wp_get_attachment_image_url( $answer->image_id, 'full' ) ); ?>" /> |
| 175 | </div> |
| 176 | <?php |
| 177 | } |
| 178 | ?> |
| 179 | <div class="quiz-answer-input-bottom"> |
| 180 | <div class="quiz-answer-input-field"> |
| 181 | <input name="attempt[<?php echo esc_attr( $is_started_quiz->attempt_id ); ?>][quiz_question][<?php echo esc_attr( $question->question_id ); ?>]" type="radio" value="<?php echo esc_attr( $answer->answer_id ); ?>"> |
| 182 | <span> </span> |
| 183 | <?php |
| 184 | if ( $answer->answer_view_format !== 'image' ) { |
| 185 | echo esc_attr( $answer_title );} |
| 186 | ?> |
| 187 | </div> |
| 188 | </div> |
| 189 | </div> |
| 190 | </label> |
| 191 | <?php |
| 192 | } elseif ( $question_type === 'multiple_choice' ) { |
| 193 | ?> |
| 194 | <label class="answer-view-<?php echo esc_attr( $answer->answer_view_format ); ?>"> |
| 195 | |
| 196 | |
| 197 | <div class="quiz-answer-input-body"> |
| 198 | <?php if ( $answer->answer_view_format === 'image' || $answer->answer_view_format === 'text_image' ) { ?> |
| 199 | <div class="quiz-answer-image-wrap"> |
| 200 | <img src="<?php echo wp_get_attachment_image_url( $answer->image_id, 'full' ); ?>" /> |
| 201 | </div> |
| 202 | <?php } ?> |
| 203 | |
| 204 | <div class="quiz-answer-input-bottom"> |
| 205 | <div class="quiz-answer-input-field"> |
| 206 | <input name="attempt[<?php echo esc_attr( $is_started_quiz->attempt_id ); ?>][quiz_question][<?php echo esc_attr( $question->question_id ); ?>][]" type="checkbox" value="<?php echo esc_attr( $answer->answer_id ); ?>"> |
| 207 | <span> </span> |
| 208 | <?php |
| 209 | if ( $answer->answer_view_format !== 'image' ) { |
| 210 | echo esc_attr( $answer_title ); |
| 211 | } |
| 212 | ?> |
| 213 | </div> |
| 214 | </div> |
| 215 | </div> |
| 216 | </label> |
| 217 | <?php |
| 218 | } elseif ( $question_type === 'fill_in_the_blank' ) { |
| 219 | ?> |
| 220 | <p class="fill-in-the-blank-field"> |
| 221 | <?php |
| 222 | $count_dash_fields = substr_count( $answer_title, '{dash}' ); |
| 223 | if ( $count_dash_fields ) { |
| 224 | |
| 225 | $dash_string = array(); |
| 226 | $input_data = array(); |
| 227 | for ( $i = 1; $i <= $count_dash_fields; $i ++ ) { |
| 228 | $dash_string[] = '{dash}'; |
| 229 | $input_data[] = "<input type='text' name='attempt[{$is_started_quiz->attempt_id}][quiz_question][{$question->question_id}][]' class='fill-in-the-blank-text-input' />"; |
| 230 | } |
| 231 | echo str_replace( $dash_string, $input_data, $answer_title ); |
| 232 | } |
| 233 | ?> |
| 234 | </p> |
| 235 | <?php |
| 236 | } elseif ( $question_type === 'ordering' ) { |
| 237 | ?> |
| 238 | <div class="question-type-ordering-item"> |
| 239 | <div class="answer-title"> |
| 240 | <?php |
| 241 | if ( $answer->answer_view_format !== 'image' ) { |
| 242 | echo '<p class="tutor-quiz-answer-title">' . $answer_title . '</p>'; |
| 243 | } |
| 244 | if ( $answer->answer_view_format === 'image' || $answer->answer_view_format === 'text_image' ) { |
| 245 | ?> |
| 246 | <div class="quiz-answer-image-wrap"> |
| 247 | <img src="<?php echo wp_get_attachment_image_url( $answer->image_id, 'full' ); ?>" /> |
| 248 | </div> |
| 249 | <?php |
| 250 | } |
| 251 | ?> |
| 252 | </div> |
| 253 | <span class="answer-sorting-bar"><i class="tutor-icon-menu-2"></i> </span> |
| 254 | <input type="hidden" name="attempt[<?php echo esc_attr( $is_started_quiz->attempt_id ); ?>][quiz_question][<?php echo esc_attr( $question->question_id ); ?>][answers][]" value="<?php echo esc_attr( $answer->answer_id ); ?>" > |
| 255 | </div> |
| 256 | <?php |
| 257 | } |
| 258 | } |
| 259 | |
| 260 | /** |
| 261 | * Question type matchind and image matching |
| 262 | */ |
| 263 | if ( $question_type === 'matching' || $question_type === 'image_matching' ) { |
| 264 | ?> |
| 265 | <div class="quiz-answers-type-matching-wrap <?php echo esc_attr( 'answer-type-' . $question_type ); ?> "> |
| 266 | <div class="quiz-draggable-rand-answers"> |
| 267 | <?php |
| 268 | $rand_answers = tutor_utils()->get_answers_by_quiz_question( $question->question_id, true ); |
| 269 | foreach ( $rand_answers as $rand_answer ) { |
| 270 | ?> |
| 271 | <div class="quiz-draggable-answer-item"> |
| 272 | <?php |
| 273 | if ( $question_type === 'matching' ) { |
| 274 | echo '<span class="draggable-answer-title">' . stripslashes( $rand_answer->answer_two_gap_match ) . '</span>'; |
| 275 | } else { |
| 276 | echo '<span class="draggable-answer-title">' . stripslashes( $rand_answer->answer_title ) . '</span>'; |
| 277 | } |
| 278 | ?> |
| 279 | <span class="draggable-answer-icon"> <i class="tutor-icon-menu-2"></i> </span> |
| 280 | <input type="hidden" name="attempt[<?php echo esc_attr( $is_started_quiz->attempt_id ); ?>][quiz_question][<?php echo esc_attr( $question->question_id ); ?>][answers][]" value="<?php echo esc_attr( $rand_answer->answer_id ); ?>" > |
| 281 | </div> |
| 282 | <?php |
| 283 | } |
| 284 | ?> |
| 285 | </div> |
| 286 | |
| 287 | <div class="quiz-answer-matching-items-wrap"> |
| 288 | <?php |
| 289 | foreach ( $answers as $answer ) { |
| 290 | ?> |
| 291 | <div class="quiz-answer-item-matching"> |
| 292 | <div class="quiz-answer-matching-title"> |
| 293 | <?php |
| 294 | if ( $question_type === 'matching' ) { |
| 295 | |
| 296 | if ( $answer->answer_view_format !== 'image' ) { |
| 297 | echo '<p class="tutor-quiz-answer-title">' . stripslashes( $answer->answer_title ) . '</p>'; |
| 298 | } |
| 299 | if ( $answer->answer_view_format === 'image' || $answer->answer_view_format === 'text_image' ) { |
| 300 | ?> |
| 301 | <div class="quiz-answer-image-wrap"> |
| 302 | <img src="<?php echo wp_get_attachment_image_url( $answer->image_id, 'full' ); ?>" /> |
| 303 | </div> |
| 304 | <?php |
| 305 | } |
| 306 | } elseif ( intval( $answer->image_id ) ) { |
| 307 | echo '<img src="' . wp_get_attachment_image_url( $answer->image_id, 'full' ) . '" />'; |
| 308 | } |
| 309 | ?> |
| 310 | </div> |
| 311 | <div class="quiz-answer-matching-droppable"></div> |
| 312 | </div> |
| 313 | <?php |
| 314 | } |
| 315 | ?> |
| 316 | |
| 317 | </div> |
| 318 | </div> |
| 319 | <?php |
| 320 | } |
| 321 | } |
| 322 | |
| 323 | /** |
| 324 | * For Open Ended Question Type |
| 325 | */ |
| 326 | if ( $question_type === 'open_ended' || $question_type === 'short_answer' ) { |
| 327 | ?> |
| 328 | <textarea class="question_type_<?php echo esc_attr( $question_type ); ?>" name="attempt[<?php echo esc_attr( $is_started_quiz->attempt_id ); ?>][quiz_question][<?php echo esc_attr( $question->question_id ); ?>]"></textarea> |
| 329 | <?php |
| 330 | if ( $question_type === 'short_answer' ) { |
| 331 | $get_option_meta = tutor_utils()->get_quiz_option( $quiz_id ); |
| 332 | if ( isset( $get_option_meta['short_answer_characters_limit'] ) ) { |
| 333 | if ( $get_option_meta['short_answer_characters_limit'] != '' ) { |
| 334 | $characters_limit = tutor_utils()->avalue_dot( 'short_answer_characters_limit', $quiz_attempt_info ); |
| 335 | echo '<p class="answer_limit_desc">' . __( 'characters remaining', 'tutor' ) . ' :<span class="characters_remaining">' . esc_attr( $characters_limit ) . '</span> </p>'; |
| 336 | } |
| 337 | } |
| 338 | } |
| 339 | if ( $question_type === 'open_ended' ) { |
| 340 | $get_option_meta = tutor_utils()->get_quiz_option( $quiz_id ); |
| 341 | if ( isset( $get_option_meta['open_ended_answer_characters_limit'] ) ) { |
| 342 | if ( $get_option_meta['open_ended_answer_characters_limit'] != '' ) { |
| 343 | $characters_limit = $get_option_meta['open_ended_answer_characters_limit']; |
| 344 | echo '<p class="answer_limit_desc">' . __( 'characters remaining', 'tutor' ) . ' :<span class="characters_remaining">' . $characters_limit . '</span> </p>'; |
| 345 | } |
| 346 | } |
| 347 | } |
| 348 | } |
| 349 | |
| 350 | |
| 351 | if ( $question_type === 'image_answering' ) { |
| 352 | ?> |
| 353 | <div class="quiz-image-answering-wrap"> |
| 354 | <?php |
| 355 | foreach ( $answers as $answer ) { |
| 356 | ?> |
| 357 | <div class="quiz-image-answering-answer"> |
| 358 | <?php |
| 359 | if ( intval( $answer->image_id ) ) { |
| 360 | ?> |
| 361 | <div class="quiz-image-answering-image-wrap"> |
| 362 | <?php echo '<img src="' . wp_get_attachment_image_url( $answer->image_id, 'full' ) . '" />'; ?> |
| 363 | </div> |
| 364 | |
| 365 | <div class="quiz-image-answering-input-field-wrap"> |
| 366 | <input type="text" name="attempt[<?php echo esc_attr( $is_started_quiz->attempt_id ); ?>][quiz_question][<?php echo esc_attr( $question->question_id ); ?>][answer_id][<?php echo esc_attr( $answer->answer_id ); ?>]" > |
| 367 | </div> |
| 368 | <?php |
| 369 | } |
| 370 | ?> |
| 371 | </div> |
| 372 | <?php |
| 373 | } |
| 374 | ?> |
| 375 | </div> |
| 376 | <?php |
| 377 | } |
| 378 | ?> |
| 379 | |
| 380 | <div class="answer-help-block"></div> |
| 381 | |
| 382 | </div> |
| 383 | |
| 384 | <?php |
| 385 | if ( $question_layout_view !== 'question_below_each_other' ) { |
| 386 | ?> |
| 387 | <div class="quiz-answer-footer-bar"> |
| 388 | <div class="quiz-footer-button"> |
| 389 | <?php |
| 390 | if ( ! $hide_previous_button && $previous_question ) { |
| 391 | ?> |
| 392 | <button type="button" class="tutor-button tutor-button-outlined tutor-button-outlined-transparent tutor-quiz-answer-previous-btn"> |
| 393 | <?php _e( 'Back', 'tutor' ); ?> |
| 394 | </button> |
| 395 | <?php |
| 396 | } |
| 397 | ?> |
| 398 | <button type="submit" class="tutor-button tutor-button-primary <?php echo esc_attr( $next_question ? 'tutor-quiz-answer-next-btn' : 'tutor-quiz-submit-btn' ); ?>"> |
| 399 | <?php $next_question ? _e( 'Answer & Next Question', 'tutor' ) : _e( 'Submit Quiz', 'tutor' ); ?> |
| 400 | </button> |
| 401 | </div> |
| 402 | </div> |
| 403 | <?php |
| 404 | } |
| 405 | ?> |
| 406 | </div> |
| 407 | |
| 408 | <?php |
| 409 | } |
| 410 | |
| 411 | if ( $question_layout_view === 'question_below_each_other' ) { |
| 412 | ?> |
| 413 | <div class="quiz-answer-footer-bar"> |
| 414 | <div class="quiz-footer-button"> |
| 415 | <button type="submit" name="quiz_answer_submit_btn" value="quiz_answer_submit" class="tutor-button |
| 416 | tutor-button-primary"><?php _e( 'Submit Quiz', 'tutor' ); ?></button> |
| 417 | </div> |
| 418 | </div> |
| 419 | <?php } ?> |
| 420 | |
| 421 | </form> |
| 422 | </div> |
| 423 | |
| 424 | <?php |
| 425 | |
| 426 | } else { |
| 427 | ?> |
| 428 | <div class="start-quiz-wrap"> |
| 429 | <form id="tutor-finish-quiz" method="post"> |
| 430 | <?php wp_nonce_field( tutor()->nonce_action, tutor()->nonce ); ?> |
| 431 | |
| 432 | <input type="hidden" value="<?php echo esc_attr( $quiz_id ); ?>" name="quiz_id"/> |
| 433 | <input type="hidden" value="tutor_finish_quiz_attempt" name="tutor_action"/> |
| 434 | |
| 435 | <button type="submit" class="tutor-button" name="finish_quiz_btn" value="finish_quiz"> |
| 436 | <i class="icon-floppy"></i> <?php _e( 'Finish', 'tutor' ); ?> |
| 437 | </button> |
| 438 | </form> |
| 439 | </div> |
| 440 | |
| 441 | <?php |
| 442 | } |
| 443 | } else { |
| 444 | |
| 445 | if ( $attempt_remaining > 0 || $attempts_allowed == 0 ) { |
| 446 | do_action( 'tuotr_quiz/start_form/before', $quiz_id ); |
| 447 | ?> |
| 448 | <div class="start-quiz-wrap"> |
| 449 | <form id="tutor-start-quiz" method="post"> |
| 450 | <?php wp_nonce_field( tutor()->nonce_action, tutor()->nonce ); ?> |
| 451 | |
| 452 | <input type="hidden" value="<?php echo esc_attr( $quiz_id ); ?>" name="quiz_id"/> |
| 453 | <input type="hidden" value="tutor_start_quiz" name="tutor_action"/> |
| 454 | |
| 455 | <button type="submit" class="tutor-button" name="start_quiz_btn" value="start_quiz"> |
| 456 | <?php _e( 'Start Quiz', 'tutor' ); ?> |
| 457 | </button> |
| 458 | </form> |
| 459 | </div> |
| 460 | |
| 461 | <?php |
| 462 | do_action( 'tuotr_quiz/start_form/after', $quiz_id ); |
| 463 | } |
| 464 | |
| 465 | |
| 466 | |
| 467 | if ( $previous_attempts ) { |
| 468 | do_action( 'tutor_quiz/previous_attempts_html/before', $previous_attempts, $quiz_id ); |
| 469 | |
| 470 | ob_start(); |
| 471 | tutor_load_template( 'single.quiz.previous-attempts', compact( 'previous_attempts', 'quiz_id' ) ); |
| 472 | $previous_attempts_html = ob_get_clean(); |
| 473 | echo apply_filters( 'tutor_quiz/previous_attempts_html', $previous_attempts_html, $previous_attempts, $quiz_id ); |
| 474 | |
| 475 | do_action( 'tutor_quiz/previous_attempts/after', $previous_attempts, $quiz_id ); |
| 476 | } |
| 477 | } |
| 478 | |
| 479 | |
| 480 | tutor_next_previous_pagination(); |
| 481 | |
| 482 | do_action( 'tutor_quiz/body/after', $quiz_id ); |
| 483 | ?> |
| 484 | </div> |
| 485 | |
| 486 | <script> |
| 487 | window.tutor_quiz_context = '<?php echo strrev(base64_encode(json_encode($quiz_answers))); ?>'; |
| 488 | </script> |
| 489 |