]> git.nbdom.net Git - nb.git/commitdiff
www/dbq/dbq.php
authorNicolas Boisselier <nicolas.boisselier@gmail.com>
Sat, 6 Jan 2018 19:27:04 +0000 (19:27 +0000)
committerNicolas Boisselier <nicolas.boisselier@gmail.com>
Sat, 6 Jan 2018 19:27:04 +0000 (19:27 +0000)
etc/dbq/pub.php
lib/php/db/table.php
www/dbq/dbq.php

index c4009ec86e922835f6e0afbc788826a91e303a57..000f8e1a99f643cacd126f566e89a028aa2673ee 100644 (file)
@@ -1,7 +1,17 @@
 <?php
+return;
 require_once(realpath(dirname(__FILE__).'/../../lib/php/maps.php'));
+function pub_map(&$r) {
+       if (empty($r['latitude'])) return;
+       if (empty($r['longiture'])) return;
+       $r['maps'] = '<a href="'.Maps::link($r['latitude'],$r['latitude']).'">'
+               .Maps::img($r['latitude'],$r['latitude'])
+       .'</a>';
+}
+
 $DBQ['pub'] = [
        'tables' => [
+               'zipcode' => [ 'extras' => ['maps' => ''] ],
        ],
 ];
 ?>
index 52816fa7f1d8b21066a0d01a0e30c0fc76bce5b2..3d517ecfbb5e817f4a692541ca9be1f7ba718e3b 100644 (file)
@@ -985,7 +985,8 @@ Class Table extends nb {
     // Post
     //
     if ($parser and !empty($this->row_parse_post)) {
-      $call = $this->row_parse_post; $call($row,$this);
+      $call = $this->row_parse_post;
+                       $call($row,$this);
     }
 
     if ($parser and !empty($this->db()->row_parse_post)) {
index 66a6528bf738d1387a1dd7d4bc3b4cf623f6a41a..6c192587c51fd65274db2355b1ef6c98da55b9b4 100644 (file)
@@ -441,13 +441,24 @@ class DbQ extends nb {
        public function table_rows($fct=null) {
                $this->db->limit = $this->limit();
 
+    if (!empty($this->db()->row_parse_pre)) {
+      $row_parse_pre = $this->db()->row_parse_pre;
+    }
+
+    if (!empty($this->db()->row_parse_post)) {
+      $row_parse_post = $this->db()->row_parse_post;
+      $call($r,$this);
+    }
+
                $opt = ($this->page->is('html')
                        and $this->table_rw()
                ) ? [
                        'row_parse_pre' => function(&$r){
+                               if (!empty($row_parse_pre)) $row_parse_pre($r,$this);
                                $GLOBALS['dbq_args'] = urlencode( join($this->param_args_sep,$this->table->fields_keys_values($r)) );
                        },
                        'row_parse_post' => function(&$r){
+                               if (!empty($row_parse_post)) $row_parse_post($r,$this);
 
                                $args = $GLOBALS['dbq_args'];
                                $hidden = $this->form_hidden($r);
@@ -473,7 +484,9 @@ class DbQ extends nb {
                        },
                ] : [];
 
-               $this->table->rows($opt);
+               #$this->table->rows($opt);
+               $this->db()->__construct($opt);
+               $this->table->rows();
                unset($GLOBALS['dbq_args']);
        }