ecommerce
2 months ago
tools
2 months ago
add_new_instructor.php
2 years ago
addons.php
1 year ago
announcements.php
2 months ago
answer.php
3 years ago
course-builder.php
1 year ago
course-list.php
2 months ago
enable_disable_addons.php
10 months ago
feature-promotion.php
2 years ago
get-pro.php
8 months ago
instructors.php
2 months ago
question_answer.php
11 months ago
quiz_attempts.php
10 months ago
students.php
2 months ago
tools.php
3 years ago
view_attempt.php
5 months ago
welcome.php
1 year ago
whats-new.php
11 months ago
withdraw_requests.php
2 months ago
course-list.php
517 lines
| 1 | <?php |
| 2 | /** |
| 3 | * Course List Template. |
| 4 | * |
| 5 | * @package Tutor\Views |
| 6 | * @author Themeum <support@themeum.com> |
| 7 | * @link https://themeum.com |
| 8 | * @since 2.0.0 |
| 9 | */ |
| 10 | |
| 11 | if ( ! defined( 'ABSPATH' ) ) { |
| 12 | exit; |
| 13 | } |
| 14 | |
| 15 | use TUTOR\Course_List; |
| 16 | use TUTOR\Input; |
| 17 | use Tutor\Models\CourseModel; |
| 18 | |
| 19 | $courses = tutor_lms()->course_list; |
| 20 | |
| 21 | /** |
| 22 | * Short able params |
| 23 | */ |
| 24 | $course_id = Input::get( 'course-id', '' ); |
| 25 | $order_filter = Input::get( 'order', 'DESC' ); |
| 26 | $date = Input::get( 'date', '' ); |
| 27 | $search_filter = Input::get( 'search', '' ); |
| 28 | $category_slug = Input::get( 'category', '' ); |
| 29 | |
| 30 | $current_user_id = get_current_user_id(); |
| 31 | |
| 32 | /** |
| 33 | * Determine active tab |
| 34 | */ |
| 35 | $active_tab = Input::get( 'data', 'all' ); |
| 36 | |
| 37 | /** |
| 38 | * Pagination data |
| 39 | */ |
| 40 | $paged_filter = Input::get( 'paged', 1, Input::TYPE_INT ); |
| 41 | $limit = tutor_utils()->get_option( 'pagination_per_page' ); |
| 42 | $offset = ( $limit * $paged_filter ) - $limit; |
| 43 | |
| 44 | /** |
| 45 | * Navbar data to make nav menu |
| 46 | */ |
| 47 | $add_course_url = esc_url( admin_url( 'admin.php?page=create-course' ) ); |
| 48 | $navbar_data = array( |
| 49 | 'page_title' => $courses->page_title, |
| 50 | 'add_button' => true, |
| 51 | 'button_title' => __( 'New Course', 'tutor' ), |
| 52 | 'button_url' => '#', |
| 53 | 'button_class' => 'tutor-create-new-course', |
| 54 | ); |
| 55 | |
| 56 | $status_options = $courses->tabs_key_value( $category_slug, $course_id, $date, $search_filter ); |
| 57 | |
| 58 | $categories = get_terms( |
| 59 | array( |
| 60 | 'taxonomy' => CourseModel::COURSE_CATEGORY, |
| 61 | 'orderby' => 'term_id', |
| 62 | 'order' => 'DESC', |
| 63 | ) |
| 64 | ); |
| 65 | $category_options = array( |
| 66 | array( |
| 67 | 'key' => '', |
| 68 | 'title' => __( 'All Categories', 'tutor' ), |
| 69 | ), |
| 70 | ); |
| 71 | if ( ! is_wp_error( $categories ) && ! empty( $categories ) ) { |
| 72 | foreach ( $categories as $category ) { |
| 73 | $category_options[] = array( |
| 74 | 'key' => $category->slug, |
| 75 | 'title' => $category->name, |
| 76 | ); |
| 77 | } |
| 78 | } |
| 79 | |
| 80 | /** |
| 81 | * Bulk action & filters |
| 82 | */ |
| 83 | $filters = array( |
| 84 | 'bulk_action' => $courses->bulk_action, |
| 85 | 'bulk_actions' => $courses->prepare_bulk_actions(), |
| 86 | 'ajax_action' => 'tutor_course_list_bulk_action', |
| 87 | 'filters' => apply_filters( |
| 88 | 'tutor_course_list_before_filter_items', |
| 89 | array( |
| 90 | array( |
| 91 | 'label' => __( 'Status', 'tutor' ), |
| 92 | 'field_type' => 'select', |
| 93 | 'field_name' => 'data', |
| 94 | 'options' => $status_options, |
| 95 | 'value' => Input::get( 'data', '' ), |
| 96 | ), |
| 97 | array( |
| 98 | 'label' => __( 'Category', 'tutor' ), |
| 99 | 'field_type' => 'select', |
| 100 | 'field_name' => 'category', |
| 101 | 'options' => $category_options, |
| 102 | 'searchable' => true, |
| 103 | 'value' => Input::get( 'category', '' ), |
| 104 | ), |
| 105 | array( |
| 106 | 'label' => __( 'Publish Date', 'tutor' ), |
| 107 | 'field_type' => 'date', |
| 108 | 'field_name' => 'date', |
| 109 | 'show_label' => true, |
| 110 | 'value' => Input::get( 'date', '' ), |
| 111 | ), |
| 112 | ), |
| 113 | ), |
| 114 | ); |
| 115 | |
| 116 | $args = array( |
| 117 | 'post_type' => tutor()->course_post_type, |
| 118 | 'orderby' => 'ID', |
| 119 | 'order' => $order_filter, |
| 120 | 'paged' => $paged_filter, |
| 121 | 'offset' => $offset, |
| 122 | 'posts_per_page' => tutor_utils()->get_option( 'pagination_per_page' ), |
| 123 | ); |
| 124 | |
| 125 | if ( 'all' === $active_tab || 'mine' === $active_tab ) { |
| 126 | $args['post_status'] = array( 'publish', 'pending', 'draft', 'private', 'future' ); |
| 127 | } else { |
| 128 | //phpcs:ignore WordPress.WP.GlobalVariablesOverride.Prohibited |
| 129 | $status = 'published' === $active_tab ? 'publish' : $active_tab; |
| 130 | $args['post_status'] = array( $status ); |
| 131 | } |
| 132 | |
| 133 | $date_filter = sanitize_text_field( tutor_utils()->array_get( 'date', $_GET, '' ) ); |
| 134 | |
| 135 | //phpcs:ignore WordPress.WP.GlobalVariablesOverride.Prohibited |
| 136 | $year = gmdate( 'Y', strtotime( $date_filter ) ); |
| 137 | $month = gmdate( 'm', strtotime( $date_filter ) ); |
| 138 | $day = gmdate( 'd', strtotime( $date_filter ) ); |
| 139 | // Add date query. |
| 140 | if ( '' !== $date_filter ) { |
| 141 | $args['date_query'] = array( |
| 142 | array( |
| 143 | 'year' => $year, |
| 144 | 'month' => $month, |
| 145 | 'day' => $day, |
| 146 | ), |
| 147 | ); |
| 148 | } |
| 149 | |
| 150 | if ( '' !== $course_id ) { |
| 151 | $args['p'] = $course_id; |
| 152 | } |
| 153 | // Add author param. |
| 154 | if ( 'mine' === $active_tab || ! current_user_can( 'administrator' ) ) { |
| 155 | $args['author'] = $current_user_id; |
| 156 | } |
| 157 | // Search filter. |
| 158 | if ( '' !== $search_filter ) { |
| 159 | $args['s'] = $search_filter; |
| 160 | } |
| 161 | // Category filter. |
| 162 | if ( '' !== $category_slug ) { |
| 163 | $args['tax_query'] = array( |
| 164 | array( |
| 165 | 'taxonomy' => CourseModel::COURSE_CATEGORY, |
| 166 | 'field' => 'slug', |
| 167 | 'terms' => $category_slug, |
| 168 | ), |
| 169 | ); |
| 170 | } |
| 171 | |
| 172 | add_filter( 'posts_search', '_tutor_search_by_title_only', 500, 2 ); |
| 173 | |
| 174 | $the_query = Course_List::course_list_query( $args, $current_user_id, $active_tab ); |
| 175 | |
| 176 | remove_filter( 'posts_search', '_tutor_search_by_title_only', 500 ); |
| 177 | |
| 178 | $available_status = array( |
| 179 | 'publish' => array( __( 'Publish', 'tutor' ), 'select-success' ), |
| 180 | 'pending' => array( __( 'Pending', 'tutor' ), 'select-warning' ), |
| 181 | 'trash' => array( __( 'Trash', 'tutor' ), 'select-danger' ), |
| 182 | 'draft' => array( __( 'Draft', 'tutor' ), 'select-default' ), |
| 183 | 'private' => array( __( 'Private', 'tutor' ), 'select-default' ), |
| 184 | ); |
| 185 | |
| 186 | if ( ! tutor_utils()->get_option( 'instructor_can_delete_course' ) && ! current_user_can( 'administrator' ) ) { |
| 187 | unset( $available_status['trash'] ); |
| 188 | } |
| 189 | |
| 190 | $future_list = array( |
| 191 | 'publish' => array( __( 'Publish', 'tutor' ), 'select-success' ), |
| 192 | 'future' => array( __( 'Schedule', 'tutor' ), 'select-default' ), |
| 193 | ); |
| 194 | |
| 195 | $show_course_delete = false; |
| 196 | if ( 'trash' === $active_tab && current_user_can( 'administrator' ) ) { |
| 197 | $show_course_delete = true; |
| 198 | } |
| 199 | |
| 200 | $total_courses_count = $the_query->found_posts; |
| 201 | $trashed_courses_count = 0; |
| 202 | $other_courses_count = 0; |
| 203 | if ( 0 === $total_courses_count ) { |
| 204 | // Get total courses count. |
| 205 | $list_args = array( |
| 206 | 'post_type' => tutor()->course_post_type, |
| 207 | 'post_status' => array( 'publish', 'pending', 'draft', 'private', 'future', 'trash' ), |
| 208 | 'author' => current_user_can( 'administrator' ) ? null : $current_user_id, |
| 209 | 'ignore_sticky_posts' => true, |
| 210 | 'update_post_meta_cache' => false, |
| 211 | 'update_post_term_cache' => false, |
| 212 | 'order_by' => 'none', |
| 213 | ); |
| 214 | $total_list_query = Course_List::course_list_query( $list_args, $current_user_id, 'any', true ); |
| 215 | $total_courses_count = $total_list_query->found_posts; |
| 216 | |
| 217 | if ( 0 === $total_courses_count ) { |
| 218 | $navbar_data['hide_action_buttons'] = true; |
| 219 | } else { |
| 220 | // Get other courses count (all but trashed courses). |
| 221 | $list_args['post_status'] = array( 'any' ); |
| 222 | $other_list_query = Course_List::course_list_query( $list_args, $current_user_id, 'any' ); |
| 223 | $other_courses_count = $other_list_query->found_posts; |
| 224 | |
| 225 | // Get trashed courses count. |
| 226 | if ( 0 === $other_courses_count ) { |
| 227 | $list_args['post_status'] = array( 'trash' ); |
| 228 | $trashed_list_query = Course_List::course_list_query( $list_args, $current_user_id, 'trash' ); |
| 229 | $trashed_courses_count = $trashed_list_query->found_posts; |
| 230 | } |
| 231 | } |
| 232 | } |
| 233 | ?> |
| 234 | |
| 235 | <div class="tutor-admin-wrap"> |
| 236 | <?php |
| 237 | $navbar_template = tutor()->path . 'views/elements/list-navbar.php'; |
| 238 | tutor_load_template_from_custom_path( $navbar_template, $navbar_data ); |
| 239 | |
| 240 | if ( $total_courses_count > 0 ) { |
| 241 | $filters_template = tutor()->path . 'views/elements/list-filters.php'; |
| 242 | tutor_load_template_from_custom_path( $filters_template, $filters ); |
| 243 | } |
| 244 | ?> |
| 245 | <div class="tutor-admin-container tutor-admin-container-lg"> |
| 246 | <div class="tutor-mt-16"> |
| 247 | <?php if ( $the_query->have_posts() ) : ?> |
| 248 | <div class="tutor-table-responsive tutor-dashboard-list-table"> |
| 249 | <table class="tutor-table tutor-table-middle table-dashboard-course-list"> |
| 250 | <thead class="tutor-text-sm tutor-text-400"> |
| 251 | <tr> |
| 252 | <th> |
| 253 | <div class="tutor-d-flex"> |
| 254 | <input type="checkbox" id="tutor-bulk-checkbox-all" class="tutor-form-check-input" /> |
| 255 | </div> |
| 256 | </th> |
| 257 | <th class="tutor-table-rows-sorting" width="30%"> |
| 258 | <?php esc_html_e( 'Title', 'tutor' ); ?> |
| 259 | <span class="a-to-z-sort-icon tutor-icon-ordering-a-z"></span> |
| 260 | </th> |
| 261 | <th width="13%"> |
| 262 | <?php esc_html_e( 'Categories', 'tutor' ); ?> |
| 263 | </th> |
| 264 | <th width="10%"> |
| 265 | <?php |
| 266 | $membership_only_mode = apply_filters( 'tutor_membership_only_mode', false ); |
| 267 | echo esc_html( $membership_only_mode ? __( 'Plan', 'tutor' ) : __( 'Price', 'tutor' ) ); |
| 268 | ?> |
| 269 | </th> |
| 270 | <th width="13%"> |
| 271 | <?php esc_html_e( 'Author', 'tutor' ); ?> |
| 272 | </th> |
| 273 | <th class="tutor-table-rows-sorting" width="15%"> |
| 274 | <?php esc_html_e( 'Date', 'tutor' ); ?> |
| 275 | <span class="a-to-z-sort-icon tutor-icon-ordering-a-z"></span> |
| 276 | </th> |
| 277 | <th></th> |
| 278 | </tr> |
| 279 | </thead> |
| 280 | |
| 281 | <tbody> |
| 282 | <?php |
| 283 | $course_ids = array_column( $the_query->posts, 'ID' ); |
| 284 | $course_meta_data = tutor_utils()->get_course_meta_data( $course_ids ); |
| 285 | $authors = array(); |
| 286 | |
| 287 | //phpcs:ignore WordPress.WP.GlobalVariablesOverride.Prohibited |
| 288 | foreach ( $the_query->posts as $key => $post ) : |
| 289 | $count_lesson = isset( $course_meta_data[ $post->ID ] ) ? $course_meta_data[ $post->ID ]['lesson'] : 0; |
| 290 | |
| 291 | $count_quiz = isset( $course_meta_data[ $post->ID ] ) ? $course_meta_data[ $post->ID ]['tutor_quiz'] : 0; |
| 292 | $count_assignment = isset( $course_meta_data[ $post->ID ] ) ? $course_meta_data[ $post->ID ]['tutor_assignments'] : 0; |
| 293 | $count_topic = isset( $course_meta_data[ $post->ID ] ) ? $course_meta_data[ $post->ID ]['topics'] : 0; |
| 294 | $thumbnail = get_tutor_course_thumbnail_src( 'post-thumbnail', $post->ID ); |
| 295 | |
| 296 | /** |
| 297 | * Prevent re-query for same author details inside loop |
| 298 | */ |
| 299 | if ( ! isset( $authors[ $post->post_author ] ) ) { |
| 300 | $authors[ $post->post_author ] = tutils()->get_tutor_user( $post->post_author ); |
| 301 | } |
| 302 | |
| 303 | $author_details = $authors[ $post->post_author ]; |
| 304 | $edit_link = apply_filters( 'tutor_course_list_course_edit_link', $add_course_url . "&course_id=$post->ID", $post ); |
| 305 | ?> |
| 306 | <tr> |
| 307 | <td> |
| 308 | <div class="td-checkbox tutor-d-flex "> |
| 309 | <input type="checkbox" class="tutor-form-check-input tutor-bulk-checkbox" name="tutor-bulk-checkbox-all" value="<?php echo esc_attr( $post->ID ); ?>" /> |
| 310 | </div> |
| 311 | </td> |
| 312 | |
| 313 | <td> |
| 314 | <div class="tutor-d-flex tutor-align-center tutor-gap-12px"> |
| 315 | <a href="<?php echo esc_url( $edit_link ); ?>" class="tutor-d-block"> |
| 316 | <div style="width: 76px;"> |
| 317 | <div class="tutor-ratio tutor-ratio-3x2"> |
| 318 | <img class="tutor-radius-3 <?php echo esc_attr( 'course-bundle' === $post->post_type ? 'tutor-bundle-list-thumb' : '' ); ?>" src="<?php echo esc_url( $thumbnail ); ?>" alt="<?php the_title(); ?>" loading="lazy"> |
| 319 | </div> |
| 320 | </div> |
| 321 | </a> |
| 322 | |
| 323 | <div> |
| 324 | <a class="tutor-table-link" href="<?php echo esc_url( $edit_link ); ?>"> |
| 325 | <?php echo esc_html( $post->post_title ); ?> |
| 326 | </a> |
| 327 | |
| 328 | <?php ob_start(); ?> |
| 329 | <div class="tutor-meta tutor-gap-1 tutor-mt-4"> |
| 330 | <div class="tutor-d-flex tutor-align-center tutor-gap-4px"> |
| 331 | <i class="tutor-icon-topic"></i> |
| 332 | <?php esc_html_e( 'Topic:', 'tutor' ); ?> |
| 333 | <span class="tutor-meta-value"><?php echo esc_html( $count_topic ); ?></span> |
| 334 | </div> |
| 335 | |
| 336 | <div class="tutor-d-flex tutor-align-center tutor-gap-4px"> |
| 337 | <i class="tutor-icon-note"></i> |
| 338 | <?php esc_html_e( 'Lesson:', 'tutor' ); ?> |
| 339 | <span class="tutor-meta-value"><?php echo esc_html( $count_lesson ); ?></span> |
| 340 | </div> |
| 341 | |
| 342 | <div class="tutor-d-flex tutor-align-center tutor-gap-4px"> |
| 343 | <i class="tutor-icon-quiz-2"></i> |
| 344 | <?php esc_html_e( 'Quiz:', 'tutor' ); ?> |
| 345 | <span class="tutor-meta-value"><?php echo esc_html( $count_quiz ); ?></span> |
| 346 | </div> |
| 347 | |
| 348 | <div class="tutor-d-flex tutor-align-center tutor-gap-4px"> |
| 349 | <i class="tutor-icon-report-time"></i> |
| 350 | <?php esc_html_e( 'Assignment:', 'tutor' ); ?> |
| 351 | <span class="tutor-meta-value"><?php echo esc_html( $count_assignment ); ?></span> |
| 352 | </div> |
| 353 | </div> |
| 354 | <?php echo wp_kses_post( apply_filters( 'tutor_course_list_meta', ob_get_clean(), $post ) ); ?> |
| 355 | </div> |
| 356 | </div> |
| 357 | </td> |
| 358 | |
| 359 | <td> |
| 360 | <?php |
| 361 | $terms = wp_get_post_terms( $post->ID, CourseModel::COURSE_CATEGORY ); |
| 362 | $category_text = ''; |
| 363 | if ( count( $terms ) ) { |
| 364 | $category_text = implode( ', ', array_column( $terms, 'name' ) ) . ' '; |
| 365 | } else { |
| 366 | $category_text = '...'; |
| 367 | } |
| 368 | ?> |
| 369 | <div title="<?php echo esc_attr( $category_text ); ?>" class="tutor-fw-medium tutor-fs-7 tutor-color-hints tutor-text-ellipsis-2-lines"> |
| 370 | <?php echo esc_html( $category_text ); ?> |
| 371 | </div> |
| 372 | </td> |
| 373 | <td> |
| 374 | <div class="tutor-fw-medium tutor-fs-7 tutor-color-hints"> |
| 375 | <?php |
| 376 | $price = tutor_utils()->get_course_price( $post->ID ); |
| 377 | if ( is_null( $price ) ) { |
| 378 | esc_html_e( 'Free', 'tutor' ); |
| 379 | } else { |
| 380 | echo $price; //phpcs:ignore |
| 381 | } |
| 382 | // Alert class for course status. |
| 383 | //phpcs:ignore WordPress.WP.GlobalVariablesOverride.Prohibited |
| 384 | $status = ( 'publish' === $post->post_status ? 'select-success' : ( 'pending' === $post->post_status ? 'select-warning' : ( 'trash' === $post->post_status ? 'select-danger' : ( 'private' === $post->post_status ? 'select-default' : 'select-default' ) ) ) ); |
| 385 | ?> |
| 386 | </div> |
| 387 | </td> |
| 388 | <td> |
| 389 | <div class="tutor-d-flex tutor-align-center"> |
| 390 | <?php |
| 391 | echo wp_kses( |
| 392 | tutor_utils()->get_tutor_avatar( $author_details, 'sm' ), |
| 393 | tutor_utils()->allowed_avatar_tags() |
| 394 | ) |
| 395 | ?> |
| 396 | <div class="tutor-ml-8"> |
| 397 | <a target="_blank" class="tutor-fs-7 tutor-table-link" href="<?php echo esc_url( tutor_utils()->profile_url( $author_details, true ) ); ?>"> |
| 398 | <?php echo esc_html( $author_details ? $author_details->display_name : '' ); ?> |
| 399 | </a> |
| 400 | </div> |
| 401 | </div> |
| 402 | </td> |
| 403 | <td> |
| 404 | <div class="tutor-fw-normal"> |
| 405 | <div class="tutor-fs-7 tutor-mb-4 tutor-color-black tutor-text-nowrap"> |
| 406 | <?php echo esc_html( tutor_i18n_get_formated_date( $post->post_date, get_option( 'date_format' ) ) ); ?> |
| 407 | </div> |
| 408 | <div class="tutor-fs-7 tutor-color-subdued"> |
| 409 | <?php echo esc_html( tutor_i18n_get_formated_date( $post->post_date, get_option( 'time_format' ) ) ); ?> |
| 410 | </div> |
| 411 | </div> |
| 412 | </td> |
| 413 | |
| 414 | <td> |
| 415 | <div class="tutor-d-flex tutor-align-center tutor-justify-end tutor-gap-1"> |
| 416 | <div class="tutor-form-select-with-icon <?php echo esc_attr( $status ); ?>"> |
| 417 | <select title="<?php esc_attr_e( 'Update course status', 'tutor' ); ?>" class="tutor-table-row-status-update" data-id="<?php echo esc_attr( $post->ID ); ?>" data-status="<?php echo esc_attr( $post->post_status ); ?>" data-status_key="status" data-action="tutor_change_course_status"> |
| 418 | <?php |
| 419 | $status_list = $available_status; |
| 420 | if ( 'future' === $post->post_status ) { |
| 421 | $status_list = $future_list; |
| 422 | } |
| 423 | |
| 424 | foreach ( $status_list as $key => $value ) : |
| 425 | ?> |
| 426 | <option data-status_class="<?php echo esc_attr( $value[1] ); ?>" value="<?php echo esc_attr( $key ); ?>" <?php selected( $key, $post->post_status, 'selected' ); ?>> |
| 427 | <?php echo esc_html( $value[0] ); ?> |
| 428 | </option> |
| 429 | <?php |
| 430 | endforeach; |
| 431 | ?> |
| 432 | </select> |
| 433 | <i class="icon1 tutor-icon-eye-bold"></i> |
| 434 | <i class="icon2 tutor-icon-angle-down"></i> |
| 435 | </div> |
| 436 | <a class="tutor-btn tutor-btn-tertiary tutor-btn-sm tutor-ml-4" href="<?php echo esc_url( get_permalink( $post->ID ) ); ?>" target="_blank"> |
| 437 | <?php esc_html_e( 'View', 'tutor' ); ?> |
| 438 | </a> |
| 439 | <div class="tutor-dropdown-parent"> |
| 440 | <button type="button" class="tutor-iconic-btn" action-tutor-dropdown="toggle"> |
| 441 | <span class="tutor-icon-kebab-menu" aria-hidden="true"></span> |
| 442 | </button> |
| 443 | <div id="table-dashboard-course-list-<?php echo esc_attr( $post->ID ); ?>" class="tutor-dropdown tutor-dropdown-dark tutor-text-left"> |
| 444 | <?php do_action( 'tutor_admin_befor_course_list_action', $post->ID ); ?> |
| 445 | <a class="tutor-dropdown-item" href="<?php echo esc_url( $edit_link ); ?>"> |
| 446 | <i class="tutor-icon-edit tutor-mr-8" aria-hidden="true"></i> |
| 447 | <span><?php esc_html_e( 'Edit', 'tutor' ); ?></span> |
| 448 | </a> |
| 449 | <?php do_action( 'tutor_admin_middle_course_list_action', $post->ID ); ?> |
| 450 | <?php if ( $show_course_delete ) : ?> |
| 451 | <a href="javascript:void(0)" class="tutor-dropdown-item tutor-admin-course-delete" data-tutor-modal-target="tutor-common-confirmation-modal" data-id="<?php echo esc_attr( $post->ID ); ?>"> |
| 452 | <i class="tutor-icon-trash-can-bold tutor-mr-8" aria-hidden="true"></i> |
| 453 | <span><?php esc_html_e( 'Delete Permanently', 'tutor' ); ?></span> |
| 454 | </a> |
| 455 | <?php endif; ?> |
| 456 | <?php do_action( 'tutor_admin_after_course_list_action', $post->ID ); ?> |
| 457 | </div> |
| 458 | </div> |
| 459 | </div> |
| 460 | </td> |
| 461 | </tr> |
| 462 | <?php endforeach; ?> |
| 463 | </tbody> |
| 464 | </table> |
| 465 | |
| 466 | <div class="tutor-admin-page-pagination-wrapper tutor-mt-32"> |
| 467 | <?php |
| 468 | /** |
| 469 | * Prepare pagination data & load template |
| 470 | */ |
| 471 | if ( $the_query->found_posts > $limit ) { |
| 472 | $pagination_data = array( |
| 473 | 'total_items' => $the_query->found_posts, |
| 474 | 'per_page' => $limit, |
| 475 | 'paged' => $paged_filter, |
| 476 | ); |
| 477 | $pagination_template = tutor()->path . 'views/elements/pagination.php'; |
| 478 | tutor_load_template_from_custom_path( $pagination_template, $pagination_data ); |
| 479 | } |
| 480 | ?> |
| 481 | </div> |
| 482 | </div> |
| 483 | <?php else : ?> |
| 484 | <?php |
| 485 | $template = ''; |
| 486 | $template_args = array( |
| 487 | 'title' => __( 'No Courses Found.', 'tutor' ), |
| 488 | ); |
| 489 | |
| 490 | if ( 0 === $total_courses_count ) { |
| 491 | $template = 'create-course-empty-state.php'; |
| 492 | } elseif ( 0 === $other_courses_count && 0 !== $trashed_courses_count ) { |
| 493 | $template = 'trashed-course-empty-state.php'; |
| 494 | $template_args = array( |
| 495 | 'trashed_courses_count' => $trashed_courses_count, |
| 496 | 'trashed_courses_url' => '?page=tutor&data=trash', |
| 497 | ); |
| 498 | } else { |
| 499 | $template = 'list-empty-state.php'; |
| 500 | } |
| 501 | |
| 502 | $full_path = tutor()->path . 'views/elements/' . $template; |
| 503 | tutor_load_template_from_custom_path( $full_path, $template_args ); |
| 504 | ?> |
| 505 | <?php endif; ?> |
| 506 | </div> |
| 507 | </div> |
| 508 | </div> |
| 509 | |
| 510 | <?php |
| 511 | tutor_load_template_from_custom_path( |
| 512 | tutor()->path . 'views/elements/common-confirm-popup.php', |
| 513 | array( |
| 514 | 'message' => __( 'Deletion of the course will erase all its topics, lessons, quizzes, events, and other information. Please confirm your choice.', 'tutor' ), |
| 515 | ) |
| 516 | ); |
| 517 |