| 1 |
<?php |
| 2 |
/** |
| 3 |
* Admin View: Exports |
| 4 |
*/ |
| 5 |
|
| 6 |
if ( ! defined( 'ABSPATH' ) ) { |
| 7 |
exit; |
| 8 |
} |
| 9 |
|
| 10 |
if ( ! current_user_can( 'manage_give_settings' ) ) { |
| 11 |
return; |
| 12 |
} |
| 13 |
|
| 14 |
/** |
| 15 |
* Fires before displaying the recount stats tools. |
| 16 |
* |
| 17 |
* @since 1.5 |
| 18 |
*/ |
| 19 |
do_action( 'give_tools_recount_stats_before' ); |
| 20 |
?> |
| 21 |
<div id="poststuff" class="give-clearfix"> |
| 22 |
<div class="postbox"> |
| 23 |
|
| 24 |
<h2 class="hndle ui-sortable-handle"><span><?php esc_html_e( 'Recount Stats', 'give' ); ?></span></h2> |
| 25 |
|
| 26 |
<div class="inside recount-stats-controls"> |
| 27 |
<p><?php esc_html_e( 'Use these tools to recount stats, delete test transactions, or reset stats.', 'give' ); ?></p> |
| 28 |
<form method="post" id="give-tools-recount-form" class="give-export-form"> |
| 29 |
|
| 30 |
<?php wp_nonce_field( 'give_ajax_export', 'give_ajax_export' ); ?> |
| 31 |
|
| 32 |
<select name="give-export-class" id="recount-stats-type"> |
| 33 |
<option value="0" selected="selected" disabled="disabled"><?php esc_html_e( 'Please select an option', 'give' ); ?></option> |
| 34 |
<option data-type="recount-stats" value="Give_Tools_Recount_Income"><?php esc_html_e( 'Recalculate Total Donation Revenue Amount', 'give' ); ?></option> |
| 35 |
<option data-type="recount-form" value="Give_Tools_Recount_Form_Stats"><?php esc_html_e( 'Recalculate Revenue Amount and Donation Counts for a Form', 'give' ); ?></option> |
| 36 |
<option data-type="recount-all" value="Give_Tools_Recount_All_Stats"><?php esc_html_e( 'Recalculate Revenue Amount and Donation Counts for All Forms', 'give' ); ?></option> |
| 37 |
<option data-type="recount-donor-stats" value="Give_Tools_Recount_Donor_Stats"><?php esc_html_e( 'Recalculate Donor Statistics', 'give' ); ?></option> |
| 38 |
<option data-type="delete-test-transactions" value="Give_Tools_Delete_Test_Transactions"><?php esc_html_e( 'Delete Test Donations', 'give' ); ?></option> |
| 39 |
<option data-type="delete-donations" value="Give_Tools_Delete_Donations"><?php esc_html_e( 'Delete Live and Test Donations', 'give' ); ?></option> |
| 40 |
<option data-type="delete-test-donors" value="Give_Tools_Delete_Donors"><?php esc_html_e( 'Delete Test Donors and Donations', 'give' ); ?></option> |
| 41 |
<option data-type="delete-import-donors" value="Give_Tools_Import_Donors"><?php esc_html_e( 'Delete Imported Donors and Donations', 'give' ); ?></option> |
| 42 |
<option data-type="reset-stats" value="Give_Tools_Reset_Stats"><?php esc_html_e( 'Delete All Data', 'give' ); ?></option> |
| 43 |
<?php |
| 44 |
/** |
| 45 |
* Fires in the recount stats selectbox. |
| 46 |
* |
| 47 |
* Allows you to add new recount tool option elements. |
| 48 |
* |
| 49 |
* @since 1.5 |
| 50 |
*/ |
| 51 |
do_action( 'give_recount_tool_options' ); |
| 52 |
?> |
| 53 |
</select> |
| 54 |
|
| 55 |
<span class="tools-form-dropdown tools-form-dropdown-recount-form" style="display: none"> |
| 56 |
<?php |
| 57 |
$args = [ |
| 58 |
'class' => 'tools-form-dropdown-recount-form-select', |
| 59 |
'name' => 'form_id', |
| 60 |
'chosen' => true, |
| 61 |
'placeholder' => esc_attr__( 'Select Form', 'give' ), |
| 62 |
]; |
| 63 |
echo Give()->html->forms_dropdown( $args ); |
| 64 |
?> |
| 65 |
</span> |
| 66 |
|
| 67 |
<span class="tools-date-dropdown tools-date-dropdown-delete-donations" style="display: none"> |
| 68 |
<?php |
| 69 |
echo Give()->html->date_field( |
| 70 |
[ |
| 71 |
'id' => 'give_delete_donations_start_date', |
| 72 |
'name' => 'delete_donations_start_date', |
| 73 |
'placeholder' => esc_attr__( 'Start date', 'give' ), |
| 74 |
'autocomplete' => 'off', |
| 75 |
] |
| 76 |
); |
| 77 |
|
| 78 |
echo Give()->html->date_field( |
| 79 |
[ |
| 80 |
'id' => 'give_delete_donations_end_date', |
| 81 |
'name' => 'delete_donations_end_date', |
| 82 |
'placeholder' => esc_attr__( 'End date', 'give' ), |
| 83 |
'autocomplete' => 'off', |
| 84 |
] |
| 85 |
); |
| 86 |
?> |
| 87 |
</span> |
| 88 |
|
| 89 |
<span class="tools-form-dropdown tools-form-dropdown-delete-import-donors" style="display: none"> |
| 90 |
<label for="delete-import-donors"> |
| 91 |
<?php |
| 92 |
echo Give()->html->checkbox( [ 'name' => 'delete-import-donors' ] ); |
| 93 |
esc_html_e( 'Delete imported WordPress users', 'give' ); |
| 94 |
?> |
| 95 |
</label> |
| 96 |
</span> |
| 97 |
|
| 98 |
<input type="submit" id="recount-stats-submit" value="<?php esc_attr_e( 'Submit', 'give' ); ?>" class="button-secondary"/> |
| 99 |
|
| 100 |
<br/> |
| 101 |
|
| 102 |
<span class="give-recount-stats-descriptions"> |
| 103 |
<span id="recount-stats"><?php esc_html_e( 'Recalculates the overall donation revenue amount.', 'give' ); ?></span> |
| 104 |
<span id="recount-form"><?php esc_html_e( 'Recalculates the donation and revenue stats for a specific form.', 'give' ); ?></span> |
| 105 |
<span id="recount-all"><?php esc_html_e( 'Recalculates the earnings and sales stats for all forms.', 'give' ); ?></span> |
| 106 |
<span id="recount-customer-stats"><?php esc_html_e( 'Recalculates the lifetime value and donation counts for all donors.', 'give' ); ?></span> |
| 107 |
<?php |
| 108 |
/** |
| 109 |
* Fires in the recount stats description area. |
| 110 |
* |
| 111 |
* Allows you to add new recount tool description text. |
| 112 |
* |
| 113 |
* @since 1.5 |
| 114 |
*/ |
| 115 |
do_action( 'give_recount_tool_descriptions' ); |
| 116 |
?> |
| 117 |
<span id="delete-test-transactions"><strong><?php esc_html_e( 'Deletes', 'give' ); ?></strong> <?php esc_html_e( 'all TEST donations, donors, and related log entries.', 'give' ); ?></span> |
| 118 |
<span id="delete-donations"><strong><?php esc_html_e( 'Deletes', 'give' ); ?></strong> <?php esc_html_e( 'all LIVE and TEST donations within a specified date range. If date range is not set then all donations are deleted. ', 'give' ); ?></span> |
| 119 |
<span id="reset-stats"><strong><?php esc_html_e( 'Deletes', 'give' ); ?></strong> <?php esc_html_e( 'ALL donations, donors, and related log entries regardless of TEST or LIVE mode.', 'give' ); ?></span> |
| 120 |
</span> |
| 121 |
|
| 122 |
<span class="spinner"></span> |
| 123 |
|
| 124 |
</form> |
| 125 |
<?php |
| 126 |
/** |
| 127 |
* Fires after the recount form. |
| 128 |
* |
| 129 |
* Allows you to add new elements after the form. |
| 130 |
* |
| 131 |
* @since 1.5 |
| 132 |
*/ |
| 133 |
do_action( 'give_tools_recount_forms' ); |
| 134 |
?> |
| 135 |
</div><!-- .inside --> |
| 136 |
</div><!-- .postbox --> |
| 137 |
</div><!-- #poststuff --> |
| 138 |
<?php |
| 139 |
/** |
| 140 |
* Fires after displaying the recount stats tools. |
| 141 |
* |
| 142 |
* @since 1.5 |
| 143 |
*/ |
| 144 |
do_action( 'give_tools_recount_stats_after' ); |
| 145 |
|