]> git.nbdom.net Git - nb.git/commitdiff
table.replace in yaml
authorNicolas Boisselier <nicolas.boisselier@gmail.com>
Fri, 15 Jan 2016 00:02:22 +0000 (01:02 +0100)
committerNicolas Boisselier <nicolas.boisselier@gmail.com>
Fri, 15 Jan 2016 00:02:22 +0000 (01:02 +0100)
lib/php/db/table.php

index 138193ddeb6cf2ce7f9e395029e47a05b22b44e3..08f6e8a62ebceca0ec08c95e718b857a98ae2556 100644 (file)
@@ -26,6 +26,7 @@ class table extends nb {
   public $sql;
   public $fields = null;
   public $fields_keys = null;
+  public $replace = array(); # replace by javascript
   public $extras = array();
   public $params = array(
     'table',
@@ -794,7 +795,7 @@ FROM pg_catalog.pg_attribute a WHERE a.attrelid = (SELECT c.oid FROM pg_catalog.
   -----------------------------------------------------------------*/
   function rows_begin_table($fields) {
 
-    $html = DB_HTML_NAV_TOP;
+    $html = $this->html_nav_top();
     #$html .= '<table data-role="table" class="ui-responsive rows '.$this->name.'">'.PHP_EOL;
     $html .= '<table class="rows '.$this->name.'">'.PHP_EOL;
     #if (!empty($opt)) $html .= '<caption>' . $this->nav($opt['count'],$opt['tot'],$opt['limit']) . '</caption>' .PHP_EOL;
@@ -839,7 +840,7 @@ FROM pg_catalog.pg_attribute a WHERE a.attrelid = (SELECT c.oid FROM pg_catalog.
     Html Div
   -----------------------------------------------------------------*/
   function rows_begin_div() {
-    return '<div class="rows '.$this->name.'">'.PHP_EOL.DB_HTML_NAV_TOP;
+    return '<div class="rows '.$this->name.'">'.PHP_EOL.$this->html_nav_top();
   }
 
   function rows_rec_div(&$row) {
@@ -1037,5 +1038,16 @@ FROM pg_catalog.pg_attribute a WHERE a.attrelid = (SELECT c.oid FROM pg_catalog.
 
     return false;
   }
+
+  function html_nav_top() {
+    $html = DB_HTML_NAV_TOP;
+    if (!empty($this->replace)) {
+      $replace = array();
+      foreach ($this->replace as $k=>$v) { $replace[] = "$k.$v"; }
+      $html .= '<span id="db-table-replace" style="display:none">'.join(' ',$replace).'</span>';
+    }
+    return $html;
+  }
+
 }
 ?>