Exemplo n.º 1
0
 static function process()
 {
     global $advman_list;
     $q = Advman_Tools::get_search_query();
     echo '<div class="wrap"><h2>' . __('Ads', 'advman');
     if (!empty($q)) {
         printf(' <span class="subtitle">' . __('Search results for &#8220;%s&#8221;', 'advman') . '</span>', $q);
     }
     echo '</h2>';
     $advman_list->views();
     $advman_list->prepare_items();
     ?>
     <form method="get">
         <input type="hidden" name="page" value="advman-list">
         <?php 
     $advman_list->search_box('search', 'ad');
     ?>
     </form>
     <form method="post">
         <?php 
     wp_nonce_field('advman-bulk-actions');
     $advman_list->display();
     ?>
     </form>
     </div>
 <?php 
 }
Exemplo n.º 2
0
 function prepare_items()
 {
     $filter = $this->_get_filter();
     $q = Advman_Tools::get_search_query();
     $columns = $this->get_columns();
     $hidden = array();
     $sortable = $this->get_sortable_columns();
     $this->_column_headers = array($columns, $hidden, $sortable);
     // Retrieve the ad data from the DB
     $data = $this->get_data($filter, $q);
     usort($data, array(&$this, 'usort_reorder'));
     $total_items = count($data);
     $per_page = 10;
     $current_page = $this->get_pagenum();
     $this->set_pagination_args(array('total_items' => $total_items, 'per_page' => $per_page));
     $this->items = array_slice($data, ($current_page - 1) * $per_page, $per_page);
 }