Commit 7d128dbc2d8737b86b2167a70d17ab4cfcfce05c

Authored by michael
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
lib/visualpatterns/PatternBrowsableSearchResults.inc
... ... @@ -107,7 +107,7 @@ class PatternBrowseableSearchResults {
107 107 $iDisplayed = 0;
108 108 //limit the result set displayed
109 109 while($sql->next_record() && ($iDisplayed < $this->iResultsToDisplay)) {
110   - $sToRender .= "<tr bgcolor=\"" . $this->getColour($iColour) . "\">";
  110 + $sToRender .= "<tr bgcolor=\"" . getColour($iColour) . "\">";
111 111 $iColour++;
112 112  
113 113 for ($i = 0; $i < count($this->aColumns); $i++) {
... ... @@ -204,10 +204,5 @@ class PatternBrowseableSearchResults {
204 204 }
205 205 return 0;
206 206 }
207   -
208   - function getColour($iColourCount) {
209   - return ($iColourCount%2 == 0) ? "F5F6EE" : "FFFFFF";
210   - }
211 207 }
212   -
213   -?>
  208 +?>
214 209 \ No newline at end of file
... ...
lib/visualpatterns/PatternEditableListFromQuery.inc
... ... @@ -124,21 +124,21 @@ class PatternEditableListFromQuery {
124 124 switch ($this->aDisplayColumnTypes[$i]) {
125 125 case 1:
126 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 128 break;
129 129 case 2:
130 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 132 break;
133 133 case 3:
134 134 $oPatternListBox = & new PatternListBox($this->aDropDownListTableNames[$i], "name", "id", $this->sUniqueName . "_" . $i . "_value");
135 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 137 break;
138 138 case 4:
139 139 //meta data type
140 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 142 default:
143 143 break;
144 144 }
... ... @@ -179,11 +179,5 @@ class PatternEditableListFromQuery {
179 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 97 switch ($this->aColumnTypes[$i]) {
98 98 //plain text field
99 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 101 break;
102 102 //text area
103 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 105 break;
106 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 108 break;
109 109 default:
110 110 break;
... ... @@ -121,11 +121,5 @@ class PatternListFromQuery {
121 121 function replaceValues($sQueryStringText, $sql) {
122 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 122 } else {
123 123 $iColour = 0;
124 124 while ($sql->next_record()) {
125   - $sToRender .= "<tr bgcolor=\"" . $this->getColour($iColour) . "\">\n";
  125 + $sToRender .= "<tr bgcolor=\"" . getColour($iColour) . "\">\n";
126 126 $iColour++;
127 127 for ($i = 0; $i < count($this->aColumns); $i++) {
128 128 switch ($this->aColumnTypes[$i]) {
... ... @@ -186,11 +186,5 @@ class PatternTableSqlQuery {
186 186 function generateImageURL($sURL) {
187 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 191 \ No newline at end of file
... ...