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.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-table.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-table.php
244 lines
1 <?php
2 extract( $data ); // $attempt_list, $context;
3
4 $page_key = 'attempt-table';
5 $table_columns = include __DIR__ . '/contexts.php';
6
7 if ( $context == 'course-single-previous-attempts' && is_array( $attempt_list ) && count( $attempt_list ) ) {
8 // Provide the attempt data from the first attempt
9 // For now now attempt specific data is shown, that's why no problem if we take meta data from any atttempt.
10 $attempt_data = $attempt_list[0];
11 include __DIR__ . '/header.php';
12 }
13 ?>
14
15 <div class="tutor-table-wrapper tutor-my-24">
16 <table class="tutor-table tutor-table-responsive my-quiz-attempts">
17 <?php if ( is_array( $attempt_list ) && count( $attempt_list ) ) { ?>
18 <thead>
19 <tr>
20 <?php
21 foreach ( $table_columns as $key => $column ) {
22 echo '<th>
23 <div class="tutor-fs-7 tutor-color-secondary">
24 ' . $column . '
25 </div>
26 </th>';
27 }
28 ?>
29 </tr>
30 </thead>
31 <?php } ?>
32 <tbody>
33 <?php
34 if ( is_array( $attempt_list ) && count( $attempt_list ) ) {
35 foreach ( $attempt_list as $attempt ) {
36 $attempt_action = tutor_utils()->get_tutor_dashboard_page_permalink( 'my-quiz-attempts/attempts-details/?attempt_id=' . $attempt->attempt_id );
37 $earned_percentage = $attempt->earned_marks > 0 ? ( number_format( ( $attempt->earned_marks * 100 ) / $attempt->total_marks ) ) : 0;
38 $answers = tutor_utils()->get_quiz_answers_by_attempt_id( $attempt->attempt_id );
39
40 $attempt_info = @unserialize($attempt->attempt_info);
41 $attempt_info = !is_array($attempt_info) ? array() : $attempt_info;
42 $passing_grade = isset($attempt_info['passing_grade']) ? (int)$attempt_info['passing_grade'] : 0;
43
44 $ans_array = is_array($answers) ? $answers : array();
45 $has_pending = count(array_filter($ans_array, function($ans){
46 return $ans->is_correct===null;
47 }));
48
49 $correct = 0;
50 $incorrect = 0;
51 if ( is_array( $answers ) && count( $answers ) > 0 ) {
52 foreach ( $answers as $answer ) {
53 if ( (bool) $answer->is_correct ) {
54 $correct++;
55 } else if(!($answer->is_correct===null)) {
56 $incorrect++;
57 }
58 }
59 }
60 ?>
61 <tr>
62 <?php
63 foreach ( $table_columns as $key => $column ) {
64 switch ( $key ) {
65 case 'checkbox':
66 ?>
67 <td data-th="<?php _e( 'Mark', 'tutor' ); ?>" class="v-align-top">
68 <div class="td-checkbox tutor-d-flex ">
69 <input id="tutor-admin-list-<?php echo $attempt->attempt_id; ?>" type="checkbox" class="tutor-form-check-input tutor-bulk-checkbox" name="tutor-bulk-checkbox-all" value="<?php echo $attempt->attempt_id; ?>" />
70 </div>
71 </td>
72 <?php
73 break;
74
75 case 'date':
76 ?>
77 <td data-th="<?php echo $column; ?>">
78 <div class="td-statement-info">
79 <span class="tutor-fs-7 tutor-color-black">
80 <?php echo date_i18n( get_option( 'date_format' ) . ' ' . get_option( 'time_format' ), strtotime( $attempt->attempt_ended_at ) ); ?>
81 </span>
82 </div>
83 </td>
84 <?php
85 break;
86
87 case 'quiz_info':
88 ?>
89 <td data-th="<?php echo $column; ?>">
90 <div class="td-statement-info">
91 <span class="tutor-fs-7 tutor-color-black">
92 <?php echo date_i18n( get_option( 'date_format' ) . ' ' . get_option( 'time_format' ), strtotime( $attempt->attempt_ended_at ) ); ?>
93 </span>
94 <div class="tutor-fs-6 tutor-fw-medium tutor-color-black tutor-margin-0">
95 <div class="tutor-fs-6 tutor-fw-medium tutor-color-black" data-href="<?php echo get_the_permalink( $attempt->course_id ); ?>">
96 <?php echo get_the_title( $attempt->course_id ); ?>
97 </div>
98 <?php
99 $attempt_user = get_userdata( $attempt->user_id );
100 $user_name = $attempt_user ? $attempt_user->display_name : '';
101 if ( $context == 'backend-dashboard-students-attempts' ) {
102 $attempt_user = get_userdata( $attempt->user_id );
103 $user_name = $attempt_user ? $attempt_user->display_name : '';
104
105 ?>
106 <div>
107 <span class="tutor-fs-7 tutor-color-secondary">
108 <?php _e( 'Student', 'tutor' ); ?>
109 </span>: <span class="tutor-fs-7 tutor-fw-medium"> <?php echo $user_name; ?> </span>
110 </div>
111 <?php
112 } else {
113 ?>
114 <?php if(!empty($user_name) && isset( $attempt->user_email ) ) : ?>
115 <span class="tutor-fs-7 tutor-color-secondary"><?php esc_html_e( 'Student', 'tutor' ); ?>: </span>
116 <span class="tutor-color-secondary tutor-fs-8 tutor-fw-medium" title="<?php echo esc_attr( $attempt->user_email ); ?>">
117 <?php echo esc_attr( isset($attempt->display_name) ? $attempt->display_name : $user_name ); ?>
118 </span>
119
120 <?php endif;
121 }
122 ?>
123 </div>
124 <?php do_action( 'tutor_quiz/table/after/course_title', $attempt, $context ); ?>
125 </div>
126 </div>
127 </td>
128 <?php
129 break;
130
131 case 'course':
132 ?>
133 <td data-th="<?php echo $column; ?>">
134 <span class="tutor-fs-7 tutor-fw-medium tutor-color-black">
135 <?php echo get_the_title( $attempt->course_id ); ?>
136 </span>
137 </td>
138 <?php
139 break;
140
141 case 'question':
142 ?>
143 <td data-th="<?php echo $column; ?>">
144 <span class="tutor-fs-7 tutor-fw-medium tutor-color-black">
145 <?php echo count( $answers ); ?>
146 </span>
147 </td>
148 <?php
149 break;
150
151 case 'total_marks':
152 ?>
153 <td data-th="<?php echo $column; ?>">
154 <span class="tutor-fs-7 tutor-fw-medium tutor-color-black">
155 <?php echo round($attempt->total_marks); ?>
156 </span>
157 </td>
158 <?php
159 break;
160
161 case 'correct_answer':
162 ?>
163 <td data-th="<?php echo $column; ?>">
164 <span class="tutor-fs-7 tutor-fw-medium tutor-color-black">
165 <?php echo $correct; ?>
166 </span>
167 </td>
168 <?php
169 break;
170
171 case 'incorrect_answer':
172 ?>
173 <td data-th="<?php echo $column; ?>">
174 <span class="tutor-fs-7 tutor-fw-medium tutor-color-black">
175 <?php echo $incorrect; ?>
176 </span>
177 </td>
178 <?php
179 break;
180
181 case 'earned_marks':
182 ?>
183 <td data-th="<?php echo $column; ?>">
184 <span class="tutor-fs-7 tutor-fw-medium tutor-color-black">
185 <?php echo round($attempt->earned_marks) . ' (' . $earned_percentage . '% )'; ?>
186 </span>
187 </td>
188 <?php
189 break;
190
191 case 'result':
192 ?>
193 <td data-th="<?php echo $column; ?>">
194 <?php
195 if($has_pending){
196 echo '<span class="tutor-badge-label label-warning">'.__('Pending', 'tutor').'</span>';
197 } else {
198 echo $earned_percentage >= $passing_grade ?
199 '<span class="tutor-badge-label label-success">' . __( 'Pass', 'tutor' ) . '</span>' :
200 '<span class="tutor-badge-label label-danger">' . __( 'Fail', 'tutor' ) . '</span>';
201 }
202 ?>
203 </td>
204 <?php
205 break;
206
207 case 'details':
208 $url = add_query_arg( array( 'view_quiz_attempt_id' => $attempt->attempt_id ), tutor()->current_url );
209 ?>
210 <td data-th="See Details">
211 <div class="tutor-d-inline-flex tutor-align-center td-action-btns">
212 <a href="<?php echo $url; ?>" class="tutor-btn tutor-btn-outline-primary tutor-btn-sm">
213 <?php
214 if ( $has_pending && ( $context == 'frontend-dashboard-students-attempts' || $context == 'backend-dashboard-students-attempts' ) ) {
215 esc_html_e( 'Review', 'tutor' );
216 } else {
217 esc_html_e( 'Details', 'tutor-pro' );
218 }
219 ?>
220 </a>
221 </div>
222 </td>
223 <?php
224 break;
225 }
226 }
227 ?>
228 </tr>
229 <?php
230 }
231 } else {
232 ?>
233 <tr>
234 <td colspan="100%" class="column-empty-state">
235 <?php tutor_utils()->tutor_empty_state( tutor_utils()->not_found_text() ); ?>
236 </td>
237 </tr>
238 <?php
239 }
240 ?>
241 </tbody>
242 </table>
243 </div>
244