phpMv  -UI toolkit 2.4.12
jQuery, jQuery UI, Twitter Bootstrap and Semantic-UI library for php & php MVC Frameworks
HtmlAccordionItem.php
Go to the documentation of this file.
1 <?php
2 
4 
7 use Ajax\JsUtils;
8 
9 
10 
12  protected $titleElement;
13  protected $_icon="dropdown";
14  protected $_title;
15  protected $_active;
16 
17  public function __construct($identifier, $title, $content=NULL) {
18  parent::__construct($identifier, "div", "content", $content);
19  $this->_template="%titleElement%".$this->_template;
20  $this->_title=$title;
21  }
22 
23  public function setTitle($title){
24  $this->_title=$title;
25  }
26 
27  public function setIcon($icon){
28  $this->_icon=$icon;
29  }
30 
31  protected function createTitleElement(){
32  $element=new HtmlSemDoubleElement("title-".$this->identifier,"div","title");
33  $element->setContent(array(new HtmlIcon("", $this->_icon),$this->_title));
34  if($this->_active===true)
35  $element->addToProperty("class", "active");
36  return $element;
37  }
38 
39  public function compile(JsUtils $js=NULL, &$view=NULL){
40  $this->titleElement=$this->createTitleElement();
41  return parent::compile($js,$view);
42  }
43 
44  public function setActive($value=true){
45  $this->_active=$value;
46  if($value===true)
47  $this->addToPropertyCtrl("class", "active", array("active"));
48  else
49  $this->removePropertyValue("class", "active");
50  return $this;
51  }
52 }
Semantic Icon component.
Definition: HtmlIcon.php:14
__construct($identifier, $title, $content=NULL)
Base class for Semantic double elements.
JQuery PHP library.
Definition: JsUtils.php:23
addToPropertyCtrl($name, $value, $typeCtrl)