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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 / single / quiz / parts / question.php
tutor / templates / single / quiz / parts Last commit date
choice-box.php 1 year ago fill-in-the-blank.php 3 years ago image-answer.php 3 years ago image-matching.php 1 year ago matching.php 1 year ago meta.php 5 days ago open-ended.php 2 years ago ordering.php 3 years ago question.php 5 days ago short-answer.php 1 year ago
question.php
237 lines
1 <?php
2 /**
3 * Question
4 *
5 * @package Tutor\Templates
6 * @subpackage Single\Quiz\Parts
7 * @author Themeum <support@themeum.com>
8 * @link https://themeum.com
9 * @version 1.0.0
10 */
11
12 ?>
13
14 <div id="tutor-quiz-attempt-questions-wrap" data-question-layout-view="<?php echo esc_attr( $question_layout_view ); ?>">
15
16 <?php
17 $choice_contexts = array(
18 'true_false' => 'radio',
19 'single_choice' => 'radio',
20 'multiple_choice' => 'checkbox',
21 );
22 $show_previous_button = (bool) tutor_utils()->get_option( 'quiz_previous_button_enabled', true );
23 $show_previous_button = $show_previous_button && ! $hide_previous_button;
24
25 if ( 'single_question' === $question_layout_view && $enable_pagination ) {
26 $question_i = 0;
27 ?>
28 <div class="tutor-quiz-questions-pagination" data-pagination-style="<?php echo esc_attr( $pagination_type ); ?>">
29 <ul>
30 <?php
31 foreach ( $questions as $question ) {
32 $question_i++;
33 $markup = "<li><a href='#quiz-attempt-single-question-{$question->question_id}' class='tutor-quiz-question-paginate-item'>{$question_i}</a> </li>";
34 echo wp_kses(
35 $markup,
36 array(
37 'li' => array(),
38 'a' => array(
39 'href' => true,
40 'class' => true,
41 ),
42 )
43 );
44 }
45 ?>
46 </ul>
47 </div>
48 <?php
49 }
50 ?>
51
52 <form id="tutor-answering-quiz" method="post">
53 <?php wp_nonce_field( tutor()->nonce_action, tutor()->nonce, false ); ?>
54 <input type="hidden" value="<?php echo esc_attr( $is_started_quiz->attempt_id ); ?>" name="attempt_id"/>
55 <input type="hidden" value="tutor_answering_quiz_question" name="tutor_action"/>
56 <?php
57 $question_i = 0;
58 foreach ( $questions as $question ) {
59 $question_i++;
60 $question_settings = maybe_unserialize( $question->question_settings );
61 $style_display = ( 'question_below_each_other' !== $question_layout_view && 1 == $question_i ) ? 'block' : 'none';
62 if ( 'question_below_each_other' === $question_layout_view ) {
63 $style_display = 'block';
64 }
65
66 $next_question = isset( $questions[ $question_i ] ) ? $questions[ $question_i ] : false;
67 $previous_question = $question_i > 1 ? $questions[ $question_i - 1 ] : false;
68 ?>
69 <div id="quiz-attempt-single-question-<?php echo esc_attr( $question->question_id ); ?>"
70 class="quiz-attempt-single-question quiz-attempt-single-question-<?php echo esc_attr( $question_i ); ?>"
71 style="display: <?php echo esc_attr( $style_display ); ?> ;"
72 <?php echo $next_question ? "data-next-question-id='#quiz-attempt-single-question-" . esc_attr( $next_question->question_id ) . "'" : ''; ?>
73 <?php echo 'h5p' === $question->question_type ? 'data-h5p-quiz-content-id=' . esc_attr( $question->question_description ) : ''; ?>
74 data-enable-answer-reveal="<?php echo esc_attr( $enable_answer_reveal ? '1' : '0' ); ?>"
75 data-question_index="<?php echo esc_attr( $question_i ); ?>"
76 data-question-type="<?php echo esc_attr( $question->question_type ); ?>">
77
78 <div class="quiz-question tutor-mt-44 tutor-mr-md-100">
79 <?php
80 $input_markup = "<input type='hidden' name='attempt[{$is_started_quiz->attempt_id}][quiz_question_ids][]' value='{$question->question_id}' />";
81 echo wp_kses(
82 $input_markup,
83 array(
84 'input' => array(
85 'type' => true,
86 'name' => true,
87 'value' => true,
88 ),
89 )
90 );
91
92 $question_type = $question->question_type;
93
94 $rand_choice = false;
95 if ( 'matching' !== $question_type && 'image_matching' !== $question_type ) { // Note: Randomize will be done in specific template.
96 if ( 'ordering' === $question_type ) {
97 $rand_choice = true;
98 } else {
99 $question_settings = maybe_unserialize( $question->question_settings );
100 $rand_choice = ( isset( $question_settings['randomize_question'] ) && '1' === $question_settings['randomize_question'] );
101 }
102 }
103
104 $answers = \Tutor\Models\QuizModel::get_answers_by_quiz_question( $question->question_id, $rand_choice );
105 $show_question_mark = (bool) tutor_utils()->avalue_dot( 'show_question_mark', $question_settings );
106 $answer_required = (bool) tutor_utils()->array_get( 'answer_required', $question_settings );
107 echo wp_kses(
108 '<div class="quiz-question-title tutor-fs-4 tutor-fw-medium tutor-color-black tutor-mb-20">',
109 array(
110 'div' => array( 'class' => true ),
111 )
112 );
113
114 if ( ! $hide_question_number_overview ) {
115 echo esc_html( $question_i . '. ' );
116 }
117 echo esc_html( stripslashes( $question->question_title ) );
118 echo '</div>';
119
120 if ( $show_question_mark ) {
121 echo wp_kses(
122 '<p class="question-marks"> ' . __( 'Marks : ', 'tutor' ) . $question->question_mark . ' </p>',
123 array(
124 'p' => array( 'class' => true ),
125 )
126 );
127 }
128
129
130 $question_description = apply_filters( 'tutor_filter_quiz_question_description', wp_unslash( $question->question_description ) );
131 if ( $question_description ) {
132 $markup = "<div class='matching-quiz-question-desc'><span class='tutor-fs-7 tutor-color-secondary'>{$question_description}</span></div>";
133 if ( tutor()->has_pro ) {
134 do_action( 'tutor_quiz_question_desc_render', $markup, $question );
135 } else {
136 echo wp_kses_post( $markup );
137 }
138 }
139
140 ?>
141 </div>
142 <!-- Quiz Answer -->
143 <?php
144 if ( array_key_exists( $question_type, $choice_contexts ) ) {
145 // Only checkbox and radio type content will be loaded here.
146 $choice_type = $choice_contexts[ $question_type ];
147 require 'choice-box.php';
148 }
149
150 // Fill In The Blank.
151 if ( 'fill_in_the_blank' === $question_type ) {
152 require 'fill-in-the-blank.php';
153 }
154
155 // Ordering.
156 if ( 'ordering' === $question_type ) {
157 require 'ordering.php';
158 }
159
160
161 // Matching.
162 if ( 'matching' === $question_type ) {
163 $is_image_matching = isset( $question_settings['is_image_matching'] ) && '1' === $question_settings['is_image_matching'];
164 if ( $is_image_matching ) {
165 require 'image-matching.php';
166 } else {
167 require 'matching.php';
168 }
169 }
170
171 // Image Matching.
172 if ( 'image_matching' === $question_type ) {
173 require 'image-matching.php';
174 }
175
176 // Image Answer.
177 if ( 'image_answering' === $question_type ) {
178 require 'image-answer.php';
179 }
180
181 // Open Ended.
182 if ( 'open_ended' === $question_type ) {
183 require 'open-ended.php';
184 }
185
186 // Short Answer.
187 if ( 'short_answer' === $question_type ) {
188 require 'short-answer.php';
189 }
190
191 do_action( 'tutor_require_question_answer_file', $question_type, $is_started_quiz, $question );
192 ?>
193
194 <div class="answer-help-block tutor-mt-24"></div>
195
196 <?php do_action( 'tutor_quiz_question_after_answers', $post, $quiz_details, $question ); ?>
197
198 <?php if ( 'question_below_each_other' !== $question_layout_view ) : ?>
199 <div class="tutor-quiz-btn-group tutor-mt-60 tutor-d-flex">
200 <?php
201 if ( $show_previous_button && $previous_question ) {
202 ?>
203 <button type="button" class="tutor-btn tutor-btn-outline-primary tutor-btn-md tutor-quiz-answer-previous-btn tutor-mr-20">
204 <span class="tutor-icon-previous tutor-mr-8" aria-hidden="true"></span> <?php esc_html_e( 'Back', 'tutor' ); ?>
205 </button>
206 <?php
207 }
208 ?>
209 <button disabled="disabled" type="submit" class="tutor-btn tutor-btn-primary tutor-btn-md start-quiz-btn tutor-quiz-next-btn-all <?php echo $next_question ? 'tutor-quiz-answer-next-btn' : 'tutor-quiz-submit-btn'; ?>">
210 <?php $next_question ? esc_html_e( 'Submit &amp; Next', 'tutor' ) : esc_html_e( 'Submit Quiz', 'tutor' ); ?>
211 </button>
212 <?php if ( ! isset( $question_settings['answer_required'] ) || '0' === $question_settings['answer_required'] ) : ?>
213 <span class="tutor-ml-32 tutor-btn tutor-btn-ghost tutor-btn-md tutor-next-btn <?php echo $next_question ? 'tutor-quiz-answer-next-btn' : 'tutor-quiz-submit-btn'; ?> tutor-ml-auto">
214 <?php esc_html_e( 'Skip Question', 'tutor' ); ?>
215 </span>
216 <?php endif; ?>
217 </div>
218 <?php endif; ?>
219 </div>
220 <?php
221 }
222
223 if ( 'question_below_each_other' === $question_layout_view ) {
224 ?>
225 <div class="quiz-answer-footer-bar tutor-mt-60">
226 <div class="quiz-footer-button">
227 <button type="submit" name="quiz_answer_submit_btn" value="quiz_answer_submit" class="tutor-btn tutor-btn-primary">
228 <?php esc_html_e( 'Submit Quiz', 'tutor' ); ?>
229 </button>
230 </div>
231 </div>
232 <?php
233 }
234 ?>
235 </form>
236 </div>
237