Ignore:
Timestamp:
06/29/07 15:17:46 (17 years ago)
Author:
niltonneto
Message:

Versão nova do ADODB (4.5 para 4.95)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/phpgwapi/inc/adodb/tohtml.inc.php

    r2 r34  
    11<?php  
    22/* 
    3   V4.51 29 July 2004  (c) 2000-2004 John Lim (jlim@natsoft.com.my). All rights reserved. 
     3  V4.93 10 Oct 2006  (c) 2000-2007 John Lim (jlim#natsoft.com.my). All rights reserved. 
    44  Released under both BSD license and Lesser GPL library license.  
    55  Whenever there is any discrepancy between the two licenses,  
     
    1010   
    1111// specific code for tohtml 
    12 GLOBAL $gSQLMaxRows,$gSQLBlockRows; 
    13           
     12GLOBAL $gSQLMaxRows,$gSQLBlockRows,$ADODB_ROUND; 
     13 
     14$ADODB_ROUND=4; // rounding 
    1415$gSQLMaxRows = 1000; // max no of rows to download 
    1516$gSQLBlockRows=20; // max no of rows per table block 
     
    3637// 
    3738// RETURNS: number of rows displayed 
     39 
     40 
    3841function rs2html(&$rs,$ztabhtml=false,$zheaderarray=false,$htmlspecialchars=true,$echo = true) 
    3942{ 
    4043$s ='';$rows=0;$docnt = false; 
    41 GLOBAL $gSQLMaxRows,$gSQLBlockRows; 
     44GLOBAL $gSQLMaxRows,$gSQLBlockRows,$ADODB_ROUND; 
    4245 
    4346        if (!$rs) { 
     
    5356        for ($i=0; $i < $ncols; $i++) {  
    5457                $field = $rs->FetchField($i); 
    55                 if ($zheaderarray) $fname = $zheaderarray[$i]; 
    56                 else $fname = htmlspecialchars($field->name);    
    57                 $typearr[$i] = $rs->MetaType($field->type,$field->max_length); 
    58                 //print " $field->name $field->type $typearr[$i] "; 
    59                          
     58                if ($field) { 
     59                        if ($zheaderarray) $fname = $zheaderarray[$i]; 
     60                        else $fname = htmlspecialchars($field->name);    
     61                        $typearr[$i] = $rs->MetaType($field->type,$field->max_length); 
     62                        //print " $field->name $field->type $typearr[$i] "; 
     63                } else { 
     64                        $fname = 'Field '.($i+1); 
     65                        $typearr[$i] = 'C'; 
     66                } 
    6067                if (strlen($fname)==0) $fname = '&nbsp;'; 
    6168                $hdr .= "<TH>$fname</TH>"; 
     
    7885                        switch($type) { 
    7986                        case 'D': 
    80                                 if (!strpos($v,':')) { 
     87                                if (empty($v)) $s .= "<TD> &nbsp; </TD>\n"; 
     88                                else if (!strpos($v,':')) { 
    8189                                        $s .= " <TD>".$rs->UserDate($v,"D d, M Y") ."&nbsp;</TD>\n"; 
    82                                         break; 
    8390                                } 
     91                                break; 
    8492                        case 'T': 
    85                                 $s .= " <TD>".$rs->UserTimeStamp($v,"D d, M Y, h:i:s") ."&nbsp;</TD>\n"; 
     93                                if (empty($v)) $s .= "<TD> &nbsp; </TD>\n"; 
     94                                else $s .= "    <TD>".$rs->UserTimeStamp($v,"D d, M Y, h:i:s") ."&nbsp;</TD>\n"; 
    8695                        break; 
     96                         
     97                        case 'N': 
     98                                if (abs(abs($v) - round($v,0)) < 0.00000001) 
     99                                        $v = round($v); 
     100                                else 
     101                                        $v = round($v,$ADODB_ROUND); 
    87102                        case 'I': 
    88                         case 'N': 
    89103                                $s .= " <TD align=right>".stripslashes((trim($v))) ."&nbsp;</TD>\n"; 
    90104                                 
Note: See TracChangeset for help on using the changeset viewer.