| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253 |
- <?php
- class NTKHBox
- {
- function NTKHBox($id, $padding, $spacing, $debug = False)
- {
- $this->id = $id;
- $this->padding = $padding;
- $this->spacing = $spacing;
- $this->debug = $debug;
-
- $this->elems = array();
- }
-
- function add($elem, $width = -1, $height = -1, $style = "")
- {
- $this->elems[] = array($elem, $width, $height, $style);
- }
-
- function getHtml()
- {
- $html = "";
- $html .= "<table id=\"$this->id\" class=\"hbox\" ";
- if($this->debug)
- $html .= "border=\"1\" ";
- $html .= "cellspacing=\"$this->spacing\" cellpadding=\"$this->padding\" style=\"table-layout: fixed; width: 100%; height: 100%;\">\n";
-
- $html .= "<tr>\n";
-
- for($i = 0; $i < count($this->elems); $i++)
- {
- if($this->elems[$i][1] != -1)
- $width = $this->elems[$i][1];
- else
- $width = "100%";
- if($this->elems[$i][2] != -1)
- $height = $this->elems[$i][2];
- else
- $height = "100%";
-
- $html .= "<td style=\"width: $width; height: $height; ".$this->elems[$i][3]."\">\n";
- $html .= $this->elems[$i][0]->getHtml();
- $html .= "</td>\n";
- }
-
- $html .= "</tr>\n";
- $html .= "</table>\n";
-
- return $html;
- }
- }
- ?>
|