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.2 3.5.0 3.6.0 3.6.1 3.6.2 3.6.3 3.6.4 3.7.0 3.7.1 3.7.2 3.7.3 3.7.4 3.8.0 3.8.1 3.8.2 3.8.3 3.9.0 3.9.1 3.9.10 3.9.2 3.9.3 3.9.4 3.9.5 3.9.6 3.9.7 3.9.8 3.9.9
tutor / templates / shared / components / quiz / attempt-details / question.php
tutor / templates / shared / components / quiz / attempt-details Last commit date
questions 2 days ago question-header.php 5 days ago question.php 5 days ago questions-sidebar.php 5 days ago review-answers.php 5 days ago summary.php 5 days ago
question.php
115 lines
1 <?php
2 /**
3 * Attempt details question wrapper.
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\Components\Badge;
13 use Tutor\Models\QuizModel;
14
15 if ( ! isset( $question ) || ! is_object( $question ) || empty( $question_template ) ) {
16 return;
17 }
18
19 $index = (int) ( $index ?? 1 );
20 $attempt_id = (int) ( $attempt_id ?? 0 );
21 $back_url = (string) ( $back_url ?? '' );
22 $context = (string) ( $context ?? '' );
23 $is_instructor_review = ! empty( $is_instructor_review );
24 $review_field_name = (string) ( $review_field_name ?? '' );
25 $question_settings = maybe_unserialize( $question->question_settings );
26 $question_settings = is_array( $question_settings ) ? $question_settings : array();
27 $question_type = (string) ( $question->question_type ?? '' );
28
29 if ( 'image_matching' === $question_type ) {
30 $question_type = 'matching';
31 }
32
33 if ( 'single_choice' === $question_type ) {
34 $question_type = 'multiple_choice';
35 }
36
37 $is_skipped = QuizModel::is_attempt_answer_skipped( $question );
38 $review_status = $question ? QuizModel::get_attempt_answer_status( $question ) : 'skipped';
39 $answer_status = $review_status;
40 $status_badges = array();
41
42 if ( $is_skipped ) {
43 $status_badges[] = array(
44 'label' => __( 'Skipped', 'tutor' ),
45 'variant' => Badge::INFO,
46 );
47 }
48
49 if ( $is_instructor_review ) {
50 $status_badges[] = array(
51 'status' => $review_status,
52 );
53 } elseif ( 'correct' === $review_status ) {
54 $status_badges[] = array(
55 'label' => __( 'Correct', 'tutor' ),
56 'variant' => Badge::SUCCESS,
57 );
58 } elseif ( 'pending' === $review_status ) {
59 $status_badges[] = array(
60 'label' => __( 'Pending', 'tutor' ),
61 'variant' => Badge::WARNING,
62 );
63 } elseif ( 'incorrect' === $review_status ) {
64 $status_badges[] = array(
65 'label' => __( 'Incorrect', 'tutor' ),
66 'variant' => Badge::ERROR,
67 );
68 }
69
70
71 $question_wrapper_classes = array( 'tutor-quiz-question' );
72 if ( 'review-answer-dnd' === $question_template ) {
73 $question_wrapper_classes[] = 'tutor-quiz-review-dnd';
74 }
75
76 ?>
77
78 <div class="<?php echo esc_attr( implode( ' ', $question_wrapper_classes ) ); ?>" data-question="<?php echo esc_attr( $question_type ); ?>">
79 <?php
80 tutor_load_template(
81 'shared.components.quiz.attempt-details.question-header',
82 array(
83 'question' => $question,
84 'index' => $index,
85 'question_title' => (string) ( $question->question_title ?? '' ),
86 'question_description' => (string) ( $question->question_description ?? '' ),
87 'question_mark' => (string) ( $question->question_mark ?? '' ),
88 'show_question_mark' => '1' === (string) ( $question_settings['show_question_mark'] ?? '1' ),
89 'status_badges' => $status_badges,
90 'answer_status' => $answer_status,
91 'attempt_id' => $attempt_id,
92 'attempt_answer_id' => (int) ( $question->attempt_answer_id ?? 0 ),
93 'back_url' => $back_url,
94 'context' => $context,
95 'is_instructor_review' => $is_instructor_review,
96 'review_field_name' => $review_field_name,
97 )
98 );
99
100 tutor_load_template(
101 'shared.components.quiz.attempt-details.questions.' . $question_template,
102 array(
103 'question' => $question,
104 'index' => $index,
105 )
106 );
107
108 do_action( 'tutor_quiz_attempt_details_after_question_template', $question, $question_template, $index );
109
110 if ( is_object( $question ) ) {
111 do_action( 'tutor_quiz_attempt_details_loop_after_row', $question, $answer_status, array() );
112 }
113 ?>
114 </div>
115