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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 / views / pages / view_attempt.php
tutor / views / pages Last commit date
addons.php 7 years ago answer.php 7 years ago enable_disable_addons.php 7 years ago get-pro.php 7 years ago instructors.php 7 years ago question_answer.php 7 years ago quiz_attempts.php 7 years ago status.php 7 years ago students.php 7 years ago uninstall.php 7 years ago view_attempt.php 7 years ago
view_attempt.php
268 lines
1 <?php
2 $attempt_id = (int) sanitize_text_field($_GET['attempt_id']);
3 $attempt = tutor_utils()->get_attempt($attempt_id);
4
5 if ( ! $attempt){
6 ?>
7
8 <h1><?php _e('Attempt not found', 'tutor'); ?></h1>
9
10 <?php
11 return;
12 }
13
14 $quiz_attempt_info = tutor_utils()->quiz_attempt_info($attempt->attempt_info);
15 $answers = tutor_utils()->get_quiz_answers_by_attempt_id($attempt->attempt_id);
16 ?>
17
18 <div class="wrap">
19 <h2><?php _e('View Attempts', 'tutor'); ?></h2>
20
21 <div class="tutor-quiz-attempt-info-row">
22 <div class="tutor-attempt-student-info">
23 <?php
24 $user_id = tutor_utils()->avalue_dot('user_id', $attempt);
25 $user = get_userdata($user_id);
26 ?>
27
28 <p class="quiz-attempt-info-row">
29 <?php echo '<span class="attempt-property-name">'.__('Attempt By', 'tutor').' </span><span> : '. $user->display_name.'</span>'; ?>
30 </p>
31
32 <p class="quiz-attempt-info-row">
33 <?php echo '<span class="attempt-property-name">'.__('Attempt At', 'tutor').'</span> <span> : '. date_i18n(get_option('date_format'), strtotime($attempt->attempt_started_at)).' '.date_i18n(get_option('time_format'), strtotime($attempt->attempt_started_at)).'</span>'; ?>
34 </p>
35
36 <p class="quiz-attempt-info-row">
37 <span class="attempt-property-name">
38 <?php echo __('Status', 'tutor'); ?>
39 </span>
40
41 <span class="attempt-property-value"> :
42 <?php
43 $status = ucwords(str_replace('quiz_', '', $attempt->attempt_status));
44 echo "<span class='tutor-status-context {$attempt->attempt_status}'>{$status}</span>";
45 ?>
46 </span>
47 </p>
48
49 <?php if ((bool) $attempt->is_manually_reviewed ){
50 ?>
51 <p class="quiz-attempt-info-row text-notified">
52 <span class="attempt-property-name"><?php _e('Manually reviewed at', 'tutor'); ?></span>
53
54 <span class="attempt-property-value"> :
55 <?php echo date_i18n(get_option('date_format'), strtotime($attempt->manually_reviewed_at)).' '.date_i18n(get_option('time_format'), strtotime($attempt->manually_reviewed_at)); ?>
56 </span>
57 </p>
58 <?php
59 } ?>
60
61 </div>
62
63 <div class="quiz-attempt-student-info">
64 <p class="quiz-attempt-info-row">
65 <?php
66 echo '<span class="attempt-property-name">'. __('Quiz', 'tutor').' </span> <span class="attempt-property-value"> : '."<a href='".admin_url("post.php?post={$attempt->quiz_id}&action=edit")."'>".get_the_title($attempt->quiz_id)."</a> </span> ";
67 ?>
68 </p>
69
70 <p class="quiz-attempt-info-row">
71 <?php
72 $quiz = tutor_utils()->get_course_by_quiz($attempt->quiz_id);
73 if ($quiz) {
74 echo '<span class="attempt-property-name">' . __( 'Course', 'tutor' ) . '</span> <span class="attempt-property-value"> : ' . "<a href='" . admin_url( "post.php?post={$quiz->ID}&action=edit" ) . "'>" . get_the_title( $quiz->ID ) . "</a> </span>";
75 }
76 ?>
77 </p>
78
79 <p class="quiz-attempt-info-row">
80 <span class="attempt-property-name"><?php _e('Result', 'tutor'); ?></span>
81
82 <span class="attempt-property-value"> :
83 <?php
84 $pass_mark_percent = tutor_utils()->get_quiz_option($attempt->quiz_id, 'passing_grade', 0);
85 $earned_percentage = $attempt->earned_marks > 0 ? ( number_format(($attempt->earned_marks * 100) / $attempt->total_marks)) : 0;
86
87 $output = $attempt->earned_marks." out of {$attempt->total_marks} <br />";
88 $output .= "Marks earned ({$earned_percentage}%)<br />";
89
90 if ($earned_percentage >= $pass_mark_percent){
91 $output .= '<span class="result-pass">'.__('Pass', 'tutor').'</span>';
92 }else{
93 $output .= '<span class="result-fail">'.__('Fail', 'tutor').'</span>';
94 }
95
96 echo $output;
97 ?>
98 </span>
99 </p>
100
101 <p class="quiz-attempt-info-row">
102 <span class="attempt-property-name"><?php _e('Quiz Time', 'tutor'); ?></span>
103 <span class="attempt-property-value"> :
104 <?php
105 $time_limit_seconds = tutor_utils()->avalue_dot('time_limit.time_limit_seconds', $quiz_attempt_info);
106 echo tutor_utils()->seconds_to_time_context($time_limit_seconds);
107 ?>
108 </span>
109 </p>
110
111
112 <p class="quiz-attempt-info-row">
113 <span class="attempt-property-name"><?php _e('Attempt Time', 'tutor'); ?></span>
114 <span class="attempt-property-value"> :
115 <?php
116 $attempt_time_sec = strtotime($attempt->attempt_ended_at) - strtotime($attempt->attempt_started_at);
117 echo tutor_utils()->seconds_to_time_context($attempt_time_sec);
118 ?>
119 </span>
120 </p>
121
122 </div>
123 </div>
124
125 <?php
126 if (is_array($answers) && count($answers)){
127 ?>
128 <table class="wp-list-table widefat striped">
129 <tr>
130 <th width="200"><?php _e('Question', 'tutor'); ?></th>
131 <th><?php _e('Correct', 'tutor'); ?></th>
132 <th><?php _e('Given Answers', 'tutor'); ?></th>
133 <th><?php _e('Review', 'tutor'); ?></th>
134 </tr>
135 <?php
136 foreach ($answers as $answer){
137 ?>
138
139 <tr>
140 <td><?php echo $answer->question_title; ?></td>
141 <td>
142 <?php
143 if ((bool) $answer->is_correct) {
144 echo '<span class="tutor-status-approved-context"><i class="dashicons dashicons-yes"></i> </span>';
145 }else{
146 echo '<span class="tutor-status-blocked-context"><i class="dashicons dashicons-no-alt"></i> </span>';
147 }
148 ?>
149 </td>
150
151 <td>
152 <?php
153 if ($answer->question_type === 'true_false' || $answer->question_type === 'single_choice' ){
154
155 $get_answers = tutor_utils()->get_answer_by_id($answer->given_answer);
156 $answer_titles = wp_list_pluck($get_answers, 'answer_title');
157 echo '<p>'.implode('</p><p>', $answer_titles).'</p>';
158
159 }elseif ($answer->question_type === 'multiple_choice'){
160
161 $get_answers = tutor_utils()->get_answer_by_id(maybe_unserialize($answer->given_answer));
162 $answer_titles = wp_list_pluck($get_answers, 'answer_title');
163 echo '<p>'.implode('</p><p>', $answer_titles).'</p>';
164
165 }elseif ($answer->question_type === 'fill_in_the_blank'){
166
167 $answer_titles = maybe_unserialize($answer->given_answer);
168
169 $get_db_answers_by_question = tutor_utils()->get_answers_by_quiz_question($answer->question_id);
170 foreach ($get_db_answers_by_question as $db_answer);
171 $count_dash_fields = substr_count($db_answer->answer_title, '{dash}');
172 if ($count_dash_fields){
173 $dash_string = array();
174 $input_data = array();
175
176 for($i=0; $i<$count_dash_fields; $i++){
177 //$dash_string[] = '{dash}';
178 $input_data[] = isset($answer_titles[$i]) ? "<span class='filled_dash_unser'>{$answer_titles[$i]}</span>" : "______";
179 }
180
181 $answer_title = $db_answer->answer_title;
182 foreach($input_data as $replace){
183 $answer_title = preg_replace('/{dash}/i', $replace, $answer_title, 1);
184 }
185
186 echo str_replace('{dash}', '_____', $answer_title);
187 }
188
189 }elseif ($answer->question_type === 'open_ended' || $answer->question_type === 'short_answer'){
190
191 if ($answer->given_answer){
192 echo wpautop(stripslashes($answer->given_answer));
193 }
194
195 }elseif ($answer->question_type === 'ordering'){
196
197 $ordering_ids = maybe_unserialize($answer->given_answer);
198 foreach ($ordering_ids as $ordering_id){
199 $get_answers = tutor_utils()->get_answer_by_id($ordering_id);
200 $answer_titles = wp_list_pluck($get_answers, 'answer_title');
201 echo '<p>'.implode('</p><p>', $answer_titles).'</p>';
202 }
203
204 }elseif ($answer->question_type === 'matching'){
205
206 $ordering_ids = maybe_unserialize($answer->given_answer);
207 $original_saved_answers = tutor_utils()->get_answers_by_quiz_question($answer->question_id);
208
209 foreach ($original_saved_answers as $key => $original_saved_answer){
210 $provided_answer_order_id = isset($ordering_ids[$key]) ? $ordering_ids[$key] : 0;
211 $provided_answer_order = tutor_utils()->get_answer_by_id($provided_answer_order_id);
212 foreach ($provided_answer_order as $provided_answer_order);
213 echo $original_saved_answer->answer_title ." - {$provided_answer_order->answer_two_gap_match} <br />";
214 }
215
216 }elseif ($answer->question_type === 'image_matching'){
217
218 $ordering_ids = maybe_unserialize($answer->given_answer);
219 $original_saved_answers = tutor_utils()->get_answers_by_quiz_question($answer->question_id);
220
221 echo '<div class="answer-image-matched-wrap">';
222 foreach ($original_saved_answers as $key => $original_saved_answer){
223 $provided_answer_order_id = isset($ordering_ids[$key]) ? $ordering_ids[$key] : 0;
224 $provided_answer_order = tutor_utils()->get_answer_by_id($provided_answer_order_id);
225 foreach ($provided_answer_order as $provided_answer_order);
226 ?>
227 <div class="image-matching-item">
228 <p class="dragged-img-rap"><img src="<?php echo wp_get_attachment_image_url( $original_saved_answer->image_id); ?>" /> </p>
229 <p class="dragged-caption"><?php echo $provided_answer_order->answer_title; ?></p>
230 </div>
231 <?php
232 }
233 echo '</div>';
234 }elseif ($answer->question_type === 'image_answering'){
235
236 $ordering_ids = maybe_unserialize($answer->given_answer);
237
238 echo '<div class="answer-image-matched-wrap">';
239 foreach ($ordering_ids as $answer_id => $answer){
240 $db_answers = tutor_utils()->get_answer_by_id($answer_id);
241 foreach ($db_answers as $db_answer);
242 ?>
243 <div class="image-matching-item">
244 <p class="dragged-img-rap"><img src="<?php echo wp_get_attachment_image_url( $db_answer->image_id); ?>" /> </p>
245 <p class="dragged-caption"><?php echo $answer; ?></p>
246 </div>
247 <?php
248 }
249 echo '</div>';
250 }
251
252 ?>
253 </td>
254
255 <td>
256 <a href="<?php echo admin_url("admin.php?action=review_quiz_answer&attempt_id={$attempt_id}&attempt_answer_id={$answer->attempt_answer_id}&mark_as=correct"); ?>" title="<?php _e('Mark as correct', 'tutor'); ?>" class="tutor-button button button-success"><i class="dashicons dashicons-yes"></i> </a>
257
258 <a href="<?php echo admin_url("admin.php?action=review_quiz_answer&attempt_id={$attempt_id}&attempt_answer_id={$answer->attempt_answer_id}&mark_as=incorrect"); ?>" title="<?php _e('Mark as In correct', 'tutor'); ?>" class="tutor-button button button-danger"><i class="dashicons dashicons-no-alt"></i></a>
259 </td>
260 </tr>
261 <?php
262 }
263 ?>
264 </table>
265 <?php
266 }
267 ?>
268 </div>