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