diff options
| author | hugetoad <hugetoad@97f52cf1-0a1b-0410-bd0e-c28be96e8082> | 2006-01-02 11:29:33 +0000 |
|---|---|---|
| committer | hugetoad <hugetoad@97f52cf1-0a1b-0410-bd0e-c28be96e8082> | 2006-01-02 11:29:33 +0000 |
| commit | 1bd57f97f90f26c13bb37cb6c669f444d80db01b (patch) | |
| tree | 6d574241cd286410794707afc72983f2fcbfedc2 /frontends/php/include/classes/table.inc.php | |
| parent | cc9d50233d69f1a4c85e9ea925dc7e732bad44b3 (diff) | |
| download | zabbix-1bd57f97f90f26c13bb37cb6c669f444d80db01b.tar.gz zabbix-1bd57f97f90f26c13bb37cb6c669f444d80db01b.tar.xz zabbix-1bd57f97f90f26c13bb37cb6c669f444d80db01b.zip | |
Using new class cTable for queue.php (Alexei)
git-svn-id: svn://svn.zabbix.com/trunk@2474 97f52cf1-0a1b-0410-bd0e-c28be96e8082
Diffstat (limited to 'frontends/php/include/classes/table.inc.php')
| -rw-r--r-- | frontends/php/include/classes/table.inc.php | 80 |
1 files changed, 78 insertions, 2 deletions
diff --git a/frontends/php/include/classes/table.inc.php b/frontends/php/include/classes/table.inc.php index 8a1385bb..7f0c8f26 100644 --- a/frontends/php/include/classes/table.inc.php +++ b/frontends/php/include/classes/table.inc.php @@ -21,10 +21,86 @@ <?php class Ctable { - var $elements; + var $rows; + var $header; + var $msg_empty; + + function Ctable($msg_empty="") + { + $this->rows=array(); + $this->header=array(); + $this->msg_empty=$msg_empty; + } + + function addRow($row) + { + $this->rows = array_merge($this->rows, array($row)); + } + +// Private + function setHeader($header) + { + $this->header = $header; + } + +// Private + function showHeader($class="tborder") + { + echo "<table class=\"$class\" border=0 width=\"100%\" bgcolor='#AAAAAA' cellspacing=1 cellpadding=3>"; + echo "\n"; + echo "<tr bgcolor='#CCCCCC'>"; + while(list($num,$element)=each($this->header)) + { + echo "<td><b>".$element."</b></td>"; + } + echo "</tr>"; + echo "\n"; + } + +// Private + function showFooter() + { + echo "</table>"; + echo "\n"; + } + +// Private + function showRow($elements, $rownum) + { + if($rownum%2 == 1) { echo "<TR BGCOLOR=\"#DDDDDD\">"; } + else { echo "<TR BGCOLOR=\"#EEEEEE\">"; } + + while(list($num,$element)=each($elements)) + { + if(is_array($element)&&isset($element["hide"])&&($element["hide"]==1)) continue; + if(is_array($element)) + { + if(isset($element["class"])) + echo "<td class=\"".$element["class"]."\">".$element["value"]."</td>"; + else + echo "<td>".$element["value"]."</td>"; + } + else + { + echo "<td>".$element."</td>"; + } + } + echo "</tr>"; + echo "\n"; + } - function addRow() + function show() { + $this->showHeader(); + while (list($num,$row) = each($this->rows)) + { + $this->showRow($row,$num); + } + if(count($this->rows) == 0) + { + echo "<tr bgcolor=#eeeeee><td colspan=".count($this->header)." align=center>".$this->msg_empty."</td></tr>\n"; + } + $this->showFooter(); } } ?> |
