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