]> git.nbdom.net Git - nb.git/commitdiff
config dir
authorNicolas Boisselier <nicolas.boisselier@gmail.com>
Mon, 6 Jul 2015 16:05:25 +0000 (17:05 +0100)
committerNicolas Boisselier <nicolas.boisselier@gmail.com>
Mon, 6 Jul 2015 16:05:25 +0000 (17:05 +0100)
lib/php/db.php

index ed912d180824ec38bf7a80a242571dee52755860..86b26f10ff8749b27a4d400d43420213eebaec18 100644 (file)
@@ -807,9 +807,8 @@ FROM pg_catalog.pg_attribute a WHERE a.attrelid = (SELECT c.oid FROM pg_catalog.
     Json
   -----------------------------------------------------------------*/
   function rows_begin_json() {
-    echo '['.PHP_EOL;
     $this->_row_json = null;
-    return '';
+    echo '['.PHP_EOL;
   }
 
   function rows_rec_json($row) {
@@ -822,36 +821,34 @@ FROM pg_catalog.pg_attribute a WHERE a.attrelid = (SELECT c.oid FROM pg_catalog.
   }
 
   function rows_end_json() {
-    echo ']'.PHP_EOL;
     unset($this->_row_json);
-    return '';
+    echo ']'.PHP_EOL;
   }
 
   /*-----------------------------------------------------------------
     Yaml
   -----------------------------------------------------------------*/
   function rows_begin_yaml() {
-    $this->yamls = array();
-    return '';
+    echo "---\n";
   }
 
   function rows_rec_yaml($row) {
-    #echo yaml_emit($row);
-    $this->yamls[] = $row;
+    $yaml = yaml_emit($row);
+    $yaml = preg_replace('/^---\n/','',$yaml);
+    $yaml = preg_replace('/\n\.\.\.$/','',$yaml);
+    $yaml = preg_replace('/^/m','  ',$yaml);
+    echo '- '.trim($yaml)."\n";
   }
 
   function rows_end_yaml() {
-    return yaml_emit($this->yamls);
-    unset($this->yamls);
-    return '';
+    echo '';
   }
 
   /*-----------------------------------------------------------------
     Xml
   -----------------------------------------------------------------*/
   function rows_begin_xml() {
-    #return '<'.$this->name.'>'.PHP_EOL;
-    return ''
+    echo ''
       .'<?xml version=“1.0” encoding=“utf-8”?>'.PHP_EOL
       .'<db src="db.php" table="'.$this->name.'">'.PHP_EOL
     ;
@@ -870,8 +867,8 @@ FROM pg_catalog.pg_attribute a WHERE a.attrelid = (SELECT c.oid FROM pg_catalog.
   }
 
   function rows_end_xml() {
-    #return '</'.$this->name.'>'.PHP_EOL;
-    return '</db>'.PHP_EOL;
+    #echo '</'.$this->name.'>'.PHP_EOL;
+    echo '</db>'.PHP_EOL;
   }
 
   /*-----------------------------------------------------------------
@@ -894,16 +891,15 @@ FROM pg_catalog.pg_attribute a WHERE a.attrelid = (SELECT c.oid FROM pg_catalog.
 // NB 14.04.14   function rows_begin_table($opt=array()) {
   function rows_begin_table() {
 
-    $html = '<table class="'.$this->name.' rows border">'.PHP_EOL;
+    echo '<table class="'.$this->name.' rows border">'.PHP_EOL;
 
-    $html .= '<tr class="'.$this->name.' row bold">';
-    $html .= '<th class="'.DB_HTML_EDIT.'"></th>';
+    echo '<tr class="'.$this->name.' row bold">';
+    echo '<th class="'.DB_HTML_EDIT.'"></th>';
     foreach (array_keys($this->fields()) as $f) {
-      $html .= '<th class="'.$f.'">'.$this->url_sort($f).'</th>';
+      echo '<th class="'.$f.'">'.$this->url_sort($f).'</th>';
     }
 
-    $html .= "</tr>".PHP_EOL;
-    return $html;
+    echo '</tr>'.PHP_EOL;
   }
 
   function rows_rec_table($row) {
@@ -917,14 +913,14 @@ FROM pg_catalog.pg_attribute a WHERE a.attrelid = (SELECT c.oid FROM pg_catalog.
   }
 
   function rows_end_table() {
-    return "</table>".PHP_EOL;
+    echo '</table>'.PHP_EOL;
   }
 
   /*-----------------------------------------------------------------
     Html Div
   -----------------------------------------------------------------*/
   function rows_begin_div() {
-    return '<div class="'.$this->name.' rows">'.PHP_EOL;
+    echo '<div class="'.$this->name.' rows">'.PHP_EOL;
   }
 
   function rows_rec_div($row) {