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