| @@ -1,54 +1,48 @@ | ||
| 1 | 1 | <?php |
| 2 | 2 | /** |
| 3 | - * Template for displaying orders dashboard in wp-admin | |
| 3 | + * Template for displaying statistic orders dashboard in wp-admin | |
| 4 | 4 | * |
| 5 | 5 | * @author ThimPress |
| 6 | 6 | * @package LearnPress/Inc/Admin/Views/ |
| 7 | - * @version 4.0.0 | |
| 7 | + * @version 4.0.1 | |
| 8 | 8 | */ |
| 9 | 9 | |
| 10 | 10 | defined( 'ABSPATH' ) || exit; |
| 11 | 11 | |
| 12 | -if ( empty( $specific_statuses ) ) { | |
| 12 | +if ( ! isset( $order_statuses ) || ! isset( $lp_order_icons ) ) { | |
| 13 | 13 | return; |
| 14 | 14 | } |
| 15 | 15 | ?> |
| 16 | 16 | |
| 17 | 17 | <li class="count-number total-raised"> |
| 18 | - <strong><?php echo learn_press_get_total_price_order_complete(); ?></strong> | |
| 18 | + <span> | |
| 19 | + <i class="dashicons dashicons-chart-bar"></i> | |
| 20 | + <?php echo learn_press_get_total_price_order_complete(); ?></span> | |
| 19 | 21 | <p><?php esc_html_e( 'Total Raised', 'learnpress' ); ?></p> |
| 20 | 22 | </li> |
| 21 | 23 | |
| 22 | 24 | <?php |
| 23 | - | |
| 24 | -$counts = learn_press_count_orders( array( 'status' => $specific_statuses ) ); | |
| 25 | - | |
| 26 | -foreach ( $specific_statuses as $status ) : | |
| 27 | - | |
| 28 | - $status_object = get_post_status_object( $status ); | |
| 29 | - | |
| 30 | - if ( ! $status_object ) { | |
| 31 | - continue; | |
| 32 | - } | |
| 33 | - | |
| 34 | - $count = $counts[ $status ]; | |
| 35 | - $url = $count ? admin_url( 'edit.php?post_type=' . LP_ORDER_CPT . '&post_status=' . $status ) : '#'; | |
| 25 | +$counts = learn_press_count_orders(); | |
| 26 | +foreach ( $order_statuses as $key => $status ) : | |
| 27 | + $count = $counts[ $key ]; | |
| 28 | + $url = $count ? admin_url( 'edit.php?post_type=' . LP_ORDER_CPT . '&post_status=' . $key ) : '#'; | |
| 36 | 29 | ?> |
| 37 | 30 | |
| 38 | - <li class="counter-number order-<?php echo str_replace( 'lp-', '', $status ); ?>"> | |
| 31 | + <li class="counter-number order-<?php echo $status; ?>"> | |
| 39 | 32 | <div class="counter-inner"> |
| 40 | 33 | <a href="<?php echo esc_url_raw( $url ); ?>"> |
| 41 | - <strong> | |
| 34 | + <span> | |
| 42 | 35 | <?php |
| 43 | 36 | if ( $count ) { |
| 44 | - printf( translate_nooped_plural( _n_noop( '%d order', '%d orders' ), $count, 'learnpress' ), $count ); | |
| 37 | + printf( translate_nooped_plural( _n_noop( '%d order', '%d orders', 'learnpress' ), $count, 'learnpress' ), $count ); | |
| 45 | 38 | } else { |
| 46 | 39 | printf( __( '%d order', 'learnpress' ), 0 ); |
| 47 | 40 | } |
| 41 | + //echo $lp_order_icons[ $status ]; | |
| 48 | 42 | ?> |
| 49 | - </strong> | |
| 50 | - <p><?php printf( '%s', $status_object->label ); ?></p> | |
| 43 | + </span> | |
| 44 | + <p><?php printf( '%s', LP_Order::get_status_label( $status ) ); ?></p> | |
| 51 | 45 | </a> |
| 52 | 46 | </div> |
| 53 | 47 | </li> |
| 54 | 48 | <?php endforeach; ?> |