html-admin-page-data.php
8 years ago
html-admin-page-exports.php
8 years ago
html-admin-page-import-core-settings.php
8 years ago
html-admin-page-import-donations.php
8 years ago
html-admin-page-imports.php
8 years ago
html-admin-page-system-info.php
8 years ago
html-admin-page-exports.php
304 lines
| 1 | <?php |
| 2 | /** |
| 3 | * Admin View: Exports |
| 4 | */ |
| 5 | |
| 6 | if ( ! defined( 'ABSPATH' ) ) { |
| 7 | exit; |
| 8 | } ?> |
| 9 | |
| 10 | <div id="poststuff"> |
| 11 | <div id="give-dashboard-widgets-wrap"> |
| 12 | <div id="post-body"> |
| 13 | <div id="post-body-content"> |
| 14 | |
| 15 | <?php |
| 16 | /** |
| 17 | * Fires before the reports export tab. |
| 18 | * |
| 19 | * @since 1.0 |
| 20 | */ |
| 21 | do_action( 'give_tools_tab_export_content_top' ); |
| 22 | ?> |
| 23 | |
| 24 | <table class="widefat export-options-table give-table striped"> |
| 25 | <thead> |
| 26 | <tr> |
| 27 | <th scope="col"><?php esc_html_e( 'Export Type', 'give' ); ?></th> |
| 28 | <th scope="col"><?php esc_html_e( 'Export Options', 'give' ); ?></th> |
| 29 | </tr> |
| 30 | </thead> |
| 31 | <tbody> |
| 32 | <?php |
| 33 | /** |
| 34 | * Fires in the reports export tab. |
| 35 | * |
| 36 | * Allows you to add new TR elements to the table before |
| 37 | * other elements. |
| 38 | * |
| 39 | * @since 1.0 |
| 40 | */ |
| 41 | do_action( 'give_tools_tab_export_table_top' ); |
| 42 | ?> |
| 43 | <tr class="give-export-pdf-sales-earnings"> |
| 44 | <td scope="row" class="row-title"> |
| 45 | <h3> |
| 46 | <span><?php esc_html_e( 'Export PDF of Donations and Income', 'give' ); ?></span> |
| 47 | </h3> |
| 48 | <p><?php esc_html_e( 'Download a PDF of Donations and Income reports for all forms for the current year.', 'give' ); ?></p> |
| 49 | </td> |
| 50 | <td> |
| 51 | <a class="button" href="<?php echo wp_nonce_url( add_query_arg( array( 'give-action' => 'generate_pdf' ) ), 'give_generate_pdf' ); ?>"> |
| 52 | <?php esc_html_e( 'Generate PDF', 'give' ); ?> |
| 53 | </a> |
| 54 | </td> |
| 55 | </tr> |
| 56 | <tr class="give-export-sales-earnings"> |
| 57 | <td scope="row" class="row-title"> |
| 58 | <h3> |
| 59 | <span><?php esc_html_e( 'Export Income and Donation Stats', 'give' ); ?></span> |
| 60 | </h3> |
| 61 | <p><?php esc_html_e( 'Download a CSV of income and donations over time.', 'give' ); ?></p> |
| 62 | </td> |
| 63 | <td> |
| 64 | <form method="post"> |
| 65 | <?php |
| 66 | printf( |
| 67 | /* translators: 1: start date dropdown 2: end date dropdown */ |
| 68 | esc_html__( '%1$s to %2$s', 'give' ), |
| 69 | Give()->html->year_dropdown( 'start_year' ) . ' ' . Give()->html->month_dropdown( 'start_month' ), |
| 70 | Give()->html->year_dropdown( 'end_year' ) . ' ' . Give()->html->month_dropdown( 'end_month' ) |
| 71 | ); |
| 72 | ?> |
| 73 | <input type="hidden" name="give-action" |
| 74 | value="earnings_export"/> |
| 75 | <input type="submit" |
| 76 | value="<?php esc_attr_e( 'Generate CSV', 'give' ); ?>" |
| 77 | class="button-secondary"/> |
| 78 | </form> |
| 79 | </td> |
| 80 | </tr> |
| 81 | <tr class="give-export-payment-history"> |
| 82 | <td scope="row" class="row-title"> |
| 83 | <h3> |
| 84 | <span><?php esc_html_e( 'Export Donation History', 'give' ); ?></span> |
| 85 | </h3> |
| 86 | <p><?php esc_html_e( 'Download a CSV of all donations recorded.', 'give' ); ?></p> |
| 87 | </td> |
| 88 | <td> |
| 89 | <form id="give-export-payments" |
| 90 | class="give-export-form" method="post"> |
| 91 | <?php |
| 92 | echo Give()->html->date_field( array( |
| 93 | 'id' => 'give-payment-export-start', |
| 94 | 'name' => 'start', |
| 95 | 'placeholder' => esc_attr__( 'Start date', 'give' ), |
| 96 | ) ); |
| 97 | |
| 98 | echo Give()->html->date_field( array( |
| 99 | 'id' => 'give-payment-export-end', |
| 100 | 'name' => 'end', |
| 101 | 'placeholder' => esc_attr__( 'End date', 'give' ), |
| 102 | ) ); |
| 103 | ?> |
| 104 | <select name="status"> |
| 105 | <option value="any"><?php esc_html_e( 'All Statuses', 'give' ); ?></option> |
| 106 | <?php |
| 107 | $statuses = give_get_payment_statuses(); |
| 108 | foreach ( $statuses as $status => $label ) { |
| 109 | echo '<option value="' . $status . '">' . $label . '</option>'; |
| 110 | } |
| 111 | ?> |
| 112 | </select> |
| 113 | <?php |
| 114 | if ( give_is_setting_enabled( give_get_option( 'categories' ) ) ) { |
| 115 | echo Give()->html->category_dropdown( |
| 116 | 'give_forms_categories[]', |
| 117 | 0, |
| 118 | array( |
| 119 | 'class' => 'give_forms_categories', |
| 120 | 'chosen' => true, |
| 121 | 'multiple' => true, |
| 122 | 'selected' => array(), |
| 123 | 'show_option_all' => false, |
| 124 | 'placeholder' => __( 'Choose one or more from categories', 'give' ), |
| 125 | ) |
| 126 | ); |
| 127 | } |
| 128 | |
| 129 | if ( give_is_setting_enabled( give_get_option( 'tags' ) ) ) { |
| 130 | echo Give()->html->tags_dropdown( |
| 131 | 'give_forms_tags[]', |
| 132 | 0, |
| 133 | array( |
| 134 | 'class' => 'give_forms_tags', |
| 135 | 'chosen' => true, |
| 136 | 'multiple' => true, |
| 137 | 'selected' => array(), |
| 138 | 'show_option_all' => false, |
| 139 | 'placeholder' => __( 'Choose one or more from tags', 'give' ), |
| 140 | ) |
| 141 | ); |
| 142 | } |
| 143 | |
| 144 | wp_nonce_field( 'give_ajax_export', 'give_ajax_export' ); |
| 145 | ?> |
| 146 | <input type="hidden" name="give-export-class" |
| 147 | value="Give_Batch_Payments_Export"/> |
| 148 | <span> |
| 149 | <input type="submit" |
| 150 | value="<?php esc_attr_e( 'Generate CSV', 'give' ); ?>" |
| 151 | class="button-secondary"/> |
| 152 | <span class="spinner"></span> |
| 153 | </span> |
| 154 | </form> |
| 155 | </td> |
| 156 | </tr> |
| 157 | <tr class="give-export-donors"> |
| 158 | <td scope="row" class="row-title"> |
| 159 | <h3> |
| 160 | <span><?php esc_html_e( 'Export Donors in CSV', 'give' ); ?></span> |
| 161 | </h3> |
| 162 | <p><?php esc_html_e( 'Download an export of donors for all donation forms or only those who have given to a particular form.', 'give' ); ?></p> |
| 163 | </td> |
| 164 | <td> |
| 165 | <form method="post" id="give_donor_export" |
| 166 | class="give-export-form"> |
| 167 | |
| 168 | <?php |
| 169 | // Start Date form field for donors |
| 170 | echo Give()->html->date_field( array( |
| 171 | 'id' => 'give_donor_export_start_date', |
| 172 | 'name' => 'donor_export_start_date', |
| 173 | 'placeholder' => esc_attr__( 'Start date', 'give' ), |
| 174 | ) ); |
| 175 | |
| 176 | // End Date form field for donors |
| 177 | echo Give()->html->date_field( array( |
| 178 | 'id' => 'give_donor_export_end_date', |
| 179 | 'name' => 'donor_export_end_date', |
| 180 | 'placeholder' => esc_attr__( 'End date', 'give' ), |
| 181 | ) ); |
| 182 | |
| 183 | // Donation forms dropdown for donors export |
| 184 | echo Give()->html->forms_dropdown( array( |
| 185 | 'name' => 'forms', |
| 186 | 'id' => 'give_donor_export_form', |
| 187 | 'chosen' => true, |
| 188 | ) ); |
| 189 | ?> |
| 190 | <input type="submit" value="<?php esc_attr_e( 'Generate CSV', 'give' ); ?>" class="button-secondary"/> |
| 191 | |
| 192 | <div id="export-donor-options-wrap" |
| 193 | class="give-clearfix"> |
| 194 | <p><?php esc_html_e( 'Export Columns:', 'give' ); ?></p> |
| 195 | <ul id="give-export-option-ul"> |
| 196 | <li> |
| 197 | <label for="give-export-fullname"> |
| 198 | <input type="checkbox" checked |
| 199 | name="give_export_option[full_name]" |
| 200 | id="give-export-fullname"><?php esc_html_e( 'Name', 'give' ); ?> |
| 201 | </label> |
| 202 | </li> |
| 203 | <li> |
| 204 | <label for="give-export-email"> |
| 205 | <input type="checkbox" checked |
| 206 | name="give_export_option[email]" |
| 207 | id="give-export-email"><?php esc_html_e( 'Email', 'give' ); ?> |
| 208 | </label> |
| 209 | </li> |
| 210 | <li> |
| 211 | <label for="give-export-address"> |
| 212 | <input type="checkbox" checked |
| 213 | name="give_export_option[address]" |
| 214 | id="give-export-address"><?php esc_html_e( 'Address', 'give' ); ?> |
| 215 | </label> |
| 216 | </li> |
| 217 | <li> |
| 218 | <label for="give-export-userid"> |
| 219 | <input type="checkbox" checked |
| 220 | name="give_export_option[userid]" |
| 221 | id="give-export-userid"><?php esc_html_e( 'User ID', 'give' ); ?> |
| 222 | </label> |
| 223 | </li> |
| 224 | <li> |
| 225 | <label for="give-export-donation-form"> |
| 226 | <input type="checkbox" checked |
| 227 | name="give_export_option[donation_form]" |
| 228 | id="give-export-donation-form"><?php esc_html_e( 'Donation Form', 'give' ); ?> |
| 229 | </label> |
| 230 | </li> |
| 231 | <li> |
| 232 | <label for="give-export-first-donation-date"> |
| 233 | <input type="checkbox" checked |
| 234 | name="give_export_option[date_first_donated]" |
| 235 | id="give-export-first-donation-date"><?php esc_html_e( 'First Donation Date', 'give' ); ?> |
| 236 | </label> |
| 237 | </li> |
| 238 | <li> |
| 239 | <label for="give-export-donation-number"> |
| 240 | <input type="checkbox" checked |
| 241 | name="give_export_option[donations]" |
| 242 | id="give-export-donation-number"><?php esc_html_e( 'Number of Donations', 'give' ); ?> |
| 243 | </label> |
| 244 | </li> |
| 245 | <li> |
| 246 | <label for="give-export-donation-sum"> |
| 247 | <input type="checkbox" checked |
| 248 | name="give_export_option[donation_sum]" |
| 249 | id="give-export-donation-sum"><?php esc_html_e( 'Total Donated', 'give' ); ?> |
| 250 | </label> |
| 251 | </li> |
| 252 | </ul> |
| 253 | </div> |
| 254 | <?php wp_nonce_field( 'give_ajax_export', 'give_ajax_export' ); ?> |
| 255 | <input type="hidden" name="give-export-class" value="Give_Batch_Donors_Export"/> |
| 256 | <input type="hidden" name="give_export_option[query_id]" value="<?php echo uniqid( 'give_' ); ?>"/> |
| 257 | </form> |
| 258 | </td> |
| 259 | </tr> |
| 260 | |
| 261 | <tr class="give-export-core-settings"> |
| 262 | <td scope="row" class="row-title"> |
| 263 | <h3> |
| 264 | <span><?php esc_html_e( 'Export Give Settings', 'give' ); ?></span> |
| 265 | </h3> |
| 266 | <p><?php esc_html_e( 'Download an export of Give\'s settings and import it in a new WordPress installation.', 'give' ); ?></p> |
| 267 | </td> |
| 268 | <td> |
| 269 | <form method="post"> |
| 270 | <input type="hidden" name="give-action" value="core_settings_export"/> |
| 271 | <input type="submit" value="<?php esc_attr_e( 'Export JSON', 'give' ); ?>" class="button-secondary"/> |
| 272 | </form> |
| 273 | </td> |
| 274 | </tr> |
| 275 | <?php |
| 276 | /** |
| 277 | * Fires in the reports export tab. |
| 278 | * |
| 279 | * Allows you to add new TR elements to the table after |
| 280 | * other elements. |
| 281 | * |
| 282 | * @since 1.0 |
| 283 | */ |
| 284 | do_action( 'give_tools_tab_export_table_bottom' ); |
| 285 | ?> |
| 286 | </tbody> |
| 287 | </table> |
| 288 | |
| 289 | <?php |
| 290 | /** |
| 291 | * Fires after the reports export tab. |
| 292 | * |
| 293 | * @since 1.0 |
| 294 | */ |
| 295 | do_action( 'give_tools_tab_export_content_bottom' ); |
| 296 | ?> |
| 297 | |
| 298 | </div> |
| 299 | <!-- .post-body-content --> |
| 300 | </div> |
| 301 | <!-- .post-body --> |
| 302 | </div><!-- #give-dashboard-widgets-wrap --> |
| 303 | </div><!-- #poststuff --> |
| 304 |