review.php
109 lines
| 1 | <?php |
| 2 | /** |
| 3 | * Template for displaying Assignments Review Form |
| 4 | * |
| 5 | * @since v.1.3.4 |
| 6 | * |
| 7 | * @author Themeum |
| 8 | * @url https://themeum.com |
| 9 | * |
| 10 | * @package TutorLMS/Templates |
| 11 | * @version 1.4.3 |
| 12 | */ |
| 13 | |
| 14 | $assignment_submitted_id = (int) sanitize_text_field(tutor_utils()->array_get('view_assignment', $_GET)); |
| 15 | |
| 16 | if(!$assignment_submitted_id){ |
| 17 | echo _e("Sorry, but you are looking for something that isn't here." , 'tutor'); |
| 18 | return; |
| 19 | } |
| 20 | |
| 21 | $submitted_assignment = tutor_utils()->get_assignment_submit_info($assignment_submitted_id); |
| 22 | if ( $submitted_assignment){ |
| 23 | |
| 24 | $max_mark = tutor_utils()->get_assignment_option($submitted_assignment->comment_post_ID, 'total_mark'); |
| 25 | |
| 26 | $given_mark = get_comment_meta($assignment_submitted_id, 'assignment_mark', true); |
| 27 | $instructor_note = get_comment_meta($assignment_submitted_id, 'instructor_note', true); |
| 28 | ?> |
| 29 | |
| 30 | <div class="tutor-assignment-review-header"> |
| 31 | <h3> |
| 32 | <a href="<?php echo get_the_permalink($submitted_assignment->comment_post_ID); ?>" target="_blank"> |
| 33 | <?php echo get_the_title($submitted_assignment->comment_post_ID); ?> |
| 34 | </a> |
| 35 | </h3> |
| 36 | <p> |
| 37 | <?php _e('Course' , 'tutor'); ?> : |
| 38 | <a href="<?php echo get_the_permalink($submitted_assignment->comment_parent); ?>" target="_blank"> |
| 39 | <?php echo get_the_title($submitted_assignment->comment_parent); ?> |
| 40 | </a> |
| 41 | </p> |
| 42 | </div> |
| 43 | |
| 44 | <div class="tutor-dashboard-assignment-review"> |
| 45 | <h4><?php _e('Assignment Description:', 'tutor'); ?></h4> |
| 46 | <p><?php echo nl2br(stripslashes($submitted_assignment->comment_content)); ?></p> |
| 47 | |
| 48 | <?php |
| 49 | $attached_files = get_comment_meta($submitted_assignment->comment_ID, 'uploaded_attachments', true); |
| 50 | if($attached_files){ |
| 51 | ?> |
| 52 | <h5><?php _e('Attach assignment file(s)', 'tutor'); ?></h5> |
| 53 | <div class="tutor-dashboard-assignment-files"> |
| 54 | <?php |
| 55 | $attached_files = json_decode($attached_files, true); |
| 56 | if (tutor_utils()->count($attached_files)){ |
| 57 | $upload_dir = wp_get_upload_dir(); |
| 58 | $upload_baseurl = trailingslashit(tutor_utils()->array_get('baseurl', $upload_dir)); |
| 59 | foreach ($attached_files as $attached_file){ |
| 60 | ?> |
| 61 | <div class="uploaded-files"> |
| 62 | <a href="<?php echo $upload_baseurl.tutor_utils()->array_get('uploaded_path', $attached_file) ?>" target="_blank"> <i class="tutor-icon-upload-file"></i> <?php echo tutor_utils()->array_get('name', $attached_file); ?></a> |
| 63 | </div> |
| 64 | <?php |
| 65 | } |
| 66 | } |
| 67 | ?> |
| 68 | </div> |
| 69 | <?php |
| 70 | } |
| 71 | ?> |
| 72 | </div> |
| 73 | |
| 74 | <div class="tutor-assignment-evaluate-wraps"> |
| 75 | <h3><?php _e('Evaluation', 'tutor'); ?></h3> |
| 76 | <form action="" method="post"> |
| 77 | <?php wp_nonce_field( tutor()->nonce_action, tutor()->nonce ); ?> |
| 78 | <input type="hidden" value="tutor_evaluate_assignment_submission" name="tutor_action"/> |
| 79 | <input type="hidden" value="<?php echo $assignment_submitted_id; ?>" name="assignment_submitted_id"/> |
| 80 | <div class="tutor-assignment-evaluate-row"> |
| 81 | <div class="tutor-option-field-label"> |
| 82 | <label for=""><?php _e('Your Mark', 'tutor'); ?></label> |
| 83 | </div> |
| 84 | <div class="tutor-option-field"> |
| 85 | <input type="number" name="evaluate_assignment[assignment_mark]" value="<?php echo $given_mark ? $given_mark : 0; ?>"> |
| 86 | <p class="desc"><?php echo sprintf(__('Mark this assignment out of %s', 'tutor'), "<code>{$max_mark}</code>" ); ?></p> |
| 87 | </div> |
| 88 | </div> |
| 89 | <div class="tutor-assignment-evaluate-row"> |
| 90 | <div class="tutor-option-field-label"> |
| 91 | <label for=""><?php _e('Write a note', 'tutor'); ?></label> |
| 92 | </div> |
| 93 | <div class="tutor-option-field"> |
| 94 | <textarea name="evaluate_assignment[instructor_note]"><?php echo $instructor_note; ?></textarea> |
| 95 | <p class="desc"><?php _e('Write a note to students about this submission', 'tutor'); ?></p> |
| 96 | </div> |
| 97 | </div> |
| 98 | <div class="tutor-assignment-evaluate-row"> |
| 99 | <div class="tutor-option-field-label"></div> |
| 100 | <div class="tutor-option-field"> |
| 101 | <button type="submit" class="tutor-button tutor-button-primary tutor-success"><?php _e('Evaluate this submission', 'tutor'); ?></button> |
| 102 | </div> |
| 103 | </div> |
| 104 | </form> |
| 105 | </div> |
| 106 | |
| 107 | <?php }else{ |
| 108 | _e('Assignments submission not found or not completed', 'tutor'); |
| 109 | } ?> |