Commit 9fbbab4d9fb2134aaa2d5786eb3de1ccbac658b9

Authored by Neil Blakey-Milner
1 parent 5870f55c

Use templating for this instead.


git-svn-id: https://kt-dms.svn.sourceforge.net/svnroot/kt-dms/trunk@3453 c91229c3-7414-0410-bfa2-8a42b809f60b
lib/visualpatterns/PatternTableLinks.inc
@@ -69,39 +69,16 @@ class PatternTableLinks { @@ -69,39 +69,16 @@ class PatternTableLinks {
69 function & render() { 69 function & render() {
70 global $default; 70 global $default;
71 71
72 - $iArraySize = count($this->aLinks);  
73 - $iArrayCount = 0;  
74 - $sToRender = "<table border=0 width=\"100%\" cellspacing = \"0\">\n";  
75 -  
76 - //build the table  
77 - for ($i = 0; $i < ($this->iRows > $iArraySize ? $this->iRows : $iArraySize); $i++) {  
78 - $sToRender .= "<tr>\n";  
79 - $sLink = "";  
80 - for ($j = 0; $j < $this->iColumns; $j++) {  
81 - if ($iArrayCount <= $iArraySize) {  
82 - if (strlen($this->aLinks[$iArrayCount]) > 0) {  
83 - $sLink = "<a href=\"" . $this->aLinks[$iArrayCount] . "\">";  
84 - if ($this->iLinkType == TEXT) {  
85 - $sLink .= $this->aLinksText[$iArrayCount];  
86 - } else if ($this->iLinkType == IMAGE) {  
87 - $oImage = new PatternImage($this->aLinkImages[$iArrayCount]);  
88 - $sLink .= $oImage->render();  
89 - }  
90 - $sLink .= "</a>";  
91 - }  
92 - $iArrayCount++;  
93 - }  
94 -  
95 - if (strlen($sLink) > 0) {  
96 - $sToRender .= "<td cellspacing=\"20\" width=\"100%\">$sLink</td>";  
97 - $sToRender .= "</tr><tr></tr><tr/><tr/><tr/><tr><td></td>\n";  
98 - }  
99 - }  
100 - $sToRender .= "</tr>\n";  
101 - }  
102 - $sToRender .= "</table>\n"; 72 + $oTemplating = KTTemplating::getSingleton();
  73 + $oTemplate = $oTemplating->loadTemplate("ktcore/standard_links");
  74 + $aTemplateData = array(
  75 + "array_size" => count($this->aLinks),
  76 + "links" => array_combine($this->aLinksText, $this->aLinks),
  77 + );
  78 + $sToRender = $oTemplate->render($aTemplateData);
  79 +
103 return $sToRender; 80 return $sToRender;
104 } 81 }
105 } 82 }
106 83
107 -?>  
108 \ No newline at end of file 84 \ No newline at end of file
  85 +?>