give_get_forms_label_singular(), // Singular name of the listed records. 'plural' => give_get_forms_label_plural(), // Plural name of the listed records. 'ajax' => false // Does this table support ajax? ) ); add_action( 'give_report_view_actions', array( $this, 'category_filter' ) ); $this->query(); } /** * This function renders most of the columns in the list table. * * @param array $item Contains all the data of the donation form * @param string $column_name The name of the column * * @access public * @since 1.0 * * @return string Column Name */ public function column_default( $item, $column_name ) { switch ( $column_name ) { case 'title': $title = empty( $item['title'] ) ? sprintf( __( 'Untitled (#%s)', 'give' ), $item['ID'] ) : $item['title']; return sprintf( '%s', get_edit_post_link( $item['ID'] ), $title ); case 'sales': return sprintf( '%s', admin_url( 'edit.php?post_type=give_forms&page=give-payment-history&form_id=' . urlencode( $item['ID'] ) ), $item['sales'] ); case 'earnings' : return give_currency_filter( give_format_amount( $item[ $column_name ], array( 'sanitize' => false ) ) ); case 'average_sales' : return round( $item[ $column_name ] ); case 'average_earnings' : return give_currency_filter( give_format_amount( $item[ $column_name ], array( 'sanitize' => false ) ) ); case 'details' : return '' . esc_html__( 'View Detailed Report', 'give' ) . ''; default: return $item[ $column_name ]; } } /** * Retrieve the table columns * * @access public * @since 1.0 * * @return array $columns Array of all the list table columns */ public function get_columns() { $columns = array( 'title' => esc_html__( 'Form', 'give' ), 'sales' => esc_html__( 'Donations', 'give' ), 'earnings' => esc_html__( 'Income', 'give' ), 'average_sales' => esc_html__( 'Monthly Average Donations', 'give' ), 'average_earnings' => esc_html__( 'Monthly Average Income', 'give' ), 'details' => esc_html__( 'Detailed Report', 'give' ) ); return $columns; } /** * Retrieve the table's sortable columns * * @access public * @since 1.0 * * @return array Array of all the sortable columns */ public function get_sortable_columns() { return array( 'title' => array( 'title', true ), 'sales' => array( 'sales', false ), 'earnings' => array( 'earnings', false ), ); } /** * Retrieve the current page number * * @access public * @since 1.0 * * @return int Current page number */ public function get_paged() { return isset( $_GET['paged'] ) ? absint( $_GET['paged'] ) : 1; } /** * Retrieve the category being viewed * * @access public * @since 1.0 * * @return int Category ID */ public function get_category() { return isset( $_GET['category'] ) ? absint( $_GET['category'] ) : 0; } /** * Outputs the reporting views * * @access public * @since 1.0 * * @return void */ public function bulk_actions( $which = '' ) { } /** * Generate the table navigation above or below the table * * @since 1.0 * @access protected * * @param string $which */ protected function display_tablenav( $which ) { if ( 'top' === $which ) { wp_nonce_field( 'bulk-' . $this->_args['plural'] ); } ?>