phpcompta-dev
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Phpcompta-dev] r4801 - phpcompta/tags/rel600/include


From: phpcompta-dev
Subject: [Phpcompta-dev] r4801 - phpcompta/tags/rel600/include
Date: Sat, 31 Mar 2012 19:09:51 +0200 (CEST)

Author: danydb
Date: 2012-03-31 19:09:51 +0200 (Sat, 31 Mar 2012)
New Revision: 4801

Modified:
   phpcompta/tags/rel600/include/class_html_table.php
Log:
Improve SQL2TABLE

Modified: phpcompta/tags/rel600/include/class_html_table.php
===================================================================
--- phpcompta/tags/rel600/include/class_html_table.php  2012-03-28 13:23:08 UTC 
(rev 4800)
+++ phpcompta/tags/rel600/include/class_html_table.php  2012-03-31 17:09:51 UTC 
(rev 4801)
@@ -30,9 +30,9 @@
    * Receives a SQL command and returns a string with the HTML code
    * to display it as a table.
    * Simple table without any feature (link in certain cell, sort,...)
-   * @param $cn database object 
+   * @param $cn database object
    * @param $a_col header of the column it is an array of array
-   *        indexes are link, name,image, style 
+   *        indexes are link, name,image, style
    * @param $sql query to execute
    * @param $table_style style of the table
    * @parm $a_sql_var array variable for the $sql DEFAULT NULL
@@ -69,7 +69,7 @@
                                     )
                               ,
                               $sql
-                              );                  
+                              );
   }
 @endcode
    */
@@ -81,6 +81,7 @@
     for ( $i=0;$i <count($a_col);$i++)
       {
        $content=h($a_col[$i]['name']);
+       $style=(isset($a_col[$i]['style']))?$a_col[$i]['style']:"";
        if ( isset($a_col[$i]['image']) && $a_col[$i]['image'] != '')
          {
            $content=sprintf('<img src="%s" 
border="0"></img>%s',$a_col[$i]['image'],$content);
@@ -90,10 +91,10 @@
            $content=sprintf('<a href="%s">%s</a>',
                             $a_col[$i]['link'],
                             $content);
-           $r.="<th>$content</th>";
-         } 
+           $r.="<th $style>$content</th>";
+         }
        else
-         $r.= th($content);
+         $r.= "<th $style>". h($content)."</th>";
       }
     $r.='</tr>';
     $ret=$cn->exec_sql($sql,$a_sql_var);
@@ -106,10 +107,11 @@
            $style='';$content=h($row[$e]);
 
            if ( isset($a_col[$e]['style']) )
-             $style=sprintf('style="%s"',$a_col[$e]['style']);
-
-
-           $r.=td($content,$style);
+             $style=$a_col[$e]['style'];
+               if  ( isset ($a_col[$e]['raw']))
+                       $r.='<td $style>'.$row[$e].'</td>';
+               else
+                       $r.=td($content,$style);
          }
        $r.='</tr>';
       }
@@ -148,6 +150,6 @@
                                     )
                               ,
                               $sql
-                              );                  
+                              );
   }
 }
\ No newline at end of file



---
PhpCompta est un logiciel de comptabilité libre en ligne (full web)
Projet opensource http://www.phpcompta.eu



reply via email to

[Prev in Thread] Current Thread [Next in Thread]