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