PluginProbe ʕ •ᴥ•ʔ
Tutor LMS – eLearning and online course solution / 2.0.5
Tutor LMS – eLearning and online course solution v2.0.5
4.0.1 4.0.0 3.9.15 3.9.14 3.9.13 3.9.12 3.9.11 trunk 1.0.0 1.0.0-alpha 1.0.1 1.0.2 1.0.3 1.0.4 1.0.5 1.0.6 1.0.7 1.0.8 1.0.9 1.1.0 1.1.1 1.2.0 1.2.1 1.2.11 1.2.12 1.2.13 1.2.20 1.3.0 1.3.1 1.3.2 1.3.3 1.3.4 1.3.5 1.3.6 1.3.7 1.3.8 1.3.9 1.4.0 1.4.1 1.4.2 1.4.3 1.4.4 1.4.5 1.4.6 1.4.7 1.4.8 1.4.9 1.5.0 1.5.1 1.5.2 1.5.3 1.5.4 1.5.5 1.5.6 1.5.7 1.5.8 1.5.9 1.6.0 1.6.1 1.6.2 1.6.3 1.6.4 1.6.5 1.6.6 1.6.7 1.6.8 1.6.9 1.7.0 1.7.1 1.7.2 1.7.3 1.7.4 1.7.5 1.7.6 1.7.7 1.7.8 1.7.9 1.8.0 1.8.1 1.8.10 1.8.2 1.8.3 1.8.4 1.8.5 1.8.6 1.8.7 1.8.8 1.8.9 1.9.0 1.9.1 1.9.10 1.9.11 1.9.12 1.9.13 1.9.14 1.9.15 1.9.16 1.9.2 1.9.3 1.9.4 1.9.5 1.9.6 1.9.7 1.9.8 1.9.9 2.0.0 2.0.1 2.0.10 2.0.2 2.0.3 2.0.4 2.0.5 2.0.6 2.0.7 2.0.8 2.0.9 2.1.0 2.1.1 2.1.10 2.1.2 2.1.3 2.1.4 2.1.5 2.1.6 2.1.7 2.1.8 2.1.9 2.2.0 2.2.1 2.2.2 2.2.3 2.2.4 2.3.0 2.4.0 2.5.0 2.6.0 2.6.1 2.6.2 2.7.0 2.7.1 2.7.2 2.7.3 2.7.4 2.7.5 2.7.6 2.7.7 3.0.0 3.0.1 3.0.2 3.1.0 3.2.0 3.2.1 3.2.2 3.2.3 3.3.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 / views / quiz / attempt-details.php
tutor / views / quiz Last commit date
header-context 4 years ago attempt-details.php 4 years ago attempt-table.php 4 years ago contexts.php 4 years ago header.php 4 years ago instructor-feedback.php 4 years ago
attempt-details.php
655 lines
1 <?php
2
3 if ( ! defined( 'ABSPATH' ) ){
4 exit;
5 }
6 extract($data); // $user_id, $attempt_id, $attempt_data(nullable), $context(nullable)
7
8 !isset($attempt_data) ? $attempt_data = tutor_utils()->get_attempt($attempt_id) : 0;
9 !isset($context) ? $context=null : 0;
10
11 if (!$attempt_id || !$attempt_data || $user_id!=$attempt_data->user_id){
12 echo '<p>'.__('Attempt not found or access permission denied', 'tutor').'</p>';
13 return;
14 }
15
16 if ( isset( $user_id ) && $user_id > 0 ) {
17 $user = get_userdata( $user_id );
18 if ( ! $user ) {
19 return;
20 }
21 }
22
23 function tutor_render_answer_list( $answers= array(), $dump_data=false ){
24 if(!empty($answers)){
25
26 echo '<div class="correct-answer-wrap">';
27
28 $multi_texts = array();
29 foreach ($answers as $key => $ans) {
30 $type = isset($ans->answer_view_format) ? $ans->answer_view_format : 'text_image';
31
32 if (isset($ans->answer_two_gap_match)) {
33 echo '<div class="matching-type">';
34 }
35
36 switch ($type) {
37 case 'text_image':
38 echo '<div class="text-image-type tutor-mb-4">';
39 if(isset($ans->image_id)){
40 $img_url = wp_get_attachment_image_url($ans->image_id);
41 if($img_url){
42 echo '<span class="image"><img src="'.$img_url.'" /></span>';
43 }
44 }
45 if(isset($ans->answer_title)) {
46 echo '<span class="caption">'.stripslashes($ans->answer_title).'</span>';
47 }
48 echo '</div>';
49 break;
50
51 case 'text':
52 $ans_string = '<span class="tutor-fs-7 tutor-fw-medium tutor-color-black">'
53 .esc_html( $ans->answer_title ).
54 '</span>';
55
56 if(isset($ans->answer_title) && !isset($ans->answer_two_gap_match)) {
57 $multi_texts[$ans->answer_title] = $ans_string;
58 } else {
59 echo $ans_string;
60 }
61 break;
62
63 case 'image':
64 echo '<div class="image-type">';
65 if(isset($ans->image_id)){
66 $img_url = wp_get_attachment_image_url($ans->image_id);
67 if($img_url){
68 echo '<span class="image"><img src="'.$img_url.'" />'.'</span>';
69 }
70 }
71 echo '</div>';
72 break;
73 }
74
75
76 if (isset($ans->answer_two_gap_match)) {
77 // echo '<div class="matching-separator">&nbsp;-&nbsp;</div>';
78 echo '<div class="image-match">'.stripslashes($ans->answer_two_gap_match).'</div>';
79 echo '</div>';
80 }
81 }
82 echo count($multi_texts) ? implode(', ', $multi_texts) : '';
83
84 echo '</div>';
85 }
86 }
87
88 function tutor_render_fill_in_the_blank_answer($get_db_answers_by_question, $answer_titles) {
89
90 $spaces = '&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;';
91
92 // Loop through the answers
93 foreach ($get_db_answers_by_question as $db_answer){
94 $count_dash_fields = substr_count($db_answer->answer_title, '{dash}');
95
96 if ($count_dash_fields){
97 $dash_string = array();
98 $input_data = array();
99 for($i=0; $i<$count_dash_fields; $i++){
100 $ans_title = (!empty($answer_titles[$i]) && !ctype_space($answer_titles[$i])) ? $answer_titles[$i] : null;
101 $input_data[] = $ans_title ? "<span class='filled_dash_unser'>{$ans_title}</span>" : $spaces;
102 }
103
104 $answer_title = $db_answer->answer_title;
105
106 foreach($input_data as $index=>$replace){
107 $replace = '<span style="text-decoration:underline;">'.$replace.'</span>';
108 $answer_title = preg_replace('/{dash}/i', $replace, $answer_title, 1);
109 }
110 echo str_replace('{dash}', "<span class='filled_dash_unser'>{$spaces}</span>", stripslashes($answer_title));
111 }
112 }
113 }
114
115 // Prepare student data
116 if(!isset($user_data)) {
117 $user_data = get_userdata( $user_id );
118 }
119
120 // Prepare atttempt meta info
121 extract(tutor_utils()->get_quiz_attempt_timing($attempt_data)); // $attempt_duration, $attempt_duration_taken;
122
123 // Prepare the correct/incorrect answer count for the first summary table
124 $answers = tutor_utils()->get_quiz_answers_by_attempt_id($attempt_id);
125 $correct = 0;
126 $incorrect = 0;
127 if(is_array($answers) && count($answers) > 0) {
128 foreach ($answers as $answer){
129 if ( (bool) isset( $answer->is_correct ) ? $answer->is_correct : '' ) {
130 $correct++;
131 } else {
132 if ($answer->question_type === 'open_ended' || $answer->question_type === 'short_answer'){
133 } else {
134 $incorrect++;
135 }
136 }
137 }
138 }
139
140 // Prepare the column list for the first summary table
141 $page_key ='attempt-details-summary';
142 $table_1_columns = include __DIR__ . '/contexts.php';
143
144 // Prepare the column list for the second table (eery single answer list)
145 $page_key = 'attempt-details-answers';
146 $table_2_columns = include __DIR__ . '/contexts.php';
147
148 include __DIR__ . '/header.php';
149
150 $attempt_info = @unserialize( $attempt_data->attempt_info );
151
152 if ( is_array( $attempt_info ) ) {
153 $attempt_type = '';
154 // Allowed duration
155 if ( isset( $attempt_info['time_limit'] ) ) {
156 $attempt_duration = tutor_utils()->second_to_formated_time( $attempt_info['time_limit']['time_limit_seconds'], $attempt_info['time_limit']['time_type'] );
157 }
158 if ( 'days' == $attempt_info['time_limit']['time_type'] ) {
159 $attempt_type = 'hours';
160 }
161 if ( 'hours' == $attempt_info['time_limit']['time_type'] ) {
162 $attempt_type = 'minutes';
163 }
164 if ( 'minutes' == $attempt_info['time_limit']['time_type'] ) {
165 $attempt_type = 'minutes';
166 }
167
168 // Taken duration
169 $seconds = strtotime( $attempt_data->attempt_ended_at ) - strtotime( $attempt_data->attempt_started_at );
170 $attempt_duration_taken = tutor_utils()->second_to_formated_time( $seconds, $attempt_type );
171 }
172 ?>
173
174 <?php echo is_admin() ? '<div class="tutor-admin-body">' : ''; ?>
175 <div class="tutor-table-responsive tutor-mb-32">
176 <table class="tutor-table my-quiz-attempts">
177 <thead>
178 <tr>
179 <?php foreach($table_1_columns as $key => $column) : ?>
180 <th><?php echo $column; ?></th>
181 <?php endforeach; ?>
182 </tr>
183 </thead>
184
185 <tbody>
186 <tr>
187 <?php foreach( $table_1_columns as $key => $column ) : ?>
188 <td>
189 <?php if ( $key == 'user' ) : ?>
190 <div class="tutor-d-flex tutor-align-center">
191 <?php echo tutor_utils()->get_tutor_avatar( $user_id ); ?>
192 <div class="tutor-ml-16">
193 <div>
194 <?php echo $user_data ? $user_data->display_name : ''; ?>
195 </div>
196 <a href="<?php echo esc_url( tutor_utils()->profile_url($user_id, false) ) ?>" class="tutor-iconic-btn">
197 <span class="tutor-icon-external-link"></span>
198 </a>
199 </div>
200 </div>
201
202 <?php elseif ( $key == 'date' ) : ?>
203 <div>
204 <?php echo date_i18n(get_option('date_format'), strtotime($attempt_data->attempt_started_at)); ?>
205 </div>
206 <div>
207 <?php echo date_i18n(get_option('time_format'), strtotime($attempt_data->attempt_started_at)); ?>
208 </div>
209 <?php elseif ( $key == 'qeustion_count' ) : ?>
210 <?php echo $attempt_data->total_questions; ?>
211 <?php elseif ( $key == 'quiz_time' ) : ?>
212 <?php echo $attempt_duration; ?>
213 <?php elseif ( $key == 'attempt_time' ) : ?>
214 <?php echo $attempt_duration_taken; ?>
215 <?php elseif ( $key == 'total_marks' ) : ?>
216 <?php echo $attempt_data->total_marks; ?>
217 <?php elseif ( $key == 'pass_marks' ) : ?>
218 <?php
219 $pass_marks = ($total_marks * $passing_grade) / 100;
220 echo number_format_i18n($pass_marks, 2);
221
222 $pass_mark_percent = $passing_grade;
223 echo ' ('.$pass_mark_percent.'%)';
224 ?>
225 <?php elseif ( $key == 'correct_answer' ) : ?>
226 <?php echo $correct; ?>
227 <?php elseif ( $key == 'incorrect_answer' ) : ?>
228 <?php echo $incorrect; ?>
229 <?php elseif ( $key == 'earned_marks' ) : ?>
230 <?php
231 echo $attempt_data->earned_marks;
232 $earned_percentage = $attempt_data->earned_marks > 0 ? ( number_format(($attempt_data->earned_marks * 100) / $attempt_data->total_marks)) : 0;
233 echo ' ('.$earned_percentage.'%)';
234 ?>
235 <?php elseif ( $key == 'result' ) : ?>
236 <?php
237 $ans_array = is_array( $answers ) ? $answers : array();
238 $has_pending = count( array_filter( $ans_array, function( $ans ) {
239 return $ans->is_correct === null;
240 }));
241
242 if ( $has_pending ) {
243 echo '<span class="tutor-badge-label label-warning">'.__('Pending', 'tutor').'</span>';
244 } else if ( $earned_percentage >= $pass_mark_percent ) {
245 echo '<span class="tutor-badge-label label-success">'.__('Pass', 'tutor').'</span>';
246 } else {
247 echo '<span class="tutor-badge-label label-danger">'.__('Fail', 'tutor').'</span>';
248 }
249 ?>
250 <?php endif; ?>
251 </td>
252 <?php endforeach; ?>
253 </tr>
254 </tbody>
255 </table>
256 </div>
257
258 <?php
259 // instructor feedback.
260 global $wp_query;
261 $query_vars = $wp_query->query_vars;
262 $page_name = isset( $query_vars['tutor_dashboard_page'] ) ? $query_vars['tutor_dashboard_page'] : '';
263 $attempt_info = unserialize( $attempt_data->attempt_info );
264 $feedback = is_array( $attempt_info ) && isset( $attempt_info['instructor_feedback'] ) ? $attempt_info['instructor_feedback'] : '';
265 // don't show on instructor quiz attempt since below already have feedback box area.
266 if ( '' !== $feedback && 'my-quiz-attempts' === $page_name ) {
267 ?>
268 <div class="tutor-quiz-attempt-note tutor-instructor-note tutor-my-32 tutor-py-20 tutor-px-24 tutor-py-sm-32 tutor-px-sm-36">
269 <div class="tutor-in-title tutor-fs-6 tutor-fw-medium tutor-color-black">
270 <?php esc_html_e( 'Instructor Note', 'tutor' ); ?>
271 </div>
272 <div class="tutor-in-body tutor-fs-6 tutor-color-secondary tutor-pt-12 tutor-pt-sm-16">
273 <?php echo wp_kses_post( $feedback ); ?>
274 </div>
275 </div>
276 <?php } ?>
277
278 <?php
279 if (is_array($answers) && count($answers)){
280 echo $context!='course-single-previous-attempts' ? '<div class="tutor-fs-6 tutor-fw-medium tutor-color-black tutor-mt-24">'.__('Quiz Overview', 'tutor').'</div>' : '';
281 ?>
282 <div class="tutor-table-responsive tutor-mt-16">
283 <table class="tutor-table tutor-quiz-attempt-details tutor-mb-32">
284 <thead>
285 <tr>
286 <?php foreach($table_2_columns as $key => $column) : ?>
287 <th><?php echo $column; ?></th>
288 <?php endforeach; ?>
289 </tr>
290 </thead>
291
292 <tbody>
293 <?php
294 $answer_i = 0;
295 foreach ($answers as $answer){
296 $answer_i++;
297 $question_type = tutor_utils()->get_question_types($answer->question_type);
298
299 $answer_status = 'wrong';
300
301 // If already correct, then show it
302 if ( (bool)$answer->is_correct ) {
303 $answer_status = 'correct';
304 }
305
306 // Image answering also needs review since the answer texts are not meant to match exactly
307 else if (in_array($answer->question_type, array('open_ended', 'short_answer', 'image_answering'))){
308 $answer_status = $answer->is_correct===null ? 'pending' : 'wrong';
309 }
310 ?>
311
312 <tr class="tutor-quiz-answer-status-<?php echo esc_html( $answer_status ); ?>">
313 <?php foreach($table_2_columns as $key => $column): ?>
314 <?php
315 switch($key) {
316 case 'no' :
317 ?>
318 <td class="no">
319 <span class="tutor-fs-7 tutor-fw-medium tutor-color-black">
320 <?php echo $answer_i; ?>
321 </span>
322 </td>
323 <?php
324 break;
325
326 case 'type' :
327 ?>
328 <td class="type">
329 <?php $type = tutor_utils()->get_question_types( $answer->question_type ); ?>
330 <div class="tooltip-wrap tooltip-icon tutor-d-flex">
331 <?php echo $question_type['icon']; ?>
332 <span class="tooltip-txt tooltip-top">
333 <?php echo $type['name']; ?>
334 </span>
335 </div>
336 </td>
337 <?php
338 break;
339
340 case 'questions' :
341 ?>
342 <td class="questions">
343 <span class="tutor-fs-7 tutor-fw-medium tutor-d-flex tutor-align-center">
344 <?php echo stripslashes($answer->question_title); ?>
345 </span>
346 </td>
347 <?php
348 break;
349
350 case 'given_answer' :
351 ?>
352 <td class="given-answer">
353 <?php
354 // Single choice
355 if ( $answer->question_type === 'single_choice' ) {
356 $get_answers = tutor_utils()->get_answer_by_id($answer->given_answer);
357 tutor_render_answer_list($get_answers);
358 }
359
360
361 // True false or single choise
362 if ($answer->question_type === 'true_false'){
363 $get_answers = tutor_utils()->get_answer_by_id($answer->given_answer);
364 $answer_titles = wp_list_pluck($get_answers, 'answer_title');
365 $answer_titles = array_map('stripslashes', $answer_titles);
366
367 echo '<span class="tutor-fs-7 tutor-fw-medium tutor-color-black">'.
368 implode('</p><p>', $answer_titles).
369 '</span>';
370 }
371
372 // Multiple choice
373 elseif ($answer->question_type === 'multiple_choice'){
374 $get_answers = tutor_utils()->get_answer_by_id(maybe_unserialize($answer->given_answer));
375 tutor_render_answer_list($get_answers);
376 }
377
378 // Fill in the blank
379 elseif ($answer->question_type === 'fill_in_the_blank'){
380 $answer_titles = maybe_unserialize($answer->given_answer);
381 $get_db_answers_by_question = tutor_utils()->get_answers_by_quiz_question($answer->question_id);
382
383 echo tutor_render_fill_in_the_blank_answer($get_db_answers_by_question, $answer_titles);
384 }
385
386 // Open ended or short answer
387 elseif ($answer->question_type === 'open_ended' || $answer->question_type === 'short_answer'){
388 if ($answer->given_answer){
389 echo wpautop(stripslashes($answer->given_answer));
390 }
391 }
392
393 // Ordering
394 elseif ($answer->question_type === 'ordering'){
395 $ordering_ids = maybe_unserialize($answer->given_answer);
396 foreach ($ordering_ids as $ordering_id){
397 $get_answers = tutor_utils()->get_answer_by_id($ordering_id);
398 tutor_render_answer_list($get_answers);
399 }
400 }
401
402 // Matching
403 elseif ($answer->question_type === 'matching'){
404
405 $ordering_ids = maybe_unserialize($answer->given_answer);
406 $original_saved_answers = tutor_utils()->get_answers_by_quiz_question($answer->question_id);
407
408 $answers = array();
409
410 foreach ($original_saved_answers as $key => $original_saved_answer){
411 $provided_answer_order_id = isset($ordering_ids[$key]) ? $ordering_ids[$key] : 0;
412 $provided_answer_order = tutor_utils()->get_answer_by_id($provided_answer_order_id);
413 if(tutor_utils()->count($provided_answer_order)){
414 foreach ($provided_answer_order as $provided_answer_order);
415 $original_saved_answer->answer_two_gap_match = $provided_answer_order->answer_two_gap_match;
416 $answers[] = $original_saved_answer;
417 }
418 }
419
420 tutor_render_answer_list( $answers );
421 }
422
423 elseif ($answer->question_type === 'image_matching'){
424
425 $ordering_ids = maybe_unserialize($answer->given_answer);
426 $original_saved_answers = tutor_utils()->get_answers_by_quiz_question($answer->question_id);
427
428 $answers = array();
429
430 foreach ($original_saved_answers as $key => $original_saved_answer){
431 $provided_answer_order_id = isset($ordering_ids[$key]) ? $ordering_ids[$key] : 0;
432 $provided_answer_order = tutor_utils()->get_answer_by_id($provided_answer_order_id);
433 foreach ($provided_answer_order as $provided_answer_order);
434
435 if($provided_answer_order->answer_title) {
436 $original_saved_answer->answer_view_format = 'text_image';
437 $original_saved_answer->answer_title = $provided_answer_order->answer_title;
438 $answers[] = $original_saved_answer;
439 }
440 }
441
442 tutor_render_answer_list( $answers );
443 }
444
445 elseif ($answer->question_type === 'image_answering'){
446
447 $ordering_ids = maybe_unserialize($answer->given_answer);
448
449 $answers = array();
450
451 foreach ($ordering_ids as $answer_id => $image_answer){
452 $db_answers = tutor_utils()->get_answer_by_id($answer_id);
453 foreach ($db_answers as $db_answer);
454 $db_answer->answer_title = $image_answer;
455 $db_answer->answer_view_format = 'text_image';
456 $answers[] = $db_answer;
457
458 }
459
460 tutor_render_answer_list( $answers );
461 }
462 ?>
463 </td>
464 <?php
465 break;
466
467 case 'correct_answer' :
468 ?>
469 <td class="correct-answer">
470 <?php
471 if (($answer->question_type != 'open_ended' && $answer->question_type != 'short_answer')) {
472
473 global $wpdb;
474
475 // True false
476 if ( $answer->question_type === 'true_false' ) {
477 $correct_answer = $wpdb->get_var( $wpdb->prepare(
478 "SELECT answer_title FROM {$wpdb->prefix}tutor_quiz_question_answers
479 WHERE belongs_question_id = %d
480 AND belongs_question_type='true_false'
481 AND is_correct = 1",
482 $answer->question_id
483 ) );
484
485 echo '<span class="tutor-fs-7 tutor-fw-medium tutor-color-black">' .
486 $correct_answer .
487 '</span>';
488 }
489
490 // Single choice
491 elseif ( $answer->question_type === 'single_choice' ) {
492 $correct_answer = $wpdb->get_results( $wpdb->prepare(
493 "SELECT answer_title, image_id, answer_view_format
494 FROM {$wpdb->prefix}tutor_quiz_question_answers
495 WHERE belongs_question_id = %d
496 AND belongs_question_type='single_choice' AND
497 is_correct = 1",
498 $answer->question_id
499 ) );
500
501 tutor_render_answer_list($correct_answer);
502 }
503
504 // Multiple choice
505 elseif ( $answer->question_type === 'multiple_choice' ) {
506 $correct_answer = $wpdb->get_results( $wpdb->prepare(
507 "SELECT answer_title, image_id, answer_view_format
508 FROM {$wpdb->prefix}tutor_quiz_question_answers
509 WHERE belongs_question_id = %d
510 AND belongs_question_type='multiple_choice'
511 AND is_correct = 1 ;",
512 $answer->question_id
513 ) );
514
515 tutor_render_answer_list($correct_answer);
516 }
517
518 // Fill in the blanks
519 elseif ( $answer->question_type === 'fill_in_the_blank' ) {
520 $correct_answer = $wpdb->get_var( $wpdb->prepare(
521 "SELECT answer_two_gap_match FROM {$wpdb->prefix}tutor_quiz_question_answers
522 WHERE belongs_question_id = %d
523 AND belongs_question_type='fill_in_the_blank'",
524 $answer->question_id
525 ) );
526
527 $answer_titles = explode('|', stripslashes($correct_answer));
528 $get_db_answers_by_question = tutor_utils()->get_answers_by_quiz_question($answer->question_id);
529
530 echo tutor_render_fill_in_the_blank_answer($get_db_answers_by_question, $answer_titles);
531 }
532
533 // Ordering
534 elseif ( $answer->question_type === 'ordering' ) {
535 $correct_answer = $wpdb->get_results( $wpdb->prepare(
536 "SELECT answer_title, image_id, answer_view_format
537 FROM {$wpdb->prefix}tutor_quiz_question_answers
538 WHERE belongs_question_id = %d
539 AND belongs_question_type='ordering'
540 ORDER BY answer_order ASC;",
541 $answer->question_id
542 ) );
543
544 foreach($correct_answer as $ans) {
545 tutor_render_answer_list(array($ans));
546 }
547 }
548
549 // Matching
550 elseif( $answer->question_type === 'matching' ){
551 $correct_answer = $wpdb->get_results( $wpdb->prepare(
552 "SELECT answer_title, image_id, answer_two_gap_match, answer_view_format
553 FROM {$wpdb->prefix}tutor_quiz_question_answers
554 WHERE belongs_question_id = %d
555 AND belongs_question_type='matching'
556 ORDER BY answer_order ASC;",
557 $answer->question_id
558 ) );
559
560 tutor_render_answer_list($correct_answer);
561 }
562
563 // Image matching
564 elseif( $answer->question_type === 'image_matching' ) {
565 $correct_answer = $wpdb->get_results( $wpdb->prepare(
566 "SELECT answer_title, image_id, answer_two_gap_match
567 FROM {$wpdb->prefix}tutor_quiz_question_answers
568 WHERE belongs_question_id = %d
569 AND belongs_question_type='image_matching'
570 ORDER BY answer_order ASC;",
571 $answer->question_id
572 ) );
573
574 tutor_render_answer_list($correct_answer, true);
575 }
576
577 // Image Answering
578 elseif ($answer->question_type === 'image_answering'){
579
580 $correct_answer = $wpdb->get_results( $wpdb->prepare(
581 "SELECT answer_title, image_id, answer_two_gap_match
582 FROM {$wpdb->prefix}tutor_quiz_question_answers
583 WHERE belongs_question_id = %d
584 AND belongs_question_type='image_answering'
585 ORDER BY answer_order ASC;",
586 $answer->question_id
587 ) );
588
589 !is_array($correct_answer) ? $correct_answer=array() : 0;
590
591 echo '<div class="answer-image-matched-wrap">';
592 foreach ($correct_answer as $image_answer){
593 ?>
594 <div class="image-matching-item">
595 <p class="dragged-img-rap"><img src="<?php echo wp_get_attachment_image_url( $image_answer->image_id); ?>" /> </p>
596 <p class="dragged-caption"><?php echo $image_answer->answer_title; ?></p>
597 </div>
598 <?php
599 }
600 echo '</div>';
601 }
602 }
603 ?>
604 </td>
605 <?php
606 break;
607
608 case 'answer' :
609 ?>
610 <td class="answer">
611 <?php
612 switch($answer_status) {
613 case 'correct' :
614 echo '<span class="tutor-badge-label label-success">'.__('Correct', 'tutor').'</span>';
615 break;
616
617 case 'pending' :
618 echo '<span class="tutor-badge-label label-warning">'.__('Pending', 'tutor').'</span>';
619 break;
620
621 case 'wrong' :
622 echo '<span class="tutor-badge-label label-danger">'.__('Incorrect', 'tutor').'</span>';
623 break;
624 }
625 ?>
626 </td>
627 <?php
628 break;
629
630 case 'manual_review' :
631 ?>
632 <td class="tutor-text-center tutor-nowrap-ellipsis">
633 <a href="javascript:;" data-back-url="<?php echo $back_url; ?>" data-attempt-id="<?php echo $attempt_id; ?>" data-attempt-answer-id="<?php echo $answer->attempt_answer_id; ?>" data-mark-as="correct" data-context="<?php echo $context; ?>" title="<?php _e('Mark as correct', 'tutor'); ?>" class="quiz-manual-review-action tutor-mr-12 tutor-icon-rounded tutor-color-success">
634 <i class="tutor-icon-mark"></i>
635 </a>
636 <a href="javascript:;" data-back-url="<?php echo $back_url; ?>" data-attempt-id="<?php echo $attempt_id; ?>" data-attempt-answer-id="<?php echo $answer->attempt_answer_id; ?>" data-mark-as="incorrect" data-context="<?php echo $context; ?>" title="<?php _e('Mark as In correct', 'tutor'); ?>" class="quiz-manual-review-action tutor-icon-rounded tutor-color-danger">
637 <i class="tutor-icon-times"></i>
638 </a>
639 </td>
640 <?php
641 }
642 ?>
643 <?php endforeach; ?>
644 </tr>
645 <?php
646 }
647 ?>
648 </tbody>
649 </table>
650 </div>
651 <?php
652 }
653 ?>
654
655 <?php echo is_admin() ? '</div>' : ''; ?>