course.php
52 lines
| 1 | <?php |
| 2 | /** |
| 3 | * @package TutorLMS/Templates |
| 4 | * @version 1.4.3 |
| 5 | */ |
| 6 | |
| 7 | global $wpdb; |
| 8 | $course_id = (int) sanitize_text_field(tutor_utils()->array_get('course_id', $_GET)); |
| 9 | $assignments = tutor_utils()->get_assignments_by_course($course_id); |
| 10 | |
| 11 | if($assignments->count){ |
| 12 | ?> |
| 13 | |
| 14 | <h3><?php echo get_the_title($course_id) ?></h3> |
| 15 | <div class="tutor-dashboard-info-table-wrap"> |
| 16 | <table class="tutor-dashboard-info-table tutor-dashboard-assignment-table"> |
| 17 | <thead> |
| 18 | <tr> |
| 19 | <th><?php _e('Course Name', 'tutor'); ?></th> |
| 20 | <th><?php _e('Total Mark', 'tutor'); ?></th> |
| 21 | <th><?php _e('Total Submit', 'tutor'); ?></th> |
| 22 | <th> </th> |
| 23 | </tr> |
| 24 | </thead> |
| 25 | <tbody> |
| 26 | <?php |
| 27 | foreach ($assignments->results as $item){ |
| 28 | $max_mark = tutor_utils()->get_assignment_option($item->ID, 'total_mark'); |
| 29 | $course_id = tutor_utils()->get_course_id_by_assignment($item->ID); |
| 30 | $course_url = tutor_utils()->get_tutor_dashboard_page_permalink('assignments/course'); |
| 31 | $submitted_url = tutor_utils()->get_tutor_dashboard_page_permalink('assignments/submitted'); |
| 32 | $comment_count = $wpdb->get_var("SELECT COUNT(comment_ID) FROM {$wpdb->comments} WHERE comment_type = 'tutor_assignment' AND comment_post_ID = $item->ID"); |
| 33 | // @TODO: assign post_meta is empty if user don't click on update button (http://prntscr.com/oax4t8) but post status is publish |
| 34 | ?> |
| 35 | <tr> |
| 36 | <td> |
| 37 | <h5><?php echo $item->post_title ?></h5> |
| 38 | <h5><a href='<?php echo esc_url($course_url.'?course_id='.$course_id) ?>'><?php echo __('Course: ', 'tutor'). get_the_title($course_id); ?> </a></h5> |
| 39 | </td> |
| 40 | <td><?php echo $max_mark ?></td> |
| 41 | <td><?php echo $comment_count ?></td> |
| 42 | <td> <?php echo "<a title='". __('View Coures', 'tutor') ."' href='".esc_url($submitted_url.'?assignment='.$item->ID)."'><i class='tutor-icon-angle-right'></i> </a>"; ?> </td> |
| 43 | </tr> |
| 44 | <?php |
| 45 | } |
| 46 | ?> |
| 47 | </tbody> |
| 48 | </table> |
| 49 | </div> |
| 50 | <?php }else{ |
| 51 | echo '<p>'.__('No assignment available', 'tutor' ).'</p>'; |
| 52 | } |