bulk-confirm-popup.php
1 year ago
common-confirm-popup.php
1 year ago
filters.php
1 year ago
navbar.php
3 years ago
pagination.php
3 years ago
purchase-history-filter.php
1 year ago
search-filter.php
3 years ago
filters.php
224 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\Ecommerce\CouponController; |
| 15 | use Tutor\Ecommerce\OrderController; |
| 16 | use TUTOR\Input; |
| 17 | use Tutor\Models\CouponModel; |
| 18 | use Tutor\Models\CourseModel; |
| 19 | use Tutor\Models\OrderModel; |
| 20 | |
| 21 | $current_page = Input::get( 'page', '' ); |
| 22 | |
| 23 | if ( isset( $data ) ) : ?> |
| 24 | <div class="tutor-px-20"> |
| 25 | <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' ); ?>"> |
| 26 | <?php if ( isset( $data['bulk_action'] ) && true === $data['bulk_action'] ) : ?> |
| 27 | <div class="tutor-wp-dashboard-filter-items tutor-d-flex tutor-flex-xl-nowrap tutor-flex-wrap"> |
| 28 | <form id="tutor-admin-bulk-action-form" action method="post"> |
| 29 | <input type="hidden" name="action" value="<?php echo esc_html( $data['ajax_action'] ); ?>" /> |
| 30 | <div class="tutor-d-flex"> |
| 31 | <div class="tutor-mr-12"> |
| 32 | <select name="bulk-action" title="Please select an action" class="tutor-form-select"> |
| 33 | <?php foreach ( $data['bulk_actions'] as $k => $v ) : ?> |
| 34 | <option value="<?php echo esc_attr( $v['value'] ); ?>"> |
| 35 | <?php echo esc_html( $v['option'] ); ?> |
| 36 | </option> |
| 37 | <?php endforeach; ?> |
| 38 | </select> |
| 39 | </div> |
| 40 | <button class="tutor-btn tutor-btn-outline-primary" id="tutor-admin-bulk-action-btn" data-tutor-modal-target="tutor-bulk-confirm-popup"> |
| 41 | <?php esc_html_e( 'Apply', 'tutor' ); ?> |
| 42 | </button> |
| 43 | </div> |
| 44 | </form> |
| 45 | </div> |
| 46 | <?php endif; ?> |
| 47 | <?php if ( isset( $data['filters'] ) && true === $data['filters'] ) : ?> |
| 48 | <?php |
| 49 | $courses = ( current_user_can( 'administrator' ) ) ? CourseModel::get_courses() : CourseModel::get_courses_by_instructor(); |
| 50 | $terms_arg = array( |
| 51 | 'taxonomy' => CourseModel::COURSE_CATEGORY, |
| 52 | 'orderby' => 'term_id', |
| 53 | 'order' => 'DESC', |
| 54 | ); |
| 55 | $categories = get_terms( $terms_arg ); |
| 56 | ?> |
| 57 | |
| 58 | <div class="tutor-wp-dashboard-filter-items tutor-d-flex tutor-flex-xl-nowrap tutor-flex-wrap"> |
| 59 | <div class="tutor-wp-dashboard-filter-item item-reset"> |
| 60 | <label class="tutor-form-label"> |
| 61 | </label> |
| 62 | <?php |
| 63 | $page = Input::get( 'page', '' ); |
| 64 | $sub_page = Input::get( 'sub_page', '' ); |
| 65 | $current_tab = Input::get( 'tab', '' ); |
| 66 | if ( '' === $sub_page && '' !== $current_tab ) { |
| 67 | $sub_page = $current_tab; |
| 68 | } |
| 69 | $url = ''; |
| 70 | /** |
| 71 | * Tab query param support added for reset link |
| 72 | * |
| 73 | * @since v2.1.0 |
| 74 | */ |
| 75 | if ( '' === $sub_page && '' === $current_tab ) { |
| 76 | $url = "?page=$page"; |
| 77 | } elseif ( '' === $current_tab ) { |
| 78 | $url = "?page=$page&sub_page=$sub_page"; |
| 79 | } else { |
| 80 | $url = "?page=$page&tab=$current_tab"; |
| 81 | } |
| 82 | |
| 83 | ?> |
| 84 | <a class="tutor-btn tutor-btn-ghost tutor-mt-sm-28" href="<?php echo esc_url( $url ); ?>"> |
| 85 | <i class="tutor-icon-refresh tutor-mr-8" area-hidden="true"></i> <?php esc_html_e( 'Reset', 'tutor' ); ?> |
| 86 | </a> |
| 87 | </div> |
| 88 | <?php |
| 89 | $course_id = Input::get( 'course-id', 0, Input::TYPE_INT ); |
| 90 | $order = Input::get( 'order', 'DESC' ); |
| 91 | $date = Input::get( 'date', '' ); |
| 92 | $search = Input::get( 'search', '' ); |
| 93 | $category_slug = Input::get( 'category', '' ); |
| 94 | ?> |
| 95 | <?php do_action( 'tutor_data_list_before_filter_items' ); ?> |
| 96 | <?php if ( isset( $data['course_filter'] ) && true === $data['course_filter'] ) : ?> |
| 97 | <div class="tutor-wp-dashboard-filter-item"> |
| 98 | <label class="tutor-form-label"> |
| 99 | <?php esc_html_e( 'Course', 'tutor' ); ?> |
| 100 | </label> |
| 101 | <select class="tutor-form-select" id="tutor-backend-filter-course" data-searchable> |
| 102 | <?php if ( count( $courses ) ) : ?> |
| 103 | <option value=""> |
| 104 | <?php esc_html_e( 'All Courses', 'tutor' ); ?> |
| 105 | </option> |
| 106 | <?php foreach ( $courses as $course ) : ?> |
| 107 | <option value="<?php echo esc_attr( $course->ID ); ?>" <?php selected( $course_id, $course->ID, 'selected' ); ?>> |
| 108 | <?php echo esc_html( $course->post_title ); ?> |
| 109 | </option> |
| 110 | <?php endforeach; ?> |
| 111 | <?php else : ?> |
| 112 | <option value=""><?php esc_html_e( 'No course found', 'tutor' ); ?></option> |
| 113 | <?php endif; ?> |
| 114 | </select> |
| 115 | </div> |
| 116 | <?php endif; ?> |
| 117 | <?php if ( isset( $data['category_filter'] ) && true === $data['category_filter'] ) : ?> |
| 118 | <div class="tutor-wp-dashboard-filter-item"> |
| 119 | <label class="tutor-form-label"> |
| 120 | <?php esc_html_e( 'Category', 'tutor' ); ?> |
| 121 | </label> |
| 122 | <select class="tutor-form-select" id="tutor-backend-filter-category" data-searchable> |
| 123 | <?php if ( count( $categories ) ) : ?> |
| 124 | <option value=""> |
| 125 | <?php esc_html_e( 'All Category', 'tutor' ); ?> |
| 126 | </option> |
| 127 | <?php foreach ( $categories as $category ) : ?> |
| 128 | <option value="<?php echo esc_attr( $category->slug ); ?>" <?php selected( $category_slug, $category->slug, 'selected' ); ?>> |
| 129 | <?php echo esc_html( $category->name ); ?> |
| 130 | </option> |
| 131 | <?php endforeach; ?> |
| 132 | <?php else : ?> |
| 133 | <option value=""><?php esc_html_e( 'No record found', 'tutor' ); ?></option> |
| 134 | <?php endif; ?> |
| 135 | </select> |
| 136 | </div> |
| 137 | <?php endif; ?> |
| 138 | |
| 139 | <?php if ( OrderController::PAGE_SLUG === $current_page ) : ?> |
| 140 | <div class="tutor-wp-dashboard-filter-item"> |
| 141 | <label class="tutor-form-label"> |
| 142 | <?php esc_html_e( 'Payment Status', 'tutor' ); ?> |
| 143 | </label> |
| 144 | <select class="tutor-form-select" id="tutor-backend-filter-payment-status" data-search="no"> |
| 145 | <option value=""> |
| 146 | <?php esc_html_e( 'Select', 'tutor' ); ?> |
| 147 | </option> |
| 148 | <?php |
| 149 | $payment_status = OrderModel::get_payment_status(); |
| 150 | $filter_payment_status = Input::get( 'payment-status', '' ); |
| 151 | foreach ( $payment_status as $key => $value ) : |
| 152 | ?> |
| 153 | <option value="<?php echo esc_attr( $key ); ?>" <?php selected( $filter_payment_status, $key ); ?>> |
| 154 | <?php echo esc_html( $value ); ?> |
| 155 | </option> |
| 156 | <?php endforeach; ?> |
| 157 | </select> |
| 158 | </div> |
| 159 | <?php endif; ?> |
| 160 | <?php if ( CouponController::PAGE_SLUG === $current_page ) : ?> |
| 161 | <div class="tutor-wp-dashboard-filter-item"> |
| 162 | <label class="tutor-form-label"> |
| 163 | <?php esc_html_e( 'Status', 'tutor' ); ?> |
| 164 | </label> |
| 165 | <select class="tutor-form-select" id="tutor-backend-filter-coupon-status" data-search="no"> |
| 166 | <option value=""> |
| 167 | <?php esc_html_e( 'Select', 'tutor' ); ?> |
| 168 | </option> |
| 169 | <?php |
| 170 | $coupon_status = CouponModel::get_coupon_status(); |
| 171 | $filter_coupon_status = Input::get( 'coupon-status', '' ); |
| 172 | foreach ( $coupon_status as $key => $value ) : |
| 173 | ?> |
| 174 | <option value="<?php echo esc_attr( $key ); ?>" <?php selected( $filter_coupon_status, $key ); ?>> |
| 175 | <?php echo esc_html( $value ); ?> |
| 176 | </option> |
| 177 | <?php endforeach; ?> |
| 178 | </select> |
| 179 | </div> |
| 180 | <?php endif; ?> |
| 181 | |
| 182 | <?php if ( ! isset( $data['sort_by'] ) || true == $data['sort_by'] ) : ?> |
| 183 | <div class="tutor-wp-dashboard-filter-item"> |
| 184 | <label class="tutor-form-label"> |
| 185 | <?php esc_html_e( 'Sort By', 'tutor' ); ?> |
| 186 | </label> |
| 187 | <select class="tutor-form-select" id="tutor-backend-filter-order" data-search="no"> |
| 188 | <option value="DESC" <?php selected( $order, 'DESC', 'selected' ); ?>> |
| 189 | <?php esc_html_e( 'DESC', 'tutor' ); ?> |
| 190 | </option> |
| 191 | <option value="ASC" <?php selected( $order, 'ASC', 'selected' ); ?>> |
| 192 | <?php esc_html_e( 'ASC', 'tutor' ); ?> |
| 193 | </option> |
| 194 | </select> |
| 195 | </div> |
| 196 | <?php endif; ?> |
| 197 | |
| 198 | <div class="tutor-wp-dashboard-filter-item"> |
| 199 | <label class="tutor-form-label"> |
| 200 | <?php esc_html_e( 'Date', 'tutor' ); ?> |
| 201 | </label> |
| 202 | <div class="tutor-v2-date-picker"></div> |
| 203 | </div> |
| 204 | <div class="tutor-wp-dashboard-filter-item"> |
| 205 | <form action="" method="get" id="tutor-admin-search-filter-form"> |
| 206 | <label class="tutor-form-label"> |
| 207 | <?php esc_html_e( 'Search', 'tutor' ); ?> |
| 208 | </label> |
| 209 | <div class="tutor-form-wrap"> |
| 210 | <span class="tutor-form-icon"><span class="tutor-icon-search" area-hidden="true"></span></span> |
| 211 | <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 ) ); ?>" /> |
| 212 | </div> |
| 213 | </form> |
| 214 | </div> |
| 215 | </div> |
| 216 | <?php endif; ?> |
| 217 | </div> |
| 218 | </div> |
| 219 | <?php endif; ?> |
| 220 | |
| 221 | <?php |
| 222 | tutor_load_template_from_custom_path( tutor()->path . 'views/elements/bulk-confirm-popup.php' ); |
| 223 | ?> |
| 224 |