public function prepare_items() {

		// Define Columns
		$columns = $this->get_columns();
		$hidden = [];
		$sortable = $this->get_sortable_columns();
		$this->_column_headers = [ $columns, $hidden, $sortable ];

		// Data
		$data = $this->getLatestExports();

		// Pagination
		$per_page = $this->get_items_per_page( 'pb_export_per_page', 50 );
		$current_page = $this->get_pagenum();
		$total_items = count( $data );
		$orderby = ( ! empty( $_REQUEST['orderby'] ) ) ? $_REQUEST['orderby'] : 'exported';
		$order = ( ! empty( $_REQUEST['order'] ) ) ? $_REQUEST['order'] : 'desc';

		// Data slice
		$sort = ( $orderby === 'exported' ) ? [ $orderby => $order ] : [
			$orderby => $order,
			'exported' => 'desc',
		];
		$data = wp_list_sort( $data, $sort );
		$data = array_slice( $data, ( ( $current_page - 1 ) * $per_page ), $per_page );
		$this->items = $data;

		$this->set_pagination_args(
			[
				'total_items' => $total_items,
				'per_page' => $per_page,
				'total_pages' => ceil( $total_items / $per_page ),
			]
		);
	}
public function prepare_items() {

		// Define Columns
		$columns = $this->get_columns();
		$hidden = [];
		$sortable = $this->get_sortable_columns();
		$this->_column_headers = [ $columns, $hidden, $sortable ];

		// Data
		$data = $this->getLatestExports();

		// Pagination
		$per_page = $this->get_items_per_page( 'pb_export_per_page', 50 );
		$current_page = $this->get_pagenum();
		$total_items = count( $data );
		$orderby = ( ! empty( $_REQUEST['orderby'] ) ) ? $_REQUEST['orderby'] : 'exported';
		$order = ( ! empty( $_REQUEST['order'] ) ) ? $_REQUEST['order'] : 'desc';

		// Data slice
		$sort = ( $orderby === 'exported' ) ? [ $orderby => $order ] : [
			$orderby => $order,
			'exported' => 'desc',
		];
		$data = wp_list_sort( $data, $sort );
		$data = array_slice( $data, ( ( $current_page - 1 ) * $per_page ), $per_page );
		$this->items = $data;

		$this->set_pagination_args(
			[
				'total_items' => $total_items,
				'per_page' => $per_page,
				'total_pages' => ceil( $total_items / $per_page ),
			]
		);
	}
public function prepare_items ( ) { // Define Columns $ columns = $ this -> get_columns ( ) ; $ hidden = [ ] ; $ sortable = $ this -> get_sortable_columns ( ) ; $ this -> _column_headers = [ $ columns , $ hidden , $ sortable ] ; // Data $ data = $ this -> getLatestExports ( ) ; // Pagination $ per_page = $ this -> get_items_per_page ( 'pb_export_per_page' , 50 ) ; $ current_page = $ this -> get_pagenum ( ) ; $ total_items = count ( $ data ) ; $ orderby = ( ! empty ( $ _REQUEST [ 'orderby' ] ) ) ? $ _REQUEST [ 'orderby' ] : 'exported' ; $ order = ( ! empty ( $ _REQUEST [ 'order' ] ) ) ? $ _REQUEST [ 'order' ] : 'desc' ; // Data slice $ sort = ( $ orderby === 'exported' ) ? [ $ orderby => $ order ] : [ $ orderby => $ order , 'exported' => 'desc' , ] ; $ data = wp_list_sort ( $ data , $ sort ) ; $ data = array_slice ( $ data , ( ( $ current_page - 1 ) * $ per_page ) , $ per_page ) ; $ this -> items = $ data ; $ this -> set_pagination_args ( [ 'total_items' => $ total_items , 'per_page' => $ per_page , 'total_pages' => ceil ( $ total_items / $ per_page ) , ] ) ; }
Prepares the list of items for displaying.
Prepares the list of items for displaying .