bulk-confirm-popup.php
3 years ago
common-confirm-popup.php
3 years ago
filters.php
3 years ago
navbar.php
3 years ago
pagination.php
3 years ago
purchase-history-filter.php
3 years ago
search-filter.php
3 years ago
filters.php
173 lines
| 1 | <?php |
| 2 | /** |
| 3 | * Filter views |
| 4 | * |
| 5 | * A common filter element for all the backend pages |
| 6 | * |
| 7 | * @package Tutor\Views |
| 8 | * @subpackage Tutor\ViewElements |
| 9 | * @author Themeum <support@themeum.com> |
| 10 | * @link https://themeum.com |
| 11 | * @since 2.0.0 |
| 12 | */ |
| 13 | |
| 14 | use TUTOR\Input; |
| 15 | use Tutor\Models\CourseModel; |
| 16 | |
| 17 | if ( isset( $data ) ) : ?> |
| 18 | <div class="tutor-px-20"> |
| 19 | <div class="tutor-wp-dashboard-filter tutor-d-flex tutor-align-end tutor-justify-<?php echo esc_attr( isset( $data['bulk_action'] ) && true === $data['bulk_action'] ? 'between' : 'end' ); ?>"> |
| 20 | <?php if ( isset( $data['bulk_action'] ) && true === $data['bulk_action'] ) : ?> |
| 21 | <div class="tutor-wp-dashboard-filter-items tutor-d-flex tutor-flex-xl-nowrap tutor-flex-wrap"> |
| 22 | <form id="tutor-admin-bulk-action-form" action method="post"> |
| 23 | <input type="hidden" name="action" value="<?php echo esc_html( $data['ajax_action'] ); ?>" /> |
| 24 | <div class="tutor-d-flex"> |
| 25 | <div class="tutor-mr-12"> |
| 26 | <select name="bulk-action" title="Please select an action" class="tutor-form-select"> |
| 27 | <?php foreach ( $data['bulk_actions'] as $k => $v ) : ?> |
| 28 | <option value="<?php echo esc_attr( $v['value'] ); ?>"> |
| 29 | <?php echo esc_html( $v['option'] ); ?> |
| 30 | </option> |
| 31 | <?php endforeach; ?> |
| 32 | </select> |
| 33 | </div> |
| 34 | <button class="tutor-btn tutor-btn-outline-primary" id="tutor-admin-bulk-action-btn" data-tutor-modal-target="tutor-bulk-confirm-popup"> |
| 35 | <?php esc_html_e( 'Apply', 'tutor' ); ?> |
| 36 | </button> |
| 37 | </div> |
| 38 | </form> |
| 39 | </div> |
| 40 | <?php endif; ?> |
| 41 | <?php if ( isset( $data['filters'] ) && true === $data['filters'] ) : ?> |
| 42 | <?php |
| 43 | $courses = ( current_user_can( 'administrator' ) ) ? CourseModel::get_courses() : CourseModel::get_courses_by_instructor(); |
| 44 | $terms_arg = array( |
| 45 | 'taxonomy' => 'course-category', |
| 46 | 'orderby' => 'term_id', |
| 47 | 'order' => 'DESC', |
| 48 | ); |
| 49 | $categories = get_terms( $terms_arg ); |
| 50 | ?> |
| 51 | |
| 52 | <div class="tutor-wp-dashboard-filter-items tutor-d-flex tutor-flex-xl-nowrap tutor-flex-wrap"> |
| 53 | <div class="tutor-wp-dashboard-filter-item item-reset"> |
| 54 | <label class="tutor-form-label"> |
| 55 | </label> |
| 56 | <?php |
| 57 | $page = Input::get( 'page', '' ); |
| 58 | $sub_page = Input::get( 'sub_page', '' ); |
| 59 | $current_tab = Input::get( 'tab', '' ); |
| 60 | if ( '' === $sub_page && '' !== $current_tab ) { |
| 61 | $sub_page = $current_tab; |
| 62 | } |
| 63 | $url = ''; |
| 64 | /** |
| 65 | * Tab query param support added for reset link |
| 66 | * |
| 67 | * @since v2.1.0 |
| 68 | */ |
| 69 | if ( '' === $sub_page && '' === $current_tab ) { |
| 70 | $url = "?page=$page"; |
| 71 | } elseif ( '' === $current_tab ) { |
| 72 | $url = "?page=$page&sub_page=$sub_page"; |
| 73 | } else { |
| 74 | $url = "?page=$page&tab=$current_tab"; |
| 75 | } |
| 76 | |
| 77 | ?> |
| 78 | <a class="tutor-btn tutor-btn-ghost tutor-mt-sm-28" href="<?php echo esc_url( $url ); ?>"> |
| 79 | <i class="tutor-icon-refresh tutor-mr-8" area-hidden="true"></i> <?php esc_html_e( 'Reset', 'tutor' ); ?> |
| 80 | </a> |
| 81 | </div> |
| 82 | <?php |
| 83 | $course_id = Input::get( 'course-id', 0, Input::TYPE_INT ); |
| 84 | $order = Input::get( 'order', 'DESC' ); |
| 85 | $date = Input::get( 'date', '' ); |
| 86 | $search = Input::get( 'search', '' ); |
| 87 | $category_slug = Input::get( 'category', '' ); |
| 88 | ?> |
| 89 | <?php if ( isset( $data['course_filter'] ) && true === $data['course_filter'] ) : ?> |
| 90 | <div class="tutor-wp-dashboard-filter-item"> |
| 91 | <label class="tutor-form-label"> |
| 92 | <?php esc_html_e( 'Course', 'tutor' ); ?> |
| 93 | </label> |
| 94 | <select class="tutor-form-select" id="tutor-backend-filter-course"> |
| 95 | <?php if ( count( $courses ) ) : ?> |
| 96 | <option value=""> |
| 97 | <?php esc_html_e( 'All Courses', 'tutor' ); ?> |
| 98 | </option> |
| 99 | <?php foreach ( $courses as $course ) : ?> |
| 100 | <option value="<?php echo esc_attr( $course->ID ); ?>" <?php selected( $course_id, $course->ID, 'selected' ); ?>> |
| 101 | <?php echo esc_html( $course->post_title ); ?> |
| 102 | </option> |
| 103 | <?php endforeach; ?> |
| 104 | <?php else : ?> |
| 105 | <option value=""><?php esc_html_e( 'No course found', 'tutor' ); ?></option> |
| 106 | <?php endif; ?> |
| 107 | </select> |
| 108 | </div> |
| 109 | <?php endif; ?> |
| 110 | <?php if ( isset( $data['category_filter'] ) && true === $data['category_filter'] ) : ?> |
| 111 | <div class="tutor-wp-dashboard-filter-item"> |
| 112 | <label class="tutor-form-label"> |
| 113 | <?php esc_html_e( 'Category', 'tutor' ); ?> |
| 114 | </label> |
| 115 | <select class="tutor-form-select" id="tutor-backend-filter-category"> |
| 116 | <?php if ( count( $categories ) ) : ?> |
| 117 | <option value=""> |
| 118 | <?php esc_html_e( 'All Category', 'tutor' ); ?> |
| 119 | </option> |
| 120 | <?php foreach ( $categories as $category ) : ?> |
| 121 | <option value="<?php echo esc_attr( $category->slug ); ?>" <?php selected( $category_slug, $category->slug, 'selected' ); ?>> |
| 122 | <?php echo esc_html( $category->name ); ?> |
| 123 | </option> |
| 124 | <?php endforeach; ?> |
| 125 | <?php else : ?> |
| 126 | <option value=""><?php esc_html_e( 'No record found', 'tutor' ); ?></option> |
| 127 | <?php endif; ?> |
| 128 | </select> |
| 129 | </div> |
| 130 | <?php endif; ?> |
| 131 | |
| 132 | <?php if ( ! isset( $data['sort_by'] ) || true == $data['sort_by'] ) : ?> |
| 133 | <div class="tutor-wp-dashboard-filter-item"> |
| 134 | <label class="tutor-form-label"> |
| 135 | <?php esc_html_e( 'Sort By', 'tutor' ); ?> |
| 136 | </label> |
| 137 | <select class="tutor-form-select" id="tutor-backend-filter-order" data-search="no"> |
| 138 | <option value="DESC" <?php selected( $order, 'DESC', 'selected' ); ?>> |
| 139 | <?php esc_html_e( 'DESC', 'tutor' ); ?> |
| 140 | </option> |
| 141 | <option value="ASC" <?php selected( $order, 'ASC', 'selected' ); ?>> |
| 142 | <?php esc_html_e( 'ASC', 'tutor' ); ?> |
| 143 | </option> |
| 144 | </select> |
| 145 | </div> |
| 146 | <?php endif; ?> |
| 147 | <div class="tutor-wp-dashboard-filter-item"> |
| 148 | <label class="tutor-form-label"> |
| 149 | <?php esc_html_e( 'Date', 'tutor' ); ?> |
| 150 | </label> |
| 151 | <div class="tutor-v2-date-picker"></div> |
| 152 | </div> |
| 153 | <div class="tutor-wp-dashboard-filter-item"> |
| 154 | <form action="" method="get" id="tutor-admin-search-filter-form"> |
| 155 | <label class="tutor-form-label"> |
| 156 | <?php esc_html_e( 'Search', 'tutor' ); ?> |
| 157 | </label> |
| 158 | <div class="tutor-form-wrap"> |
| 159 | <span class="tutor-form-icon"><span class="tutor-icon-search" area-hidden="true"></span></span> |
| 160 | <input type="search" class="tutor-form-control" id="tutor-backend-filter-search" name="search" placeholder="<?php esc_html_e( 'Search...' ); ?>" value="<?php echo esc_html( wp_unslash( $search ) ); ?>" /> |
| 161 | </div> |
| 162 | </form> |
| 163 | </div> |
| 164 | </div> |
| 165 | <?php endif; ?> |
| 166 | </div> |
| 167 | </div> |
| 168 | <?php endif; ?> |
| 169 | |
| 170 | <?php |
| 171 | tutor_load_template_from_custom_path( tutor()->path . 'views/elements/bulk-confirm-popup.php' ); |
| 172 | ?> |
| 173 |