PluginProbe ʕ •ᴥ•ʔ
Tutor LMS – eLearning and online course solution / 2.1.7
Tutor LMS – eLearning and online course solution v2.1.7
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
626 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 * $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' ) ); ?>
135 </span>
136 </div>
137 <div class="tutor-assignmetn-deadline">
138 <span class="tutor-fs-6 tutor-color-muted"><?php esc_html_e( 'Deadline:', 'tutor' ); ?></span>
139 <span class="tutor-fs-6 tutor-fw-medium tutor-color-black">
140 <?php
141 if ( 0 != $time_duration['value'] ) {
142 if ( $now > $remaining_time && false == $is_submitted ) {
143 esc_html_e( 'Expired', 'tutor' );
144 } else {
145 echo esc_html( tutor_assignment_convert_seconds( $remaining ) );
146 }
147 } else {
148 esc_html_e( 'N\\A', 'tutor' );
149 }
150 ?>
151 </span>
152 </div>
153 </div>
154 <div class="tutor-assignment-detail-info tutor-d-flex">
155 <div class="tutor-assignment-marks">
156 <span class="tutor-fs-6 tutor-color-muted"><?php esc_html_e( 'Total Marks:', 'tutor' ); ?></span>
157 <span class="tutor-fs-6 tutor-fw-medium tutor-color-black"><?php echo esc_html( $total_mark ); ?></span>
158 </div>
159 <div class="tutor-assignmetn-pass-mark">
160 <span class="tutor-fs-6 tutor-color-muted"><?php esc_html_e( 'Passing Mark:', 'tutor' ); ?></span>
161 <span class="tutor-fs-6 tutor-fw-medium tutor-color-black"><?php echo esc_html( $pass_mark ); ?></span>
162 </div>
163 </div>
164 </div>
165 <?php endif; ?>
166
167 <?php
168 /*
169 *time_duration[value]==0 means no limit
170 *if have unlimited time then no msg should
171 *appear
172 */
173 if ( ( 0 != $time_duration['value'] ) && ( $now > $remaining_time && false == $is_submitted ) ) :
174 ?>
175 <div class="quiz-flash-message tutor-mt-24 tutor-mt-sm-32">
176 <div class="tutor-quiz-warning-box time-over tutor-d-flex tutor-align-center tutor-justify-between">
177 <div class="flash-info tutor-d-flex tutor-align-center">
178 <span class="tutor-icon-circle-times-bold tutor-color-danger tutor-mr-8"></span>
179 <span class="tutor-fs-7 tutor-color-danger-100">
180 <?php esc_html_e( 'You have missed the submission deadline. Please contact the instructor for more information.', 'tutor' ); ?>
181 </span>
182 </div>
183 </div>
184 </div>
185 <?php endif; ?>
186
187 <?php if ( ! $is_submitting && ! $submitted_assignment ) : ?>
188 <div class="tutor-time-out-assignment-details tutor-assignment-border-bottom tutor-pb-48 tutor-pb-sm-72">
189 <div class="tutor-to-assignment tutor-pt-32 tutor-pt-sm-40">
190 <div class="tutor-to-title tutor-fs-6 tutor-fw-medium tutor-color-black">
191 <?php esc_html_e( 'Description', 'tutor' ); ?>
192 </div>
193 <div class="tutor-to-body tutor-fs-6 tutor-color-secondary tutor-pt-12 tutor-entry-content">
194 <?php the_content(); ?>
195 </div>
196 </div>
197 </div>
198 <?php endif; ?>
199
200 <?php
201 $assignment_attachments = maybe_unserialize( get_post_meta( get_the_ID(), '_tutor_assignment_attachments', true ) );
202 if ( tutor_utils()->count( $assignment_attachments ) ) :
203 ?>
204 <div class="tutor-assignment-attachments tutor-pt-40">
205 <span class="tutor-fs-6 tutor-fw-medium tutor-color-black">
206 <?php esc_html_e( 'Attachments', 'tutor' ); ?>
207 </span>
208 <div class="tutor-assignment-attachments-list tutor-pt-16">
209 <?php if ( is_array( $assignment_attachments ) && count( $assignment_attachments ) ) : ?>
210 <?php foreach ( $assignment_attachments as $attachment_id ) : ?>
211 <?php
212 $attachment_name = get_post_meta( $attachment_id, '_wp_attached_file', true );
213 $attachment_name = substr( $attachment_name, strrpos( $attachment_name, '/' ) + 1 );
214 $file_size = tutor_utils()->get_readable_filesize( get_attached_file( $attachment_id ) );
215 ?>
216 <div class="tutor-instructor-card tutor-col-sm-5 tutor-py-16 tutor-mr-12 tutor-ml-3">
217 <div class="tutor-icard-content">
218 <div class="tutor-fs-6 tutor-color-secondary">
219 <a href="<?php echo esc_url( wp_get_attachment_url( $attachment_id ) ); ?>" target="_blank"
220 download>
221 <?php echo esc_html( $attachment_name ); ?>
222 </a>
223 </div>
224 <div class="tutor-fs-7">
225 <?php esc_html_e( 'Size: ', 'tutor' ); ?>
226 <?php echo esc_html( $file_size ); ?>
227 </div>
228 </div>
229 <div class="tutor-d-flex tutor-align-center">
230 <a class="tutor-iconic-btn tutor-iconic-btn-outline" href="<?php echo esc_url( wp_get_attachment_url( $attachment_id ) ); ?>" target="_blank">
231 <span class="tutor-icon-download" area-hidden="true"></span>
232 </a>
233 </div>
234 </div>
235 <?php endforeach; ?>
236 <?php endif; ?>
237 </div>
238 </div>
239 <?php endif; ?>
240
241 <?php if ( ( $is_submitting || isset( $_GET['update-assignment'] ) ) && ( $remaining_time > $now || 0 == $time_duration['value'] ) ) : ?>
242 <div class="tutor-assignment-submission tutor-assignment-border-bottom tutor-pb-48 tutor-pb-sm-72">
243 <form action="" method="post" id="tutor_assignment_submit_form" enctype="multipart/form-data">
244 <?php wp_nonce_field( tutor()->nonce_action, tutor()->nonce ); ?>
245 <input type="hidden" value="tutor_assignment_submit" name="tutor_action" />
246 <input type="hidden" value="<?php echo esc_url( strtok( tutor()->current_url, '?' ) ); ?>" name="_wp_http_referer" />
247 <input type="hidden" name="assignment_id" value="<?php echo get_the_ID(); ?>">
248
249 <?php $allowed_upload_files = (int) tutor_utils()->get_assignment_option( get_the_ID(), 'upload_files_limit' ); ?>
250 <div class="tutor-assignment-body tutor-pt-32 tutor-pt-sm-40">
251 <div class="tutor-to-title tutor-fs-6 tutor-fw-medium tutor-color-black">
252 <?php esc_html_e( 'Assignment Submission', 'tutor' ); ?>
253 </div>
254
255 <div class="tutor-fs-7 tutor-color-secondary tutor-pt-16 tutor-pt-sm-32">
256 <?php esc_html_e( 'Assignment answer form', 'tutor' ); ?>
257 </div>
258
259 <div class="tutor-assignment-text-area tutor-pt-20">
260 <?php
261 $assignment_comment_id = Input::has( 'update-assignment' ) ? Input::get( 'update-assignment' ) : 0;
262 $content = $assignment_comment_id ? get_comment( $assignment_comment_id ) : '';
263 $args = tutor_utils()->text_editor_config();
264 $args['tinymce'] = array(
265 'toolbar1' => 'formatselect,bold,italic,underline,forecolor,bullist,numlist,alignleft,aligncenter,alignright,alignjustify,undo,redo',
266 );
267 $args['editor_height'] = '140';
268 $editor_args = array(
269 'content' => isset( $content->comment_content ) ? $content->comment_content : '',
270 'args' => $args,
271 );
272 $text_editor_template = tutor()->path . 'templates/global/tutor-text-editor.php';
273 tutor_load_template_from_custom_path( $text_editor_template, $editor_args );
274 ?>
275 </div>
276
277 <?php if ( $allowed_upload_files ) : ?>
278 <div class="tutor-assignment-attachment tutor-mt-32 tutor-py-20 tutor-px-16 tutor-py-sm-32 tutor-px-sm-32">
279 <div class="tutor-fs-7 tutor-color-secondary">
280 <?php
281 esc_html_e( sprintf( 'Attach assignment files (Max: %s file)', $allow_to_upload ), 'tutor' ); //phpcs:ignore
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 <div class="tutor-assignment-description-details tutor-assignment-border-bottom tutor-pb-32 tutor-pb-sm-44">
364 <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;"' : ''; ?>>
365 <div class="tutor-fs-6 tutor-fw-medium tutor-color-black">
366 <?php esc_html_e( 'Description', 'tutor' ); ?>
367 </div>
368 <div class="tutor-entry-content tutor-fs-6 tutor-color-secondary tutor-pt-12">
369 <?php echo apply_filters( 'the_content', $s_content );//phpcs:ignore ?>
370 </div>
371 </div>
372
373 <?php if ( $has_show_more ) : ?>
374 <a href="#" class="tutor-btn-show-more tutor-btn tutor-btn-ghost tutor-mt-32" data-tutor-toggle-more=".tutor-toggle-more-content">
375 <span class="tutor-toggle-btn-icon tutor-icon tutor-icon-plus tutor-mr-8" area-hidden="true"></span>
376 <span class="tutor-toggle-btn-text"><?php esc_html_e( 'Show More', 'tutor' ); ?></span>
377 </a>
378 <?php endif; ?>
379 </div>
380
381 <?php if ( isset( $next_prev_content_id->next_id ) && '' !== $next_prev_content_id->next_id ) : ?>
382 <div class="tutor-assignment-footer tutor-d-flex tutor-justify-end tutor-pt-32 tutor-pt-sm-44">
383 <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">
384 <?php esc_html_e( 'Skip To Next', 'tutor' ); ?>
385 </a>
386 </div>
387 <?php endif; ?>
388 <?php else : ?>
389
390 <?php if ( $submitted_assignment ) : ?>
391 <?php
392 $is_reviewed_by_instructor = get_comment_meta( $submitted_assignment->comment_ID, 'evaluate_time', true );
393
394 $assignment_id = $submitted_assignment->comment_post_ID;
395 $submit_id = $submitted_assignment->comment_ID;
396
397 $max_mark = tutor_utils()->get_assignment_option( $submitted_assignment->comment_post_ID, 'total_mark' );
398 $pass_mark = tutor_utils()->get_assignment_option( $submitted_assignment->comment_post_ID, 'pass_mark' );
399 $given_mark = get_comment_meta( $submitted_assignment->comment_ID, 'assignment_mark', true );
400 ?>
401 <div class="tutor-assignment-result-table tutor-mt-32 tutor-mb-40">
402 <div class="tutor-table-responsive">
403 <table class="tutor-table my-quiz-attempts">
404 <thead>
405 <tr>
406 <th>
407 <?php esc_html_e( 'Date', 'tutor' ); ?>
408 </th>
409 <th>
410 <?php esc_html_e( 'Total Marks', 'tutor' ); ?>
411 </th>
412 <th>
413 <?php esc_html_e( 'Pass Marks', 'tutor' ); ?>
414 </th>
415 <th>
416 <?php esc_html_e( 'Earned Marks', 'tutor' ); ?>
417 </th>
418 <th>
419 <?php esc_html_e( 'Result', 'tutor' ); ?>
420 </th>
421 </tr>
422 </thead>
423
424 <tbody>
425 <tr>
426 <td>
427 <?php echo esc_html( tutor_utils()->convert_date_into_wp_timezone( $submitted_assignment->comment_date ) ); ?>
428 </td>
429
430 <td>
431 <?php esc_html_e( $max_mark, 'tutor' );//phpcs:ignore ?>
432 </td>
433
434 <td>
435 <?php esc_html_e( $pass_mark, 'tutor' );//phpcs:ignore ?>
436 </td>
437
438 <td>
439 <?php esc_html_e( $given_mark, 'tutor' );//phpcs:ignore ?>
440 </td>
441
442 <td>
443 <?php if ( $is_reviewed_by_instructor ) : ?>
444 <?php if ( $given_mark >= $pass_mark ) : ?>
445 <span class="tutor-badge-label label-success">
446 <?php esc_html_e( 'Passed', 'tutor' ); ?>
447 </span>
448 <?php else : ?>
449 <span class="tutor-badge-label label-warning">
450 <?php esc_html_e( 'Failed', 'tutor' ); ?>
451 </span>
452 <?php endif; ?>
453 <?php endif; ?>
454
455 <?php if ( ! $is_reviewed_by_instructor ) : ?>
456 <span class="tutor-badge-label label-danger">
457 <?php esc_html_e( 'Pending', 'tutor' ); ?>
458 </span>
459 <?php endif; ?>
460 </td>
461 </tr>
462 </tbody>
463 </table>
464 </div>
465 </div>
466
467 <?php
468 $instructor_note = get_comment_meta( $submitted_assignment->comment_ID, 'instructor_note', true );
469 if ( ! empty( $instructor_note ) && $is_reviewed_by_instructor ) :
470 ?>
471 <div class="tutor-instructor-note tutor-my-32 tutor-py-20 tutor-px-24 tutor-py-sm-32 tutor-px-sm-36">
472 <div class="tutor-in-title tutor-fs-6 tutor-fw-medium tutor-color-black">
473 <?php esc_html_e( 'Instructor Note', 'tutor' ); ?>
474 </div>
475 <div class="tutor-in-body tutor-fs-6 tutor-color-secondary tutor-pt-12 tutor-pt-sm-16">
476 <?php echo wp_kses_post( nl2br( get_comment_meta( $submitted_assignment->comment_ID, 'instructor_note', true ) ) ); ?>
477 </div>
478 </div>
479 <?php endif; ?>
480
481 <?php
482 /**
483 * If user not submitted assignment and assignment expired
484 * then show expire message
485 *
486 * @since 2.0.0
487 */
488 if ( ! $is_submitted && 0 != $time_duration['value'] && ( $now > $remaining_time ) ) :
489 ?>
490 <div class="tutor-mb-40">
491 <?php
492 $alert_template = tutor()->path . 'templates/global/alert.php';
493 if ( file_exists( $alert_template ) ) {
494 tutor_load_template_from_custom_path(
495 $alert_template,
496 array(
497 'alert_class' => 'tutor-alert tutor-danger',
498 'message' => __( 'You have missed the submission deadline. Please contact the instructor for more information.', 'tutor_pro' ),
499 'icon' => ' tutor-icon-circle-times-line',
500 )
501 );
502 }
503 ?>
504 </div>
505 <?php endif; ?>
506
507 <div class="tutor-assignment-details tutor-assignment-border-bottom tutor-pb-48 tutor-pb-sm-72">
508 <div class="tutor-ar-body tutor-pt-24 tutor-pb-40 tutor-px-16 tutor-px-md-32">
509 <div class="tutor-ar-header tutor-d-flex tutor-justify-between tutor-align-center">
510 <div class="tutor-ar-title tutor-fs-6 tutor-fw-medium tutor-color-black">
511 <?php esc_html_e( 'Your Assignment', 'tutor' ); ?>
512 </div>
513
514 <?php
515 $evaluated = Assignments::is_evaluated( $post_id );
516 if ( ! $evaluated && ( $remaining_time > $now || 0 == $time_duration['value'] ) ) :
517 ?>
518 <div class="tutor-ar-btn">
519 <a href="<?php echo esc_url( add_query_arg( 'update-assignment', $submitted_assignment->comment_ID ) ); ?>"
520 class="tutor-btn tutor-btn-outline-primary tutor-btn-sm">
521 <?php esc_html_e( 'Edit', 'tutor' ); ?>
522 </a>
523 </div>
524 <?php endif; ?>
525 </div>
526
527 <div class="tutor-fs-6 tutor-color-secondary tutor-pt-16 tutor-entry-content">
528 <?php echo wp_kses_post( nl2br( stripslashes( $submitted_assignment->comment_content ) ) ); ?>
529 </div>
530
531 <?php
532 $attached_files = get_comment_meta( $submitted_assignment->comment_ID, 'uploaded_attachments', true );
533 if ( $attached_files ) :
534 ?>
535 <?php
536 $attached_files = json_decode( $attached_files, true );
537 if ( tutor_utils()->count( $attached_files ) ) :
538 ?>
539 <div class="tutor-attachment-files submited-files tutor-d-flex tutor-flex-column tutor-mt-20 tutor-mt-sm-40">
540 <?php
541 foreach ( $attached_files as $attached_file ) :
542 ?>
543 <div class="tutor-instructor-card tutor-mt-12">
544 <div class="tutor-icard-content">
545 <div class="tutor-fs-6 tutor-color-secondary">
546 <?php echo esc_html( tutor_utils()->array_get( 'name', $attached_file ) ); ?>
547 </div>
548 <div class="tutor-fs-7"><?php esc_html_e( 'Size', 'tutor' ); ?>:
549 <?php
550 echo esc_html(
551 tutor_utils()->get_readable_filesize( $upload_basedir . $attached_file['uploaded_path'] )
552 );
553 ?>
554 </div>
555 </div>
556 <div class="tutor-d-flex tutor-align-center">
557 <a class="tutor-iconic-btn tutor-iconic-btn-outline" download
558 href="<?php echo esc_url( $upload_baseurl . tutor_utils()->array_get( 'uploaded_path', $attached_file ) ); ?>"
559 target="_blank">
560 <span class="tutor-icon-download"></span>
561 </a>
562 </div>
563 </div>
564 <?php endforeach; ?>
565 </div>
566 <?php endif; ?>
567 <?php endif; ?>
568 </div>
569 </div>
570
571 <?php $has_show_more = strlen( $s_content ) > 500 ? true : false; ?>
572
573 <div class="tutor-assignment-description-details tutor-assignment-border-bottom tutor-pb-32 tutor-pb-sm-44">
574 <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;"' : ''; ?>>
575 <div class="tutor-fs-6 tutor-fw-medium tutor-color-black">
576 <?php esc_html_e( 'Description', 'tutor' ); ?>
577 </div>
578 <div class="tutor-entry-content tutor-fs-6 tutor-color-secondary tutor-pt-12">
579 <?php echo apply_filters( 'the_content', $s_content ); //phpcs:ignore ?>
580 </div>
581 </div>
582 <?php if ( $has_show_more ) : ?>
583 <a href="#" class="tutor-btn-show-more tutor-btn tutor-btn-ghost tutor-mt-32" data-tutor-toggle-more=".tutor-toggle-more-content">
584 <span class="tutor-toggle-btn-icon tutor-icon tutor-icon-plus tutor-mr-8" area-hidden="true"></span>
585 <span class="tutor-toggle-btn-text"><?php esc_html_e( 'Show More', 'tutor' ); ?></span>
586 </a>
587 <?php endif; ?>
588 </div>
589
590 <?php if ( isset( $next_prev_content_id->next_id ) && '' !== $next_prev_content_id->next_id ) : ?>
591 <div class="tutor-assignment-footer tutor-pt-32 tutor-pt-sm-44">
592 <a class="tutor-btn tutor-btn-primary tutor-static-loader"
593 href="<?php echo esc_url( get_the_permalink( $next_prev_content_id->next_id ) ); ?>">
594 <?php esc_html_e( 'Continue Lesson', 'tutor' ); ?>
595 </a>
596 </div>
597 <?php endif; ?>
598 <?php else : ?>
599 <div class="tutor-assignment-footer tutor-pt-32 tutor-pt-sm-44">
600 <div class="tutor-assignment-footer-btn tutor-d-flex tutor-justify-between">
601 <form action="" method="post" id="tutor_assignment_start_form">
602 <?php wp_nonce_field( tutor()->nonce_action, tutor()->nonce ); ?>
603 <input type="hidden" value="tutor_assignment_start_submit" name="tutor_action" />
604 <input type="hidden" name="assignment_id" value="<?php echo get_the_ID(); ?>">
605 <button type="submit" id="tutor_assignment_start_btn" class="tutor-btn tutor-btn-primary"<?php echo ( ( 0 != $time_duration['value'] ) && ( $now > $remaining_time ) ) ? ' disabled' : ''; ?>>
606 <?php esc_html_e( 'Start Assignment Submit', 'tutor' ); ?>
607 </button>
608 </form>
609
610 <?php if ( isset( $next_prev_content_id->next_id ) && 0 !== $next_prev_content_id->next_id ) : ?>
611 <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">
612 <?php esc_html_e( 'Skip To Next', 'tutor' ); ?>
613 </a>
614 <?php endif; ?>
615 </div>
616 </div>
617 <?php endif; ?>
618 <?php endif; ?>
619 </div>
620 </div>
621 </div>
622
623 <?php tutor_load_template( 'single.common.footer', array( 'course_id' => $course_id ) ); ?>
624
625 <?php do_action( 'tutor_assignment/single/after/content' ); ?>
626