return;
}
- $opt['tot'] = $count;
- $opt['count'] = $count;
- $opt['limit'] = $limit;
+ $this->tot = $opt['tot'] = $count;
+ $this->count = $opt['count'] = $count;
+ $this->limit = $opt['limit'] = $limit;
if ($opt['is_html']) {
-----------------------------------------------------------------*/
public function rows_begin_wp() {
$this->_html_table = new html_table($this);
-
return '';
}
+
public function rows_rec_wp(&$row) {
$this->_html_table->items[] = $row;
return '';
}
+
public function rows_end_wp() {
+ $this->_html_table->set_pagination_args(array(
+ 'total_items' => $this->count, // total items defined above
+ 'per_page' => $this->limit, // per page constant defined at top of method
+ 'total_pages' => ceil($this->count / $this->limit) // calculate pages count
+ ));
+ #$this->_html_table->display_tablenav('top');
$this->_html_table->display();
+ #$this->_html_table->display_tablenav('bottom');
unset($this->_html_table);
return '';
}
#$fields = $this->get_columns();
#debug($sort);
$this->_column_headers = array($this->get_columns(), array(), $this->get_sortable_columns());
- $_REQUEST['s'] = ' ';
- $this->search_box();
return;
}
<input type="search" id="<?php echo $input_id ?>" name="s" value="<?php _admin_search_query(); ?>" />
*/
}
- protected function column_default( $item, $column_name ) { echo $item[$column_name]; }
+ protected function column_default( $item, $column_name ) { return $item[$column_name]; }
public function get_columns() {
static $cols = array();
$sort = array();
foreach ($this->get_columns() as $k =>$v) {
#$sort[$k] = array($v => array($k,false));
- $sort[$k] = array($k,false);
+ $sort[$k] = array($k,$this->_table->p('orderby') == $k ? true : false);
}
return $sort;
return $this->get_columns();
}
- public function prepare_items() {
- $sql = $this->_table->rows_sql($opt);
+ public function _prepare_items() {
+debug('prepare_items');
+return;
+ list($sql,$where,$limit,$select_count) = $this->_table->rows_sql($opt);
$st = $GLOBALS['wpdb']->prepare($sql);
+ $this->items = $wpdb->get_results($st, ARRAY_A);
+ debug($this->items);
+ $total_items = $this->items;
+ $per_page = $this->_table->p('limit');
+ $this->set_pagination_args(array(
+ 'total_items' => $total_items, // total items defined above
+ 'per_page' => $per_page, // per page constant defined at top of method
+ 'total_pages' => ceil($total_items / $per_page) // calculate pages count
+ ));
return $st->execute();
}
while($file = readdir($rep)) {
if ($file == '.' or $file == '..') continue;
-
+
if (!$exp or preg_match('#\.('.$exp.')$#',$file)) {
$ls[] = $file;
}
if (!isset($array[$key]) || (isset($array[$key]) && !is_array($array[$key]))) {
$array[$key] = array();
}
-
+
// overwrite the value in the base array
if (is_array($value)) {
$value = recurse($array[$key], $value);
return $array;
}
-
+
// handle the arguments, merge one by one
$args = func_get_args();
$array = $args[0];