PluginProbe ʕ •ᴥ•ʔ
Tutor LMS – eLearning and online course solution / 2.1.9
Tutor LMS – eLearning and online course solution v2.1.9
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
633 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 && get_the_content() ) : ?>
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 $attachment_text = _x( 'Attach assignment files (Max: ', 'Assignment attachment', 'tutor' );
282 $attachment_text .= $allow_to_upload . _x( ' file)', 'Assignment attachment', 'tutor' );
283 echo esc_html( $attachment_text );
284 ?>
285 </div>
286 <div class="tutor-attachment-files tutor-mt-12">
287 <div class="tutor-assignment-upload-btn tutor-mt-12 tutor-mt-md-0">
288 <form>
289 <label for="tutor-assignment-file-upload">
290 <input type="file" id="tutor-assignment-file-upload"
291 name="attached_assignment_files[]" multiple>
292 <a class="tutor-btn tutor-btn-primary tutor-btn-md">
293 <?php esc_html_e( 'Choose file', 'tutor' ); ?>
294 </a>
295 </label>
296 <input type="hidden" name="tutor_assignment_upload_limit"
297 value="<?php echo esc_attr( $file_upload_limit * 1000000 ); ?>">
298 </form>
299 </div>
300 <div class="tutor-input-type-size">
301 <p class="tutor-fs-7 tutor-color-secondary">
302 <?php esc_html_e( 'File Support: ', 'tutor' ); ?>
303 <span class="tutor-color-black">
304 <?php esc_html_e( 'Any standard Image, Document, Presentation, Sheet, PDF or Text file is allowed', 'tutor' ); ?>
305 </span>
306 </p>
307 <p class="tutor-fs-7 tutor-color-secondary tutor-mt-7">
308 <?php esc_html_e( 'Total File Size: Max', 'tutor' ); ?>
309 <span class="tutor-color-black">
310 <?php echo esc_html( $file_upload_limit ); ?>
311 <?php esc_html_e( 'MB', 'tutor' ); ?>
312 </span>
313 </p>
314 </div>
315 </div>
316
317 <div class="tutor-container tutor-pt-16 tutor-update-assignment-attachments">
318 <div class="tutor-row tutor-gy-3" id="tutor-student-assignment-edit-file-preview">
319 <?php
320 $submitted_attachments = get_comment_meta( $assignment_comment_id, 'uploaded_attachments' );
321 if ( is_array( $submitted_attachments ) && count( $submitted_attachments ) ) :
322 ?>
323 <?php
324 foreach ( $submitted_attachments as $attach ) :
325 $attachments = json_decode( $attach );
326 ?>
327 <?php foreach ( $attachments as $attachment ) : ?>
328 <div class="tutor-instructor-card tutor-col-sm-5 tutor-py-16 tutor-mr-16">
329 <div class="tutor-icard-content">
330 <div class="tutor-fs-6 tutor-color-secondary">
331 <?php echo esc_html( $attachment->name ); ?>
332 </div>
333 <div class="tutor-fs-7">
334 <?php echo esc_html( tutor_utils()->get_readable_filesize( $upload_basedir . $attachment->uploaded_path ) ); ?>
335 </div>
336 </div>
337 <div
338 class="tutor-attachment-file-close tutor-d-flex tutor-align-center">
339 <a class="tutor-iconic-btn tutor-iconic-btn-outline" href="<?php echo esc_url( $attachment->url ); ?>"
340 data-id="<?php echo esc_attr( $assignment_comment_id ); ?>"
341 data-name="<?php echo esc_attr( $attachment->name ); ?>" target="_blank">
342 <span class="tutor-icon-times"></span>
343 </a>
344 </div>
345 </div>
346 <?php endforeach; ?>
347 <?php endforeach; ?>
348 <?php endif; ?>
349 </div>
350 </div>
351 </div>
352 <?php endif; ?>
353
354 <div class="tutor-assignment-submit-btn tutor-mt-60">
355 <button type="submit" id="tutor_assignment_submit_btn" class="tutor-btn tutor-btn-primary tutor-btn-lg tutor-static-loader">
356 <?php esc_html_e( 'Submit Assignment', 'tutor' ); ?>
357 </button>
358 </div>
359 </div>
360 </form>
361 </div>
362
363 <?php $has_show_more = strlen( $s_content ) > 500 ? true : false; ?>
364
365 <?php if( $s_content ): ?>
366 <div class="tutor-assignment-description-details tutor-assignment-border-bottom tutor-pb-32 tutor-pb-sm-44">
367 <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;"' : ''; ?>>
368 <div class="tutor-fs-6 tutor-fw-medium tutor-color-black">
369 <?php esc_html_e( 'Description', 'tutor' ); ?>
370 </div>
371 <div class="tutor-entry-content tutor-fs-6 tutor-color-secondary tutor-pt-12">
372 <?php echo apply_filters( 'the_content', $s_content );//phpcs:ignore ?>
373 </div>
374 </div>
375
376 <?php if ( $has_show_more ) : ?>
377 <a href="#" class="tutor-btn-show-more tutor-btn tutor-btn-ghost tutor-mt-32" data-tutor-toggle-more=".tutor-toggle-more-content">
378 <span class="tutor-toggle-btn-icon tutor-icon tutor-icon-plus tutor-mr-8" area-hidden="true"></span>
379 <span class="tutor-toggle-btn-text"><?php esc_html_e( 'Show More', 'tutor' ); ?></span>
380 </a>
381 <?php endif; ?>
382 </div>
383 <?php endif; ?>
384
385 <?php if ( $next_prev_content_id->next_id ) : ?>
386 <div class="tutor-assignment-footer tutor-d-flex tutor-justify-end tutor-pt-32 tutor-pt-sm-44">
387 <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">
388 <?php esc_html_e( 'Skip To Next', 'tutor' ); ?>
389 </a>
390 </div>
391 <?php endif; ?>
392 <?php else : ?>
393
394 <?php if ( $submitted_assignment ) : ?>
395 <?php
396 $is_reviewed_by_instructor = get_comment_meta( $submitted_assignment->comment_ID, 'evaluate_time', true );
397
398 $assignment_id = $submitted_assignment->comment_post_ID;
399 $submit_id = $submitted_assignment->comment_ID;
400
401 $max_mark = tutor_utils()->get_assignment_option( $submitted_assignment->comment_post_ID, 'total_mark' );
402 $pass_mark = tutor_utils()->get_assignment_option( $submitted_assignment->comment_post_ID, 'pass_mark' );
403 $given_mark = get_comment_meta( $submitted_assignment->comment_ID, 'assignment_mark', true );
404 ?>
405 <div class="tutor-assignment-result-table tutor-mt-32 tutor-mb-40">
406 <div class="tutor-table-responsive">
407 <table class="tutor-table my-quiz-attempts">
408 <thead>
409 <tr>
410 <th>
411 <?php esc_html_e( 'Date', 'tutor' ); ?>
412 </th>
413 <th>
414 <?php esc_html_e( 'Total Marks', 'tutor' ); ?>
415 </th>
416 <th>
417 <?php esc_html_e( 'Pass Marks', 'tutor' ); ?>
418 </th>
419 <th>
420 <?php esc_html_e( 'Earned Marks', 'tutor' ); ?>
421 </th>
422 <th>
423 <?php esc_html_e( 'Result', 'tutor' ); ?>
424 </th>
425 </tr>
426 </thead>
427
428 <tbody>
429 <tr>
430 <td>
431 <?php echo esc_html( tutor_utils()->convert_date_into_wp_timezone( $submitted_assignment->comment_date ) ); ?>
432 </td>
433
434 <td>
435 <?php esc_html_e( $max_mark, 'tutor' );//phpcs:ignore ?>
436 </td>
437
438 <td>
439 <?php esc_html_e( $pass_mark, 'tutor' );//phpcs:ignore ?>
440 </td>
441
442 <td>
443 <?php esc_html_e( $given_mark, 'tutor' );//phpcs:ignore ?>
444 </td>
445
446 <td>
447 <?php if ( $is_reviewed_by_instructor ) : ?>
448 <?php if ( $given_mark >= $pass_mark ) : ?>
449 <span class="tutor-badge-label label-success">
450 <?php esc_html_e( 'Passed', 'tutor' ); ?>
451 </span>
452 <?php else : ?>
453 <span class="tutor-badge-label label-warning">
454 <?php esc_html_e( 'Failed', 'tutor' ); ?>
455 </span>
456 <?php endif; ?>
457 <?php endif; ?>
458
459 <?php if ( ! $is_reviewed_by_instructor ) : ?>
460 <span class="tutor-badge-label label-danger">
461 <?php esc_html_e( 'Pending', 'tutor' ); ?>
462 </span>
463 <?php endif; ?>
464 </td>
465 </tr>
466 </tbody>
467 </table>
468 </div>
469 </div>
470
471 <?php
472 $instructor_note = get_comment_meta( $submitted_assignment->comment_ID, 'instructor_note', true );
473 if ( ! empty( $instructor_note ) && $is_reviewed_by_instructor ) :
474 ?>
475 <div class="tutor-instructor-note tutor-my-32 tutor-py-20 tutor-px-24 tutor-py-sm-32 tutor-px-sm-36">
476 <div class="tutor-in-title tutor-fs-6 tutor-fw-medium tutor-color-black">
477 <?php esc_html_e( 'Instructor Note', 'tutor' ); ?>
478 </div>
479 <div class="tutor-in-body tutor-fs-6 tutor-color-secondary tutor-pt-12 tutor-pt-sm-16">
480 <?php echo wp_kses_post( nl2br( get_comment_meta( $submitted_assignment->comment_ID, 'instructor_note', true ) ) ); ?>
481 </div>
482 </div>
483 <?php endif; ?>
484
485 <?php
486 /**
487 * If user not submitted assignment and assignment expired
488 * then show expire message
489 *
490 * @since 2.0.0
491 */
492 if ( ! $is_submitted && 0 != $time_duration['value'] && ( $now > $remaining_time ) ) :
493 ?>
494 <div class="tutor-mb-40">
495 <?php
496 $alert_template = tutor()->path . 'templates/global/alert.php';
497 if ( file_exists( $alert_template ) ) {
498 tutor_load_template_from_custom_path(
499 $alert_template,
500 array(
501 'alert_class' => 'tutor-alert tutor-danger',
502 'message' => __( 'You have missed the submission deadline. Please contact the instructor for more information.', 'tutor_pro' ),
503 'icon' => ' tutor-icon-circle-times-line',
504 )
505 );
506 }
507 ?>
508 </div>
509 <?php endif; ?>
510
511 <div class="tutor-assignment-details tutor-assignment-border-bottom tutor-pb-48 tutor-pb-sm-72">
512 <div class="tutor-ar-body tutor-pt-24 tutor-pb-40 tutor-px-16 tutor-px-md-32">
513 <div class="tutor-ar-header tutor-d-flex tutor-justify-between tutor-align-center">
514 <div class="tutor-ar-title tutor-fs-6 tutor-fw-medium tutor-color-black">
515 <?php esc_html_e( 'Your Assignment', 'tutor' ); ?>
516 </div>
517
518 <?php
519 $evaluated = Assignments::is_evaluated( $post_id );
520 if ( ! $evaluated && ( $remaining_time > $now || 0 == $time_duration['value'] ) ) :
521 ?>
522 <div class="tutor-ar-btn">
523 <a href="<?php echo esc_url( add_query_arg( 'update-assignment', $submitted_assignment->comment_ID ) ); ?>"
524 class="tutor-btn tutor-btn-outline-primary tutor-btn-sm">
525 <?php esc_html_e( 'Edit', 'tutor' ); ?>
526 </a>
527 </div>
528 <?php endif; ?>
529 </div>
530
531 <div class="tutor-fs-6 tutor-color-secondary tutor-pt-16 tutor-entry-content">
532 <?php echo wp_kses_post( nl2br( stripslashes( $submitted_assignment->comment_content ) ) ); ?>
533 </div>
534
535 <?php
536 $attached_files = get_comment_meta( $submitted_assignment->comment_ID, 'uploaded_attachments', true );
537 if ( $attached_files ) :
538 ?>
539 <?php
540 $attached_files = json_decode( $attached_files, true );
541 if ( tutor_utils()->count( $attached_files ) ) :
542 ?>
543 <div class="tutor-attachment-files submited-files tutor-d-flex tutor-flex-column tutor-mt-20 tutor-mt-sm-40">
544 <?php
545 foreach ( $attached_files as $attached_file ) :
546 ?>
547 <div class="tutor-instructor-card tutor-mt-12">
548 <div class="tutor-icard-content">
549 <div class="tutor-fs-6 tutor-color-secondary">
550 <?php echo esc_html( tutor_utils()->array_get( 'name', $attached_file ) ); ?>
551 </div>
552 <div class="tutor-fs-7"><?php esc_html_e( 'Size', 'tutor' ); ?>:
553 <?php
554 echo esc_html(
555 tutor_utils()->get_readable_filesize( $upload_basedir . $attached_file['uploaded_path'] )
556 );
557 ?>
558 </div>
559 </div>
560 <div class="tutor-d-flex tutor-align-center">
561 <a class="tutor-iconic-btn tutor-iconic-btn-outline" download
562 href="<?php echo esc_url( $upload_baseurl . tutor_utils()->array_get( 'uploaded_path', $attached_file ) ); ?>"
563 target="_blank">
564 <span class="tutor-icon-download"></span>
565 </a>
566 </div>
567 </div>
568 <?php endforeach; ?>
569 </div>
570 <?php endif; ?>
571 <?php endif; ?>
572 </div>
573 </div>
574
575 <?php $has_show_more = strlen( $s_content ) > 500 ? true : false; ?>
576
577 <?php if( $s_content ): ?>
578 <div class="tutor-assignment-description-details tutor-assignment-border-bottom tutor-pb-32 tutor-pb-sm-44">
579 <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;"' : ''; ?>>
580 <div class="tutor-fs-6 tutor-fw-medium tutor-color-black">
581 <?php esc_html_e( 'Description', 'tutor' ); ?>
582 </div>
583 <div class="tutor-entry-content tutor-fs-6 tutor-color-secondary tutor-pt-12">
584 <?php echo apply_filters( 'the_content', $s_content ); //phpcs:ignore ?>
585 </div>
586 </div>
587 <?php if ( $has_show_more ) : ?>
588 <a href="#" class="tutor-btn-show-more tutor-btn tutor-btn-ghost tutor-mt-32" data-tutor-toggle-more=".tutor-toggle-more-content">
589 <span class="tutor-toggle-btn-icon tutor-icon tutor-icon-plus tutor-mr-8" area-hidden="true"></span>
590 <span class="tutor-toggle-btn-text"><?php esc_html_e( 'Show More', 'tutor' ); ?></span>
591 </a>
592 <?php endif; ?>
593 </div>
594 <?php endif; ?>
595
596
597 <?php if ( $next_prev_content_id->next_id ) : ?>
598 <div class="tutor-assignment-footer tutor-pt-32 tutor-pt-sm-44">
599 <a class="tutor-btn tutor-btn-primary tutor-static-loader"
600 href="<?php echo esc_url( get_the_permalink( $next_prev_content_id->next_id ) ); ?>">
601 <?php esc_html_e( 'Continue Lesson', 'tutor' ); ?>
602 </a>
603 </div>
604 <?php endif; ?>
605 <?php else : ?>
606 <div class="tutor-assignment-footer tutor-pt-32 tutor-pt-sm-44">
607 <div class="tutor-assignment-footer-btn tutor-d-flex tutor-justify-between">
608 <form action="" method="post" id="tutor_assignment_start_form">
609 <?php wp_nonce_field( tutor()->nonce_action, tutor()->nonce ); ?>
610 <input type="hidden" value="tutor_assignment_start_submit" name="tutor_action" />
611 <input type="hidden" name="assignment_id" value="<?php echo get_the_ID(); ?>">
612 <button type="submit" id="tutor_assignment_start_btn" class="tutor-btn tutor-btn-primary"<?php echo ( ( 0 != $time_duration['value'] ) && ( $now > $remaining_time ) ) ? ' disabled' : ''; ?>>
613 <?php esc_html_e( 'Start Assignment Submit', 'tutor' ); ?>
614 </button>
615 </form>
616
617 <?php if ( $next_prev_content_id->next_id ) : ?>
618 <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">
619 <?php esc_html_e( 'Skip To Next', 'tutor' ); ?>
620 </a>
621 <?php endif; ?>
622 </div>
623 </div>
624 <?php endif; ?>
625 <?php endif; ?>
626 </div>
627 </div>
628 </div>
629
630 <?php tutor_load_template( 'single.common.footer', array( 'course_id' => $course_id ) ); ?>
631
632 <?php do_action( 'tutor_assignment/single/after/content' ); ?>
633