-
Notifications
You must be signed in to change notification settings - Fork 0
/
Accordion.php
48 lines (43 loc) · 1.57 KB
/
Accordion.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
<?php
// Lucas Tiago de Moraes
// include class DHX
include_once 'DHX.php';
// class Accordion
class Accordion extends DHX {
public $skin = 'dhx_skyblue'; // set skin
public $mode = 'single'; // set mode
public $iconsPath = '../common/'; // set iconsPath
public $openEffect = 'false'; // set openEffect
private $document; // ref document
private $accordion; // ref accordion
// auto construct
function __construct($value = ''){
if($value){
$this->encoding($value);
}
$this->document = $this->document();
$this->accordion = $this->document->appendChild(new DOMElement('accordion'));
}
// public cell
public function cell(){
$data = func_get_args();
foreach($data as $row){
$cell = $this->accordion->appendChild(new DOMElement('cell'));
foreach($row as $key => $value){
if($key == 'text'){
$cell->appendChild($this->document->createTextNode($value));
}else{
$cell->setAttributeNode(new DOMAttr($key, $value));
}
}
}
}
// public result
public function result(){
$this->accordion->setAttributeNode(new DOMAttr('skin', $this->skin));
$this->accordion->setAttributeNode(new DOMAttr('mode', $this->mode));
$this->accordion->setAttributeNode(new DOMAttr('iconsPath', $this->iconsPath));
$this->accordion->setAttributeNode(new DOMAttr('openEffect', $this->openEffect));
return $this->document->saveXML();
}
}