tutor-instructor.php
60 lines
| 1 | <?php |
| 2 | /** |
| 3 | * Tutor instructor |
| 4 | * |
| 5 | * @package Tutor\Templates |
| 6 | * @subpackage Shortcode |
| 7 | * @author Themeum <support@themeum.com> |
| 8 | * @link https://themeum.com |
| 9 | * @since 2.0.0 |
| 10 | */ |
| 11 | |
| 12 | use Tutor\Models\CourseModel; |
| 13 | |
| 14 | ?> |
| 15 | <div class="tutor-pagination-wrapper-replaceable tutor-instructor-list-wrapper"> |
| 16 | <?php if ( count( $instructors ) ) : ?> |
| 17 | <div class="tutor-instructor-list"> |
| 18 | <div class="tutor-grid tutor-grid-<?php echo esc_attr( $column_count ); ?>"> |
| 19 | <?php foreach ( $instructors as $instructor ) : ?> |
| 20 | <?php |
| 21 | $instructor->course_count = CourseModel::get_course_count_by_instructor( $instructor->ID ); |
| 22 | $instructor->ratings = tutor_utils()->get_instructor_ratings( $instructor->ID ); |
| 23 | tutor_load_template( |
| 24 | 'instructor.' . $layout, |
| 25 | array( |
| 26 | 'instructor' => $instructor, |
| 27 | ) |
| 28 | ); |
| 29 | ?> |
| 30 | <?php endforeach; ?> |
| 31 | </div> |
| 32 | </div> |
| 33 | <?php else : ?> |
| 34 | <?php tutor_utils()->tutor_empty_state( 'No Instructor Found', 'tutor' ); ?> |
| 35 | <?php endif; ?> |
| 36 | |
| 37 | <?php |
| 38 | // @todo: convert to pagination |
| 39 | if ( $current_page > 1 || $instructors_count > $limit ) { |
| 40 | $pagination_data = array( |
| 41 | 'total_items' => $instructors_count, |
| 42 | 'per_page' => $limit, |
| 43 | 'paged' => $current_page, |
| 44 | 'ajax' => array_merge( |
| 45 | $filter, |
| 46 | array( |
| 47 | 'loading_container' => '.tutor-instructor-list-wrapper', |
| 48 | 'action' => 'load_filtered_instructor', |
| 49 | ) |
| 50 | ), |
| 51 | ); |
| 52 | |
| 53 | tutor_load_template_from_custom_path( |
| 54 | tutor()->path . 'templates/dashboard/elements/pagination.php', |
| 55 | $pagination_data |
| 56 | ); |
| 57 | } |
| 58 | ?> |
| 59 | </div> |
| 60 |