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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 / student-quiz-attempt-row.php
tutor / templates / shared / components Last commit date
quiz 2 days ago student-quiz-attempt-row.php 5 days ago
student-quiz-attempt-row.php
156 lines
1 <?php
2 /**
3 * Tutor dashboard quiz attempt row.
4 * Reusable component for displaying a single quiz attempt row.
5 *
6 * @package Tutor\Templates
7 * @author Themeum <support@themeum.com>
8 * @link https://themeum.com
9 * @since 4.0.0
10 */
11
12 defined( 'ABSPATH' ) || exit;
13
14 use TUTOR\Icon;
15 use TUTOR\Quiz_Attempts_List;
16 use Tutor\Components\SvgIcon;
17 use Tutor\Components\PreviewTrigger;
18 use Tutor\Components\Constants\Color;
19
20 if ( empty( $attempt ) ) {
21 return;
22 }
23
24 $show_quiz_title = $show_quiz_title ?? false;
25 $show_course = $show_course ?? false;
26 $attempt_number = $attempt_number ?? null;
27 $attempts_count = $attempts_count ?? 0;
28 $is_previous = $is_previous ?? false;
29 $is_learning_area = $is_learning_area ?? false;
30 $details_url = $quiz_attempt_obj->get_review_url(
31 $attempt,
32 array( 'action' => 'view_details' )
33 ) ?? '#';
34
35 $hide_quiz_details = Quiz_Attempts_List::is_attempt_details_hidden();
36
37 ?>
38 <div class="tutor-quiz-attempts-item" data-learning-area="<?php echo esc_attr( $is_learning_area ? 'true' : 'false' ); ?>">
39 <div class="tutor-quiz-item-info">
40 <?php
41 if ( $show_quiz_title && ! empty( $quiz_title ) ) :
42 ?>
43 <div class="tutor-quiz-item-info-expanded">
44 <?php if ( $hide_quiz_details ) : ?>
45 <div class="tutor-medium tutor-font-semibold tutor-text-start">
46 <?php echo esc_html( $quiz_title ); ?>
47 </div>
48 <?php else : ?>
49 <a href="<?php echo esc_url( $details_url ); ?>" class="tutor-quiz-item-info-title">
50 <?php echo esc_html( $quiz_title ); ?>
51 </a>
52 <?php endif; ?>
53 <?php if ( $attempts_count > 1 ) : ?>
54 <button @click="expanded = !expanded" class="tutor-quiz-attempts-expand-btn">
55 <?php
56 printf(
57 /* translators: %d: number of attempts */
58 esc_html__( '%d Attempts', 'tutor' ),
59 esc_attr( $attempts_count )
60 );
61 ?>
62 <span class="tutor-quiz-attempts-expand-icon">
63 <?php SvgIcon::make()->name( Icon::CHEVRON_DOWN )->size( 18 )->render(); ?>
64 </span>
65 </button>
66 <?php endif; ?>
67 </div>
68 <?php endif; ?>
69
70 <?php if ( $attempt_number ) : ?>
71 <div class="tutor-flex tutor-items-start tutor-justify-start tutor-gap-4">
72 <?php if ( $hide_quiz_details ) : ?>
73 <div class="tutor-medium tutor-font-semibold">
74 <?php
75 /* translators: %d: attempt number */
76 echo esc_html( sprintf( __( 'Attempt %d', 'tutor' ), $attempt_number ) );
77 ?>
78 </div>
79 <?php else : ?>
80 <a href="<?php echo esc_url( $details_url ); ?>" class="tutor-quiz-item-info-title">
81 <?php
82 /* translators: %d: attempt number */
83 echo esc_html( sprintf( __( 'Attempt %d', 'tutor' ), $attempt_number ) );
84 ?>
85 </a>
86 <?php endif; ?>
87 </div>
88 <?php endif; ?>
89
90 <?php if ( ! $is_previous ) : ?>
91 <div class="tutor-quiz-item-info-course">
92 <?php esc_html_e( 'Course:', 'tutor' ); ?>
93 <?php
94 PreviewTrigger::make()
95 ->id( $course_id ?? 0 )
96 ->render()
97 ?>
98 </div>
99 <?php endif; ?>
100
101 <div class="tutor-quiz-item-info-date">
102 <?php
103 echo $is_learning_area && ! $hide_quiz_details
104 ? '<a href="' . esc_url( $details_url ) . '">' . esc_html( $attempt['date'] ?? '' ) . '</a>'
105 : esc_html( $attempt['date'] ?? '' );
106 ?>
107 </div>
108 </div>
109
110 <div class="tutor-quiz-item-marks">
111 <?php Quiz_Attempts_List::render_quiz_attempt_marks_percentage( $attempt['result'], $attempt['marks_percent'] ); ?>
112 <div class="tutor-quiz-marks-breakdown">
113 <div class="tutor-quiz-marks-correct">
114 <?php
115 /* translators: %d: number of correct answers */
116 echo esc_html( sprintf( __( '%d correct', 'tutor' ), $attempt['correct_answers'] ?? 0 ) );
117 ?>
118 </div>
119 <div class="tutor-quiz-marks-incorrect">
120 <?php
121 /* translators: %d: number of incorrect answers */
122 echo esc_html( sprintf( __( '%d incorrect', 'tutor' ), $attempt['incorrect_answers'] ?? 0 ) );
123 ?>
124 </div>
125 </div>
126 </div>
127
128 <div class="tutor-quiz-item-time">
129 <?php SvgIcon::make()->name( Icon::STOPWATCH )->size( 20 )->color( Color::SECONDARY )->render(); ?>
130 <?php echo esc_html( $attempt['time_taken'] ?? '' ); ?>
131 </div>
132
133 <div class="tutor-quiz-item-result">
134 <?php
135 $quiz_attempt_obj->render_quiz_attempt_list_badge( $attempt );
136 $quiz_attempt_obj->render_student_attempt_popover( $attempt, $attempts_count, $quiz_id, $is_learning_area );
137 ?>
138 </div>
139 <?php if ( $attempts_count > 1 ) : ?>
140 <div class="tutor-quiz-item-actions" x-show="expanded" x-cloak>
141 <?php
142 $quiz_attempt_obj->render_details_button( $attempt );
143 $quiz_attempt_obj->render_student_attempt_popover( $attempt, $attempts_count, $quiz_id, false, false );
144 ?>
145 </div>
146 <?php endif; ?>
147
148 <?php if ( $attempt_number && $is_previous ) : ?>
149 <div class="tutor-quiz-item-actions" x-show="expanded" x-cloak>
150 <?php
151 $quiz_attempt_obj->render_details_button( $attempt );
152 ?>
153 </div>
154 <?php endif; ?>
155 </div>
156