html-admin-page-data.php
6 years ago
html-admin-page-exports.php
6 years ago
html-admin-page-import-core-settings.php
6 years ago
html-admin-page-import-donations.php
6 years ago
html-admin-page-imports.php
6 years ago
html-admin-page-system-info.php
6 years ago
html-admin-page-exports.php
232 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 | |
| 44 | <tr class="give-export-donations-history"> |
| 45 | <td scope="row" class="row-title"> |
| 46 | <h3> |
| 47 | <span><?php esc_html_e( 'Export Donation History', 'give' ); ?></span> |
| 48 | </h3> |
| 49 | <p><?php esc_html_e( 'Download a CSV of all donations recorded.', 'give' ); ?></p> |
| 50 | </td> |
| 51 | <td> |
| 52 | <a class="button" href="<?php echo add_query_arg( array( 'type' => 'export_donations' ) ); ?>"> |
| 53 | <?php esc_html_e( 'Generate CSV', 'give' ); ?> |
| 54 | </a> |
| 55 | </td> |
| 56 | </tr> |
| 57 | |
| 58 | <tr class="give-export-pdf-sales-earnings"> |
| 59 | <td scope="row" class="row-title"> |
| 60 | <h3> |
| 61 | <span><?php esc_html_e( 'Export PDF of Donations and Income', 'give' ); ?></span> |
| 62 | </h3> |
| 63 | <p><?php esc_html_e( 'Download a PDF of Donations and Income reports for all forms for the current year.', 'give' ); ?></p> |
| 64 | </td> |
| 65 | <td> |
| 66 | <a class="button" href="<?php echo wp_nonce_url( add_query_arg( array( 'give-action' => 'generate_pdf' ) ), 'give_generate_pdf' ); ?>"> |
| 67 | <?php esc_html_e( 'Generate PDF', 'give' ); ?> |
| 68 | </a> |
| 69 | </td> |
| 70 | </tr> |
| 71 | <tr class="give-export-sales-earnings"> |
| 72 | <td scope="row" class="row-title"> |
| 73 | <h3> |
| 74 | <span><?php esc_html_e( 'Export Income and Donation Stats', 'give' ); ?></span> |
| 75 | </h3> |
| 76 | <p><?php esc_html_e( 'Download a CSV of income and donations over time.', 'give' ); ?></p> |
| 77 | </td> |
| 78 | <td> |
| 79 | <form method="post"> |
| 80 | <?php |
| 81 | printf( |
| 82 | /* translators: 1: start date dropdown 2: end date dropdown */ |
| 83 | esc_html__( '%1$s to %2$s', 'give' ), |
| 84 | Give()->html->year_dropdown( 'start_year' ) . ' ' . Give()->html->month_dropdown( 'start_month' ), |
| 85 | Give()->html->year_dropdown( 'end_year' ) . ' ' . Give()->html->month_dropdown( 'end_month' ) |
| 86 | ); |
| 87 | ?> |
| 88 | <input type="hidden" name="give-action" value="earnings_export"/> |
| 89 | <input type="submit" value="<?php esc_attr_e( 'Generate CSV', 'give' ); ?>" class="button-secondary"/> |
| 90 | </form> |
| 91 | </td> |
| 92 | </tr> |
| 93 | |
| 94 | <tr class="give-export-donors"> |
| 95 | <td scope="row" class="row-title"> |
| 96 | <h3> |
| 97 | <span><?php esc_html_e( 'Export Donors', 'give' ); ?></span> |
| 98 | </h3> |
| 99 | <p><?php esc_html_e( 'Download a CSV of donors. Column values reflect totals across all donation forms by default, or a single donation form if selected.', 'give' ); ?></p> |
| 100 | </td> |
| 101 | <td> |
| 102 | <form method="post" id="give_donor_export" class="give-export-form"> |
| 103 | <?php |
| 104 | // Start Date form field for donors. |
| 105 | echo Give()->html->date_field( |
| 106 | array( |
| 107 | 'id' => 'give_donor_export_start_date', |
| 108 | 'name' => 'donor_export_start_date', |
| 109 | 'placeholder' => esc_attr__( 'Start Date', 'give' ), |
| 110 | 'autocomplete' => 'off', |
| 111 | ) |
| 112 | ); |
| 113 | |
| 114 | // End Date form field for donors. |
| 115 | echo Give()->html->date_field( |
| 116 | array( |
| 117 | 'id' => 'give_donor_export_end_date', |
| 118 | 'name' => 'donor_export_end_date', |
| 119 | 'placeholder' => esc_attr__( 'End Date', 'give' ), |
| 120 | 'autocomplete' => 'off', |
| 121 | ) |
| 122 | ); |
| 123 | |
| 124 | // Donation forms dropdown for donors export. |
| 125 | echo Give()->html->forms_dropdown( |
| 126 | array( |
| 127 | 'name' => 'forms', |
| 128 | 'id' => 'give_donor_export_form', |
| 129 | 'chosen' => true, |
| 130 | 'class' => 'give-width-25em', |
| 131 | ) |
| 132 | ); |
| 133 | ?> |
| 134 | <br> |
| 135 | <input type="submit" value="<?php esc_attr_e( 'Generate CSV', 'give' ); ?>" class="button-secondary"/> |
| 136 | |
| 137 | <div id="export-donor-options-wrap" class="give-clearfix"> |
| 138 | <p><?php esc_html_e( 'Export Columns:', 'give' ); ?></p> |
| 139 | <ul id="give-export-option-ul"> |
| 140 | <?php |
| 141 | $donor_export_columns = give_export_donors_get_default_columns(); |
| 142 | |
| 143 | foreach ( $donor_export_columns as $column_name => $column_label ) { |
| 144 | ?> |
| 145 | <li> |
| 146 | <label for="give-export-<?php echo esc_attr( $column_name ); ?>"> |
| 147 | <input |
| 148 | type="checkbox" |
| 149 | checked |
| 150 | name="give_export_option[<?php echo esc_attr( $column_name ); ?>]" |
| 151 | id="give-export-<?php echo esc_attr( $column_name ); ?>" |
| 152 | /> |
| 153 | <?php echo esc_attr( $column_label ); ?> |
| 154 | </label> |
| 155 | </li> |
| 156 | <?php |
| 157 | } |
| 158 | ?> |
| 159 | </ul> |
| 160 | </div> |
| 161 | <?php wp_nonce_field( 'give_ajax_export', 'give_ajax_export' ); ?> |
| 162 | <input type="hidden" name="give-export-class" value="Give_Batch_Donors_Export"/> |
| 163 | <input type="hidden" name="give_export_option[query_id]" value="<?php echo uniqid( 'give_' ); ?>"/> |
| 164 | </form> |
| 165 | </td> |
| 166 | </tr> |
| 167 | |
| 168 | <tr class="give-export-core-settings"> |
| 169 | <td scope="row" class="row-title"> |
| 170 | <h3> |
| 171 | <span><?php esc_html_e( 'Export GiveWP Settings', 'give' ); ?></span> |
| 172 | </h3> |
| 173 | <p><?php esc_html_e( 'Download an export of Give\'s settings and import it in a new WordPress installation.', 'give' ); ?></p> |
| 174 | </td> |
| 175 | <td> |
| 176 | <form method="post"> |
| 177 | <?php |
| 178 | $export_excludes = apply_filters( 'give_settings_export_excludes', array() ); |
| 179 | if ( ! empty( $export_excludes ) ) { |
| 180 | ?> |
| 181 | <i class="settings-excludes-title"><?php esc_html_e( 'Checked options from the list will not be exported.', 'give' ); ?></i> |
| 182 | <ul class="settings-excludes-list"> |
| 183 | <?php foreach ( $export_excludes as $option_key => $option_label ) { ?> |
| 184 | <li> |
| 185 | <label for="settings_export_excludes[<?php echo $option_key; ?>]"> |
| 186 | <input |
| 187 | type="checkbox" |
| 188 | checked |
| 189 | name="settings_export_excludes[<?php echo $option_key; ?>]" |
| 190 | id="settings_export_excludes[<?php echo $option_key; ?>]" |
| 191 | /> |
| 192 | <?php echo esc_html( $option_label ); ?> |
| 193 | </label> |
| 194 | </li> |
| 195 | <?php } ?> |
| 196 | </ul> |
| 197 | <?php } ?> |
| 198 | <input type="hidden" name="give-action" value="core_settings_export"/> |
| 199 | <input type="submit" value="<?php esc_attr_e( 'Export JSON', 'give' ); ?>" class="button-secondary"/> |
| 200 | </form> |
| 201 | </td> |
| 202 | </tr> |
| 203 | <?php |
| 204 | /** |
| 205 | * Fires in the reports export tab. |
| 206 | * |
| 207 | * Allows you to add new TR elements to the table after |
| 208 | * other elements. |
| 209 | * |
| 210 | * @since 1.0 |
| 211 | */ |
| 212 | do_action( 'give_tools_tab_export_table_bottom' ); |
| 213 | ?> |
| 214 | </tbody> |
| 215 | </table> |
| 216 | |
| 217 | <?php |
| 218 | /** |
| 219 | * Fires after the reports export tab. |
| 220 | * |
| 221 | * @since 1.0 |
| 222 | */ |
| 223 | do_action( 'give_tools_tab_export_content_bottom' ); |
| 224 | ?> |
| 225 | |
| 226 | </div> |
| 227 | <!-- .post-body-content --> |
| 228 | </div> |
| 229 | <!-- .post-body --> |
| 230 | </div><!-- #give-dashboard-widgets-wrap --> |
| 231 | </div><!-- #poststuff --> |
| 232 |