-
Notifications
You must be signed in to change notification settings - Fork 0
/
Tabbar.php
44 lines (39 loc) · 1.27 KB
/
Tabbar.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
<?php
// Lucas Tiago de Moraes
// include class DHX
include_once 'DHX.php';
// class Tabbar
class Tabbar extends DHX {
private $document; // ref document
private $row; // ref row
// auto construct
function __construct($value = ''){
if($value){
$this->encoding($value);
}
$this->document = $this->document();
$tabbar = $this->document->appendChild(new DOMElement('tabbar'));
$this->row = $tabbar->appendChild(new DOMElement('row'));
}
// public tab
public function tab(){
$data = func_get_args();
foreach($data as $row){
$tab = $this->row->appendChild(new DOMElement('tab'));
foreach($row as $key => $value){
if($key == 'text'){
$tab->appendChild($this->document->createTextNode($value));
}elseif($key == 'content'){
$content = $tab->appendChild(new DOMElement('content'));
$content->appendChild(new DOMCdataSection($value));
}else{
$tab->setAttributeNode(new DOMAttr($key, $value));
}
}
}
}
// public result
public function result(){
return $this->document->saveXML();
}
}