Completed
Push — master ( fdc0c0...9de830 )
by Jean-Christophe
03:31
created

HtmlAccordionItem::compile()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 4
rs 10
cc 1
eloc 3
nc 1
nop 2
1
<?php
2
3
namespace Ajax\semantic\html\content;
4
5
use Ajax\semantic\html\base\HtmlSemDoubleElement;
6
use Ajax\semantic\html\elements\HtmlIcon;
7
use Ajax\JsUtils;
8
use Phalcon\Mvc\View;
9
10
11
class HtmlAccordionItem extends HtmlSemDoubleElement {
12
	protected $titleElement;
13
	protected $_icon="dropdown";
14
	protected $_title;
15
16
	public function __construct($identifier, $title, $content=NULL) {
17
		parent::__construct($identifier, "div", "content", $content);
18
		$this->_template="%titleElement%".$this->_template;
19
		$this->_title=$title;
20
	}
21
22
	public function setTitle($title){
23
		$this->_title=$title;
24
	}
25
26
	public function setIcon($icon){
27
		$this->_icon=$icon;
28
	}
29
30
	protected function createTitleElement(){
31
		$element=new HtmlSemDoubleElement("title-".$this->identifier,"div","title");
32
		$element->setContent(array(new HtmlIcon("", $this->_icon),$this->_title));
33
		return $element;
34
	}
35
36
	public function compile(JsUtils $js=NULL, View $view=NULL){
37
		$this->titleElement=$this->createTitleElement();
38
		return parent::compile($js,$view);
39
	}
40
}