| 1 |
<?php |
| 2 |
/** |
| 3 |
* Display the export button in the campaign filters box. |
| 4 |
* |
| 5 |
* @author Eric Daams |
| 6 |
* @package Charitable/Admin View/Campaigns Page |
| 7 |
* @copyright Copyright (c) 2019, Studio 164a |
| 8 |
* @license http://opensource.org/licenses/gpl-2.0.php GNU Public License |
| 9 |
* @since 1.6.0 |
| 10 |
* @version 1.6.0 |
| 11 |
*/ |
| 12 |
|
| 13 |
$modal_class = apply_filters( 'charitable_modal_window_class', 'charitable-modal' ); |
| 14 |
$start_date = isset( $_GET['start_date'] ) ? sanitize_text_field( $_GET['start_date'] ) : null; |
| 15 |
$end_date = isset( $_GET['end_date'] ) ? sanitize_text_field( $_GET['end_date'] ) : null; |
| 16 |
$status = isset( $_GET['status'] ) ? $_GET['status'] : ''; |
| 17 |
$report_type = isset( $_GET['report_type'] ) ? $_GET['report_type'] : 'campaigns'; |
| 18 |
$report_types = apply_filters( 'charitable_campaign_export_report_types', array( |
| 19 |
'campaigns' => __( 'Campaigns', 'charitable' ), |
| 20 |
) ); |
| 21 |
$statuses = array( |
| 22 |
'' => __( 'Any', 'charitable' ), |
| 23 |
'pending' => __( 'Pending', 'charitable' ), |
| 24 |
'draft' => __( 'Draft', 'charitable' ), |
| 25 |
'active' => __( 'Active', 'charitable' ), |
| 26 |
'finish' => __( 'Finished', 'charitable' ), |
| 27 |
'publish' => __( 'Published', 'charitable' ), |
| 28 |
); |
| 29 |
|
| 30 |
?> |
| 31 |
<div id="charitable-campaigns-export-modal" style="display: none;" class="charitable-campaigns-modal <?php echo esc_attr( $modal_class ); ?>" tabindex="0"> |
| 32 |
<a class="modal-close"></a> |
| 33 |
<h3><?php _e( 'Export Campaigns', 'charitable' ); ?></h3> |
| 34 |
<form class="charitable-campaigns-modal-form charitable-modal-form" method="get" action="<?php echo admin_url( 'admin.php' ); ?>"> |
| 35 |
<?php wp_nonce_field( 'charitable_export_campaigns', '_charitable_export_nonce' ); ?> |
| 36 |
<input type="hidden" name="charitable_action" value="export_campaigns" /> |
| 37 |
<input type="hidden" name="page" value="charitable-campaigns-table" /> |
| 38 |
<fieldset> |
| 39 |
<legend><?php _e( 'Filter by Date Created', 'charitable' ); ?></legend> |
| 40 |
<input type="text" id="charitable-export-start_date" name="start_date" class="charitable-datepicker" value="<?php echo $start_date; ?>" placeholder="<?php esc_attr_e( 'From:', 'charitable' ); ?>" /> |
| 41 |
<input type="text" id="charitable-export-end_date" name="end_date" class="charitable-datepicker" value="<?php echo $end_date; ?>" placeholder="<?php esc_attr_e( 'To:', 'charitable' ); ?>" /> |
| 42 |
</fieldset> |
| 43 |
<label for="charitable-campaigns-export-campaign"><?php _e( 'Filter by Status', 'charitable' ); ?></label> |
| 44 |
<select id="charitable-campaigns-export-campaign" name="status"> |
| 45 |
<?php foreach ( $statuses as $key => $label ) : ?> |
| 46 |
<option value="<?php echo esc_attr( $key ); ?>" <?php selected( $key, $status ); ?>><?php echo $label; ?></option> |
| 47 |
<?php endforeach ?> |
| 48 |
</select> |
| 49 |
<?php if ( count( $report_types ) > 1 ) : ?> |
| 50 |
<label for="charitable-campaigns-export-report-type"><?php _e( 'Type of Report', 'charitable' ); ?></label> |
| 51 |
<select id="charitable-campaigns-export-report-type" name="report_type"> |
| 52 |
<?php foreach ( $report_types as $key => $report_label ) : ?> |
| 53 |
<option value="<?php echo esc_attr( $key ); ?>"><?php echo $report_label; ?></option> |
| 54 |
<?php endforeach; ?> |
| 55 |
</select> |
| 56 |
<?php else : ?> |
| 57 |
<input type="hidden" name="report_type" value="<?php echo esc_attr( key( $report_types ) ); ?>" /> |
| 58 |
<?php endif ?> |
| 59 |
<?php do_action( 'charitable_export_campaigns_form' ); ?> |
| 60 |
<button name="charitable-export-campaigns" class="button button-primary"><?php _e( 'Export', 'charitable' ); ?></button> |
| 61 |
</form> |
| 62 |
</div> |
| 63 |
|