← All changes
|
includes/admin/reports/class-donor-reports-table.php
+28
-23
2.3.1
→
4.17.0
View file →
| @@ -61,13 +61,15 @@ | ||
| 61 | 61 | public function __construct() { |
| 62 | 62 | global $status, $page; |
| 63 | 63 | |
| 64 | 64 | // Set parent defaults |
| 65 | - parent::__construct( array( | |
| 66 | - 'singular' => esc_html__( 'Donor', 'give' ), // Singular name of the listed records | |
| 67 | - 'plural' => esc_html__( 'Donors', 'give' ), // Plural name of the listed records | |
| 68 | - 'ajax' => false,// Does this table support ajax? | |
| 69 | - ) ); | |
| 65 | + parent::__construct( | |
| 66 | + array( | |
| 67 | + 'singular' => esc_html__( 'Donor', 'give' ), // Singular name of the listed records | |
| 68 | + 'plural' => esc_html__( 'Donors', 'give' ), // Plural name of the listed records | |
| 69 | + 'ajax' => false, // Does this table support ajax? | |
| 70 | + ) | |
| 71 | + ); | |
| 70 | 72 | |
| 71 | 73 | } |
| 72 | 74 | |
| 73 | 75 | /** |
| @@ -108,13 +110,13 @@ | ||
| 108 | 110 | echo '<input type="hidden" name="order" value="' . esc_attr( $_REQUEST['order'] ) . '" />'; |
| 109 | 111 | } |
| 110 | 112 | ?> |
| 111 | 113 | <p class="search-box donor-search" role="search"> |
| 112 | - <label class="screen-reader-text" for="<?php echo $input_id ?>"><?php echo $text; ?>:</label> | |
| 113 | - <input type="search" id="<?php echo $input_id ?>" name="s" value="<?php _admin_search_query(); ?>" /> | |
| 114 | + <label class="screen-reader-text" for="<?php echo $input_id; ?>"><?php echo $text; ?>:</label> | |
| 115 | + <input type="search" id="<?php echo $input_id; ?>" name="s" value="<?php _admin_search_query(); ?>" /> | |
| 114 | 116 | <?php submit_button( $text, 'button', false, false, array( 'ID' => 'search-submit' ) ); ?> |
| 115 | 117 | </p> |
| 116 | - <?php | |
| 118 | + <?php | |
| 117 | 119 | } |
| 118 | 120 | |
| 119 | 121 | /** |
| 120 | 122 | * Generate the table navigation above or below the table |
| @@ -144,9 +146,10 @@ | ||
| 144 | 146 | if ( 'top' === $which ) { |
| 145 | 147 | $this->give_search_box( esc_html__( 'Search Donors', 'give' ), 'give-donors-report-search' ); |
| 146 | 148 | } |
| 147 | 149 | |
| 148 | - $this->bulk_actions( $which ); ?> | |
| 150 | + $this->bulk_actions( $which ); | |
| 151 | + ?> | |
| 149 | 152 | |
| 150 | 153 | </div> |
| 151 | 154 | <?php |
| 152 | 155 | $this->extra_tablenav( $which ); |
| @@ -175,24 +178,24 @@ | ||
| 175 | 178 | public function column_default( $item, $column_name ) { |
| 176 | 179 | |
| 177 | 180 | switch ( $column_name ) { |
| 178 | 181 | |
| 179 | - case 'name' : | |
| 180 | - $name = '#' . $item['id'] . ' '; | |
| 181 | - $name .= ! empty( $item['name'] ) ? $item['name'] : '<em>' . esc_html__( 'Unnamed Donor', 'give' ) . '</em>'; | |
| 182 | + case 'name': | |
| 183 | + $name = '#' . $item['id'] . ' '; | |
| 184 | + $name .= ! empty( $item['name'] ) ? $item['name'] : '<em>' . esc_html__( 'Unnamed Donor', 'give' ) . '</em>'; | |
| 182 | 185 | $view_url = admin_url( 'edit.php?post_type=give_forms&page=give-donors&view=overview&id=' . $item['id'] ); |
| 183 | 186 | $value = '<a href="' . esc_url( $view_url ) . '">' . $name . '</a>'; |
| 184 | 187 | break; |
| 185 | 188 | |
| 186 | - case 'num_donations' : | |
| 189 | + case 'num_donations': | |
| 187 | 190 | $value = sprintf( |
| 188 | 191 | '<a href="%s">%s</a>', |
| 189 | 192 | admin_url( 'edit.php?post_type=give_forms&page=give-payment-history&donor=' . absint( $item['id'] ) ), |
| 190 | - esc_html( $item['num_donations'] ) | |
| 191 | - ); | |
| 193 | + esc_html( $item['num_donations'] ) | |
| 194 | + ); | |
| 192 | 195 | break; |
| 193 | 196 | |
| 194 | - case 'amount_spent' : | |
| 197 | + case 'amount_spent': | |
| 195 | 198 | $value = give_currency_filter( give_format_amount( $item[ $column_name ], array( 'sanitize' => false ) ) ); |
| 196 | 199 | break; |
| 197 | 200 | |
| 198 | 201 | default: |
| @@ -322,9 +325,9 @@ | ||
| 322 | 325 | $_donor_query = $this->get_donor_query(); |
| 323 | 326 | |
| 324 | 327 | $_donor_query['number'] = -1; |
| 325 | 328 | $_donor_query['offset'] = 0; |
| 326 | - $donors = Give()->donors->get_donors( $_donor_query ); | |
| 329 | + $donors = Give()->donors->get_donors( $_donor_query ); | |
| 327 | 330 | |
| 328 | 331 | return count( $donors ); |
| 329 | 332 | } |
| 330 | 333 | |
| @@ -348,9 +351,9 @@ | ||
| 348 | 351 | 'order' => $order, |
| 349 | 352 | 'orderby' => $orderby, |
| 350 | 353 | ); |
| 351 | 354 | |
| 352 | - if( $search ) { | |
| 355 | + if ( $search ) { | |
| 353 | 356 | if ( is_email( $search ) ) { |
| 354 | 357 | $args['email'] = $search; |
| 355 | 358 | } elseif ( is_numeric( $search ) ) { |
| 356 | 359 | $args['id'] = $search; |
| @@ -384,11 +387,13 @@ | ||
| 384 | 387 | $this->items = $this->reports_data(); |
| 385 | 388 | |
| 386 | 389 | $this->total = $this->get_donor_count(); |
| 387 | 390 | |
| 388 | - $this->set_pagination_args( array( | |
| 389 | - 'total_items' => $this->total, | |
| 390 | - 'per_page' => $this->per_page, | |
| 391 | - 'total_pages' => ceil( $this->total / $this->per_page ), | |
| 392 | - ) ); | |
| 391 | + $this->set_pagination_args( | |
| 392 | + array( | |
| 393 | + 'total_items' => $this->total, | |
| 394 | + 'per_page' => $this->per_page, | |
| 395 | + 'total_pages' => ceil( $this->total / $this->per_page ), | |
| 396 | + ) | |
| 397 | + ); | |
| 393 | 398 | } |
| 394 | 399 | } |