[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Gforge-commits] gforge/common/include utils.php,1.27,1.28
From: |
gsmet |
Subject: |
[Gforge-commits] gforge/common/include utils.php,1.27,1.28 |
Date: |
Mon, 09 Feb 2004 04:32:01 -0600 |
Update of /cvsroot/gforge/gforge/common/include
In directory db.perdue.net:/tmp/cvs-serv18504/common/include
Modified Files:
utils.php
Log Message:
fixed #616
Index: utils.php
===================================================================
RCS file: /cvsroot/gforge/gforge/common/include/utils.php,v
retrieving revision 1.27
retrieving revision 1.28
diff -u -d -r1.27 -r1.28
--- utils.php 9 Jan 2004 23:39:05 -0000 1.27
+++ utils.php 9 Feb 2004 10:31:58 -0000 1.28
@@ -628,67 +628,76 @@
* ShowResultSet() - Show a generic result set
* Very simple, plain way to show a generic result set
*
- * @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
+ * @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
+ * @param array Don't display these cols
*
*/
-function
ShowResultSet($result,$title='',$linkify=false,$displayHeaders=true,$headerMapping=array())
{
+function
ShowResultSet($result,$title='',$linkify=false,$displayHeaders=true,$headerMapping=array(),
$excludedCols=array()) {
global $group_id,$HTML;
- if ($result) {
+ if($result) {
$rows = db_numrows($result);
$cols = db_numfields($result);
- echo '
- <table border="0" width="100%">';
-
- /* Create the title */
- if(strlen($title) > 0) {
- $cell_data=array();
- $cell_data[] = array($title, 'colspan="'.$cols.'"');
- echo $HTML->multiTableRow('',$cell_data, TRUE);
- }
+ echo '<table border="0" width="100%">';
/* Create the headers */
- $cell_data=array();
+ $headersCellData = array();
+ $colsToKeep = array();
for ($i=0; $i < $cols; $i++) {
- $fieldName = db_fieldname($result,$i);
+ $fieldName = db_fieldname($result, $i);
+ if(in_array($fieldName, $excludedCols)) {
+ continue;
+ }
+ $colsToKeep[] = $i;
if(isset($headerMapping[$fieldName])) {
- $cell_data[] = $headerMapping[$fieldName];
+ $headersCellData[] = $headerMapping[$fieldName];
}
else {
- $cell_data[] = array($fieldName);
+ $headersCellData[] = array($fieldName);
}
}
- echo $HTML->multiTableRow('',$cell_data, TRUE);
+
+ /* Create the title */
+ if(strlen($title) > 0) {
+ $titleCellData = array();
+ $titleCellData[] = array($title,
'colspan="'.count($headersCellData).'"');
+ echo $HTML->multiTableRow('', $titleCellData, TRUE);
+ }
+
+ /* Display the headers */
+ echo $HTML->multiTableRow('', $headersCellData, TRUE);
/* Create the rows */
- for ($j = 0; $j < $rows; $j++) {
+ for ($j = 0; $j < $rows; $j++) {
echo '<tr '. $HTML->boxGetAltRowStyle($j) . '>';
for ($i = 0; $i < $cols; $i++) {
- if ($linkify && $i == 0) {
- $link = '<a href="'.$PHP_SELF.'?';
- $linkend = '</a>';
- if ($linkify == "bug_cat") {
- $link .=
'group_id='.$group_id.'&bug_cat_mod=y&bug_cat_id='.db_result($result,
$j, 'bug_category_id').'">';
- } else if($linkify == "bug_group") {
- $link .=
'group_id='.$group_id.'&bug_group_mod=y&bug_group_id='.db_result($result,
$j, 'bug_group_id').'">';
- } else if($linkify == "patch_cat") {
- $link .=
'group_id='.$group_id.'&patch_cat_mod=y&patch_cat_id='.db_result($result,
$j, 'patch_category_id').'">';
- } else if($linkify == "support_cat") {
- $link .=
'group_id='.$group_id.'&support_cat_mod=y&support_cat_id='.db_result($result,
$j, 'support_category_id').'">';
- } else if($linkify == "pm_project") {
- $link .=
'group_id='.$group_id.'&project_cat_mod=y&project_cat_id='.db_result($result,
$j, 'group_project_id').'">';
+ if(in_array($i, $colsToKeep)) {
+ if ($linkify && $i == 0) {
+ $link = '<a
href="'.$PHP_SELF.'?';
+ $linkend = '</a>';
+ if ($linkify == "bug_cat") {
+ $link .=
'group_id='.$group_id.'&bug_cat_mod=y&bug_cat_id='.db_result($result,
$j, 'bug_category_id').'">';
+ } else if($linkify ==
"bug_group") {
+ $link .=
'group_id='.$group_id.'&bug_group_mod=y&bug_group_id='.db_result($result,
$j, 'bug_group_id').'">';
+ } else if($linkify ==
"patch_cat") {
+ $link .=
'group_id='.$group_id.'&patch_cat_mod=y&patch_cat_id='.db_result($result,
$j, 'patch_category_id').'">';
+ } else if($linkify ==
"support_cat") {
+ $link .=
'group_id='.$group_id.'&support_cat_mod=y&support_cat_id='.db_result($result,
$j, 'support_category_id').'">';
+ } else if($linkify ==
"pm_project") {
+ $link .=
'group_id='.$group_id.'&project_cat_mod=y&project_cat_id='.db_result($result,
$j, 'group_project_id').'">';
+ } else {
+ $link = $linkend = '';
+ }
} else {
$link = $linkend = '';
}
- } else {
- $link = $linkend = '';
+ echo '<td>'.$link . db_result($result,
$j, $i) . $linkend.'</td>';
}
- echo '<td>'.$link . db_result($result, $j,
$i) . $linkend.'</td>';
}
echo '</tr>';
}
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Gforge-commits] gforge/common/include utils.php,1.27,1.28,
gsmet <=
- Prev by Date:
[Gforge-commits] gforge/www/include pre.php, 1.20, 1.21 Layout.class, 1.73, 1.74
- Next by Date:
[Gforge-commits] gforge/common/include constants.php,NONE,1.1
- Previous by thread:
[Gforge-commits] gforge/www/include pre.php, 1.20, 1.21 Layout.class, 1.73, 1.74
- Next by thread:
[Gforge-commits] gforge/common/include constants.php,NONE,1.1
- Index(es):