]> git.nbdom.net Git - nb.git/commitdiff
css, args by ref
authorNicolas Boisselier <nicolas.boisselier@gmail.com>
Thu, 6 Aug 2015 01:30:02 +0000 (02:30 +0100)
committerNicolas Boisselier <nicolas.boisselier@gmail.com>
Thu, 6 Aug 2015 01:30:02 +0000 (02:30 +0100)
lib/css/button.css
lib/css/db.css
lib/php/db/table.php
lib/php/functions.php
lib/php/test.php [changed mode: 0644->0755]

index c19ab182327139699286e6d396f25d3f5c85d756..66aa43c643476812143e45e5129205d6d46292e4 100644 (file)
        box-sizing: border-box;
 
   background-color: #f4f4f4;
-  border: solid 1px #ddd;
   /*
+  border: solid 1px #ddd;
   box-shadow: 0px 1px 0px rgba(0, 0, 0, 0.1);
   */
   color: #666;
 }
 
 .button:hover {
-  background-color: #f0f0f0;
+  opacity: 0.6;
 }
 
 form a.button:visited,
index 9eafc6497a75737ba13ea95c0a7e74291b4890f6..6f64434ffc12680c5e3d7d510319517d5d3528eb 100644 (file)
@@ -59,6 +59,10 @@ div.rows .nav {
   padding: 0;
 }
 
+div.rows .row *:not([class~=buttons]):hover {
+  opacity: 0.7;
+}
+
 div.rows .row .buttons {
   padding-bottom: 0.5em;
 }
@@ -73,6 +77,8 @@ div.rows .row label {
 div.rows .row span {
   width: 70%;
   display: inline-block;
+  white-space: pre;
+  text-align: right;
 }
 /*
 .rows ul .button { float: right; }
@@ -83,13 +89,13 @@ div.rows div.buttons { float: right; }
 /*
   Menu
 */
-.db.menu {
+.db .menu {
   margin: 0 auto;
   padding: 0.5em 0.8em;
   display: table;
 }
 
-ul.db.menu {
+.db ul.menu {
   max-width: 7em;
 }
 
@@ -109,25 +115,25 @@ li.tables li {
   Edit
 */
 
-form.db.edit {
+.db form.edit {
   max-width: 50em;
   margin: 0 auto;
 }
 
-form.db.edit label {
+.db form.edit label {
   width: 20%;
   margin-bottom: 0.3em;
   display: inline-block;
   text-align: right;
 }
 
-form.db.edit span,
-form.db.edit input {
+.db form.edit span,
+.db form.edit input {
   width: 70%;
 }
 
 /*
-form.db.edit
+.db form.edit
 */
 .buttons {
   margin: 0.5em auto 0 auto;
@@ -138,7 +144,7 @@ form.db.edit
 
 /*
 */
-form.db.edit
+.db form.edit
 .buttons input {
   width: auto;
   float: none;
index 16a152ceb22a376e688004cb91c65c04dafe02b7..708aa5f10007f5515b437904611e3d3aeb1607c5 100644 (file)
@@ -656,7 +656,7 @@ FROM pg_catalog.pg_attribute a WHERE a.attrelid = (SELECT c.oid FROM pg_catalog.
     return '['.PHP_EOL;
   }
 
-  function rows_rec_json($row) {
+  function rows_rec_json(&$row) {
     $json = '';
     if ($this->_row_json === null) {
       $this->_row_json = true;
@@ -678,7 +678,7 @@ FROM pg_catalog.pg_attribute a WHERE a.attrelid = (SELECT c.oid FROM pg_catalog.
     return "---\n";
   }
 
-  function rows_rec_yaml($row) {
+  function rows_rec_yaml(&$row) {
     $yaml = yaml_emit($row);
     $yaml = preg_replace('/^---\n/','',$yaml);
     $yaml = preg_replace('/\n\.\.\.$/','',$yaml);
@@ -700,14 +700,14 @@ FROM pg_catalog.pg_attribute a WHERE a.attrelid = (SELECT c.oid FROM pg_catalog.
     ;
   }
 
-  function rows_rec_xml($row) {
+  function rows_rec_xml(&$row) {
     $xml = '';
     $xml .= "\t<rows>".PHP_EOL;
-    foreach (array_keys($this->fields()) as $f) {
-      if ($row[$f] !== '') $xml .= ''
-        . "\t\t<".$f.'>'
-        .'<![CDATA['.$row[$f].']]>'
-        . '</'.$f.'>'
+    foreach ($row as $k=>$v) {
+      if ($v !== '') $xml .= ''
+        . "\t\t<".$k.">"
+        .'<![CDATA['.$v.']]>'
+        . '</'.$k.'>'
       .PHP_EOL;
     }
     $xml .= "\t</rows>".PHP_EOL;
@@ -725,7 +725,7 @@ FROM pg_catalog.pg_attribute a WHERE a.attrelid = (SELECT c.oid FROM pg_catalog.
     return join("\t",array_keys($fields))."\n";
   }
 
-  function rows_rec_csv($row) {
+  function rows_rec_csv(&$row) {
     return join("\t",array_values($row))."\n";
   }
 
@@ -740,7 +740,7 @@ FROM pg_catalog.pg_attribute a WHERE a.attrelid = (SELECT c.oid FROM pg_catalog.
   function rows_begin_table() {
 
     $html = '';
-    $html .= '<table class="rows db '.$this->name.'">'.PHP_EOL;
+    $html .= '<table class="rows '.$this->name.'">'.PHP_EOL;
 
     $colspan = 0;
     if (DB_HTML_EDIT) $colspan++;
@@ -753,28 +753,28 @@ FROM pg_catalog.pg_attribute a WHERE a.attrelid = (SELECT c.oid FROM pg_catalog.
 
     $html .= '<tr class="head">';
 
-    if (DB_HTML_EDIT) $html .= '<th class="'.DB_HTML_EDIT.'"></th>';
+    if (DB_HTML_EDIT) $html .= '<th class="edit"></th>';
 
     foreach (array_keys($this->fields()) as $f) {
       $html .= '<th class="'.$f.'">'.$this->url_sort($f).'</th>';
     }
-    if (DB_HTML_DELETE) $html .= '<th class="'.DB_HTML_DELETE.'"></th>';
+    if (DB_HTML_DELETE) $html .= '<th class="delete"></th>';
     $html .= '</tr>'.PHP_EOL;#.'<tbody>'.PHP_EOL;
 
     return $html;
   }
 
-  function rows_rec_table($row) {
-
-    array_unshift($row,'<a class="edit button" href="'.$this->url_keys($row,'action=edit').'">'.DB_HTML_EDIT.'</a>');
-    array_push($row,'<a class="delete button" href="'.$this->url_keys($row,'action=delete').'">'.DB_HTML_DELETE.'</a>');
+  function rows_rec_table(&$row) {
 
     $html = '<tr class="row">';
 
+    $html .= '<td class="action"><a class="edit button" href="'.$this->url_keys($row,'action=edit').'">'.DB_HTML_EDIT.'</a></td>';
+
     foreach ($row as $k => $v) {
       $html .= '<td class="'.$k.'">'.$v.'</td>';
     }
 
+    $html .= '<td class="action"><a class="delete button" href="'.$this->url_keys($row,'action=delete').'">'.DB_HTML_DELETE.'</a></td>';
     $html .= '</tr>'.PHP_EOL;
 
     return $html;
@@ -787,9 +787,7 @@ FROM pg_catalog.pg_attribute a WHERE a.attrelid = (SELECT c.oid FROM pg_catalog.
     if (!empty($opt['count'])) $html .= ''#'<tfoot>'.PHP_EOL
       .'<tr class="nav bottom">'
       . '<td colspan="'.(
-        count($this->fields())
-        +(DB_HTML_EDIT ? 1 :0)
-        +(DB_HTML_DELETE ? 1 :0)
+        count($this->fields()) +(DB_HTML_EDIT ? 1 :0) +(DB_HTML_DELETE ? 1 :0)
       ).'">'
       . $this->nav($opt['count'],$opt['tot'],$opt['limit'])
       . '</td>'
@@ -804,10 +802,10 @@ 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 db '.$this->name.'">'.DB_HTML_NAV_TOP.PHP_EOL;
+    return '<div class="rows '.$this->name.'">'.DB_HTML_NAV_TOP.PHP_EOL;
   }
 
-  function rows_rec_div($row) {
+  function rows_rec_div(&$row) {
 
     $html = '';
 
index 38f1aa8af8dd86e0e70719f6f4bdfd3d3ad5361e..f4e2291f58c613e8a0727382a76001c777213a0e 100644 (file)
@@ -294,4 +294,9 @@ function html_select_array($data,$opt=array()) {
   return $html;
 
 }
+    /*
+    if (preg_match('/^(1)?$/',$this->db->p('header'))) echo $this->{"rows_begin_$format"}($this->fields());
+      echo $this->{"rows_rec_$format"}($row);
+    echo $this->{"rows_end_$format"}($opt);
+*/
 ?>
old mode 100644 (file)
new mode 100755 (executable)
index f439772..37574f3
@@ -1,3 +1,4 @@
+#!/usr/bin/env php -q
 <?php // test.php
 if (0) die(
   ' strpos: '.strpos('text/html', 'ml')
@@ -17,36 +18,19 @@ echo $first;
 exit;
 */
 
-function _static() {
-  static $v = null;
-  if ($v === null) $v = preg_match('/zaza/','zaza hello') ? true : false;
-  return $v;
-} benchmark('_static');
-
-function _glob() {
-  if (!isset($GLOBALS['ZAZA'])) $GLOBALS['ZAZA'] = preg_match('/zaza/','zaza hello') ? true : false;
-  return $GLOBALS['ZAZA'];
-} benchmark('_glob');
-
-function _defined() {
-  if (!defined('ZAZA')) define('ZAZA',preg_match('/zaza/','zaza hello') ? true : false);
-  return ZAZA;
-} benchmark('_defined');
-
-function direct() {
-  return preg_match('/zaza/','zaza hello');
-} benchmark('direct');
-benchmark();
-exit;
-
+function __f1(&$ar) { $v=$ar; return; foreach ($ar as $v) { 1; } }
+function __f2($ar) { return; foreach ($ar as $v) { 1; } }
+$array = array_fill(0,10000,"a");
 function _f1() {
-  $_REQUEST['zaza'] === null;
+  __f1($array);
 } benchmark('_f1');
 
 function _f2() {
-  $_REQUEST['zaza'] == null;
+  __f2($array);
 } benchmark('_f2');
 
+benchmark(); exit;
+
 function _f3() {
   @$_REQUEST['zaza'];
 } benchmark('_f3');
@@ -59,8 +43,7 @@ function _f5() {
   !empty($_REQUEST['zaza']);
 } benchmark('_f5');
 
-benchmark();
-exit;
+benchmark(); exit;
 
 $g = array();
 function _is_set() {