PluginProbe ʕ •ᴥ•ʔ
Tutor LMS – eLearning and online course solution / 3.6.4
Tutor LMS – eLearning and online course solution v3.6.4
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 / templates / single / assignment / content.php
tutor / templates / single / assignment Last commit date
content.php 1 year ago
content.php
637 lines
1 <?php
2 /**
3 * Template for assignment content.
4 *
5 * @package Tutor\Templates
6 * @subpackage Single\Assignment
7 * @author Themeum <support@themeum.com>
8 * @link https://themeum.com
9 * @since 1.4.3
10 */
11
12 use TUTOR\Input;
13 use \TUTOR_ASSIGNMENTS\Assignments;
14
15 if ( ! defined( 'ABSPATH' ) ) {
16 exit;
17 }
18
19 global $post;
20 global $wpdb;
21 global $next_id;
22 global $assignment_submitted_id;
23
24 $is_submitting = tutor_utils()->is_assignment_submitting( get_the_ID() );
25
26 // Get the comment.
27 $post_id = get_the_ID(); //phpcs:ignore
28 $user_id = get_current_user_id();
29 $user_data = get_userdata( $user_id );
30 $assignment_comment = tutor_utils()->get_single_comment_user_post_id( $post_id, $user_id );
31 $submitted_assignment = tutor_utils()->is_assignment_submitted( get_the_ID() );
32
33 // Get the ID of this content and the corresponding course.
34 $course_content_id = get_the_ID();
35 $course_id = tutor_utils()->get_course_id_by_subcontent( $course_content_id );
36
37 // Get total content count.
38 $course_stats = tutor_utils()->get_course_completed_percent( $course_id, 0, true );
39
40 // Get enrolled data.
41 $enrolled_info = tutor_utils()->is_enrolled( $course_id, $user_id );
42 $enrollment_time = apply_filters( 'tutor_content_drip_assignment_deadline', strtotime( $enrolled_info->post_date_gmt ?? '' ), $course_id, $post_id );
43
44 /**
45 * Convert assignment time
46 *
47 * @todo move to utils
48 *
49 * @param integer $seconds seconds.
50 * @return string
51 */
52 function tutor_assignment_convert_seconds( $seconds ) {
53 $dt1 = new DateTime( '@0' );
54 $dt2 = new DateTime( "@$seconds" );
55
56 $diff = $dt1->diff( $dt2 );
57 $days = $diff->days;
58 $hours = $diff->h;
59 $minutes = $diff->i;
60
61 return $days . ' ' . _n( 'Day', 'Days', $days, 'tutor' ) . ', ' . $hours . ' ' . _n( 'Hour', 'Hours', $hours, 'tutor' ) . ', ' . $minutes . ' ' . _n( 'Minute', 'Minutes', $minutes, 'tutor' );
62 }
63
64 $next_prev_content_id = tutor_utils()->get_course_prev_next_contents_by_id( $post_id );
65 $content = get_the_content();
66 $s_content = $content;
67 $allow_to_upload = (int) tutor_utils()->get_assignment_option( $post_id, 'upload_files_limit' );
68 $course_id = tutor_utils()->get_course_id_by( 'lesson', get_the_ID() );
69
70 $upload_dir = wp_get_upload_dir();
71 $upload_baseurl = trailingslashit( $upload_dir['baseurl'] ?? '' );
72 $upload_basedir = trailingslashit( $upload_dir['basedir'] ?? '' );
73 ?>
74
75 <?php do_action( 'tutor_assignment/single/before/content' ); ?>
76
77 <?php tutor_load_template( 'single.common.header', array( 'course_id' => $course_id ) ); ?>
78
79 <div class="tutor-course-topic-single-body">
80 <div class="tutor-quiz-wrapper tutor-d-flex tutor-justify-center tutor-mt-36 tutor-pb-80">
81 <div id="tutor-assignment-wrap" class="tutor-quiz-wrap tutor-course-assignment-details tutor-submit-assignment tutor-assignment-result-pending">
82 <div class="tutor-assignment-title tutor-fs-4 tutor-fw-medium tutor-color-black">
83 <?php the_title(); ?>
84 </div>
85
86 <?php
87 $time_duration = tutor_utils()->get_assignment_option(
88 get_the_ID(),
89 'time_duration',
90 array(
91 'time' => '',
92 'value' => 0,
93 )
94 );
95
96 if ( ! is_array( $time_duration ) ) {
97 $time_duration = array();
98 }
99
100 $time_unit = $time_duration['time'] ?? '';
101 $time_value = isset( $time_duration['value'] ) ? (int) $time_duration['value'] : 0;
102
103 $total_mark = tutor_utils()->get_assignment_option( get_the_ID(), 'total_mark' );
104 $pass_mark = tutor_utils()->get_assignment_option( get_the_ID(), 'pass_mark' );
105 $file_upload_limit = tutor_utils()->get_assignment_option( get_the_ID(), 'upload_file_size_limit' );
106 $deadline_from_start = (bool) tutor_utils()->get_assignment_option( get_the_ID(), 'deadline_from_start' );
107
108 global $post;
109 $assignment_created_time = strtotime( $post->post_date_gmt );
110 $deadline_time = $enrollment_time < $assignment_created_time ? $assignment_created_time : $enrollment_time;
111
112 $start_assignment_date = null;
113 if ( $assignment_comment && isset( $assignment_comment->comment_date_gmt ) ) {
114 $start_assignment_date = $assignment_comment->comment_date_gmt;
115 }
116
117 if ( $deadline_from_start && $start_assignment_date ) {
118 $deadline_time = strtotime( $start_assignment_date );
119 }
120
121 $time_duration_in_sec = 0;
122
123 if ( $time_value && ! empty( $time_unit ) ) {
124 switch ( $time_unit ) {
125 case 'hours':
126 $time_duration_in_sec = 3600;
127 break;
128 case 'days':
129 $time_duration_in_sec = 86400;
130 break;
131 case 'weeks':
132 $time_duration_in_sec = 7 * 86400;
133 break;
134 default:
135 $time_duration_in_sec = 0;
136 break;
137 }
138 }
139
140 $time_duration_in_sec = $time_duration_in_sec * $time_value;
141 $remaining_time = $deadline_time + $time_duration_in_sec;
142 $now = time();
143 $remaining = $now - $remaining_time;
144 $is_expired = false;
145
146 $time_map = array(
147 'days' => _n( 'Day', 'Days', $time_value, 'tutor' ),
148 'hours' => _n( 'Hour', 'Hours', $time_value, 'tutor' ),
149 'weeks' => _n( 'Week', 'Weeks', $time_value, 'tutor' ),
150 );
151 ?>
152
153 <?php if ( ! $submitted_assignment ) : ?>
154 <div class="tutor-assignment-meta-info tutor-d-flex tutor-justify-between tutor-mt-24 tutor-mt-sm-32 tutor-py-16 tutor-py-sm-24">
155 <div class="tutor-assignment-detail-info tutor-d-flex">
156 <div class="tutor-assignment-duration">
157 <span class="tutor-fs-6 tutor-color-muted"><?php esc_html_e( 'Duration:', 'tutor' ); ?></span>
158 <span class="tutor-fs-6 tutor-fw-medium tutor-color-black">
159 <?php echo esc_html( $time_value ? $time_value . ' ' . $time_map[ $time_unit ] : __( 'No limit', 'tutor' ) ); //phpcs:ignore ?>
160 </span>
161 </div>
162 <div class="tutor-assignmetn-deadline">
163 <span class="tutor-fs-6 tutor-color-muted"><?php esc_html_e( 'Deadline:', 'tutor' ); ?></span>
164 <span class="tutor-fs-6 tutor-fw-medium tutor-color-black">
165 <?php
166 if ( $time_value ) {
167 if ( $deadline_from_start && ! $start_assignment_date ) {
168 printf(
169 // translators: %1$s is the number value (e.g., 3), %2$s is the time unit (e.g., days).
170 esc_html__( '%1$s %2$s after you start the assignment', 'tutor' ),
171 esc_html( $time_value ),
172 esc_html( strtolower( $time_map[ $time_unit ] ) )
173 );
174 } else {
175 if ( $now > $remaining_time && ! $submitted_assignment ) {
176 $is_expired = true;
177 esc_html_e( 'Expired', 'tutor' );
178 } else {
179 echo esc_html( tutor_assignment_convert_seconds( $remaining ) );
180 }
181 }
182 } else {
183 esc_html_e( 'N\\A', 'tutor' );
184 }
185 ?>
186 </span>
187 </div>
188 </div>
189 <div class="tutor-assignment-detail-info tutor-d-flex">
190 <div class="tutor-assignment-marks">
191 <span class="tutor-fs-6 tutor-color-muted"><?php esc_html_e( 'Total Marks:', 'tutor' ); ?></span>
192 <span class="tutor-fs-6 tutor-fw-medium tutor-color-black"><?php echo esc_html( $total_mark ); ?></span>
193 </div>
194 <div class="tutor-assignmetn-pass-mark">
195 <span class="tutor-fs-6 tutor-color-muted"><?php esc_html_e( 'Passing Mark:', 'tutor' ); ?></span>
196 <span class="tutor-fs-6 tutor-fw-medium tutor-color-black"><?php echo esc_html( $pass_mark ); ?></span>
197 </div>
198 </div>
199 </div>
200 <?php endif; ?>
201
202 <?php
203 /**
204 * Time_duration[value]==0 means no limit
205 * if have unlimited time then no msg should appear
206 */
207 if ( $is_expired ) :
208 ?>
209 <div class="quiz-flash-message tutor-mt-24 tutor-mt-sm-32">
210 <div class="tutor-quiz-warning-box time-over tutor-d-flex tutor-align-center tutor-justify-between">
211 <div class="flash-info tutor-d-flex tutor-align-center">
212 <span class="tutor-icon-circle-times-bold tutor-color-danger tutor-mr-8"></span>
213 <span class="tutor-fs-7 tutor-color-danger-100">
214 <?php esc_html_e( 'You have missed the submission deadline. Please contact the instructor for more information.', 'tutor' ); ?>
215 </span>
216 </div>
217 </div>
218 </div>
219 <?php endif; ?>
220
221 <?php if ( ! $is_submitting && ! $submitted_assignment && get_the_content() ) : ?>
222 <div class="tutor-time-out-assignment-details tutor-assignment-border-bottom tutor-pb-48 tutor-pb-sm-72">
223 <div class="tutor-to-assignment tutor-pt-32 tutor-pt-sm-40">
224 <div class="tutor-to-title tutor-fs-6 tutor-fw-medium tutor-color-black">
225 <?php esc_html_e( 'Description', 'tutor' ); ?>
226 </div>
227 <div class="tutor-to-body tutor-fs-6 tutor-color-secondary tutor-pt-12 tutor-entry-content">
228 <?php the_content(); ?>
229 </div>
230 </div>
231 </div>
232 <?php endif; ?>
233
234 <?php
235 $assignment_attachments = maybe_unserialize( get_post_meta( get_the_ID(), '_tutor_assignment_attachments', true ) );
236 if ( tutor_utils()->count( $assignment_attachments ) ) :
237 ?>
238 <div class="tutor-assignment-attachments tutor-pt-40">
239 <span class="tutor-fs-6 tutor-fw-medium tutor-color-black">
240 <?php esc_html_e( 'Attachments', 'tutor' ); ?>
241 </span>
242 <div class="tutor-assignment-attachments-list tutor-pt-16">
243 <?php if ( is_array( $assignment_attachments ) && count( $assignment_attachments ) ) : ?>
244 <?php foreach ( $assignment_attachments as $attachment_id ) : ?>
245 <?php
246 $attachment_name = get_post_meta( $attachment_id, '_wp_attached_file', true );
247 $attachment_name = substr( $attachment_name, strrpos( $attachment_name, '/' ) + 1 );
248 $file_size = tutor_utils()->get_readable_filesize( get_attached_file( $attachment_id ) );
249 ?>
250 <div class="tutor-instructor-card tutor-col-sm-5 tutor-py-16 tutor-mr-12 tutor-ml-3">
251 <div class="tutor-icard-content">
252 <div class="tutor-fs-6 tutor-color-secondary">
253 <a href="<?php echo esc_url( wp_get_attachment_url( $attachment_id ) ); ?>" target="_blank"
254 download>
255 <?php echo esc_html( $attachment_name ); ?>
256 </a>
257 </div>
258 <div class="tutor-fs-7">
259 <?php esc_html_e( 'Size: ', 'tutor' ); ?>
260 <?php echo esc_html( $file_size ); ?>
261 </div>
262 </div>
263 <div class="tutor-d-flex tutor-align-center">
264 <a class="tutor-iconic-btn tutor-iconic-btn-outline" href="<?php echo esc_url( wp_get_attachment_url( $attachment_id ) ); ?>" target="_blank">
265 <span class="tutor-icon-download" area-hidden="true"></span>
266 </a>
267 </div>
268 </div>
269 <?php endforeach; ?>
270 <?php endif; ?>
271 </div>
272 </div>
273 <?php endif; ?>
274
275 <?php if ( ( $is_submitting || isset( $_GET['update-assignment'] ) ) && ( $remaining_time > $now || 0 === $time_value ) ) : ?>
276 <div class="tutor-assignment-submission tutor-assignment-border-bottom tutor-pb-48 tutor-pb-sm-72">
277 <form action="" method="post" id="tutor_assignment_submit_form" enctype="multipart/form-data">
278 <?php wp_nonce_field( tutor()->nonce_action, tutor()->nonce, false ); ?>
279 <input type="hidden" value="tutor_assignment_submit" name="tutor_action" />
280 <input type="hidden" name="assignment_id" value="<?php echo get_the_ID(); ?>">
281
282 <?php $allowed_upload_files = (int) tutor_utils()->get_assignment_option( get_the_ID(), 'upload_files_limit' ); ?>
283 <div class="tutor-assignment-body tutor-pt-32 tutor-pt-sm-40">
284 <div class="tutor-to-title tutor-fs-6 tutor-fw-medium tutor-color-black">
285 <?php esc_html_e( 'Assignment Submission', 'tutor' ); ?>
286 </div>
287
288 <div class="tutor-fs-7 tutor-color-secondary tutor-pt-16 tutor-pt-sm-32">
289 <?php esc_html_e( 'Assignment answer form', 'tutor' ); ?>
290 </div>
291
292 <div class="tutor-assignment-text-area tutor-pt-20">
293 <?php
294 $assignment_comment_id = Input::has( 'update-assignment' ) ? Input::get( 'update-assignment' ) : 0;
295 $content = $assignment_comment_id ? get_comment( $assignment_comment_id ) : '';
296 $args = tutor_utils()->text_editor_config();
297 $args['tinymce'] = array(
298 'toolbar1' => 'formatselect,bold,italic,underline,forecolor,bullist,numlist,alignleft,aligncenter,alignright,alignjustify,undo,redo',
299 );
300 $args['editor_height'] = '140';
301 $editor_args = array(
302 'content' => isset( $content->comment_content ) ? $content->comment_content : '',
303 'args' => $args,
304 );
305 $text_editor_template = tutor()->path . 'templates/global/tutor-text-editor.php';
306 tutor_load_template_from_custom_path( $text_editor_template, $editor_args );
307 ?>
308 </div>
309
310 <?php if ( $allowed_upload_files ) : ?>
311 <div class="tutor-assignment-attachment tutor-mt-32 tutor-py-20 tutor-px-16 tutor-py-sm-32 tutor-px-sm-32">
312 <div class="tutor-fs-7 tutor-color-secondary">
313 <?php
314 $attachment_text = _x( 'Attach assignment files (Max: ', 'Assignment attachment', 'tutor' );
315 $attachment_text .= $allow_to_upload . _x( ' file)', 'Assignment attachment', 'tutor' );
316 echo esc_html( $attachment_text );
317 ?>
318 </div>
319 <div class="tutor-attachment-files tutor-mt-12">
320 <div class="tutor-assignment-upload-btn tutor-mt-12 tutor-mt-md-0">
321 <form>
322 <label for="tutor-assignment-file-upload">
323 <input type="file" id="tutor-assignment-file-upload"
324 name="attached_assignment_files[]" multiple>
325 <a class="tutor-btn tutor-btn-primary tutor-btn-md">
326 <?php esc_html_e( 'Choose file', 'tutor' ); ?>
327 </a>
328 </label>
329 <input type="hidden" name="tutor_assignment_upload_limit"
330 value="<?php echo esc_attr( $file_upload_limit * 1000000 ); ?>">
331 </form>
332 </div>
333 <div class="tutor-input-type-size">
334 <p class="tutor-fs-7 tutor-color-secondary">
335 <?php esc_html_e( 'File Support: ', 'tutor' ); ?>
336 <span class="tutor-color-black">
337 <?php esc_html_e( 'Any standard Image, Document, Presentation, Sheet, PDF or Text file is allowed', 'tutor' ); ?>
338 </span>
339 </p>
340 <p class="tutor-fs-7 tutor-color-secondary tutor-mt-7">
341 <?php esc_html_e( 'Total File Size: Max', 'tutor' ); ?>
342 <span class="tutor-color-black">
343 <?php echo esc_html( $file_upload_limit ); ?>
344 <?php esc_html_e( 'MB', 'tutor' ); ?>
345 </span>
346 </p>
347 </div>
348 </div>
349
350 <div class="tutor-container tutor-pt-16 tutor-update-assignment-attachments">
351 <div class="tutor-row tutor-gy-3" id="tutor-student-assignment-edit-file-preview">
352 <?php
353 $submitted_attachments = get_comment_meta( $assignment_comment_id, 'uploaded_attachments' );
354 if ( is_array( $submitted_attachments ) && count( $submitted_attachments ) ) :
355 ?>
356 <?php
357 foreach ( $submitted_attachments as $attach ) :
358 $attachments = json_decode( $attach );
359 ?>
360 <?php foreach ( $attachments as $attachment ) : ?>
361 <div class="tutor-instructor-card tutor-col-sm-5 tutor-py-16 tutor-mr-16">
362 <div class="tutor-icard-content">
363 <div class="tutor-fs-6 tutor-color-secondary">
364 <?php echo esc_html( $attachment->name ); ?>
365 </div>
366 <div class="tutor-fs-7">
367 <?php echo esc_html( tutor_utils()->get_readable_filesize( $upload_basedir . $attachment->uploaded_path ) ); ?>
368 </div>
369 </div>
370 <div
371 class="tutor-attachment-file-close tutor-d-flex tutor-align-center">
372 <a class="tutor-iconic-btn tutor-iconic-btn-outline" href="<?php echo esc_url( $attachment->url ); ?>"
373 data-id="<?php echo esc_attr( $assignment_comment_id ); ?>"
374 data-name="<?php echo esc_attr( $attachment->name ); ?>" target="_blank">
375 <span class="tutor-icon-times"></span>
376 </a>
377 </div>
378 </div>
379 <?php endforeach; ?>
380 <?php endforeach; ?>
381 <?php endif; ?>
382 </div>
383 </div>
384 </div>
385 <?php endif; ?>
386
387 <div class="tutor-assignment-submit-btn tutor-mt-60">
388 <button type="submit" id="tutor_assignment_submit_btn" class="tutor-btn tutor-btn-primary tutor-btn-lg tutor-static-loader">
389 <?php esc_html_e( 'Submit Assignment', 'tutor' ); ?>
390 </button>
391 </div>
392 </div>
393 </form>
394 </div>
395
396 <?php $has_show_more = strlen( $s_content ) > 500 ? true : false; ?>
397
398 <?php if ( $s_content ) : ?>
399 <div class="tutor-assignment-description-details tutor-assignment-border-bottom tutor-pb-32 tutor-pb-sm-44">
400 <div id="content-section" class="tutor-pt-40 tutor-pt-sm-60<?php echo esc_attr( $has_show_more ? ' tutor-toggle-more-content tutor-toggle-more-collapsed' : '' ); ?>"<?php echo $has_show_more ? ' data-tutor-toggle-more-content data-toggle-height="300" style="height: 300px;"' : ''; ?>>
401 <div class="tutor-fs-6 tutor-fw-medium tutor-color-black">
402 <?php esc_html_e( 'Description', 'tutor' ); ?>
403 </div>
404 <div class="tutor-entry-content tutor-fs-6 tutor-color-secondary tutor-pt-12">
405 <?php echo apply_filters( 'the_content', $s_content );//phpcs:ignore ?>
406 </div>
407 </div>
408
409 <?php if ( $has_show_more ) : ?>
410 <a href="#" class="tutor-btn-show-more tutor-btn tutor-btn-ghost tutor-mt-32" data-tutor-toggle-more=".tutor-toggle-more-content">
411 <span class="tutor-toggle-btn-icon tutor-icon tutor-icon-plus tutor-mr-8" area-hidden="true"></span>
412 <span class="tutor-toggle-btn-text"><?php esc_html_e( 'Show More', 'tutor' ); ?></span>
413 </a>
414 <?php endif; ?>
415 </div>
416 <?php endif; ?>
417
418 <?php if ( $next_prev_content_id->next_id ) : ?>
419 <div class="tutor-assignment-footer tutor-d-flex tutor-justify-end tutor-pt-32 tutor-pt-sm-44">
420 <a href="<?php echo esc_url( get_permalink( $next_prev_content_id->next_id ) ); ?>" class="tuttor-assignment-skip-button tutor-btn tutor-btn-ghost tutor-mt-md-0 tutor-mt-12">
421 <?php esc_html_e( 'Skip To Next', 'tutor' ); ?>
422 </a>
423 </div>
424 <?php endif; ?>
425 <?php else : ?>
426
427 <?php if ( $submitted_assignment ) : ?>
428 <?php
429 $is_reviewed_by_instructor = get_comment_meta( $submitted_assignment->comment_ID, 'evaluate_time', true );
430
431 $assignment_id = $submitted_assignment->comment_post_ID;
432 $submit_id = $submitted_assignment->comment_ID;
433
434 $max_mark = tutor_utils()->get_assignment_option( $submitted_assignment->comment_post_ID, 'total_mark' );
435 $pass_mark = tutor_utils()->get_assignment_option( $submitted_assignment->comment_post_ID, 'pass_mark' );
436 $given_mark = get_comment_meta( $submitted_assignment->comment_ID, 'assignment_mark', true );
437 ?>
438 <div class="tutor-assignment-result-table tutor-mt-32 tutor-mb-40">
439 <div class="tutor-table-responsive">
440 <table class="tutor-table my-quiz-attempts">
441 <thead>
442 <tr>
443 <th>
444 <?php esc_html_e( 'Date', 'tutor' ); ?>
445 </th>
446 <th>
447 <?php esc_html_e( 'Total Marks', 'tutor' ); ?>
448 </th>
449 <th>
450 <?php esc_html_e( 'Pass Marks', 'tutor' ); ?>
451 </th>
452 <th>
453 <?php esc_html_e( 'Earned Marks', 'tutor' ); ?>
454 </th>
455 <th>
456 <?php esc_html_e( 'Result', 'tutor' ); ?>
457 </th>
458 </tr>
459 </thead>
460
461 <tbody>
462 <tr>
463 <td>
464 <?php echo esc_html( tutor_utils()->convert_date_into_wp_timezone( $submitted_assignment->comment_date ) ); ?>
465 </td>
466
467 <td>
468 <?php esc_html_e( $max_mark, 'tutor' );//phpcs:ignore ?>
469 </td>
470
471 <td>
472 <?php esc_html_e( $pass_mark, 'tutor' );//phpcs:ignore ?>
473 </td>
474
475 <td>
476 <?php esc_html_e( $given_mark, 'tutor' );//phpcs:ignore ?>
477 </td>
478
479 <td>
480 <?php if ( $is_reviewed_by_instructor ) : ?>
481 <?php if ( $given_mark >= $pass_mark ) : ?>
482 <span class="tutor-badge-label label-success">
483 <?php esc_html_e( 'Passed', 'tutor' ); ?>
484 </span>
485 <?php else : ?>
486 <span class="tutor-badge-label label-danger">
487 <?php esc_html_e( 'Failed', 'tutor' ); ?>
488 </span>
489 <?php endif; ?>
490 <?php endif; ?>
491
492 <?php if ( ! $is_reviewed_by_instructor ) : ?>
493 <span class="tutor-badge-label label-warning">
494 <?php esc_html_e( 'Pending', 'tutor' ); ?>
495 </span>
496 <?php endif; ?>
497 </td>
498 </tr>
499 </tbody>
500 </table>
501 </div>
502 </div>
503
504 <?php
505 $instructor_note = get_comment_meta( $submitted_assignment->comment_ID, 'instructor_note', true );
506 if ( ! empty( $instructor_note ) && $is_reviewed_by_instructor ) :
507 ?>
508 <div class="tutor-instructor-note tutor-my-32 tutor-py-20 tutor-px-24 tutor-py-sm-32 tutor-px-sm-36">
509 <div class="tutor-in-title tutor-fs-6 tutor-fw-medium tutor-color-black">
510 <?php esc_html_e( 'Instructor Note', 'tutor' ); ?>
511 </div>
512 <div class="tutor-in-body tutor-fs-6 tutor-color-secondary tutor-pt-12 tutor-pt-sm-16">
513 <?php echo wp_kses_post( nl2br( get_comment_meta( $submitted_assignment->comment_ID, 'instructor_note', true ) ) ); ?>
514 </div>
515 </div>
516 <?php endif; ?>
517 <div class="tutor-assignment-details tutor-assignment-border-bottom tutor-pb-48 tutor-pb-sm-72">
518 <div class="tutor-ar-body tutor-pt-24 tutor-pb-40 tutor-px-16 tutor-px-md-32">
519 <div class="tutor-ar-header tutor-d-flex tutor-justify-between tutor-align-center">
520 <div class="tutor-ar-title tutor-fs-6 tutor-fw-medium tutor-color-black">
521 <?php esc_html_e( 'Your Assignment', 'tutor' ); ?>
522 </div>
523
524 <?php
525 $result = Assignments::get_assignment_result( $post_id, $user_id );
526 if ( in_array( $result, array( 'pending', 'fail' ), true ) && ( $remaining_time > $now || 0 === $time_value ) ) :
527 ?>
528 <div class="tutor-ar-btn">
529 <a href="<?php echo esc_url( add_query_arg( 'update-assignment', $submitted_assignment->comment_ID ) ); ?>"
530 class="tutor-btn tutor-btn-outline-primary tutor-btn-sm">
531 <?php esc_html_e( 'Edit', 'tutor' ); ?>
532 </a>
533 </div>
534 <?php endif; ?>
535 </div>
536
537 <div class="tutor-fs-6 tutor-color-secondary tutor-pt-16 tutor-entry-content">
538 <?php echo wp_kses_post( nl2br( stripslashes( $submitted_assignment->comment_content ) ) ); ?>
539 </div>
540
541 <?php
542 $attached_files = get_comment_meta( $submitted_assignment->comment_ID, 'uploaded_attachments', true );
543 if ( $attached_files ) :
544 ?>
545 <?php
546 $attached_files = json_decode( $attached_files, true );
547 if ( tutor_utils()->count( $attached_files ) ) :
548 ?>
549 <div class="tutor-attachment-files submited-files tutor-d-flex tutor-flex-column tutor-mt-20 tutor-mt-sm-40">
550 <?php foreach ( $attached_files as $attached_file ) : ?>
551 <div class="tutor-instructor-card tutor-mt-12">
552 <div class="tutor-icard-content">
553 <div class="tutor-fs-6 tutor-color-secondary">
554 <?php echo esc_html( tutor_utils()->array_get( 'name', $attached_file ) ); ?>
555 </div>
556 <div class="tutor-fs-7"><?php esc_html_e( 'Size', 'tutor' ); ?>:
557 <?php
558 echo esc_html(
559 tutor_utils()->get_readable_filesize( $upload_basedir . $attached_file['uploaded_path'] )
560 );
561 ?>
562 </div>
563 </div>
564 <div class="tutor-d-flex tutor-align-center">
565 <a class="tutor-iconic-btn tutor-iconic-btn-outline" download
566 href="<?php echo esc_url( $upload_baseurl . tutor_utils()->array_get( 'uploaded_path', $attached_file ) ); ?>"
567 target="_blank">
568 <span class="tutor-icon-download"></span>
569 </a>
570 </div>
571 </div>
572 <?php endforeach; ?>
573 </div>
574 <?php endif; ?>
575 <?php endif; ?>
576 </div>
577 </div>
578
579 <?php $has_show_more = strlen( $s_content ) > 500 ? true : false; ?>
580
581 <?php if ( $s_content ) : ?>
582 <div class="tutor-assignment-description-details tutor-assignment-border-bottom tutor-pb-32 tutor-pb-sm-44">
583 <div id="content-section" class="tutor-pt-40 tutor-pt-sm-60<?php echo $has_show_more ? ' tutor-toggle-more-content tutor-toggle-more-collapsed' : ''; ?>"<?php echo $has_show_more ? ' data-tutor-toggle-more-content data-toggle-height="300" style="height: 300px;"' : ''; ?>>
584 <div class="tutor-fs-6 tutor-fw-medium tutor-color-black">
585 <?php esc_html_e( 'Description', 'tutor' ); ?>
586 </div>
587 <div class="tutor-entry-content tutor-fs-6 tutor-color-secondary tutor-pt-12">
588 <?php echo apply_filters( 'the_content', $s_content ); //phpcs:ignore ?>
589 </div>
590 </div>
591 <?php if ( $has_show_more ) : ?>
592 <a href="#" class="tutor-btn-show-more tutor-btn tutor-btn-ghost tutor-mt-32" data-tutor-toggle-more=".tutor-toggle-more-content">
593 <span class="tutor-toggle-btn-icon tutor-icon tutor-icon-plus tutor-mr-8" area-hidden="true"></span>
594 <span class="tutor-toggle-btn-text"><?php esc_html_e( 'Show More', 'tutor' ); ?></span>
595 </a>
596 <?php endif; ?>
597 </div>
598 <?php endif; ?>
599
600
601 <?php if ( $next_prev_content_id->next_id ) : ?>
602 <div class="tutor-assignment-footer tutor-pt-32 tutor-pt-sm-44">
603 <a class="tutor-btn tutor-btn-primary tutor-static-loader"
604 href="<?php echo esc_url( get_the_permalink( $next_prev_content_id->next_id ) ); ?>">
605 <?php esc_html_e( 'Continue Lesson', 'tutor' ); ?>
606 </a>
607 </div>
608 <?php endif; ?>
609 <?php else : ?>
610 <div class="tutor-assignment-footer tutor-pt-32 tutor-pt-sm-44">
611 <div class="tutor-assignment-footer-btn tutor-d-flex tutor-justify-between">
612 <form action="" method="post" id="tutor_assignment_start_form">
613 <?php wp_nonce_field( tutor()->nonce_action, tutor()->nonce ); ?>
614 <input type="hidden" value="tutor_assignment_start_submit" name="tutor_action" />
615 <input type="hidden" name="assignment_id" value="<?php echo get_the_ID(); ?>">
616 <button type="submit" id="tutor_assignment_start_btn" class="tutor-btn tutor-btn-primary"<?php echo $is_expired ? ' disabled' : ''; ?>>
617 <?php esc_html_e( 'Start Assignment', 'tutor' ); ?>
618 </button>
619 </form>
620
621 <?php if ( $next_prev_content_id->next_id ) : ?>
622 <a href="<?php echo esc_url( get_permalink( $next_prev_content_id->next_id ) ); ?>" class="tutor-btn tutor-btn-ghost tutor-mt-md-0 tutor-mt-12">
623 <?php esc_html_e( 'Skip To Next', 'tutor' ); ?>
624 </a>
625 <?php endif; ?>
626 </div>
627 </div>
628 <?php endif; ?>
629 <?php endif; ?>
630 </div>
631 </div>
632 </div>
633
634 <?php tutor_load_template( 'single.common.footer', array( 'course_id' => $course_id ) ); ?>
635
636 <?php do_action( 'tutor_assignment/single/after/content' ); ?>
637