PluginProbe ʕ •ᴥ•ʔ
Tutor LMS – eLearning and online course solution / 2.7.3
Tutor LMS – eLearning and online course solution v2.7.3
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
631 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 appear
171 */
172 if ( ( 0 != $time_duration['value'] ) && ( $now > $remaining_time && false == $is_submitted ) ) :
173 ?>
174 <div class="quiz-flash-message tutor-mt-24 tutor-mt-sm-32">
175 <div class="tutor-quiz-warning-box time-over tutor-d-flex tutor-align-center tutor-justify-between">
176 <div class="flash-info tutor-d-flex tutor-align-center">
177 <span class="tutor-icon-circle-times-bold tutor-color-danger tutor-mr-8"></span>
178 <span class="tutor-fs-7 tutor-color-danger-100">
179 <?php esc_html_e( 'You have missed the submission deadline. Please contact the instructor for more information.', 'tutor' ); ?>
180 </span>
181 </div>
182 </div>
183 </div>
184 <?php endif; ?>
185
186 <?php if ( ! $is_submitting && ! $submitted_assignment && get_the_content() ) : ?>
187 <div class="tutor-time-out-assignment-details tutor-assignment-border-bottom tutor-pb-48 tutor-pb-sm-72">
188 <div class="tutor-to-assignment tutor-pt-32 tutor-pt-sm-40">
189 <div class="tutor-to-title tutor-fs-6 tutor-fw-medium tutor-color-black">
190 <?php esc_html_e( 'Description', 'tutor' ); ?>
191 </div>
192 <div class="tutor-to-body tutor-fs-6 tutor-color-secondary tutor-pt-12 tutor-entry-content">
193 <?php the_content(); ?>
194 </div>
195 </div>
196 </div>
197 <?php endif; ?>
198
199 <?php
200 $assignment_attachments = maybe_unserialize( get_post_meta( get_the_ID(), '_tutor_assignment_attachments', true ) );
201 if ( tutor_utils()->count( $assignment_attachments ) ) :
202 ?>
203 <div class="tutor-assignment-attachments tutor-pt-40">
204 <span class="tutor-fs-6 tutor-fw-medium tutor-color-black">
205 <?php esc_html_e( 'Attachments', 'tutor' ); ?>
206 </span>
207 <div class="tutor-assignment-attachments-list tutor-pt-16">
208 <?php if ( is_array( $assignment_attachments ) && count( $assignment_attachments ) ) : ?>
209 <?php foreach ( $assignment_attachments as $attachment_id ) : ?>
210 <?php
211 $attachment_name = get_post_meta( $attachment_id, '_wp_attached_file', true );
212 $attachment_name = substr( $attachment_name, strrpos( $attachment_name, '/' ) + 1 );
213 $file_size = tutor_utils()->get_readable_filesize( get_attached_file( $attachment_id ) );
214 ?>
215 <div class="tutor-instructor-card tutor-col-sm-5 tutor-py-16 tutor-mr-12 tutor-ml-3">
216 <div class="tutor-icard-content">
217 <div class="tutor-fs-6 tutor-color-secondary">
218 <a href="<?php echo esc_url( wp_get_attachment_url( $attachment_id ) ); ?>" target="_blank"
219 download>
220 <?php echo esc_html( $attachment_name ); ?>
221 </a>
222 </div>
223 <div class="tutor-fs-7">
224 <?php esc_html_e( 'Size: ', 'tutor' ); ?>
225 <?php echo esc_html( $file_size ); ?>
226 </div>
227 </div>
228 <div class="tutor-d-flex tutor-align-center">
229 <a class="tutor-iconic-btn tutor-iconic-btn-outline" href="<?php echo esc_url( wp_get_attachment_url( $attachment_id ) ); ?>" target="_blank">
230 <span class="tutor-icon-download" area-hidden="true"></span>
231 </a>
232 </div>
233 </div>
234 <?php endforeach; ?>
235 <?php endif; ?>
236 </div>
237 </div>
238 <?php endif; ?>
239
240 <?php if ( ( $is_submitting || isset( $_GET['update-assignment'] ) ) && ( $remaining_time > $now || 0 == $time_duration['value'] ) ) : ?>
241 <div class="tutor-assignment-submission tutor-assignment-border-bottom tutor-pb-48 tutor-pb-sm-72">
242 <form action="" method="post" id="tutor_assignment_submit_form" enctype="multipart/form-data">
243 <?php wp_nonce_field( tutor()->nonce_action, tutor()->nonce, false ); ?>
244 <input type="hidden" value="tutor_assignment_submit" name="tutor_action" />
245 <input type="hidden" name="assignment_id" value="<?php echo get_the_ID(); ?>">
246
247 <?php $allowed_upload_files = (int) tutor_utils()->get_assignment_option( get_the_ID(), 'upload_files_limit' ); ?>
248 <div class="tutor-assignment-body tutor-pt-32 tutor-pt-sm-40">
249 <div class="tutor-to-title tutor-fs-6 tutor-fw-medium tutor-color-black">
250 <?php esc_html_e( 'Assignment Submission', 'tutor' ); ?>
251 </div>
252
253 <div class="tutor-fs-7 tutor-color-secondary tutor-pt-16 tutor-pt-sm-32">
254 <?php esc_html_e( 'Assignment answer form', 'tutor' ); ?>
255 </div>
256
257 <div class="tutor-assignment-text-area tutor-pt-20">
258 <?php
259 $assignment_comment_id = Input::has( 'update-assignment' ) ? Input::get( 'update-assignment' ) : 0;
260 $content = $assignment_comment_id ? get_comment( $assignment_comment_id ) : '';
261 $args = tutor_utils()->text_editor_config();
262 $args['tinymce'] = array(
263 'toolbar1' => 'formatselect,bold,italic,underline,forecolor,bullist,numlist,alignleft,aligncenter,alignright,alignjustify,undo,redo',
264 );
265 $args['editor_height'] = '140';
266 $editor_args = array(
267 'content' => isset( $content->comment_content ) ? $content->comment_content : '',
268 'args' => $args,
269 );
270 $text_editor_template = tutor()->path . 'templates/global/tutor-text-editor.php';
271 tutor_load_template_from_custom_path( $text_editor_template, $editor_args );
272 ?>
273 </div>
274
275 <?php if ( $allowed_upload_files ) : ?>
276 <div class="tutor-assignment-attachment tutor-mt-32 tutor-py-20 tutor-px-16 tutor-py-sm-32 tutor-px-sm-32">
277 <div class="tutor-fs-7 tutor-color-secondary">
278 <?php
279 $attachment_text = _x( 'Attach assignment files (Max: ', 'Assignment attachment', 'tutor' );
280 $attachment_text .= $allow_to_upload . _x( ' file)', 'Assignment attachment', 'tutor' );
281 echo esc_html( $attachment_text );
282 ?>
283 </div>
284 <div class="tutor-attachment-files tutor-mt-12">
285 <div class="tutor-assignment-upload-btn tutor-mt-12 tutor-mt-md-0">
286 <form>
287 <label for="tutor-assignment-file-upload">
288 <input type="file" id="tutor-assignment-file-upload"
289 name="attached_assignment_files[]" multiple>
290 <a class="tutor-btn tutor-btn-primary tutor-btn-md">
291 <?php esc_html_e( 'Choose file', 'tutor' ); ?>
292 </a>
293 </label>
294 <input type="hidden" name="tutor_assignment_upload_limit"
295 value="<?php echo esc_attr( $file_upload_limit * 1000000 ); ?>">
296 </form>
297 </div>
298 <div class="tutor-input-type-size">
299 <p class="tutor-fs-7 tutor-color-secondary">
300 <?php esc_html_e( 'File Support: ', 'tutor' ); ?>
301 <span class="tutor-color-black">
302 <?php esc_html_e( 'Any standard Image, Document, Presentation, Sheet, PDF or Text file is allowed', 'tutor' ); ?>
303 </span>
304 </p>
305 <p class="tutor-fs-7 tutor-color-secondary tutor-mt-7">
306 <?php esc_html_e( 'Total File Size: Max', 'tutor' ); ?>
307 <span class="tutor-color-black">
308 <?php echo esc_html( $file_upload_limit ); ?>
309 <?php esc_html_e( 'MB', 'tutor' ); ?>
310 </span>
311 </p>
312 </div>
313 </div>
314
315 <div class="tutor-container tutor-pt-16 tutor-update-assignment-attachments">
316 <div class="tutor-row tutor-gy-3" id="tutor-student-assignment-edit-file-preview">
317 <?php
318 $submitted_attachments = get_comment_meta( $assignment_comment_id, 'uploaded_attachments' );
319 if ( is_array( $submitted_attachments ) && count( $submitted_attachments ) ) :
320 ?>
321 <?php
322 foreach ( $submitted_attachments as $attach ) :
323 $attachments = json_decode( $attach );
324 ?>
325 <?php foreach ( $attachments as $attachment ) : ?>
326 <div class="tutor-instructor-card tutor-col-sm-5 tutor-py-16 tutor-mr-16">
327 <div class="tutor-icard-content">
328 <div class="tutor-fs-6 tutor-color-secondary">
329 <?php echo esc_html( $attachment->name ); ?>
330 </div>
331 <div class="tutor-fs-7">
332 <?php echo esc_html( tutor_utils()->get_readable_filesize( $upload_basedir . $attachment->uploaded_path ) ); ?>
333 </div>
334 </div>
335 <div
336 class="tutor-attachment-file-close tutor-d-flex tutor-align-center">
337 <a class="tutor-iconic-btn tutor-iconic-btn-outline" href="<?php echo esc_url( $attachment->url ); ?>"
338 data-id="<?php echo esc_attr( $assignment_comment_id ); ?>"
339 data-name="<?php echo esc_attr( $attachment->name ); ?>" target="_blank">
340 <span class="tutor-icon-times"></span>
341 </a>
342 </div>
343 </div>
344 <?php endforeach; ?>
345 <?php endforeach; ?>
346 <?php endif; ?>
347 </div>
348 </div>
349 </div>
350 <?php endif; ?>
351
352 <div class="tutor-assignment-submit-btn tutor-mt-60">
353 <button type="submit" id="tutor_assignment_submit_btn" class="tutor-btn tutor-btn-primary tutor-btn-lg tutor-static-loader">
354 <?php esc_html_e( 'Submit Assignment', 'tutor' ); ?>
355 </button>
356 </div>
357 </div>
358 </form>
359 </div>
360
361 <?php $has_show_more = strlen( $s_content ) > 500 ? true : false; ?>
362
363 <?php if ( $s_content ) : ?>
364 <div class="tutor-assignment-description-details tutor-assignment-border-bottom tutor-pb-32 tutor-pb-sm-44">
365 <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;"' : ''; ?>>
366 <div class="tutor-fs-6 tutor-fw-medium tutor-color-black">
367 <?php esc_html_e( 'Description', 'tutor' ); ?>
368 </div>
369 <div class="tutor-entry-content tutor-fs-6 tutor-color-secondary tutor-pt-12">
370 <?php echo apply_filters( 'the_content', $s_content );//phpcs:ignore ?>
371 </div>
372 </div>
373
374 <?php if ( $has_show_more ) : ?>
375 <a href="#" class="tutor-btn-show-more tutor-btn tutor-btn-ghost tutor-mt-32" data-tutor-toggle-more=".tutor-toggle-more-content">
376 <span class="tutor-toggle-btn-icon tutor-icon tutor-icon-plus tutor-mr-8" area-hidden="true"></span>
377 <span class="tutor-toggle-btn-text"><?php esc_html_e( 'Show More', 'tutor' ); ?></span>
378 </a>
379 <?php endif; ?>
380 </div>
381 <?php endif; ?>
382
383 <?php if ( $next_prev_content_id->next_id ) : ?>
384 <div class="tutor-assignment-footer tutor-d-flex tutor-justify-end tutor-pt-32 tutor-pt-sm-44">
385 <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">
386 <?php esc_html_e( 'Skip To Next', 'tutor' ); ?>
387 </a>
388 </div>
389 <?php endif; ?>
390 <?php else : ?>
391
392 <?php if ( $submitted_assignment ) : ?>
393 <?php
394 $is_reviewed_by_instructor = get_comment_meta( $submitted_assignment->comment_ID, 'evaluate_time', true );
395
396 $assignment_id = $submitted_assignment->comment_post_ID;
397 $submit_id = $submitted_assignment->comment_ID;
398
399 $max_mark = tutor_utils()->get_assignment_option( $submitted_assignment->comment_post_ID, 'total_mark' );
400 $pass_mark = tutor_utils()->get_assignment_option( $submitted_assignment->comment_post_ID, 'pass_mark' );
401 $given_mark = get_comment_meta( $submitted_assignment->comment_ID, 'assignment_mark', true );
402 ?>
403 <div class="tutor-assignment-result-table tutor-mt-32 tutor-mb-40">
404 <div class="tutor-table-responsive">
405 <table class="tutor-table my-quiz-attempts">
406 <thead>
407 <tr>
408 <th>
409 <?php esc_html_e( 'Date', 'tutor' ); ?>
410 </th>
411 <th>
412 <?php esc_html_e( 'Total Marks', 'tutor' ); ?>
413 </th>
414 <th>
415 <?php esc_html_e( 'Pass Marks', 'tutor' ); ?>
416 </th>
417 <th>
418 <?php esc_html_e( 'Earned Marks', 'tutor' ); ?>
419 </th>
420 <th>
421 <?php esc_html_e( 'Result', 'tutor' ); ?>
422 </th>
423 </tr>
424 </thead>
425
426 <tbody>
427 <tr>
428 <td>
429 <?php echo esc_html( tutor_utils()->convert_date_into_wp_timezone( $submitted_assignment->comment_date ) ); ?>
430 </td>
431
432 <td>
433 <?php esc_html_e( $max_mark, 'tutor' );//phpcs:ignore ?>
434 </td>
435
436 <td>
437 <?php esc_html_e( $pass_mark, 'tutor' );//phpcs:ignore ?>
438 </td>
439
440 <td>
441 <?php esc_html_e( $given_mark, 'tutor' );//phpcs:ignore ?>
442 </td>
443
444 <td>
445 <?php if ( $is_reviewed_by_instructor ) : ?>
446 <?php if ( $given_mark >= $pass_mark ) : ?>
447 <span class="tutor-badge-label label-success">
448 <?php esc_html_e( 'Passed', 'tutor' ); ?>
449 </span>
450 <?php else : ?>
451 <span class="tutor-badge-label label-danger">
452 <?php esc_html_e( 'Failed', 'tutor' ); ?>
453 </span>
454 <?php endif; ?>
455 <?php endif; ?>
456
457 <?php if ( ! $is_reviewed_by_instructor ) : ?>
458 <span class="tutor-badge-label label-warning">
459 <?php esc_html_e( 'Pending', 'tutor' ); ?>
460 </span>
461 <?php endif; ?>
462 </td>
463 </tr>
464 </tbody>
465 </table>
466 </div>
467 </div>
468
469 <?php
470 $instructor_note = get_comment_meta( $submitted_assignment->comment_ID, 'instructor_note', true );
471 if ( ! empty( $instructor_note ) && $is_reviewed_by_instructor ) :
472 ?>
473 <div class="tutor-instructor-note tutor-my-32 tutor-py-20 tutor-px-24 tutor-py-sm-32 tutor-px-sm-36">
474 <div class="tutor-in-title tutor-fs-6 tutor-fw-medium tutor-color-black">
475 <?php esc_html_e( 'Instructor Note', 'tutor' ); ?>
476 </div>
477 <div class="tutor-in-body tutor-fs-6 tutor-color-secondary tutor-pt-12 tutor-pt-sm-16">
478 <?php echo wp_kses_post( nl2br( get_comment_meta( $submitted_assignment->comment_ID, 'instructor_note', true ) ) ); ?>
479 </div>
480 </div>
481 <?php endif; ?>
482
483 <?php
484 /**
485 * If user not submitted assignment and assignment expired
486 * then show expire message
487 *
488 * @since 2.0.0
489 */
490 if ( ! $is_submitted && 0 != $time_duration['value'] && ( $now > $remaining_time ) ) :
491 ?>
492 <div class="tutor-mb-40">
493 <?php
494 $alert_template = tutor()->path . 'templates/global/alert.php';
495 if ( file_exists( $alert_template ) ) {
496 tutor_load_template_from_custom_path(
497 $alert_template,
498 array(
499 'alert_class' => 'tutor-alert tutor-danger',
500 'message' => __( 'You have missed the submission deadline. Please contact the instructor for more information.', 'tutor_pro' ),
501 'icon' => ' tutor-icon-circle-times-line',
502 )
503 );
504 }
505 ?>
506 </div>
507 <?php endif; ?>
508
509 <div class="tutor-assignment-details tutor-assignment-border-bottom tutor-pb-48 tutor-pb-sm-72">
510 <div class="tutor-ar-body tutor-pt-24 tutor-pb-40 tutor-px-16 tutor-px-md-32">
511 <div class="tutor-ar-header tutor-d-flex tutor-justify-between tutor-align-center">
512 <div class="tutor-ar-title tutor-fs-6 tutor-fw-medium tutor-color-black">
513 <?php esc_html_e( 'Your Assignment', 'tutor' ); ?>
514 </div>
515
516 <?php
517 $result = Assignments::get_assignment_result( $post_id, $user_id );
518 if ( in_array( $result, array( 'pending', 'fail' ), true ) && ( $remaining_time > $now || 0 == $time_duration['value'] ) ) :
519 ?>
520 <div class="tutor-ar-btn">
521 <a href="<?php echo esc_url( add_query_arg( 'update-assignment', $submitted_assignment->comment_ID ) ); ?>"
522 class="tutor-btn tutor-btn-outline-primary tutor-btn-sm">
523 <?php esc_html_e( 'Edit', 'tutor' ); ?>
524 </a>
525 </div>
526 <?php endif; ?>
527 </div>
528
529 <div class="tutor-fs-6 tutor-color-secondary tutor-pt-16 tutor-entry-content">
530 <?php echo wp_kses_post( nl2br( stripslashes( $submitted_assignment->comment_content ) ) ); ?>
531 </div>
532
533 <?php
534 $attached_files = get_comment_meta( $submitted_assignment->comment_ID, 'uploaded_attachments', true );
535 if ( $attached_files ) :
536 ?>
537 <?php
538 $attached_files = json_decode( $attached_files, true );
539 if ( tutor_utils()->count( $attached_files ) ) :
540 ?>
541 <div class="tutor-attachment-files submited-files tutor-d-flex tutor-flex-column tutor-mt-20 tutor-mt-sm-40">
542 <?php
543 foreach ( $attached_files as $attached_file ) :
544 ?>
545 <div class="tutor-instructor-card tutor-mt-12">
546 <div class="tutor-icard-content">
547 <div class="tutor-fs-6 tutor-color-secondary">
548 <?php echo esc_html( tutor_utils()->array_get( 'name', $attached_file ) ); ?>
549 </div>
550 <div class="tutor-fs-7"><?php esc_html_e( 'Size', 'tutor' ); ?>:
551 <?php
552 echo esc_html(
553 tutor_utils()->get_readable_filesize( $upload_basedir . $attached_file['uploaded_path'] )
554 );
555 ?>
556 </div>
557 </div>
558 <div class="tutor-d-flex tutor-align-center">
559 <a class="tutor-iconic-btn tutor-iconic-btn-outline" download
560 href="<?php echo esc_url( $upload_baseurl . tutor_utils()->array_get( 'uploaded_path', $attached_file ) ); ?>"
561 target="_blank">
562 <span class="tutor-icon-download"></span>
563 </a>
564 </div>
565 </div>
566 <?php endforeach; ?>
567 </div>
568 <?php endif; ?>
569 <?php endif; ?>
570 </div>
571 </div>
572
573 <?php $has_show_more = strlen( $s_content ) > 500 ? true : false; ?>
574
575 <?php if ( $s_content ) : ?>
576 <div class="tutor-assignment-description-details tutor-assignment-border-bottom tutor-pb-32 tutor-pb-sm-44">
577 <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;"' : ''; ?>>
578 <div class="tutor-fs-6 tutor-fw-medium tutor-color-black">
579 <?php esc_html_e( 'Description', 'tutor' ); ?>
580 </div>
581 <div class="tutor-entry-content tutor-fs-6 tutor-color-secondary tutor-pt-12">
582 <?php echo apply_filters( 'the_content', $s_content ); //phpcs:ignore ?>
583 </div>
584 </div>
585 <?php if ( $has_show_more ) : ?>
586 <a href="#" class="tutor-btn-show-more tutor-btn tutor-btn-ghost tutor-mt-32" data-tutor-toggle-more=".tutor-toggle-more-content">
587 <span class="tutor-toggle-btn-icon tutor-icon tutor-icon-plus tutor-mr-8" area-hidden="true"></span>
588 <span class="tutor-toggle-btn-text"><?php esc_html_e( 'Show More', 'tutor' ); ?></span>
589 </a>
590 <?php endif; ?>
591 </div>
592 <?php endif; ?>
593
594
595 <?php if ( $next_prev_content_id->next_id ) : ?>
596 <div class="tutor-assignment-footer tutor-pt-32 tutor-pt-sm-44">
597 <a class="tutor-btn tutor-btn-primary tutor-static-loader"
598 href="<?php echo esc_url( get_the_permalink( $next_prev_content_id->next_id ) ); ?>">
599 <?php esc_html_e( 'Continue Lesson', 'tutor' ); ?>
600 </a>
601 </div>
602 <?php endif; ?>
603 <?php else : ?>
604 <div class="tutor-assignment-footer tutor-pt-32 tutor-pt-sm-44">
605 <div class="tutor-assignment-footer-btn tutor-d-flex tutor-justify-between">
606 <form action="" method="post" id="tutor_assignment_start_form">
607 <?php wp_nonce_field( tutor()->nonce_action, tutor()->nonce ); ?>
608 <input type="hidden" value="tutor_assignment_start_submit" name="tutor_action" />
609 <input type="hidden" name="assignment_id" value="<?php echo get_the_ID(); ?>">
610 <button type="submit" id="tutor_assignment_start_btn" class="tutor-btn tutor-btn-primary"<?php echo ( ( 0 != $time_duration['value'] ) && ( $now > $remaining_time ) ) ? ' disabled' : ''; ?>>
611 <?php esc_html_e( 'Start Assignment Submit', 'tutor' ); ?>
612 </button>
613 </form>
614
615 <?php if ( $next_prev_content_id->next_id ) : ?>
616 <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">
617 <?php esc_html_e( 'Skip To Next', 'tutor' ); ?>
618 </a>
619 <?php endif; ?>
620 </div>
621 </div>
622 <?php endif; ?>
623 <?php endif; ?>
624 </div>
625 </div>
626 </div>
627
628 <?php tutor_load_template( 'single.common.footer', array( 'course_id' => $course_id ) ); ?>
629
630 <?php do_action( 'tutor_assignment/single/after/content' ); ?>
631