ecommerce
6 months ago
tools
1 year ago
add_new_instructor.php
2 years ago
addons.php
1 year ago
announcements.php
11 months ago
answer.php
3 years ago
course-builder.php
1 year ago
course-list.php
10 months ago
enable_disable_addons.php
10 months ago
feature-promotion.php
2 years ago
get-pro.php
8 months ago
instructors.php
11 months ago
question_answer.php
11 months ago
quiz_attempts.php
9 months ago
students.php
11 months ago
tools.php
3 years ago
view_attempt.php
6 months ago
welcome.php
1 year ago
whats-new.php
11 months ago
withdraw_requests.php
9 months ago
students.php
199 lines
| 1 | <?php |
| 2 | /** |
| 3 | * Student List Template. |
| 4 | * |
| 5 | * @package Tutor\Views |
| 6 | * @subpackage Tutor\Students |
| 7 | * @author Themeum <support@themeum.com> |
| 8 | * @link https://themeum.com |
| 9 | * @since 2.0.0 |
| 10 | */ |
| 11 | |
| 12 | if ( ! defined( 'ABSPATH' ) ) { |
| 13 | exit; |
| 14 | } |
| 15 | |
| 16 | use TUTOR\Input; |
| 17 | use Tutor\Models\CourseModel; |
| 18 | |
| 19 | $students = tutor_lms()->student_list; |
| 20 | |
| 21 | //phpcs:disable WordPress.WP.GlobalVariablesOverride.Prohibited |
| 22 | $user_id = Input::get( 'user_id', '' ); |
| 23 | $course_id = Input::get( 'course-id', '' ); |
| 24 | $order = Input::get( 'order', 'DESC' ); |
| 25 | $date = Input::has( 'date' ) ? tutor_get_formated_date( 'Y-m-d', Input::get( 'date' ) ) : ''; |
| 26 | $search = Input::get( 'search', '' ); |
| 27 | |
| 28 | /** |
| 29 | * Pagination data |
| 30 | */ |
| 31 | $paged = Input::get( 'paged', 1, Input::TYPE_INT ); |
| 32 | $per_page = tutor_utils()->get_option( 'pagination_per_page' ); |
| 33 | $offset = ( $per_page * $paged ) - $per_page; |
| 34 | |
| 35 | $students_list = tutor_utils()->get_students( $offset, $per_page, $search, $course_id, $date, $order ); |
| 36 | $total = tutor_utils()->get_total_students( $search, $course_id, $date ); |
| 37 | //phpcs:enable |
| 38 | |
| 39 | /** |
| 40 | * Navbar data to make nav menu |
| 41 | */ |
| 42 | $navbar_data = array( |
| 43 | 'page_title' => $students->page_title, |
| 44 | ); |
| 45 | |
| 46 | /** |
| 47 | * Bulk action & filters |
| 48 | */ |
| 49 | $filters = array( |
| 50 | 'bulk_action' => tutor_utils()->has_user_role( 'administrator' ) ? $students->bulk_action : false, |
| 51 | 'bulk_actions' => $students->prpare_bulk_actions(), |
| 52 | 'ajax_action' => 'tutor_student_bulk_action', |
| 53 | 'filters' => array( |
| 54 | array( |
| 55 | 'label' => __( 'Courses', 'tutor' ), |
| 56 | 'field_type' => 'select', |
| 57 | 'field_name' => 'course-id', |
| 58 | 'options' => CourseModel::get_course_dropdown_options(), |
| 59 | 'searchable' => true, |
| 60 | 'value' => Input::get( 'course-id', '' ), |
| 61 | ), |
| 62 | array( |
| 63 | 'label' => __( 'Date', 'tutor' ), |
| 64 | 'field_type' => 'date', |
| 65 | 'field_name' => 'date', |
| 66 | 'show_label' => true, |
| 67 | 'value' => Input::get( 'date', '' ), |
| 68 | ), |
| 69 | ), |
| 70 | ); |
| 71 | |
| 72 | ?> |
| 73 | |
| 74 | <div class="tutor-admin-wrap"> |
| 75 | |
| 76 | <?php |
| 77 | /** |
| 78 | * Load Templates with data. |
| 79 | */ |
| 80 | $navbar_template = tutor()->path . 'views/elements/list-navbar.php'; |
| 81 | $filters_template = tutor()->path . 'views/elements/list-filters.php'; |
| 82 | tutor_load_template_from_custom_path( $navbar_template, $navbar_data ); |
| 83 | tutor_load_template_from_custom_path( $filters_template, $filters ); |
| 84 | ?> |
| 85 | |
| 86 | <div class="tutor-admin-container tutor-admin-container-lg tutor-mt-16"> |
| 87 | <?php if ( is_array( $students_list ) && count( $students_list ) ) : ?> |
| 88 | <div class="tutor-table-responsive tutor-dashboard-list-table"> |
| 89 | <table class="tutor-table tutor-table-middle tutor-table-with-checkbox"> |
| 90 | <thead> |
| 91 | <tr> |
| 92 | <th width="3%"> |
| 93 | <div class="tutor-d-flex"> |
| 94 | <input type="checkbox" id="tutor-bulk-checkbox-all" class="tutor-form-check-input" /> |
| 95 | </div> |
| 96 | </th> |
| 97 | <th class="tutor-table-rows-sorting"> |
| 98 | <?php esc_html_e( 'Students', 'tutor' ); ?> |
| 99 | <span class="tutor-icon-ordering-a-z a-to-z-sort-icon"></span> |
| 100 | </th> |
| 101 | <th class="tutor-table-rows-sorting"> |
| 102 | <?php esc_html_e( 'Email', 'tutor' ); ?> |
| 103 | <span class="tutor-icon-order-down up-down-icon"></span> |
| 104 | </th> |
| 105 | <th class="tutor-table-rows-sorting"> |
| 106 | <?php esc_html_e( 'Registration Date', 'tutor' ); ?> |
| 107 | <span class="tutor-icon-order-down up-down-icon"></span> |
| 108 | </th> |
| 109 | <th class="tutor-table-rows-sorting"> |
| 110 | <?php esc_html_e( 'Course Taken', 'tutor' ); ?> |
| 111 | <span class="tutor-icon-order-down up-down-icon"></span> |
| 112 | </th> |
| 113 | <th></th> |
| 114 | </tr> |
| 115 | </thead> |
| 116 | |
| 117 | <tbody> |
| 118 | <?php |
| 119 | foreach ( $students_list as $list ) : |
| 120 | $reg_date = $list->user_registered; |
| 121 | ?> |
| 122 | <tr> |
| 123 | <td> |
| 124 | <div class="tutor-d-flex"> |
| 125 | <input id="tutor-admin-list-<?php echo esc_attr( $list->ID ); ?>" type="checkbox" class="tutor-form-check-input tutor-bulk-checkbox" name="tutor-bulk-checkbox-all" value="<?php echo esc_attr( $list->ID ); ?>" /> |
| 126 | </div> |
| 127 | </td> |
| 128 | <td> |
| 129 | <div class="tutor-d-flex tutor-align-center tutor-gap-1"> |
| 130 | <?php |
| 131 | echo wp_kses( |
| 132 | tutor_utils()->get_tutor_avatar( $list->ID ), |
| 133 | tutor_utils()->allowed_avatar_tags() |
| 134 | ); |
| 135 | ?> |
| 136 | <span> |
| 137 | <?php echo esc_html( $list->display_name ); ?> |
| 138 | </span> |
| 139 | <a href="<?php echo esc_url( tutor_utils()->profile_url( $list->ID, false ) ); ?>" class="tutor-iconic-btn" target="_blank"> |
| 140 | <span class="tutor-icon-external-link" area-hidden="True"></span> |
| 141 | </a> |
| 142 | </div> |
| 143 | </td> |
| 144 | <td> |
| 145 | <div class="tutor-d-flex tutor-align-center" style="gap: 5px;"> |
| 146 | <span class="tutor-fs-7"> |
| 147 | <?php echo esc_html( $list->user_email ); ?> |
| 148 | </span> |
| 149 | <?php do_action( 'tutor_show_email_verified_badge', $list->ID ); ?> |
| 150 | </div> |
| 151 | </td> |
| 152 | <td> |
| 153 | <span class="tutor-fs-7"> |
| 154 | <?php echo esc_html( $reg_date ? tutor_i18n_get_formated_date( tutor_utils()->get_local_time_from_unix( $list->user_registered ) ) : '' ); ?> |
| 155 | </span> |
| 156 | </td> |
| 157 | <td> |
| 158 | <?php $course_taken = tutor_utils()->get_enrolled_courses_ids_by_user( $list->ID ); ?> |
| 159 | <span class="tutor-fs-7"><?php echo esc_html( is_array( $course_taken ) ? count( $course_taken ) : 0 ); ?></span> |
| 160 | </td> |
| 161 | <td> |
| 162 | <?php if ( tutor()->has_pro ) : ?> |
| 163 | <div class="tutor-d-flex tutor-align-center tutor-gap-1"> |
| 164 | <?php do_action( 'tutor_before_student_details_btn', $list->ID ); ?> |
| 165 | <a href="<?php echo esc_url( admin_url( 'admin.php?page=tutor_report&sub_page=students&student_id=' . $list->ID ) ); ?>" |
| 166 | class="tutor-btn tutor-btn-tertiary tutor-btn-sm"> |
| 167 | <?php esc_html_e( 'Details', 'tutor' ); ?> |
| 168 | </a> |
| 169 | </div> |
| 170 | <?php endif; ?> |
| 171 | </td> |
| 172 | </tr> |
| 173 | <?php endforeach; ?> |
| 174 | </tbody> |
| 175 | </table> |
| 176 | </div> |
| 177 | <?php else : ?> |
| 178 | <?php tutils()->render_list_empty_state(); ?> |
| 179 | <?php endif; ?> |
| 180 | |
| 181 | <div class="tutor-admin-page-pagination-wrapper tutor-mt-32"> |
| 182 | <?php |
| 183 | /** |
| 184 | * Prepare pagination data & load template |
| 185 | */ |
| 186 | if ( $total > $per_page ) { |
| 187 | $pagination_data = array( |
| 188 | 'total_items' => $total, |
| 189 | 'per_page' => $per_page, |
| 190 | 'paged' => $paged, |
| 191 | ); |
| 192 | $pagination_template = tutor()->path . 'views/elements/pagination.php'; |
| 193 | tutor_load_template_from_custom_path( $pagination_template, $pagination_data ); |
| 194 | } |
| 195 | ?> |
| 196 | </div> |
| 197 | </div> |
| 198 | </div> |
| 199 |