--- /dev/null
+<?php
+class html_table extends WP_List_Table {
+
+ public $_table;
+ #var $items = array();
+
+ public function __construct($table) {
+ parent::__construct();
+ $this->_table = $table;
+#debug($table);
+ #$fields = $this->get_columns();
+ #debug($sort);
+ $this->_column_headers = array($this->get_columns(), array(), $this->get_sortable_columns());
+ return;
+ }
+
+ protected function column_default( $item, $column_name ) { echo $item[$column_name]; }
+
+ public function get_columns() {
+ static $cols = array();
+ if (empty($cols)) {
+ foreach ($this->_table->fields() as $f) {
+ $cols[$f->name] = $f->prettyText($f->name);
+ }
+ #$cols = array_map(function($k,$v){return array($v=>$this->_table->prettyText($v));},$fields,$fields);
+ }
+ return $cols;
+ }
+
+ protected function get_sortable_columns() {
+ $sort = array();
+ foreach ($this->get_columns() as $k =>$v) {
+ #$sort[$k] = array($v => array($k,false));
+ $sort[$k] = array($k,false);
+ }
+ return $sort;
+ return $this->get_columns();
+ }
+
+ public function prepare_items() {
+ $sql = $this->_table->rows_sql($opt);
+ $st = $GLOBALS['wpdb']->prepare($sql);
+ return $st->execute();
+ }
+
+}
+?>