src/ListTable.php
public function prepare_items() {

		$page     = $this->get_pagenum();
		$per_page = $this->get_items_per_page( get_current_screen()->id . '_per_page' );

		if ( ! isset( $_GET['orderby'] ) ) {
			$_GET['orderby'] = 'time';
			$_GET['order']   = 'desc';
		}

		$args = array(
			'page'           => $page,
			'items_per_page' => $per_page
		);

		if ( isset( $_GET['orderby'] ) ) {
			$args['order'] = array(
				$_GET['orderby'] => isset( $_GET['order'] ) ? $_GET['order'] : 'ASC'
			);
		}

		if ( ! empty( $_GET['s'] ) ) {
			$args['message'] = $_GET['s'];
		}

		if ( ! empty( $_GET['level'] ) && array_key_exists( $_GET['level'], $this->get_levels() ) ) {
			$args['level'] = $_GET['level'];
		}

		if ( ! empty( $_GET['m'] ) ) {

			$args['time'] = array(
				'month' => substr( $_GET['m'], 4, 2 ),
				'year'  => substr( $_GET['m'], 0, 4 )
			);
		}

		$query = new LogQuery( $this->table, $this->model_class, $args );

		$total = $query->get_total_items();

		$this->items = $query->get_results();

		$this->set_pagination_args( array(
				'total_items' => $total,
				// we have to calculate the total number of items
				'per_page'    => $per_page,
				// we have to determine how many items to show on a page
				'total_pages' => ceil( $total / $per_page )
				// we have to calculate the total number of pages
			)
		);
	}
public function prepare_items() {

		$page     = $this->get_pagenum();
		$per_page = $this->get_items_per_page( get_current_screen()->id . '_per_page' );

		if ( ! isset( $_GET['orderby'] ) ) {
			$_GET['orderby'] = 'time';
			$_GET['order']   = 'desc';
		}

		$args = array(
			'page'           => $page,
			'items_per_page' => $per_page
		);

		if ( isset( $_GET['orderby'] ) ) {
			$args['order'] = array(
				$_GET['orderby'] => isset( $_GET['order'] ) ? $_GET['order'] : 'ASC'
			);
		}

		if ( ! empty( $_GET['s'] ) ) {
			$args['message'] = $_GET['s'];
		}

		if ( ! empty( $_GET['level'] ) && array_key_exists( $_GET['level'], $this->get_levels() ) ) {
			$args['level'] = $_GET['level'];
		}

		if ( ! empty( $_GET['m'] ) ) {

			$args['time'] = array(
				'month' => substr( $_GET['m'], 4, 2 ),
				'year'  => substr( $_GET['m'], 0, 4 )
			);
		}

		$query = new LogQuery( $this->table, $this->model_class, $args );

		$total = $query->get_total_items();

		$this->items = $query->get_results();

		$this->set_pagination_args( array(
				'total_items' => $total,
				// we have to calculate the total number of items
				'per_page'    => $per_page,
				// we have to determine how many items to show on a page
				'total_pages' => ceil( $total / $per_page )
				// we have to calculate the total number of pages
			)
		);
	}
public function prepare_items ( ) { $ page = $ this -> get_pagenum ( ) ; $ per_page = $ this -> get_items_per_page ( get_current_screen ( ) -> id . '_per_page' ) ; if ( ! isset ( $ _GET [ 'orderby' ] ) ) { $ _GET [ 'orderby' ] = 'time' ; $ _GET [ 'order' ] = 'desc' ; } $ args = array ( 'page' => $ page , 'items_per_page' => $ per_page ) ; if ( isset ( $ _GET [ 'orderby' ] ) ) { $ args [ 'order' ] = array ( $ _GET [ 'orderby' ] => isset ( $ _GET [ 'order' ] ) ? $ _GET [ 'order' ] : 'ASC' ) ; } if ( ! empty ( $ _GET [ 's' ] ) ) { $ args [ 'message' ] = $ _GET [ 's' ] ; } if ( ! empty ( $ _GET [ 'level' ] ) && array_key_exists ( $ _GET [ 'level' ] , $ this -> get_levels ( ) ) ) { $ args [ 'level' ] = $ _GET [ 'level' ] ; } if ( ! empty ( $ _GET [ 'm' ] ) ) { $ args [ 'time' ] = array ( 'month' => substr ( $ _GET [ 'm' ] , 4 , 2 ) , 'year' => substr ( $ _GET [ 'm' ] , 0 , 4 ) ) ; } $ query = new LogQuery ( $ this -> table , $ this -> model_class , $ args ) ; $ total = $ query -> get_total_items ( ) ; $ this -> items = $ query -> get_results ( ) ; $ this -> set_pagination_args ( array ( 'total_items' => $ total , // we have to calculate the total number of items 'per_page' => $ per_page , // we have to determine how many items to show on a page 'total_pages' => ceil ( $ total / $ per_page ) // we have to calculate the total number of pages ) ) ; }
Prepares the list of items for displaying.
@uses   WP_List_Table::set_pagination_args()

@since  1.0
@access public
Prepares the list of items for displaying . @uses WP_List_Table :: set_pagination_args ()