gforge-commits
[Top][All Lists]
Advanced

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

[Gforge-commits] gforge/common/include utils.php,1.26,1.27


From: cbayle
Subject: [Gforge-commits] gforge/common/include utils.php,1.26,1.27
Date: Fri, 09 Jan 2004 17:39:07 -0600

Update of /cvsroot/gforge/gforge/common/include
In directory db.perdue.net:/tmp/cvs-serv20930/gforge/common/include

Modified Files:
        utils.php 
Log Message:
Patch [ #616 ] ShowResultSet function
 Work on the ShowResultSet function to make it more flexible and to make its 
html output localizable.
 Improved localization of detail_task.php.
 thanks to Guillaume Smet


Index: utils.php
===================================================================
RCS file: /cvsroot/gforge/gforge/common/include/utils.php,v
retrieving revision 1.26
retrieving revision 1.27
diff -u -d -r1.26 -r1.27
--- utils.php   12 Jun 2003 00:32:55 -0000      1.26
+++ utils.php   9 Jan 2004 23:39:05 -0000       1.27
@@ -631,9 +631,11 @@
  * @param              int             The result set ID
  * @param              string  The title of the result set
  * @param              bool    The option to turn URL's into links
+ * @param              bool    The option to display headers
+ * @param              array   The db field name -> label mapping
  *
  */
-function  ShowResultSet($result,$title="Untitled",$linkify=false)  {
+function  
ShowResultSet($result,$title='',$linkify=false,$displayHeaders=true,$headerMapping=array())
  {
        global $group_id,$HTML;
 
        if  ($result)  {
@@ -644,15 +646,22 @@
                        <table border="0" width="100%">';
 
                /*  Create the title  */
-
-               $cell_data=array();
-               $cell_data[] = array($title, 'colspan="'.$cols.'"');
-               echo $HTML->multiTableRow('',$cell_data, TRUE);
+               if(strlen($title) > 0) {
+                       $cell_data=array();
+                       $cell_data[] = array($title, 'colspan="'.$cols.'"');
+                       echo $HTML->multiTableRow('',$cell_data, TRUE);
+               }
 
                /*  Create  the  headers  */
                $cell_data=array();
                for ($i=0; $i < $cols; $i++) {
-                       $cell_data[] = array(db_fieldname($result,$i));
+                       $fieldName = db_fieldname($result,$i);
+                       if(isset($headerMapping[$fieldName])) {
+                               $cell_data[] = $headerMapping[$fieldName];
+                       }
+                       else {
+                               $cell_data[] = array($fieldName);
+                       }
                }
                echo $HTML->multiTableRow('',$cell_data, TRUE);
 





reply via email to

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