Commit 115f94d0190a436c66955fbf2974b0cad107e89e
1 parent
a8552d87
Added to functionality to specify multiple variables to add to the query string
git-svn-id: https://kt-dms.svn.sourceforge.net/svnroot/kt-dms/trunk@697 c91229c3-7414-0410-bfa2-8a42b809f60b
Showing
2 changed files
with
25 additions
and
6 deletions
lib/visualpatterns/PatternListBox.inc
| @@ -98,7 +98,10 @@ class PatternListBox { | @@ -98,7 +98,10 @@ class PatternListBox { | ||
| 98 | global $default; | 98 | global $default; |
| 99 | 99 | ||
| 100 | $sql = $default->db; | 100 | $sql = $default->db; |
| 101 | - $sQuery = "SELECT DISTINCT $this->sDisplayColumn AS display, $this->sValueColumn AS value FROM $this->sTableName "; | 101 | + $sQuery = "SELECT DISTINCT ST." . $this->sDisplayColumn . " AS display, ST." . $this->sValueColumn . " AS value FROM $this->sTableName AS ST "; |
| 102 | + if (isset($this->sFromClause)) { | ||
| 103 | + $sQuery .= $this->sFromClause . " "; | ||
| 104 | + } | ||
| 102 | if (isset($this->sWhereClause)) { | 105 | if (isset($this->sWhereClause)) { |
| 103 | $sQuery .= "WHERE " . $this->sWhereClause . " "; | 106 | $sQuery .= "WHERE " . $this->sWhereClause . " "; |
| 104 | } | 107 | } |
lib/visualpatterns/PatternTableSqlQuery.inc
| @@ -37,8 +37,10 @@ class PatternTableSqlQuery { | @@ -37,8 +37,10 @@ class PatternTableSqlQuery { | ||
| 37 | var $sWidth; | 37 | var $sWidth; |
| 38 | /** link url used if a column type of 3 is specified */ | 38 | /** link url used if a column type of 3 is specified */ |
| 39 | var $sLinkURL; | 39 | var $sLinkURL; |
| 40 | - /** database column value to append to link url if a column type of 3 is specified */ | ||
| 41 | - var $sDBQueryStringColumn; | 40 | + /** database column values to append to link url if a column type of 3 is specified */ |
| 41 | + var $aDBQueryStringColumns; | ||
| 42 | + /** variables names to give $aDBQueryStringColumns on the query string */ | ||
| 43 | + var $aQueryStringVariableNames; | ||
| 42 | /** display the column headings or not */ | 44 | /** display the column headings or not */ |
| 43 | var $bDisplayColumnHeadings; | 45 | var $bDisplayColumnHeadings; |
| 44 | /** table heading */ | 46 | /** table heading */ |
| @@ -50,7 +52,7 @@ class PatternTableSqlQuery { | @@ -50,7 +52,7 @@ class PatternTableSqlQuery { | ||
| 50 | /** message that will be displayed if the table is empty*/ | 52 | /** message that will be displayed if the table is empty*/ |
| 51 | var $sEmptyTableMessage; | 53 | var $sEmptyTableMessage; |
| 52 | 54 | ||
| 53 | - function PatternTableSqlQuery($sTmpQuery, $aTmpColumns, $aTmpColumnTypes, $aTmpColumnHeaderNames, $sTmpWidth, $sTmpLinkURL = null, $sTmpDBQueryStringColumn = null, $bTmpDisplayColumnHeadings = false) { | 55 | + function PatternTableSqlQuery($sTmpQuery, $aTmpColumns, $aTmpColumnTypes, $aTmpColumnHeaderNames, $sTmpWidth, $sTmpLinkURL = null, $sTmpDBQueryStringColumns = null, $aNewQueryStringVariableNames = null) { |
| 54 | $this->sQuery = $sTmpQuery; | 56 | $this->sQuery = $sTmpQuery; |
| 55 | $this->aColumns = & $aTmpColumns; | 57 | $this->aColumns = & $aTmpColumns; |
| 56 | $this->aColumnTypes = $aTmpColumnTypes; | 58 | $this->aColumnTypes = $aTmpColumnTypes; |
| @@ -58,7 +60,8 @@ class PatternTableSqlQuery { | @@ -58,7 +60,8 @@ class PatternTableSqlQuery { | ||
| 58 | $this->sWidth = $sTmpWidth; | 60 | $this->sWidth = $sTmpWidth; |
| 59 | $this->bDisplayColumnHeadings = $bTmpDisplayColumnHeadings; | 61 | $this->bDisplayColumnHeadings = $bTmpDisplayColumnHeadings; |
| 60 | $this->sLinkURL = $sTmpLinkURL; | 62 | $this->sLinkURL = $sTmpLinkURL; |
| 61 | - $this->sDBQueryStringColumn = $sTmpDBQueryStringColumn; | 63 | + $this->aDBQueryStringColumns = $sTmpDBQueryStringColumns; |
| 64 | + $this->aQueryStringVariableNames = $aNewQueryStringVariableNames; | ||
| 62 | } | 65 | } |
| 63 | 66 | ||
| 64 | function setEmptyTableMessage($sNewValue) { | 67 | function setEmptyTableMessage($sNewValue) { |
| @@ -77,6 +80,10 @@ class PatternTableSqlQuery { | @@ -77,6 +80,10 @@ class PatternTableSqlQuery { | ||
| 77 | $this->bUseImageURLFromQuery = $bNewValue; | 80 | $this->bUseImageURLFromQuery = $bNewValue; |
| 78 | } | 81 | } |
| 79 | 82 | ||
| 83 | + function setDisplayColumnHeadings($bNewValue) { | ||
| 84 | + $this->bDisplayColumnHeadings = $bNewValue; | ||
| 85 | + } | ||
| 86 | + | ||
| 80 | /** | 87 | /** |
| 81 | * Build the HTML string used to render the object | 88 | * Build the HTML string used to render the object |
| 82 | * | 89 | * |
| @@ -121,7 +128,16 @@ class PatternTableSqlQuery { | @@ -121,7 +128,16 @@ class PatternTableSqlQuery { | ||
| 121 | $sToRender .= $sql->f($this->aColumns[$i]) . "</td>"; | 128 | $sToRender .= $sql->f($this->aColumns[$i]) . "</td>"; |
| 122 | break; | 129 | break; |
| 123 | case 3: | 130 | case 3: |
| 124 | - $sToRender .= "<td><a href=\"" . $this->sLinkURL . $sql->f($this->sDBQueryStringColumn) . "\">"; | 131 | + $sToRender .= "<td><a href=\"" . $this->sLinkURL; |
| 132 | + for ($j = 0; $j < count($this->aDBQueryStringColumns); $j++) { | ||
| 133 | + if (strpos($sToRender, "?") === false) { | ||
| 134 | + $sToRender .= "?" . $this->aQueryStringVariableNames[$j] . "=" . $sql->f($this->aDBQueryStringColumns[$j]); | ||
| 135 | + } else { | ||
| 136 | + $sToRender .= "&" . $this->aQueryStringVariableNames[$j] . "=" . $sql->f($this->aDBQueryStringColumns[$j]); | ||
| 137 | + } | ||
| 138 | + } | ||
| 139 | + $sToRender .= "\">"; | ||
| 140 | + | ||
| 125 | if (isset($this->sImageURL)) { | 141 | if (isset($this->sImageURL)) { |
| 126 | $sToRender .= $this->generateImageURL($this->sImageURL); | 142 | $sToRender .= $this->generateImageURL($this->sImageURL); |
| 127 | } else if ($this->bUseImageURLFromQuery) { | 143 | } else if ($this->bUseImageURLFromQuery) { |