questions
1 month ago
question-header.php
1 month ago
question.php
1 month ago
questions-sidebar.php
1 month ago
review-answers.php
1 month ago
summary.php
1 month ago
review-answers.php
86 lines
| 1 | <?php |
| 2 | /** |
| 3 | * Tutor learning area attempt details review answers list. |
| 4 | * |
| 5 | * @package Tutor\Templates |
| 6 | * @subpackage LearningArea\Quiz\AttemptDetails |
| 7 | * @since 4.0.0 |
| 8 | */ |
| 9 | |
| 10 | defined( 'ABSPATH' ) || exit; |
| 11 | |
| 12 | use Tutor\Quiz; |
| 13 | |
| 14 | $questions = isset( $questions ) && is_array( $questions ) ? $questions : array(); |
| 15 | $attempt_data = isset( $attempt_data ) && is_object( $attempt_data ) ? $attempt_data : null; |
| 16 | $back_url = isset( $back_url ) ? (string) $back_url : ''; |
| 17 | $context = isset( $context ) ? (string) $context : ''; |
| 18 | ?> |
| 19 | |
| 20 | <div class="tutor-quiz tutor-quiz-questions"> |
| 21 | <?php foreach ( $questions as $index => $question ) : ?> |
| 22 | <?php |
| 23 | $question_type = $question->question_type ?? ''; |
| 24 | |
| 25 | $question_id = (int) ( $question->question_id ?? 0 ); |
| 26 | |
| 27 | $is_dnd = in_array( $question_type, array( 'image_answering', 'ordering', 'matching', 'image_matching' ), true ); |
| 28 | $is_true_false = 'true_false' === $question_type; |
| 29 | $is_multiple_choice = in_array( $question_type, array( 'single_choice', 'multiple_choice' ), true ); |
| 30 | $is_open_ended = in_array( $question_type, array( 'open_ended', 'short_answer' ), true ); |
| 31 | $is_fill_in_the_blanks = 'fill_in_the_blank' === $question_type; |
| 32 | $is_draw_image = 'draw_image' === $question_type; |
| 33 | $is_pin = 'pin_image' === $question_type; |
| 34 | $is_scale = 'scale' === $question_type; |
| 35 | $is_coordinates = 'coordinates' === $question_type; |
| 36 | $is_puzzle = 'puzzle' === $question_type; |
| 37 | |
| 38 | $question_template = ''; |
| 39 | |
| 40 | if ( $is_dnd ) { |
| 41 | $question_template = 'review-answer-dnd'; |
| 42 | } elseif ( $is_true_false ) { |
| 43 | $question_template = 'true-false'; |
| 44 | } elseif ( $is_multiple_choice ) { |
| 45 | $question_template = 'multiple-choice'; |
| 46 | } elseif ( $is_open_ended ) { |
| 47 | $question_template = 'open-ended'; |
| 48 | } elseif ( $is_fill_in_the_blanks ) { |
| 49 | $question_template = 'fill-in-the-blank'; |
| 50 | } elseif ( $is_scale ) { |
| 51 | $question_template = 'scale'; |
| 52 | } elseif ( $is_pin ) { |
| 53 | $question_template = 'pin-image'; |
| 54 | } elseif ( $is_draw_image ) { |
| 55 | $question_template = 'draw-image'; |
| 56 | } elseif ( $is_coordinates ) { |
| 57 | $question_template = 'coordinates'; |
| 58 | } elseif ( $is_puzzle ) { |
| 59 | $question_template = 'puzzle'; |
| 60 | } |
| 61 | ?> |
| 62 | |
| 63 | <div id="question-<?php echo esc_attr( $question_id ); ?>"> |
| 64 | <?php |
| 65 | if ( ! empty( $question_template ) ) { |
| 66 | tutor_load_template( |
| 67 | 'shared.components.quiz.attempt-details.question', |
| 68 | array( |
| 69 | 'question' => $question, |
| 70 | 'index' => (int) $index + 1, |
| 71 | 'question_template' => $question_template, |
| 72 | 'attempt_id' => (int) ( $attempt_data->attempt_id ?? 0 ), |
| 73 | 'is_manually_reviewed' => ! empty( $attempt_data->is_manually_reviewed ), |
| 74 | 'back_url' => $back_url, |
| 75 | 'context' => $context, |
| 76 | 'is_instructor_review' => $is_instructor_review, |
| 77 | 'review_field_name' => "review_statuses[{$question_id}]", |
| 78 | ) |
| 79 | ); |
| 80 | } |
| 81 | do_action( 'tutor_review_answer_after_question_template', $question, $index, $is_instructor_review ); |
| 82 | ?> |
| 83 | </div> |
| 84 | <?php endforeach; ?> |
| 85 | </div> |
| 86 |