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