Commit 7342ce7c65c62527d9136bd1310cf17832578e37
1 parent
27748a00
added image handling functionality
git-svn-id: https://kt-dms.svn.sourceforge.net/svnroot/kt-dms/trunk@271 c91229c3-7414-0410-bfa2-8a42b809f60b
Showing
1 changed file
with
12 additions
and
2 deletions
lib/visualpatterns/PatternTableLinks.inc
| @@ -8,6 +8,9 @@ HTML table with with specified number of rows and columns | @@ -8,6 +8,9 @@ HTML table with with specified number of rows and columns | ||
| 8 | @date 7 January 2003 | 8 | @date 7 January 2003 |
| 9 | */ | 9 | */ |
| 10 | 10 | ||
| 11 | +define("TEXT", 1); | ||
| 12 | +define("IMAGE", 2); | ||
| 13 | + | ||
| 11 | class PatternTableLinks { | 14 | class PatternTableLinks { |
| 12 | 15 | ||
| 13 | /** Array of link URLS to display in tables */ | 16 | /** Array of link URLS to display in tables */ |
| @@ -33,7 +36,7 @@ class PatternTableLinks { | @@ -33,7 +36,7 @@ class PatternTableLinks { | ||
| 33 | * @param $iLinkType Link type (1 = Text or 2 = Button). Default is 1 | 36 | * @param $iLinkType Link type (1 = Text or 2 = Button). Default is 1 |
| 34 | * @param $aLinkImages Array of images URL placed over links | 37 | * @param $aLinkImages Array of images URL placed over links |
| 35 | */ | 38 | */ |
| 36 | - function PatternTableLinks($aNewLinks, $aNewLinksText, $iNewRows, $iNewColumns, $iNewLinkType = 1, $aNewLinkImages = null) { | 39 | + function PatternTableLinks($aNewLinks, $aNewLinksText, $iNewRows, $iNewColumns, $iNewLinkType = TEXT, $aNewLinkImages = null) { |
| 37 | $this->aLinks = $aNewLinks; | 40 | $this->aLinks = $aNewLinks; |
| 38 | $this->aLinksText = $aNewLinksText; | 41 | $this->aLinksText = $aNewLinksText; |
| 39 | $this->aLinkImages = $aNewLinkImages; | 42 | $this->aLinkImages = $aNewLinkImages; |
| @@ -58,7 +61,14 @@ class PatternTableLinks { | @@ -58,7 +61,14 @@ class PatternTableLinks { | ||
| 58 | for ($j = 0; $j < $this->iColumns; $j++) { | 61 | for ($j = 0; $j < $this->iColumns; $j++) { |
| 59 | $sToRender = $sToRender . "<td>"; | 62 | $sToRender = $sToRender . "<td>"; |
| 60 | if ($iArrayCount < $iArraySize) { | 63 | if ($iArrayCount < $iArraySize) { |
| 61 | - $sToRender = $sToRender . "<a href=\"" . $this->aLinks[$iArrayCount] . "\" />" . $this->aLinksText[$iArrayCount]; | 64 | + $sToRender = $sToRender . "<a href=\"" . $this->aLinks[$iArrayCount] . "\" />"; |
| 65 | + if ($this->iLinkType == TEXT) { | ||
| 66 | + $sToRender = $sToRender . $this->aLinksText[$iArrayCount]; | ||
| 67 | + } else if ($this->iLinkType == IMAGE) { | ||
| 68 | + $oImage = new PatternImage($this->aLinkImages[$iArrayCount]); | ||
| 69 | + $sToRender = $sToRender . $oImage->render(); | ||
| 70 | + } | ||
| 71 | + $sToRender = $sToRender . "</a>"; | ||
| 62 | $iArrayCount++; | 72 | $iArrayCount++; |
| 63 | } | 73 | } |
| 64 | $sToRender = $sToRender . "</td>\n"; | 74 | $sToRender = $sToRender . "</td>\n"; |