bulk-confirm-popup.php
1 year ago
common-confirm-popup.php
1 year ago
course-empty-state.php
1 year ago
course-filters.php
1 year ago
course-navbar.php
1 year ago
filters.php
1 year ago
navbar.php
1 year ago
pagination.php
3 years ago
purchase-history-filter.php
1 year ago
search-filter.php
3 years ago
course-filters.php
231 lines
| 1 | <?php |
| 2 | /** |
| 3 | * Course 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 3.5.0 |
| 12 | */ |
| 13 | |
| 14 | use TUTOR\Input; |
| 15 | |
| 16 | if ( isset( $data ) ) : ?> |
| 17 | <div class="tutor-admin-container tutor-admin-container-lg"> |
| 18 | <div class="tutor-wp-dashboard-course-filter tutor-justify-<?php echo esc_attr( ! empty( $data['bulk_action'] ) ? 'between' : 'end' ); ?>"> |
| 19 | <?php if ( isset( $data['bulk_action'] ) && true === $data['bulk_action'] ) : ?> |
| 20 | <form id="tutor-admin-bulk-action-form" action method="post"> |
| 21 | <input type="hidden" name="action" value="<?php echo esc_attr( $data['ajax_action'] ); ?>" /> |
| 22 | <div class="tutor-d-flex"> |
| 23 | <div class="tutor-mr-12"> |
| 24 | <select name="bulk-action" title="Please select an action" class="tutor-form-control tutor-form-select"> |
| 25 | <?php foreach ( $data['bulk_actions'] as $k => $v ) : ?> |
| 26 | <option value="<?php echo esc_attr( $v['value'] ); ?>"> |
| 27 | <?php echo esc_html( $v['option'] ); ?> |
| 28 | </option> |
| 29 | <?php endforeach; ?> |
| 30 | </select> |
| 31 | </div> |
| 32 | <button class="tutor-btn tutor-btn-outline-primary" id="tutor-admin-bulk-action-btn" data-tutor-modal-target="tutor-bulk-confirm-popup"> |
| 33 | <?php esc_html_e( 'Apply', 'tutor' ); ?> |
| 34 | </button> |
| 35 | </div> |
| 36 | </form> |
| 37 | <?php endif; ?> |
| 38 | <?php |
| 39 | $search_query = Input::get( 'search', '', Input::TYPE_STRING ); |
| 40 | $current_order = Input::get( 'order', 'DESC', Input::TYPE_STRING ); |
| 41 | $order_link = add_query_arg( 'order', 'ASC' === $current_order ? 'DESC' : 'ASC' ); |
| 42 | |
| 43 | $current_page = Input::get( 'page', '', Input::TYPE_STRING ); |
| 44 | $sub_page = Input::get( 'sub_page', '', Input::TYPE_STRING ); |
| 45 | $current_tab = Input::get( 'tab', '', Input::TYPE_STRING ); |
| 46 | if ( '' === $sub_page && '' !== $current_tab ) { |
| 47 | $sub_page = $current_tab; |
| 48 | } |
| 49 | |
| 50 | $url = ''; |
| 51 | if ( '' === $sub_page && '' === $current_tab ) { |
| 52 | $url = "?page=$current_page"; |
| 53 | } elseif ( '' === $current_tab ) { |
| 54 | $url = "?page=$current_page&sub_page=$sub_page"; |
| 55 | } else { |
| 56 | $url = "?page=$current_page&tab=$current_tab"; |
| 57 | } |
| 58 | |
| 59 | $filters_count = count( |
| 60 | array_filter( |
| 61 | $data['filters'], |
| 62 | function( $filter ) { |
| 63 | $value = Input::get( $filter['field_name'], '', Input::TYPE_STRING ); |
| 64 | return null !== $value && '' !== $value; |
| 65 | } |
| 66 | ) |
| 67 | ); |
| 68 | ?> |
| 69 | |
| 70 | <div class="tutor-wp-dashboard-filter-right tutor-d-flex tutor-flex-wrap tutor-gap-1 <?php echo esc_attr( $filters_count > 2 ? 'tutor-flex-column' : 'tutor-flex-row-reverse' ); ?>"> |
| 71 | <div class="tutor-d-flex tutor-flex-wrap tutor-align-center tutor-justify-end tutor-gap-1 tutor-ml-16"> |
| 72 | <?php if ( isset( $data['filters'] ) ) : ?> |
| 73 | <div class="tutor-wp-dashboard-filters tutor-dropdown-parent"> |
| 74 | <button type="button" class="tutor-wp-dashboard-filters-button <?php echo esc_attr( $filters_count > 0 ? 'active' : '' ); ?>" action-tutor-dropdown="toggle"> |
| 75 | <i class="tutor-icon-slider-horizontal"></i> |
| 76 | <span class="tutor-fs-6 tutor-color-secondary"><?php esc_html_e( 'Filters', 'tutor' ); ?></span> |
| 77 | <?php if ( $filters_count > 0 ) : ?> |
| 78 | <span class="tutor-wp-dashboard-filters-line"></span> |
| 79 | <span class="tutor-wp-dashboard-filters-count"><?php echo esc_html( $filters_count ); ?></span> |
| 80 | <?php endif; ?> |
| 81 | </button> |
| 82 | |
| 83 | <form class="tutor-dropdown tutor-admin-dashboard-filter-form" data-tutor-dropdown-persistent> |
| 84 | <div class="tutor-d-flex tutor-justify-between tutor-mb-16"> |
| 85 | <span class="tutor-fs-6 tutor-fw-medium"><?php esc_html_e( 'Filters', 'tutor' ); ?></span> |
| 86 | <button type="button" class="tutor-iconic-btn" data-tutor-dropdown-close> |
| 87 | <i class="tutor-icon-times"></i> |
| 88 | </button> |
| 89 | </div> |
| 90 | |
| 91 | <div class="tutor-d-flex tutor-flex-column tutor-gap-12px"> |
| 92 | <?php foreach ( $data['filters'] as $filter ) : ?> |
| 93 | <?php if ( 'date' === $filter['field_type'] ) : ?> |
| 94 | <div class="tutor-wp-dashboard-filters-item"> |
| 95 | <?php if ( isset( $filter['label'] ) && ! empty( $filter['show_label'] ) ) : ?> |
| 96 | <label class="tutor-form-label"> |
| 97 | <?php echo esc_html( $filter['label'] ); ?> |
| 98 | </label> |
| 99 | <?php endif; ?> |
| 100 | <div class="tutor-v2-date-picker" data-prevent_redirect="1" data-is_clearable="1" data-input_name="<?php echo esc_attr( $filter['field_name'] ); ?>"> |
| 101 | <div class="tutor-form-wrap"> |
| 102 | <span class="tutor-form-icon tutor-form-icon-reverse"> |
| 103 | <span class="tutor-icon-calender-line" aria-hidden="true"></span> |
| 104 | </span> |
| 105 | <input class="tutor-form-control" placeholder="<?php esc_attr_e( 'Loading...', 'tutor' ); ?>"> |
| 106 | </div> |
| 107 | </div> |
| 108 | </div> |
| 109 | <?php elseif ( 'select' === $filter['field_type'] ) : ?> |
| 110 | <div class="tutor-wp-dashboard-filters-item"> |
| 111 | <?php if ( isset( $filter['label'] ) && ! empty( $filter['show_label'] ) ) : ?> |
| 112 | <label class="tutor-form-label"> |
| 113 | <?php echo esc_html( $filter['label'] ); ?> |
| 114 | </label> |
| 115 | <?php endif; ?> |
| 116 | <select name="<?php echo esc_attr( $filter['field_name'] ); ?>" class="tutor-form-control tutor-form-select" <?php echo ! empty( $filter['searchable'] ) ? 'data-searchable' : ''; ?>> |
| 117 | <?php if ( count( $filter['options'] ) ) : ?> |
| 118 | <?php foreach ( $filter['options'] as $option ) : ?> |
| 119 | <option value="<?php echo esc_attr( $option['key'] ); ?>" <?php selected( $filter['value'], $option['key'], 'selected' ); ?>> |
| 120 | <?php echo esc_html( $option['title'] ); ?> |
| 121 | <?php if ( isset( $option['value'] ) ) : ?> |
| 122 | (<?php echo esc_html( $option['value'] ); ?>) |
| 123 | <?php endif; ?> |
| 124 | </option> |
| 125 | <?php endforeach; ?> |
| 126 | <?php else : ?> |
| 127 | <option value=""><?php esc_html_e( 'No record found', 'tutor' ); ?></option> |
| 128 | <?php endif; ?> |
| 129 | </select> |
| 130 | </div> |
| 131 | <?php endif; ?> |
| 132 | <?php endforeach; ?> |
| 133 | </div> |
| 134 | |
| 135 | <div class="tutor-d-flex tutor-justify-end tutor-mt-16"> |
| 136 | <button type="submit" class="tutor-btn tutor-btn-outline-primary"> |
| 137 | <?php esc_html_e( 'Apply Filters', 'tutor' ); ?> |
| 138 | </button> |
| 139 | </div> |
| 140 | </form> |
| 141 | </div> |
| 142 | <?php endif; ?> |
| 143 | |
| 144 | <a class="tutor-wp-dashboard-filter-order" href="<?php echo esc_url( $order_link ); ?>"> |
| 145 | <?php if ( 'ASC' === $current_order ) : ?> |
| 146 | <i class="tutor-icon-sorting-asc"></i> |
| 147 | <?php else : ?> |
| 148 | <i class="tutor-icon-sorting-desc"></i> |
| 149 | <?php endif; ?> |
| 150 | </a> |
| 151 | |
| 152 | <form action="" method="get" id="tutor-admin-search-filter-form"> |
| 153 | <div class="tutor-form-wrap"> |
| 154 | <span class="tutor-form-icon"><span class="tutor-icon-search" area-hidden="true"></span></span> |
| 155 | <input type="search" class="tutor-form-control" id="tutor-backend-filter-search" name="search" placeholder="<?php esc_html_e( 'Search...', 'tutor' ); ?>" value="<?php echo esc_html( wp_unslash( $search_query ) ); ?>" /> |
| 156 | </div> |
| 157 | </form> |
| 158 | </div> |
| 159 | |
| 160 | <?php if ( $filters_count > 0 || strlen( $search_query ) > 0 ) : ?> |
| 161 | <div class="tutor-d-flex tutor-flex-wrap tutor-align-center tutor-justify-end tutor-gap-1"> |
| 162 | <a class="tutor-color-subdued tutor-px-8 tutor-py-4" href="<?php echo esc_url( $url ); ?>"> |
| 163 | <?php esc_html_e( 'Clear All', 'tutor' ); ?> |
| 164 | </a> |
| 165 | |
| 166 | <div class="tutor-wp-dashboard-filter-tag-wrapper"> |
| 167 | <?php |
| 168 | if ( ! empty( $data['filters'] ) ) { |
| 169 | foreach ( $data['filters'] as $key => $filter ) { |
| 170 | $query_value = Input::get( $filter['field_name'], '', Input::TYPE_STRING ); |
| 171 | if ( empty( $query_value ) ) { |
| 172 | continue; |
| 173 | } |
| 174 | ?> |
| 175 | |
| 176 | <?php if ( 'date' === $filter['field_type'] ) : ?> |
| 177 | <div class="tutor-wp-dashboard-filter-tag"> |
| 178 | <div class="tutor-d-flex tutor-gap-4px tutor-align-center"> |
| 179 | <span><?php echo esc_html( $filter['label'] ); ?>:</span> |
| 180 | <div class="tutor-v2-date-picker" data-input_name="<?php echo esc_attr( $filter['field_name'] ); ?>"> |
| 181 | <input class="tutor-form-control" placeholder="<?php esc_attr_e( 'Loading...', 'tutor' ); ?>"> |
| 182 | </div> |
| 183 | </div> |
| 184 | <a href="<?php echo esc_url( remove_query_arg( $filter['field_name'] ) ); ?>"> |
| 185 | <i class="tutor-icon-times"></i> |
| 186 | </a> |
| 187 | </div> |
| 188 | <?php elseif ( 'select' === $filter['field_type'] && ! empty( $filter['options'] ) ) : ?> |
| 189 | <div class="tutor-wp-dashboard-filter-tag-dropdown"> |
| 190 | <select name="<?php echo esc_attr( $filter['field_name'] ); ?>" class="tutor-form-control tutor-form-select tutor-filter-select" <?php echo ! empty( $filter['searchable'] ) ? 'data-searchable' : ''; ?>> |
| 191 | <?php if ( count( $filter['options'] ) ) : ?> |
| 192 | <?php foreach ( $filter['options'] as $option ) : ?> |
| 193 | <option value="<?php echo esc_attr( $option['key'] ); ?>" <?php selected( $filter['value'], $option['key'], 'selected' ); ?>> |
| 194 | <?php echo esc_html( $option['title'] ); ?> |
| 195 | <?php if ( isset( $option['value'] ) ) : ?> |
| 196 | (<?php echo esc_html( $option['value'] ); ?>) |
| 197 | <?php endif; ?> |
| 198 | </option> |
| 199 | <?php endforeach; ?> |
| 200 | <?php else : ?> |
| 201 | <option value=""><?php esc_html_e( 'No record found', 'tutor' ); ?></option> |
| 202 | <?php endif; ?> |
| 203 | </select> |
| 204 | <a href="<?php echo esc_url( remove_query_arg( $filter['field_name'] ) ); ?>"> |
| 205 | <i class="tutor-icon-times"></i> |
| 206 | </a> |
| 207 | </div> |
| 208 | <?php else : ?> |
| 209 | <div class="tutor-wp-dashboard-filter-tag"> |
| 210 | <span><?php echo esc_html( $filter['label'] ); ?>: <?php echo esc_html( $query_value ); ?></span> |
| 211 | <a href="<?php echo esc_url( remove_query_arg( $filter['field_name'] ) ); ?>"> |
| 212 | <i class="tutor-icon-times"></i> |
| 213 | </a> |
| 214 | </div> |
| 215 | <?php endif; ?> |
| 216 | <?php |
| 217 | } |
| 218 | } |
| 219 | ?> |
| 220 | </div> |
| 221 | </div> |
| 222 | <?php endif; ?> |
| 223 | </div> |
| 224 | </div> |
| 225 | </div> |
| 226 | <?php endif; ?> |
| 227 | |
| 228 | <?php |
| 229 | tutor_load_template_from_custom_path( tutor()->path . 'views/elements/bulk-confirm-popup.php' ); |
| 230 | ?> |
| 231 |