Commit 7d128dbc2d8737b86b2167a70d17ab4cfcfce05c
1 parent
cf6baa86
refactored getColour method
git-svn-id: https://kt-dms.svn.sourceforge.net/svnroot/kt-dms/trunk@1991 c91229c3-7414-0410-bfa2-8a42b809f60b
Showing
4 changed files
with
10 additions
and
33 deletions
lib/visualpatterns/PatternBrowsableSearchResults.inc
| @@ -107,7 +107,7 @@ class PatternBrowseableSearchResults { | @@ -107,7 +107,7 @@ class PatternBrowseableSearchResults { | ||
| 107 | $iDisplayed = 0; | 107 | $iDisplayed = 0; |
| 108 | //limit the result set displayed | 108 | //limit the result set displayed |
| 109 | while($sql->next_record() && ($iDisplayed < $this->iResultsToDisplay)) { | 109 | while($sql->next_record() && ($iDisplayed < $this->iResultsToDisplay)) { |
| 110 | - $sToRender .= "<tr bgcolor=\"" . $this->getColour($iColour) . "\">"; | 110 | + $sToRender .= "<tr bgcolor=\"" . getColour($iColour) . "\">"; |
| 111 | $iColour++; | 111 | $iColour++; |
| 112 | 112 | ||
| 113 | for ($i = 0; $i < count($this->aColumns); $i++) { | 113 | for ($i = 0; $i < count($this->aColumns); $i++) { |
| @@ -204,10 +204,5 @@ class PatternBrowseableSearchResults { | @@ -204,10 +204,5 @@ class PatternBrowseableSearchResults { | ||
| 204 | } | 204 | } |
| 205 | return 0; | 205 | return 0; |
| 206 | } | 206 | } |
| 207 | - | ||
| 208 | - function getColour($iColourCount) { | ||
| 209 | - return ($iColourCount%2 == 0) ? "F5F6EE" : "FFFFFF"; | ||
| 210 | - } | ||
| 211 | } | 207 | } |
| 212 | - | ||
| 213 | -?> | 208 | +?> |
| 214 | \ No newline at end of file | 209 | \ No newline at end of file |
lib/visualpatterns/PatternEditableListFromQuery.inc
| @@ -124,21 +124,21 @@ class PatternEditableListFromQuery { | @@ -124,21 +124,21 @@ class PatternEditableListFromQuery { | ||
| 124 | switch ($this->aDisplayColumnTypes[$i]) { | 124 | switch ($this->aDisplayColumnTypes[$i]) { |
| 125 | case 1: | 125 | case 1: |
| 126 | //plain text field | 126 | //plain text field |
| 127 | - $sToRender .= "\t<td bgcolor=\"" . $this->getColour($i) . "\"><input type=\"text\" size = \"30\" name=\"" . $this->sUniqueName . "_" . $i . "_value\" value=\"" . stripslashes($sql->f($this->aDisplayColumns[$i])) . "\"</td>\n"; | 127 | + $sToRender .= "\t<td bgcolor=\"" . getColour($i) . "\"><input type=\"text\" size = \"30\" name=\"" . $this->sUniqueName . "_" . $i . "_value\" value=\"" . stripslashes($sql->f($this->aDisplayColumns[$i])) . "\"</td>\n"; |
| 128 | break; | 128 | break; |
| 129 | case 2: | 129 | case 2: |
| 130 | //boolean value | 130 | //boolean value |
| 131 | - $sToRender .= "\t<td bgcolor=\"" . $this->getColour($i) . "\"><input type=\"checkbox\" name=\"" . $this->sUniqueName . "_" . $i . "_value\" value=\"1\" " . ($sql->f($this->aDisplayColumns[$i]) ? " CHECKED " : " ") . "/></td>\n"; | 131 | + $sToRender .= "\t<td bgcolor=\"" . getColour($i) . "\"><input type=\"checkbox\" name=\"" . $this->sUniqueName . "_" . $i . "_value\" value=\"1\" " . ($sql->f($this->aDisplayColumns[$i]) ? " CHECKED " : " ") . "/></td>\n"; |
| 132 | break; | 132 | break; |
| 133 | case 3: | 133 | case 3: |
| 134 | $oPatternListBox = & new PatternListBox($this->aDropDownListTableNames[$i], "name", "id", $this->sUniqueName . "_" . $i . "_value"); | 134 | $oPatternListBox = & new PatternListBox($this->aDropDownListTableNames[$i], "name", "id", $this->sUniqueName . "_" . $i . "_value"); |
| 135 | $oPatternListBox->setSelectedValue($sql->f($this->aStoreColumns[$i])); | 135 | $oPatternListBox->setSelectedValue($sql->f($this->aStoreColumns[$i])); |
| 136 | - $sToRender .= "\t<td bgcolor=\"" . $this->getColour($i) . "\">" . $oPatternListBox->render() . "</td>\t\n"; | 136 | + $sToRender .= "\t<td bgcolor=\"" . getColour($i) . "\">" . $oPatternListBox->render() . "</td>\t\n"; |
| 137 | break; | 137 | break; |
| 138 | case 4: | 138 | case 4: |
| 139 | //meta data type | 139 | //meta data type |
| 140 | $oPattern = & new PatternMetaData($this->aMetaDataFields[$i], $this->sUniqueName . "_" . $i . "_value", $sql->f($this->aStoreColumns[$i])); | 140 | $oPattern = & new PatternMetaData($this->aMetaDataFields[$i], $this->sUniqueName . "_" . $i . "_value", $sql->f($this->aStoreColumns[$i])); |
| 141 | - $sToRender .= "\t<td bgcolor=\"" . $this->getColour($i) . "\">" . $oPattern->render() . "</td>\t\n"; | 141 | + $sToRender .= "\t<td bgcolor=\"" . getColour($i) . "\">" . $oPattern->render() . "</td>\t\n"; |
| 142 | default: | 142 | default: |
| 143 | break; | 143 | break; |
| 144 | } | 144 | } |
| @@ -179,11 +179,5 @@ class PatternEditableListFromQuery { | @@ -179,11 +179,5 @@ class PatternEditableListFromQuery { | ||
| 179 | return $sToRender; | 179 | return $sToRender; |
| 180 | 180 | ||
| 181 | } | 181 | } |
| 182 | - | ||
| 183 | - function getColour($iColourCount) { | ||
| 184 | - return ($iColourCount%2 == 0) ? "F5F6EE" : "FFFFFF"; | ||
| 185 | - } | ||
| 186 | - | ||
| 187 | } | 182 | } |
| 188 | - | ||
| 189 | ?> | 183 | ?> |
lib/visualpatterns/PatternListFromQuery.inc
| @@ -97,14 +97,14 @@ class PatternListFromQuery { | @@ -97,14 +97,14 @@ class PatternListFromQuery { | ||
| 97 | switch ($this->aColumnTypes[$i]) { | 97 | switch ($this->aColumnTypes[$i]) { |
| 98 | //plain text field | 98 | //plain text field |
| 99 | case 1: | 99 | case 1: |
| 100 | - $sToRender .= "<td bgcolor=\"$sTDBGColour\">" . $this->aColumnNames[$i] . "</td><td bgcolor=\"" . $this->getColour($iColour) ."\">" . stripslashes($sql->f($this->aColumns[$i])) . "</td>\n"; | 100 | + $sToRender .= "<td bgcolor=\"$sTDBGColour\">" . $this->aColumnNames[$i] . "</td><td bgcolor=\"" . getColour($iColour) ."\">" . stripslashes($sql->f($this->aColumns[$i])) . "</td>\n"; |
| 101 | break; | 101 | break; |
| 102 | //text area | 102 | //text area |
| 103 | case 2: | 103 | case 2: |
| 104 | - $sToRender .= "<td bgcolor=\"$sTDBGColour\">" . $this->aColumnNames[$i] . "</td><td bgcolor=\"" . $this->getColour($iColour) ."\"><textarea cols=$this->iTextAreaColumns rows=$this->iTextAreaRows READONLY>" . $sql->f($this->aColumns[$i]) . "</textarea></td>\n"; | 104 | + $sToRender .= "<td bgcolor=\"$sTDBGColour\">" . $this->aColumnNames[$i] . "</td><td bgcolor=\"" . getColour($iColour) ."\"><textarea cols=$this->iTextAreaColumns rows=$this->iTextAreaRows READONLY>" . $sql->f($this->aColumns[$i]) . "</textarea></td>\n"; |
| 105 | break; | 105 | break; |
| 106 | case 3: | 106 | case 3: |
| 107 | - $sToRender .= "<td bgcolor=\"$sTDBGColour\">" . $this->aColumnNames[$i] . "</b></td><td bgcolor=\"" . $this->getColour($iColour) ."\"><a href=\"" . $this->aHyperLinkURL[$i] . "?" . $this->replaceValues($this->aQueryStringText[$i], $sql) . "\">" . stripslashes($sql->f($this->aColumns[$i])) . "</a></td>\n"; | 107 | + $sToRender .= "<td bgcolor=\"$sTDBGColour\">" . $this->aColumnNames[$i] . "</b></td><td bgcolor=\"" . getColour($iColour) ."\"><a href=\"" . $this->aHyperLinkURL[$i] . "?" . $this->replaceValues($this->aQueryStringText[$i], $sql) . "\">" . stripslashes($sql->f($this->aColumns[$i])) . "</a></td>\n"; |
| 108 | break; | 108 | break; |
| 109 | default: | 109 | default: |
| 110 | break; | 110 | break; |
| @@ -121,11 +121,5 @@ class PatternListFromQuery { | @@ -121,11 +121,5 @@ class PatternListFromQuery { | ||
| 121 | function replaceValues($sQueryStringText, $sql) { | 121 | function replaceValues($sQueryStringText, $sql) { |
| 122 | return $sQueryStringText; | 122 | return $sQueryStringText; |
| 123 | } | 123 | } |
| 124 | - | ||
| 125 | - function getColour($iColourCount) { | ||
| 126 | - return ($iColourCount%2 == 0) ? "F5F6EE" : "FFFFFF"; | ||
| 127 | - } | ||
| 128 | - | ||
| 129 | } | 124 | } |
| 130 | - | ||
| 131 | ?> | 125 | ?> |
lib/visualpatterns/PatternTableSqlQuery.inc
| @@ -122,7 +122,7 @@ class PatternTableSqlQuery { | @@ -122,7 +122,7 @@ class PatternTableSqlQuery { | ||
| 122 | } else { | 122 | } else { |
| 123 | $iColour = 0; | 123 | $iColour = 0; |
| 124 | while ($sql->next_record()) { | 124 | while ($sql->next_record()) { |
| 125 | - $sToRender .= "<tr bgcolor=\"" . $this->getColour($iColour) . "\">\n"; | 125 | + $sToRender .= "<tr bgcolor=\"" . getColour($iColour) . "\">\n"; |
| 126 | $iColour++; | 126 | $iColour++; |
| 127 | for ($i = 0; $i < count($this->aColumns); $i++) { | 127 | for ($i = 0; $i < count($this->aColumns); $i++) { |
| 128 | switch ($this->aColumnTypes[$i]) { | 128 | switch ($this->aColumnTypes[$i]) { |
| @@ -186,11 +186,5 @@ class PatternTableSqlQuery { | @@ -186,11 +186,5 @@ class PatternTableSqlQuery { | ||
| 186 | function generateImageURL($sURL) { | 186 | function generateImageURL($sURL) { |
| 187 | return "<img src=\"" . $sURL . "\" border=\"0\"/>"; | 187 | return "<img src=\"" . $sURL . "\" border=\"0\"/>"; |
| 188 | } | 188 | } |
| 189 | - | ||
| 190 | - function getColour($iColourCount) { | ||
| 191 | - return ($iColourCount%2 == 0) ? "F5F6EE" : "FFFFFF"; | ||
| 192 | - } | ||
| 193 | - | ||
| 194 | } | 189 | } |
| 195 | - | ||
| 196 | ?> | 190 | ?> |
| 197 | \ No newline at end of file | 191 | \ No newline at end of file |