]> git.nbdom.net Git - nb.git/commitdiff
wp compatible
authorNicolas Boisselier <nicolas.boisselier@semantico.com>
Tue, 19 Apr 2016 16:28:13 +0000 (17:28 +0100)
committerNicolas Boisselier <nicolas.boisselier@semantico.com>
Tue, 19 Apr 2016 16:28:13 +0000 (17:28 +0100)
lib/php/db/table.php

index 4b01c8dd4a8d9d402d70ab0b249a7a6b51468320..c7f57fecd8a50d1b67f77984d54cbb1a6fa7d48c 100644 (file)
@@ -31,7 +31,7 @@ Class Table extends nb {
   public $created;
 
   # hidden, sort, ... fields
-  public static $params = array( 'db', 'table', 'limit', 'debug', 'action');
+  public static $params = array( 'db', 'table', 'limit', 'debug', 'action', 'page');
 
   public $fields;
 
@@ -58,14 +58,16 @@ Class Table extends nb {
     }
 
     // Connection
-#bye($opt['db']);
     if (isset($opt['db'])) {
       $this->db(is_object($opt['db']) ? $opt['db'] : new Db($opt['db']));
       unset($opt['db']);
+
     } elseif(isset($GLOBALS['Db'])) {
       $this->db($GLOBALS['Db']);
+
     } else {
       $this->db(new Db());
+
     }
 
     // Order BY
@@ -313,7 +315,7 @@ Class Table extends nb {
     $st = $this->db()->conn->prepare($sql);
     $st->execute();
 
-    echo '<form class="db edit" method="post" action="?">'.NB_EOL;
+    echo '<form class="db edit form-table" method="post" action="?">'.NB_EOL;
     echo '<div class="fields">'.NB_EOL;
     $count = 0;
     if ( $add or ($row = $st->fetch(PDO::FETCH_ASSOC, PDO::FETCH_ORI_NEXT))) {
@@ -729,7 +731,7 @@ Class Table extends nb {
         }
 
       }
-      
+
       #
       # Row
       #
@@ -959,7 +961,7 @@ Class Table extends nb {
     $html = '';
 
     #$html .= '<table data-role="table" class="ui-responsive rows '.$this->name.'">'.NB_EOL;
-    $html .= '<table class="rows">'.NB_EOL;
+    $html .= '<table class="rows wp-list-table widefat fixed striped">'.NB_EOL;
     #if (!empty($opt)) $html .= '<caption>' . $this->nav($opt['count'],$opt['tot'],$opt['limit']) . '</caption>' .NB_EOL;
 
     if ($this->p('header')!=="0") {
@@ -1010,7 +1012,7 @@ Class Table extends nb {
     Html Div
   -----------------------------------------------------------------*/
   public function rows_begin_div() {
-    return '<div class="rows">'.NB_EOL;
+    return '<div class="rows search-results">'.NB_EOL;
   }
 
   public function rows_rec_div(&$row) {
@@ -1399,6 +1401,9 @@ Class Table extends nb {
       $r .= '</span>';
     }
 
+    // Submit
+    $r .= '<input type="submit" class="button button-small" /><input type="reset" class="button button-small" />';
+
     // Order By
     /*
     $r .= '<span class="label">';