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.0 3.3.1 3.4.0 3.4.1 3.4.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 1 month ago open-ended.php 2 years ago ordering.php 3 years ago question.php 3 weeks ago short-answer.php 1 year ago
question.php
238 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="<?php echo esc_attr( $is_started_quiz->quiz_id ); ?>" name="quiz_id"/>
56 <input type="hidden" value="tutor_answering_quiz_question" name="tutor_action"/>
57 <?php
58 $question_i = 0;
59 foreach ( $questions as $question ) {
60 $question_i++;
61 $question_settings = maybe_unserialize( $question->question_settings );
62 $style_display = ( 'question_below_each_other' !== $question_layout_view && 1 == $question_i ) ? 'block' : 'none';
63 if ( 'question_below_each_other' === $question_layout_view ) {
64 $style_display = 'block';
65 }
66
67 $next_question = isset( $questions[ $question_i ] ) ? $questions[ $question_i ] : false;
68 $previous_question = $question_i > 1 ? $questions[ $question_i - 1 ] : false;
69 ?>
70 <div id="quiz-attempt-single-question-<?php echo esc_attr( $question->question_id ); ?>"
71 class="quiz-attempt-single-question quiz-attempt-single-question-<?php echo esc_attr( $question_i ); ?>"
72 style="display: <?php echo esc_attr( $style_display ); ?> ;"
73 <?php echo $next_question ? "data-next-question-id='#quiz-attempt-single-question-" . esc_attr( $next_question->question_id ) . "'" : ''; ?>
74 <?php echo 'h5p' === $question->question_type ? 'data-h5p-quiz-content-id=' . esc_attr( $question->question_description ) : ''; ?>
75 data-enable-answer-reveal="<?php echo esc_attr( $enable_answer_reveal ? '1' : '0' ); ?>"
76 data-question_index="<?php echo esc_attr( $question_i ); ?>"
77 data-question-type="<?php echo esc_attr( $question->question_type ); ?>">
78
79 <div class="quiz-question tutor-mt-44 tutor-mr-md-100">
80 <?php
81 $input_markup = "<input type='hidden' name='attempt[{$is_started_quiz->attempt_id}][quiz_question_ids][]' value='{$question->question_id}' />";
82 echo wp_kses(
83 $input_markup,
84 array(
85 'input' => array(
86 'type' => true,
87 'name' => true,
88 'value' => true,
89 ),
90 )
91 );
92
93 $question_type = $question->question_type;
94
95 $rand_choice = false;
96 if ( 'matching' !== $question_type && 'image_matching' !== $question_type ) { // Note: Randomize will be done in specific template.
97 if ( 'ordering' === $question_type ) {
98 $rand_choice = true;
99 } else {
100 $question_settings = maybe_unserialize( $question->question_settings );
101 $rand_choice = ( isset( $question_settings['randomize_question'] ) && '1' === $question_settings['randomize_question'] );
102 }
103 }
104
105 $answers = \Tutor\Models\QuizModel::get_answers_by_quiz_question( $question->question_id, $rand_choice );
106 $show_question_mark = (bool) tutor_utils()->avalue_dot( 'show_question_mark', $question_settings );
107 $answer_required = (bool) tutor_utils()->array_get( 'answer_required', $question_settings );
108 echo wp_kses(
109 '<div class="quiz-question-title tutor-fs-4 tutor-fw-medium tutor-color-black tutor-mb-20">',
110 array(
111 'div' => array( 'class' => true ),
112 )
113 );
114
115 if ( ! $hide_question_number_overview ) {
116 echo esc_html( $question_i . '. ' );
117 }
118 echo esc_html( stripslashes( $question->question_title ) );
119 echo '</div>';
120
121 if ( $show_question_mark ) {
122 echo wp_kses(
123 '<p class="question-marks"> ' . __( 'Marks : ', 'tutor' ) . $question->question_mark . ' </p>',
124 array(
125 'p' => array( 'class' => true ),
126 )
127 );
128 }
129
130
131 $question_description = apply_filters( 'tutor_filter_quiz_question_description', wp_unslash( $question->question_description ) );
132 if ( $question_description ) {
133 $markup = "<div class='matching-quiz-question-desc'><span class='tutor-fs-7 tutor-color-secondary'>{$question_description}</span></div>";
134 if ( tutor()->has_pro ) {
135 do_action( 'tutor_quiz_question_desc_render', $markup, $question );
136 } else {
137 echo wp_kses_post( $markup );
138 }
139 }
140
141 ?>
142 </div>
143 <!-- Quiz Answer -->
144 <?php
145 if ( array_key_exists( $question_type, $choice_contexts ) ) {
146 // Only checkbox and radio type content will be loaded here.
147 $choice_type = $choice_contexts[ $question_type ];
148 require 'choice-box.php';
149 }
150
151 // Fill In The Blank.
152 if ( 'fill_in_the_blank' === $question_type ) {
153 require 'fill-in-the-blank.php';
154 }
155
156 // Ordering.
157 if ( 'ordering' === $question_type ) {
158 require 'ordering.php';
159 }
160
161
162 // Matching.
163 if ( 'matching' === $question_type ) {
164 $is_image_matching = isset( $question_settings['is_image_matching'] ) && '1' === $question_settings['is_image_matching'];
165 if ( $is_image_matching ) {
166 require 'image-matching.php';
167 } else {
168 require 'matching.php';
169 }
170 }
171
172 // Image Matching.
173 if ( 'image_matching' === $question_type ) {
174 require 'image-matching.php';
175 }
176
177 // Image Answer.
178 if ( 'image_answering' === $question_type ) {
179 require 'image-answer.php';
180 }
181
182 // Open Ended.
183 if ( 'open_ended' === $question_type ) {
184 require 'open-ended.php';
185 }
186
187 // Short Answer.
188 if ( 'short_answer' === $question_type ) {
189 require 'short-answer.php';
190 }
191
192 do_action( 'tutor_require_question_answer_file', $question_type, $is_started_quiz, $question );
193 ?>
194
195 <div class="answer-help-block tutor-mt-24"></div>
196
197 <?php do_action( 'tutor_quiz_question_after_answers', $post, $quiz_details, $question ); ?>
198
199 <?php if ( 'question_below_each_other' !== $question_layout_view ) : ?>
200 <div class="tutor-quiz-btn-group tutor-mt-60 tutor-d-flex">
201 <?php
202 if ( $show_previous_button && $previous_question ) {
203 ?>
204 <button type="button" class="tutor-btn tutor-btn-outline-primary tutor-btn-md tutor-quiz-answer-previous-btn tutor-mr-20">
205 <span class="tutor-icon-previous tutor-mr-8" aria-hidden="true"></span> <?php esc_html_e( 'Back', 'tutor' ); ?>
206 </button>
207 <?php
208 }
209 ?>
210 <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'; ?>">
211 <?php $next_question ? esc_html_e( 'Submit &amp; Next', 'tutor' ) : esc_html_e( 'Submit Quiz', 'tutor' ); ?>
212 </button>
213 <?php if ( ! isset( $question_settings['answer_required'] ) || '0' === $question_settings['answer_required'] ) : ?>
214 <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">
215 <?php esc_html_e( 'Skip Question', 'tutor' ); ?>
216 </span>
217 <?php endif; ?>
218 </div>
219 <?php endif; ?>
220 </div>
221 <?php
222 }
223
224 if ( 'question_below_each_other' === $question_layout_view ) {
225 ?>
226 <div class="quiz-answer-footer-bar tutor-mt-60">
227 <div class="quiz-footer-button">
228 <button type="submit" name="quiz_answer_submit_btn" value="quiz_answer_submit" class="tutor-btn tutor-btn-primary">
229 <?php esc_html_e( 'Submit Quiz', 'tutor' ); ?>
230 </button>
231 </div>
232 </div>
233 <?php
234 }
235 ?>
236 </form>
237 </div>
238