woocommerce/includes/admin/views/html-report-by-date.php

86 lines
3.5 KiB
PHP
Raw Normal View History

<?php
/**
* Admin View: Report by Date (with date filters)
*/
if ( ! defined( 'ABSPATH' ) ) {
exit; // Exit if accessed directly
}
?>
<div id="poststuff" class="woocommerce-reports-wide">
<div class="postbox">
<?php if ( 'custom' === $current_range && isset( $_GET['start_date'], $_GET['end_date'] ) ) : ?>
<h3 class="screen-reader-text"><?php echo esc_html( sprintf( _x( 'From %s to %s', 'start date and end date', 'woocommerce' ), wc_clean( $_GET['start_date'] ), wc_clean( $_GET['end_date'] ) ) ); ?></h3>
<?php else : ?>
<h3 class="screen-reader-text"><?php echo esc_html( $ranges[ $current_range ] ); ?></h3>
<?php endif; ?>
<div class="stats_range">
2013-07-18 11:56:12 +00:00
<?php $this->get_export_button(); ?>
<ul>
<?php
2015-01-29 14:33:06 +00:00
foreach ( $ranges as $range => $name ) {
echo '<li class="' . ( $current_range == $range ? 'active' : '' ) . '"><a href="' . esc_url( remove_query_arg( array( 'start_date', 'end_date' ), add_query_arg( 'range', $range ) ) ) . '">' . $name . '</a></li>';
}
?>
<li class="custom <?php echo $current_range == 'custom' ? 'active' : ''; ?>">
<?php _e( 'Custom:', 'woocommerce' ); ?>
<form method="GET">
<div>
2013-06-27 15:12:17 +00:00
<?php
// Maintain query string
2015-01-29 14:33:06 +00:00
foreach ( $_GET as $key => $value ) {
if ( is_array( $value ) ) {
foreach ( $value as $v ) {
2013-06-27 15:12:17 +00:00
echo '<input type="hidden" name="' . esc_attr( sanitize_text_field( $key ) ) . '[]" value="' . esc_attr( sanitize_text_field( $v ) ) . '" />';
2015-01-29 14:33:06 +00:00
}
} else {
2013-06-27 15:12:17 +00:00
echo '<input type="hidden" name="' . esc_attr( sanitize_text_field( $key ) ) . '" value="' . esc_attr( sanitize_text_field( $value ) ) . '" />';
2015-01-29 14:33:06 +00:00
}
}
2013-06-27 15:12:17 +00:00
?>
<input type="hidden" name="range" value="custom" />
<input type="text" size="9" placeholder="yyyy-mm-dd" value="<?php if ( ! empty( $_GET['start_date'] ) ) echo esc_attr( $_GET['start_date'] ); ?>" name="start_date" class="range_datepicker from" />
<input type="text" size="9" placeholder="yyyy-mm-dd" value="<?php if ( ! empty( $_GET['end_date'] ) ) echo esc_attr( $_GET['end_date'] ); ?>" name="end_date" class="range_datepicker to" />
<input type="submit" class="button" value="<?php esc_attr_e( 'Go', 'woocommerce' ); ?>" />
</div>
</form>
</li>
</ul>
</div>
2013-07-10 11:05:45 +00:00
<?php if ( empty( $hide_sidebar ) ) : ?>
<div class="inside chart-with-sidebar">
<div class="chart-sidebar">
2013-07-18 08:20:49 +00:00
<?php if ( $legends = $this->get_chart_legend() ) : ?>
<ul class="chart-legend">
<?php foreach ( $legends as $legend ) : ?>
2014-11-24 15:18:41 +00:00
<li style="border-color: <?php echo $legend['color']; ?>" <?php if ( isset( $legend['highlight_series'] ) ) echo 'class="highlight_series ' . ( isset( $legend['placeholder'] ) ? 'tips' : '' ) . '" data-series="' . esc_attr( $legend['highlight_series'] ) . '"'; ?> data-tip="<?php echo isset( $legend['placeholder'] ) ? $legend['placeholder'] : ''; ?>">
2013-07-18 08:20:49 +00:00
<?php echo $legend['title']; ?>
</li>
<?php endforeach; ?>
</ul>
<?php endif; ?>
2013-07-10 11:05:45 +00:00
<ul class="chart-widgets">
<?php foreach ( $this->get_chart_widgets() as $widget ) : ?>
<li class="chart-widget">
<?php if ( $widget['title'] ) : ?><h4><?php echo $widget['title']; ?></h4><?php endif; ?>
<?php call_user_func( $widget['callback'] ); ?>
</li>
<?php endforeach; ?>
</ul>
</div>
<div class="main">
<?php $this->get_main_chart(); ?>
</div>
</div>
2013-07-10 11:05:45 +00:00
<?php else : ?>
<div class="inside">
<?php $this->get_main_chart(); ?>
</div>
2013-07-10 11:05:45 +00:00
<?php endif; ?>
</div>
2014-11-24 15:18:41 +00:00
</div>