content.php
707 lines
| 1 | <?php |
| 2 | |
| 3 | /** |
| 4 | * @package TutorLMS/Templates |
| 5 | * @version 1.4.3 |
| 6 | */ |
| 7 | |
| 8 | use \TUTOR_ASSIGNMENTS\Assignments; |
| 9 | |
| 10 | if ( ! defined( 'ABSPATH' ) ) { |
| 11 | exit; |
| 12 | } |
| 13 | global $post; |
| 14 | global $wpdb; |
| 15 | global $next_id; |
| 16 | global $assignment_submitted_id; |
| 17 | $is_submitted = false; |
| 18 | $is_submitting = tutor_utils()->is_assignment_submitting( get_the_ID() ); |
| 19 | // get the comment |
| 20 | $post_id = get_the_ID(); |
| 21 | $user_id = get_current_user_id(); |
| 22 | $user_data = get_userdata( $user_id ); |
| 23 | $assignment_comment = tutor_utils()->get_single_comment_user_post_id( $post_id, $user_id ); |
| 24 | // $submitted_assignment = tutor_utils()->get_assignment_submit_info( $assignment_submitted_id ); |
| 25 | $submitted_assignment = tutor_utils()->is_assignment_submitted( get_the_ID() ); |
| 26 | if ( $assignment_comment != false ) { |
| 27 | $submitted = $assignment_comment->comment_approved; |
| 28 | $submitted == 'submitted' ? $is_submitted = true : ''; |
| 29 | } |
| 30 | |
| 31 | // Get the ID of this content and the corresponding course |
| 32 | $course_content_id = get_the_ID(); |
| 33 | $course_id = tutor_utils()->get_course_id_by_subcontent( $course_content_id ); |
| 34 | |
| 35 | // Get total content count |
| 36 | $course_stats = tutor_utils()->get_course_completed_percent( $course_id, 0, true ); |
| 37 | |
| 38 | function tutor_assignment_convert_seconds( $seconds ) { |
| 39 | $dt1 = new DateTime( '@0' ); |
| 40 | $dt2 = new DateTime( "@$seconds" ); |
| 41 | return $dt1->diff( $dt2 )->format( '%a Days, %h Hours' ); |
| 42 | } |
| 43 | $next_prev_content_id = tutor_utils()->get_course_prev_next_contents_by_id( $post_id ); |
| 44 | $content = get_the_content(); |
| 45 | $s_content = $content; |
| 46 | $allow_to_upload = (int) tutor_utils()->get_assignment_option( $post_id, 'upload_files_limit' ); |
| 47 | ?> |
| 48 | |
| 49 | <?php do_action( 'tutor_assignment/single/before/content' ); ?> |
| 50 | |
| 51 | <div class="tutor-single-page-top-bar tutor-d-flex tutor-justify-content-between"> |
| 52 | <div class="tutor-topbar-left-item tutor-d-flex"> |
| 53 | <div class="tutor-topbar-item tutor-topbar-sidebar-toggle tutor-hide-sidebar-bar flex-center tutor-d-none tutor-d-xl-flex"> |
| 54 | <a href="javascript:;" class="tutor-lesson-sidebar-hide-bar"> |
| 55 | <span class="tutor-icon-icon-light-left-line tutor-color-white flex-center"></span> |
| 56 | </a> |
| 57 | </div> |
| 58 | <div class="tutor-topbar-item tutor-topbar-content-title-wrap flex-center"> |
| 59 | <span class="tutor-icon-assignment-filled tutor-icon-24 tutor-color-white tutor-mr-4"></span> |
| 60 | <span class="text-regular-caption tutor-color-design-white"> |
| 61 | <?php |
| 62 | esc_html_e( 'Assignment: ', 'tutor' ); |
| 63 | the_title(); |
| 64 | ?> |
| 65 | </span> |
| 66 | </div> |
| 67 | </div> |
| 68 | <div class="tutor-topbar-right-item tutor-d-flex"> |
| 69 | <div class="tutor-topbar-assignment-details tutor-d-flex tutor-align-items-center"> |
| 70 | <?php |
| 71 | do_action( 'tutor_course/single/enrolled/before/lead_info/progress_bar' ); |
| 72 | ?> |
| 73 | <div class="text-regular-caption tutor-color-design-white"> |
| 74 | <span class="tutor-progress-content tutor-color-primary-60"> |
| 75 | <?php _e( 'Your Progress:', 'tutor' ); ?> |
| 76 | </span> |
| 77 | <span class="text-bold-caption"> |
| 78 | <?php echo $course_stats['completed_count']; ?> |
| 79 | </span> |
| 80 | <?php _e( 'of ', 'tutor' ); ?> |
| 81 | <span class="text-bold-caption"> |
| 82 | <?php echo $course_stats['total_count']; ?> |
| 83 | </span> |
| 84 | (<?php echo $course_stats['completed_percent'] . '%'; ?>) |
| 85 | </div> |
| 86 | <?php |
| 87 | do_action( 'tutor_course/single/enrolled/after/lead_info/progress_bar' ); |
| 88 | ?> |
| 89 | </div> |
| 90 | <div class="tutor-topbar-cross-icon tutor-ml-16 flex-center"> |
| 91 | <?php $course_id = tutor_utils()->get_course_id_by( 'lesson', get_the_ID() ); ?> |
| 92 | <a href="<?php echo esc_url( get_the_permalink( $course_id ) ); ?>"> |
| 93 | <span class="tutor-icon-line-cross-line tutor-color-white flex-center"></span> |
| 94 | </a> |
| 95 | </div> |
| 96 | </div> |
| 97 | </div> |
| 98 | |
| 99 | <div class="tutor-mobile-top-navigation tutor-d-block tutor-d-sm-none tutor-my-20 tutor-mx-12"> |
| 100 | <div class="tutor-mobile-top-nav d-grid"> |
| 101 | <a href="<?php echo esc_url( get_the_permalink( isset( $previous_id ) ? $previous_id : '' ) ); ?>"> |
| 102 | <span class="tutor-top-nav-icon tutor-icon-previous-line design-lightgrey"></span> |
| 103 | </a> |
| 104 | <div class="tutor-top-nav-title tutor-fs-6 tutor-fw-normal tutor-color-black"> |
| 105 | <?php |
| 106 | the_title(); |
| 107 | ?> |
| 108 | </div> |
| 109 | </div> |
| 110 | </div> |
| 111 | <div class="tutor-quiz-wrapper tutor-quiz-wrapper tutor-d-flex justify-content-center tutor-mt-36 tutor-pb-80"> |
| 112 | <div id="tutor-assignment-wrap" class="tutor-quiz-wrap tutor-course-assignment-details tutor-submit-assignment tutor-assignment-result-pending"> |
| 113 | <div class="tutor-assignment-title tutor-fs-4 tutor-fw-medium tutor-color-black"> |
| 114 | <?php the_title(); ?> |
| 115 | </div> |
| 116 | |
| 117 | <?php |
| 118 | $time_duration = tutor_utils()->get_assignment_option( |
| 119 | get_the_ID(), |
| 120 | 'time_duration', |
| 121 | array( |
| 122 | 'time' => '', |
| 123 | 'value' => 0, |
| 124 | ) |
| 125 | ); |
| 126 | |
| 127 | $total_mark = tutor_utils()->get_assignment_option( get_the_ID(), 'total_mark' ); |
| 128 | $pass_mark = tutor_utils()->get_assignment_option( get_the_ID(), 'pass_mark' ); |
| 129 | $file_upload_limit = tutor_utils()->get_assignment_option( get_the_ID(), 'upload_file_size_limit' ); |
| 130 | |
| 131 | global $post; |
| 132 | $assignment_created_time = strtotime( $post->post_date_gmt ); |
| 133 | $time_duration_in_sec = 0; |
| 134 | if ( isset( $time_duration['value'] ) and isset( $time_duration['time'] ) ) { |
| 135 | switch ( $time_duration['time'] ) { |
| 136 | case 'hours': |
| 137 | $time_duration_in_sec = 3600; |
| 138 | break; |
| 139 | case 'days': |
| 140 | $time_duration_in_sec = 86400; |
| 141 | break; |
| 142 | case 'weeks': |
| 143 | $time_duration_in_sec = 7 * 86400; |
| 144 | break; |
| 145 | default: |
| 146 | $time_duration_in_sec = 0; |
| 147 | break; |
| 148 | } |
| 149 | } |
| 150 | |
| 151 | $time_duration_in_sec = $time_duration_in_sec * $time_duration['value']; |
| 152 | $remaining_time = $assignment_created_time + $time_duration_in_sec; |
| 153 | $now = time(); |
| 154 | $remaining = $now - $remaining_time; |
| 155 | |
| 156 | ?> |
| 157 | <?php if ( ! $submitted_assignment ) { ?> |
| 158 | <div class="tutor-assignment-meta-info tutor-d-flex tutor-justify-content-between tutor-mt-24 tutor-mt-sm-32 tutor-py-16 tutor-py-sm-24"> |
| 159 | <div class="tutor-assignment-detail-info tutor-d-flex"> |
| 160 | <div class="tutor-assignment-duration"> |
| 161 | <span class="text-regular-body tutor-color-muted"><?php esc_html_e( 'Duration:', 'tutor' ); ?></span> |
| 162 | <span class="tutor-fs-6 tutor-fw-medium tutor-color-black"> |
| 163 | <?php echo esc_html( $time_duration['value'] ? $time_duration['value'] . ' ' . $time_duration['time'] : __( 'No limit', 'tutor' ) ); ?> |
| 164 | </span> |
| 165 | </div> |
| 166 | <div class="tutor-assignmetn-deadline"> |
| 167 | <span class="text-regular-body tutor-color-muted"><?php esc_html_e( 'Deadline:', 'tutor' ); ?></span> |
| 168 | <span class="tutor-fs-6 tutor-fw-medium tutor-color-black"> |
| 169 | <?php |
| 170 | if ( $time_duration['value'] != 0 ) { |
| 171 | if ( $now > $remaining_time and $is_submitted == false ) { |
| 172 | esc_html_e( 'Expired', 'tutor' ); |
| 173 | } else { |
| 174 | echo esc_html( tutor_assignment_convert_seconds( $remaining ) ); |
| 175 | } |
| 176 | } else { |
| 177 | esc_html_e( 'N\\A', 'tutor' ); |
| 178 | } |
| 179 | ?> |
| 180 | </span> |
| 181 | </div> |
| 182 | </div> |
| 183 | <div class="tutor-assignment-detail-info tutor-d-flex"> |
| 184 | <div class="tutor-assignment-marks"> |
| 185 | <span class="text-regular-body tutor-color-muted"><?php _e( 'Total Marks:', 'tutor' ); ?></span> |
| 186 | <span class="tutor-fs-6 tutor-fw-medium tutor-color-black"><?php echo $total_mark; ?></span> |
| 187 | </div> |
| 188 | <div class="tutor-assignmetn-pass-mark"> |
| 189 | <span class="text-regular-body tutor-color-muted"><?php _e( 'Passing Mark:', 'tutor' ); ?></span> |
| 190 | <span class="tutor-fs-6 tutor-fw-medium tutor-color-black"><?php echo $pass_mark; ?></span> |
| 191 | </div> |
| 192 | </div> |
| 193 | </div> |
| 194 | <?php } ?> |
| 195 | <?php |
| 196 | /* |
| 197 | *time_duration[value]==0 means no limit |
| 198 | *if have unlimited time then no msg should |
| 199 | *appear |
| 200 | */ |
| 201 | if ( $time_duration['value'] != 0 ) : |
| 202 | if ( $now > $remaining_time and $is_submitted == false ) : |
| 203 | ?> |
| 204 | <div class="quiz-flash-message tutor-mt-24 tutor-mt-sm-32"> |
| 205 | <div class="tutor-quiz-warning-box time-over tutor-d-flex tutor-align-items-center tutor-justify-content-between"> |
| 206 | <div class="flash-info tutor-d-flex tutor-align-items-center"> |
| 207 | <span class="tutor-icon-cross-cricle-filled tutor-color-design-danger tutor-mr-8"></span> |
| 208 | <span class="text-regular-caption tutor-color-danger-100"> |
| 209 | <?php _e( 'You have missed the submission deadline. Please contact the instructor for more information.', 'tutor' ); ?> |
| 210 | </span> |
| 211 | </div> |
| 212 | </div> |
| 213 | </div> |
| 214 | <?php |
| 215 | endif; |
| 216 | endif; |
| 217 | ?> |
| 218 | <?php if ( ! $is_submitting && ! $submitted_assignment ) { ?> |
| 219 | <div class="tutor-time-out-assignment-details tutor-assignment-border-bottom tutor-pb-48 tutor-pb-sm-72"> |
| 220 | <div class="tutor-to-assignment tutor-pt-32 tutor-pt-sm-40 has-show-more"> |
| 221 | |
| 222 | <div class="tutor-to-title tutor-fs-6 tutor-fw-medium tutor-color-black"> |
| 223 | <?php _e( 'Description', 'tutor' ); ?> |
| 224 | </div> |
| 225 | |
| 226 | <div class="tutor-to-body tutor-fs-6 tutor-fw-normal tutor-color-black-60 tutor-pt-12 tutor-entry-content"> |
| 227 | <?php the_content(); ?> |
| 228 | </div> |
| 229 | |
| 230 | </div> |
| 231 | </div> |
| 232 | <?php } ?> |
| 233 | <?php |
| 234 | $assignment_attachments = maybe_unserialize( get_post_meta( get_the_ID(), '_tutor_assignment_attachments', true ) ); |
| 235 | if ( tutor_utils()->count( $assignment_attachments ) ) { |
| 236 | ?> |
| 237 | <div class="tutor-assignment-attachments tutor-pt-40"> |
| 238 | <span class="tutor-fs-6 tutor-fw-medium tutor-color-black"> |
| 239 | <?php esc_html_e( 'Attachments', 'tutor' ); ?> |
| 240 | </span> |
| 241 | <div class="tutor-container tutor-pt-16"> |
| 242 | <div class="tutor-row tutor-gy-3"> |
| 243 | <?php if ( is_array( $assignment_attachments ) && count( $assignment_attachments ) ) : ?> |
| 244 | <?php |
| 245 | foreach ( $assignment_attachments as $attachment_id ) : |
| 246 | $attachment_name = get_post_meta( $attachment_id, '_wp_attached_file', true ); |
| 247 | $attachment_name = substr( $attachment_name, strrpos( $attachment_name, '/' ) + 1 ); |
| 248 | $file_size = tutor_utils()->get_attachment_file_size( $attachment_id ); |
| 249 | ?> |
| 250 | <div class="tutor-instructor-card tutor-col-sm-5 tutor-py-16 tutor-mr-12 tutor-ml-3"> |
| 251 | <div class="tutor-icard-content"> |
| 252 | <div class="text-regular-body color-text-title"> |
| 253 | <a href="<?php echo esc_url( wp_get_attachment_url( $attachment_id ) ); ?>" target="_blank" download> |
| 254 | <?php echo esc_html( $attachment_name ); ?> |
| 255 | </a> |
| 256 | </div> |
| 257 | <div class="text-regular-small"> |
| 258 | <?php esc_html_e( 'Size: ', 'tutor' ); ?> |
| 259 | <?php echo esc_html( $file_size ? $file_size . 'KB' : '' ); ?> |
| 260 | </div> |
| 261 | </div> |
| 262 | <div class="tutor-avatar tutor-is-xs flex-center"> |
| 263 | <a href="<?php echo esc_url( wp_get_attachment_url( $attachment_id ) ); ?>" target="_blank" download> |
| 264 | <span class="tutor-icon-download-line"></span> |
| 265 | </a> |
| 266 | </div> |
| 267 | </div> |
| 268 | <?php endforeach; ?> |
| 269 | <?php endif; ?> |
| 270 | </div> |
| 271 | </div> |
| 272 | </div> |
| 273 | <?php |
| 274 | } |
| 275 | |
| 276 | if ( ( $is_submitting || isset( $_GET['update-assignment'] ) ) && ( $remaining_time > $now || $time_duration['value'] == 0 ) ) { |
| 277 | |
| 278 | ?> |
| 279 | |
| 280 | <div class="tutor-assignment-submission tutor-assignment-border-bottom tutor-pb-48 tutor-pb-sm-72"> |
| 281 | <form action="" method="post" id="tutor_assignment_submit_form" enctype="multipart/form-data"> |
| 282 | <?php wp_nonce_field( tutor()->nonce_action, tutor()->nonce ); ?> |
| 283 | <input type="hidden" value="tutor_assignment_submit" name="tutor_action" /> |
| 284 | <input type="hidden" value="<?php echo tutor()->current_url; ?>" name="_wp_http_referer" /> |
| 285 | <input type="hidden" name="assignment_id" value="<?php echo get_the_ID(); ?>"> |
| 286 | |
| 287 | <?php $allowed_upload_files = (int) tutor_utils()->get_assignment_option( get_the_ID(), 'upload_files_limit' ); ?> |
| 288 | <div class="tutor-assignment-body tutor-pt-32 tutor-pt-sm-40 has-show-more"> |
| 289 | <div class="tutor-to-title tutor-fs-6 tutor-fw-medium tutor-color-black"> |
| 290 | <?php _e( 'Assignment Submission', 'tutor' ); ?> |
| 291 | </div> |
| 292 | <div class="text-regular-caption tutor-color-black-60 tutor-pt-16 tutor-pt-sm-32"> |
| 293 | <?php _e( 'Assignment answer form', 'tutor' ); ?> |
| 294 | </div> |
| 295 | <div class="tutor-assignment-text-area tutor-pt-20"> |
| 296 | <!-- <textarea name="assignment_answer" class="tutor-form-control"></textarea> --> |
| 297 | <?php |
| 298 | $assignment_comment_id = isset( $_GET['update-assignment'] ) ? sanitize_text_field( $_GET['update-assignment'] ) : 0; |
| 299 | $content = $assignment_comment_id ? get_comment( $assignment_comment_id ) : ''; |
| 300 | $args = tutor_utils()->text_editor_config(); |
| 301 | $args['tinymce'] = array( |
| 302 | 'toolbar1' => 'formatselect,bold,italic,underline,forecolor,bullist,numlist,alignleft,aligncenter,alignright,alignjustify,undo,redo', |
| 303 | ); |
| 304 | $args['editor_height'] = '140'; |
| 305 | $editor_args = array( |
| 306 | 'content' => isset( $content->comment_content ) ? $content->comment_content : '', |
| 307 | 'args' => $args, |
| 308 | ); |
| 309 | $text_editor_template = tutor()->path . 'templates/global/tutor-text-editor.php'; |
| 310 | tutor_load_template_from_custom_path( $text_editor_template, $editor_args ); |
| 311 | ?> |
| 312 | </div> |
| 313 | |
| 314 | <?php if ( $allowed_upload_files ) { ?> |
| 315 | <div class="tutor-assignment-attachment tutor-mt-32 tutor-py-20 tutor-px-16 tutor-py-sm-32 tutor-px-sm-32"> |
| 316 | <div class="text-regular-caption tutor-color-black-60"> |
| 317 | <?php _e( "Attach assignment files (Max: $allow_to_upload file)", 'tutor' ); ?> |
| 318 | </div> |
| 319 | <div class="tutor-attachment-files tutor-mt-12"> |
| 320 | <div class="tutor-assignment-upload-btn tutor-mt-12 tutor-mt-md-0"> |
| 321 | <form> |
| 322 | <label for="tutor-assignment-file-upload"> |
| 323 | <input type="file" id="tutor-assignment-file-upload" name="attached_assignment_files[]" multiple> |
| 324 | <a class="tutor-btn tutor-btn-primary tutor-btn-md"> |
| 325 | <?php _e( 'Choose file', 'tutor' ); ?> |
| 326 | </a> |
| 327 | </label> |
| 328 | <input type="hidden" name="tutor_assignment_upload_limit" value="<?php echo $file_upload_limit * 1000000?>"> |
| 329 | </form> |
| 330 | </div> |
| 331 | <div class="tutor-input-type-size"> |
| 332 | <p class="text-regular-small tutor-color-black-60"> |
| 333 | <?php _e( 'File Support: ', 'tutor' ); ?> |
| 334 | <span class="tutor-color-black"> |
| 335 | <?php esc_html_e( 'Any standard Image, Document, Presentation, Sheet, PDF or Text file is allowed', 'tutor' ); ?> |
| 336 | </span> |
| 337 | </p> |
| 338 | <p class="text-regular-small tutor-color-black-60 tutor-mt-7"> |
| 339 | <?php _e( 'Total File Size: Max', 'tutor' ); ?> |
| 340 | <span class="tutor-color-black"> |
| 341 | <?php echo $file_upload_limit; ?> |
| 342 | <?php _e( 'MB', 'tutor' ); ?> |
| 343 | </span> |
| 344 | </p> |
| 345 | </div> |
| 346 | </div> |
| 347 | <!-- uploaded attachment by students --> |
| 348 | <div class="tutor-container tutor-pt-16 tutor-update-assignment-attachments"> |
| 349 | <div class="tutor-row tutor-gy-3" id="tutor-student-assignment-edit-file-preview"> |
| 350 | <?php |
| 351 | $submitted_attachments = get_comment_meta( $assignment_comment_id, 'uploaded_attachments' ); |
| 352 | if ( is_array( $submitted_attachments ) && count( $submitted_attachments ) ) : |
| 353 | foreach ( $submitted_attachments as $attach ) : |
| 354 | $attachments = json_decode( $attach ); |
| 355 | ?> |
| 356 | <?php foreach ( $attachments as $attachment ) : ?> |
| 357 | <div class="tutor-instructor-card tutor-col-sm-5 tutor-py-16 tutor-mr-16"> |
| 358 | <div class="tutor-icard-content"> |
| 359 | <div class="text-regular-body tutor-color-black-70"> |
| 360 | <?php echo esc_html( $attachment->name ); ?> |
| 361 | </div> |
| 362 | <div class="text-regular-small">Size: 230KB;</div> |
| 363 | </div> |
| 364 | <div class="tutor-attachment-file-close tutor-avatar tutor-is-xs flex-center"> |
| 365 | <a href="<?php echo esc_url( $attachment->url ); ?>" data-id="<?php echo esc_attr( $assignment_comment_id ); ?>" data-name="<?php echo esc_attr( $attachment->name ); ?>" target="_blank"> |
| 366 | <span class="tutor-icon-cross-filled color-design-brand"></span> |
| 367 | </a> |
| 368 | </div> |
| 369 | </div> |
| 370 | <?php endforeach; ?> |
| 371 | <?php endforeach; ?> |
| 372 | <?php endif; ?> |
| 373 | </div> |
| 374 | </div> |
| 375 | <!-- uploaded attachment by students end --> |
| 376 | </div> |
| 377 | |
| 378 | <?php } ?> |
| 379 | <div class="tutor-assignment-submit-btn tutor-mt-60"> |
| 380 | <button type="submit" class="tutor-btn tutor-btn-primary tutor-btn-lg" id="tutor_assignment_submit_btn"> |
| 381 | <?php esc_html_e( 'Submit Assignment', 'tutor' ); ?> |
| 382 | </button> |
| 383 | </div> |
| 384 | </div> |
| 385 | </form> |
| 386 | </div> <!-- assignment-submission --> |
| 387 | <div class="tutor-assignment-description-details tutor-assignment-border-bottom tutor-pb-32 tutor-pb-sm-44"> |
| 388 | <div class="tutor-pt-40 tutor-pt-sm-60 <?php echo esc_attr( strlen( $s_content ) > 500 ? 'tutor-ad-body has-show-more' : '' ); ?>" id="content-section"> |
| 389 | <div class="text-medium-h6 tutor-color-black"> |
| 390 | <?php _e( 'Description', 'tutor' ); ?> |
| 391 | </div> |
| 392 | <div class="text-regular-body tutor-color-black-60 tutor-pt-12 tutor-entry-content" id="short-text"> |
| 393 | <?php |
| 394 | if ( strlen( $s_content ) > 500 ) { |
| 395 | echo wp_kses_post( substr_replace( $s_content, '...', 500 ) ); |
| 396 | } else { |
| 397 | echo wp_kses_post( $s_content ); |
| 398 | } |
| 399 | ?> |
| 400 | <span id="dots"></span> |
| 401 | </div> |
| 402 | <?php if ( strlen( $s_content ) > 500 ) : ?> |
| 403 | <div class="text-regular-body tutor-color-black-60 tutor-pt-12 tutor-entry-content" id="full-text"> |
| 404 | <?php |
| 405 | echo wp_kses_post( $s_content ); |
| 406 | ?> |
| 407 | </div> |
| 408 | <div class="tutor-show-more-btn tutor-pt-12"> |
| 409 | <button class="tutor-btn tutor-btn-icon tutor-btn-disable-outline tutor-btn-ghost tutor-no-hover tutor-btn-lg" id="showBtn"> |
| 410 | <span class="btn-icon tutor-icon-plus-filled tutor-color-design-brand" id="no-icon"></span> |
| 411 | <span class="tutor-color-black"><?php esc_html_e( 'Show More', 'tutor' ); ?></span> |
| 412 | </button> |
| 413 | </div> |
| 414 | <?php endif; ?> |
| 415 | </div> |
| 416 | </div> |
| 417 | <?php if ( isset( $next_prev_content_id->next_id ) && '' !== $next_prev_content_id->next_id ) : ?> |
| 418 | <div class="tutor-assignment-footer tutor-d-flex tutor-justify-content-end tutor-pt-32 tutor-pt-sm-44"> |
| 419 | <a href="<?php echo esc_url( get_permalink( $next_prev_content_id->next_id ) ); ?>" class="tutor-btn tutor-btn-disable-outline tutor-no-hover tutor-btn-lg tutor-mt-md-0 tutor-mt-12"> |
| 420 | <?php esc_html_e( 'Skip To Next', 'tutor' ); ?> |
| 421 | </a> |
| 422 | </div> |
| 423 | <?php endif; ?> |
| 424 | <?php |
| 425 | } else { |
| 426 | |
| 427 | /** |
| 428 | * If assignment submitted |
| 429 | */ |
| 430 | if ( $submitted_assignment ) { |
| 431 | $is_reviewed_by_instructor = get_comment_meta( $submitted_assignment->comment_ID, 'evaluate_time', true ); |
| 432 | |
| 433 | |
| 434 | $assignment_id = $submitted_assignment->comment_post_ID; |
| 435 | $submit_id = $submitted_assignment->comment_ID; |
| 436 | |
| 437 | $max_mark = tutor_utils()->get_assignment_option( $submitted_assignment->comment_post_ID, 'total_mark' ); |
| 438 | $pass_mark = tutor_utils()->get_assignment_option( $submitted_assignment->comment_post_ID, 'pass_mark' ); |
| 439 | $given_mark = get_comment_meta( $submitted_assignment->comment_ID, 'assignment_mark', true ); |
| 440 | ?> |
| 441 | <div class="tutor-assignment-result-table tutor-mt-32 tutor-mb-40"> |
| 442 | <div class="tutor-ui-table-wrapper"> |
| 443 | <table class="tutor-ui-table tutor-ui-table-responsive my-quiz-attempts"> |
| 444 | <thead> |
| 445 | <tr> |
| 446 | <th> |
| 447 | <span class="text-regular-small tutor-color-black-60"> |
| 448 | <?php _e( 'Date', 'tutor' ); ?> |
| 449 | </span> |
| 450 | </th> |
| 451 | <th> |
| 452 | <span class="text-regular-small tutor-color-black-60"> |
| 453 | <?php _e( 'Total Marks', 'tutor' ); ?> |
| 454 | </span> |
| 455 | </th> |
| 456 | <th> |
| 457 | <span class="text-regular-small tutor-color-black-60"> |
| 458 | <?php _e( 'Pass Marks', 'tutor' ); ?> |
| 459 | </span> |
| 460 | </th> |
| 461 | <th> |
| 462 | <span class="text-regular-small tutor-color-black-60"> |
| 463 | <?php _e( 'Earned Marks', 'tutor' ); ?> |
| 464 | </span> |
| 465 | </th> |
| 466 | <th> |
| 467 | <span class="text-regular-small tutor-color-black-60"> |
| 468 | <?php _e( 'Result', 'tutor' ); ?> |
| 469 | </span> |
| 470 | </th> |
| 471 | </tr> |
| 472 | </thead> |
| 473 | <tbody> |
| 474 | <tr> |
| 475 | <td data-th="Date" class="date"> |
| 476 | <div class="td-statement-info"> |
| 477 | <span class="text-medium-small tutor-color-black"> |
| 478 | <?php esc_html_e( tutor_utils()->convert_date_into_wp_timezone( $submitted_assignment->comment_date ) ) ?> |
| 479 | </span> |
| 480 | </div> |
| 481 | </td> |
| 482 | <td data-th="Total Marks" class="total-marks"> |
| 483 | <span class="tutor-fs-7 tutor-fw-medium tutor-color-black"> |
| 484 | <?php esc_html_e( $max_mark, 'tutor' ); ?> |
| 485 | </span> |
| 486 | </td> |
| 487 | <td data-th="Pass Marks" class="pass-marks"> |
| 488 | <span class="tutor-fs-7 tutor-fw-medium tutor-color-black"> |
| 489 | <?php esc_html_e( $pass_mark, 'tutor' ); ?> |
| 490 | </span> |
| 491 | </td> |
| 492 | <td data-th="Earned Marks" class="earned-marks"> |
| 493 | <span class="tutor-fs-7 tutor-fw-medium tutor-color-black"> |
| 494 | <?php esc_html_e( $given_mark, 'tutor' ); ?> |
| 495 | </span> |
| 496 | </td> |
| 497 | <td data-th="Result" class="result"> |
| 498 | <?php |
| 499 | if ( $is_reviewed_by_instructor ) { |
| 500 | if ( $given_mark >= $pass_mark ) { |
| 501 | ?> |
| 502 | <span class="tutor-badge-label label-success"> |
| 503 | <?php _e( 'Passed', 'tutor' ); ?> |
| 504 | </span> |
| 505 | <?php |
| 506 | } else { |
| 507 | ?> |
| 508 | <span class="tutor-badge-label label-warning"> |
| 509 | <?php _e( 'Failed', 'tutor' ); ?> |
| 510 | </span> |
| 511 | <?php |
| 512 | } |
| 513 | } |
| 514 | ?> |
| 515 | <?php |
| 516 | if ( ! $is_reviewed_by_instructor ) { |
| 517 | ?> |
| 518 | <span class="tutor-badge-label label-danger"> |
| 519 | <?php _e( 'Pending', 'tutor' ); ?> |
| 520 | </span> |
| 521 | <?php } ?> |
| 522 | </td> |
| 523 | </tr> |
| 524 | </tbody> |
| 525 | </table> |
| 526 | </div> |
| 527 | </div> <!-- assignment-result-table --> |
| 528 | |
| 529 | |
| 530 | <?php |
| 531 | $instructor_note = get_comment_meta( $submitted_assignment->comment_ID, 'instructor_note', true ); |
| 532 | if ( !empty($instructor_note) && $is_reviewed_by_instructor ) { |
| 533 | ?> |
| 534 | <div class="tutor-instructor-note tutor-my-32 tutor-py-20 tutor-px-24 tutor-py-sm-32 tutor-px-sm-36"> |
| 535 | <div class="tutor-in-title tutor-fs-6 tutor-fw-medium tutor-color-black"> |
| 536 | <?php _e( 'Instructor Note', 'tutor' ); ?> |
| 537 | </div> |
| 538 | <div class="tutor-in-body tutor-fs-6 tutor-fw-normal tutor-color-black-60 tutor-pt-12 tutor-pt-sm-16"> |
| 539 | <?php echo nl2br( get_comment_meta( $submitted_assignment->comment_ID, 'instructor_note', true ) ); ?> |
| 540 | </div> |
| 541 | </div> |
| 542 | <?php } ?> |
| 543 | |
| 544 | <?php |
| 545 | /** |
| 546 | * If user not submitted assignment and assignment expired |
| 547 | * then show expire message |
| 548 | * |
| 549 | * @since v2.0.0 |
| 550 | */ |
| 551 | if ( ! $is_submitted && 0 != $time_duration['value'] && ( $now > $remaining_time ) ) : |
| 552 | ?> |
| 553 | <div class="tutor-mb-40"> |
| 554 | <?php |
| 555 | $alert_template = tutor()->path . 'templates/global/alert.php'; |
| 556 | if ( file_exists( $alert_template ) ) { |
| 557 | tutor_load_template_from_custom_path( |
| 558 | $alert_template, |
| 559 | array( |
| 560 | 'alert_class' => 'tutor-alert tutor-danger', |
| 561 | 'message' => __( 'You have missed the submission deadline. Please contact the instructor for more information.', 'tutor_pro' ), |
| 562 | 'icon' => ' tutor-icon-cross-circle-outline-filled', |
| 563 | ) |
| 564 | ); |
| 565 | } |
| 566 | ?> |
| 567 | </div> |
| 568 | <?php endif; ?> |
| 569 | |
| 570 | <div class="tutor-assignment-details tutor-assignment-border-bottom tutor-pb-48 tutor-pb-sm-72"> |
| 571 | <div class="tutor-ar-body tutor-pt-24 tutor-pb-40 tutor-px-16 tutor-px-md-32"> |
| 572 | <div class="tutor-ar-header tutor-d-flex tutor-justify-content-between tutor-align-items-center"> |
| 573 | <div class="tutor-ar-title tutor-fs-6 tutor-fw-medium tutor-color-black"> |
| 574 | <?php esc_html_e( 'Your Assignment', 'tutor' ); ?> |
| 575 | </div> |
| 576 | <?php |
| 577 | $evaluated = Assignments::is_evaluated( $post_id ); |
| 578 | if ( ! $evaluated && ( $remaining_time > $now || $time_duration['value'] == 0 ) ) : |
| 579 | ?> |
| 580 | <div class="tutor-ar-btn"> |
| 581 | <a href="<?php echo esc_url( add_query_arg( 'update-assignment', $submitted_assignment->comment_ID ) ); ?>" class="tutor-btn tutor-btn-tertiary tutor-is-outline tutor-btn-sm"> |
| 582 | <?php esc_html_e( 'Edit', 'tutor' ); ?> |
| 583 | </a> |
| 584 | </div> |
| 585 | <?php endif; ?> |
| 586 | </div> |
| 587 | <div class="text-regular-body tutor-color-black-60 tutor-pt-16 tutor-entry-content"> |
| 588 | <?php echo nl2br( stripslashes( $submitted_assignment->comment_content ) ); ?> |
| 589 | </div> |
| 590 | <?php |
| 591 | $attached_files = get_comment_meta( $submitted_assignment->comment_ID, 'uploaded_attachments', true ); |
| 592 | if ( $attached_files ) { |
| 593 | $attached_files = json_decode( $attached_files, true ); |
| 594 | |
| 595 | if ( tutor_utils()->count( $attached_files ) ) { |
| 596 | ?> |
| 597 | <div class="tutor-attachment-files submited-files tutor-d-flex tutor-mt-20 tutor-mt-sm-40"> |
| 598 | <?php |
| 599 | $upload_dir = wp_get_upload_dir(); |
| 600 | $upload_baseurl = trailingslashit( tutor_utils()->array_get( 'baseurl', $upload_dir ) ); |
| 601 | |
| 602 | foreach ( $attached_files as $attached_file ) { |
| 603 | ?> |
| 604 | <div class="tutor-instructor-card"> |
| 605 | <div class="tutor-icard-content"> |
| 606 | <div class="text-regular-body tutor-color-black-70"> |
| 607 | <?php echo tutor_utils()->array_get( 'name', $attached_file ); ?> |
| 608 | </div> |
| 609 | <div class="text-regular-small">Size: <?php echo tutor_utils()->array_get( 'size', $attached_file ); ?></div> |
| 610 | </div> |
| 611 | <div class="tutor-avatar tutor-is-xs flex-center"> |
| 612 | <a download href="<?php echo $upload_baseurl . tutor_utils()->array_get( 'uploaded_path', $attached_file ); ?>" target="_blank"> |
| 613 | <span class="tutor-icon-download-line tutor-color-design-brand"></span> |
| 614 | </a> |
| 615 | </div> |
| 616 | </div> |
| 617 | <?php |
| 618 | } |
| 619 | ?> |
| 620 | </div> |
| 621 | <?php |
| 622 | } |
| 623 | } |
| 624 | ?> |
| 625 | </div> |
| 626 | </div> |
| 627 | |
| 628 | <div class="tutor-assignment-description-details tutor-assignment-border-bottom tutor-pb-32 tutor-pb-sm-44"> |
| 629 | <div class="tutor-pt-40 tutor-pt-sm-60 <?php echo esc_attr( strlen( $s_content ) > 500 ? 'tutor-ad-body has-show-more' : '' ); ?>" id="content-section"> |
| 630 | <div class="text-medium-h6 tutor-color-black"> |
| 631 | <?php _e( 'Description', 'tutor' ); ?> |
| 632 | </div> |
| 633 | <div class="text-regular-body tutor-color-black-60 tutor-pt-12 tutor-entry-content" id="short-text"> |
| 634 | <?php |
| 635 | if ( strlen( $s_content ) > 500 ) { |
| 636 | echo wp_kses_post( substr_replace( $s_content, '...', 500 ) ); |
| 637 | } else { |
| 638 | echo wp_kses_post( $s_content ); |
| 639 | } |
| 640 | ?> |
| 641 | <span id="dots"></span> |
| 642 | </div> |
| 643 | <?php if ( strlen( $s_content ) > 500 ) : ?> |
| 644 | <div class="text-regular-body tutor-color-black-60 tutor-pt-12 tutor-entry-content" id="full-text"> |
| 645 | <?php |
| 646 | echo wp_kses_post( $s_content ); |
| 647 | ?> |
| 648 | </div> |
| 649 | <div class="tutor-show-more-btn tutor-pt-12"> |
| 650 | <button class="tutor-btn tutor-btn-icon tutor-btn-disable-outline tutor-btn-ghost tutor-no-hover tutor-btn-lg" id="showBtn"> |
| 651 | <span class="btn-icon tutor-icon-plus-filled tutor-color-design-brand" id="no-icon"></span> |
| 652 | <span class="tutor-color-black"><?php esc_html_e( 'Show More', 'tutor' ); ?></span> |
| 653 | </button> |
| 654 | </div> |
| 655 | <?php endif; ?> |
| 656 | </div> |
| 657 | </div> |
| 658 | <?php if ( isset( $next_prev_content_id->next_id ) && '' !== $next_prev_content_id->next_id ) : ?> |
| 659 | <div class="tutor-assignment-footer tutor-pt-32 tutor-pt-sm-44"> |
| 660 | <a class="tutor-btn tutor-btn-primary tutor-btn-lg" href="<?php echo esc_url( get_the_permalink( $next_prev_content_id->next_id ) ); ?>"> |
| 661 | <?php esc_html_e( 'Continue Lesson', 'tutor' ); ?> |
| 662 | </a> |
| 663 | </div> |
| 664 | <?php endif; ?> |
| 665 | <?php |
| 666 | } else { |
| 667 | ?> |
| 668 | <div class="tutor-assignment-footer tutor-pt-32 tutor-pt-sm-44"> |
| 669 | <div class="tutor-assignment-footer-btn tutor-d-flex tutor-justify-content-between"> |
| 670 | <form action="" method="post" id="tutor_assignment_start_form"> |
| 671 | <?php wp_nonce_field( tutor()->nonce_action, tutor()->nonce ); ?> |
| 672 | <input type="hidden" value="tutor_assignment_start_submit" name="tutor_action" /> |
| 673 | <input type="hidden" name="assignment_id" value="<?php echo get_the_ID(); ?>"> |
| 674 | <button type="submit" class="tutor-btn tutor-btn-primary |
| 675 | <?php |
| 676 | if ( $time_duration['value'] != 0 ) { |
| 677 | if ( $now > $remaining_time ) { |
| 678 | echo 'tutor-btn-disable tutor-no-hover'; } |
| 679 | } |
| 680 | ?> |
| 681 | tutor-btn-lg" id="tutor_assignment_start_btn" |
| 682 | <?php |
| 683 | if ( $time_duration['value'] != 0 ) { |
| 684 | if ( $now > $remaining_time ) { |
| 685 | echo 'disabled'; } |
| 686 | } |
| 687 | ?> |
| 688 | > |
| 689 | <?php esc_html_e( 'Start Assignment Submit', 'tutor' ); ?> |
| 690 | </button> |
| 691 | </form> |
| 692 | |
| 693 | <?php if ( isset( $next_prev_content_id->next_id ) && 0 !== $next_prev_content_id->next_id ) : ?> |
| 694 | <a href="<?php echo esc_url( get_permalink( $next_prev_content_id->next_id ) ); ?>" class="tutor-btn tutor-btn-disable-outline tutor-no-hover tutor-btn-lg tutor-mt-md-0 tutor-mt-12"> |
| 695 | <?php esc_html_e( 'Skip To Next', 'tutor' ); ?> |
| 696 | </a> |
| 697 | <?php endif; ?> |
| 698 | </div> |
| 699 | </div> |
| 700 | <?php |
| 701 | } |
| 702 | } |
| 703 | ?> |
| 704 | </div> |
| 705 | </div> |
| 706 | |
| 707 | <?php do_action( 'tutor_assignment/single/after/content' ); ?> |