-
Notifications
You must be signed in to change notification settings - Fork 0
/
HtmlTable.class.php
52 lines (42 loc) · 1.14 KB
/
HtmlTable.class.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
<?php
class HtmlTable extends HtmlElement
{
private $_content,
$_caption;
public $_tag;
public function toHtml()
{
parent::prepareAttributes();
$attributes = $this->prepareAttributes();
$content = $this->prepareContent();
$this->_tohtml = "\n\t\t<table".$attributes.">\n\t\t\t".$this->_caption.$content."\t\t</table>\n";
return ($this->_tohtml);
}
public function addItem(HtmlTableRow $row)
{
$this->_content[] = $row->toHtml();
}
public function prepareContent()
{
$content = "";
if ($this->_content)
{
foreach ($this->_content as $value)
$content .= $value;
}
$this->_content = $content;
return ($this->_content);
}
public function setCaption($caption)
{
if (isset($caption))
$this->_caption = '<caption>'.$caption."</caption>\n";
}
public function getTableNumRows()
{
if ($this->_content)
{
return (count($this->_content));
}
}
}