phpMv  -UI toolkit 2.4.12
jQuery, jQuery UI, Twitter Bootstrap and Semantic-UI library for php & php MVC Frameworks
HtmlAccordion.php
Go to the documentation of this file.
1 <?php
2 
4 
7 use Ajax\JsUtils;
8 
10 
11  protected $params=array();
12 
13  public function __construct( $identifier, $tagName="div", $baseClass="ui"){
14  parent::__construct( $identifier, "div", "ui accordion");
15  }
16 
17 
18  protected function createItem($value){
19  $count=$this->count();
20  $title=$value;
21  $content=NULL;
22  if(\is_array($value)){
23  $title=@$value[0];$content=@$value[1];
24  }
25  return new HtmlAccordionItem("item-".$this->identifier."-".$count, $title,$content);
26  }
27 
31  public function getItem($index){
32  return parent::getItem($index);
33  }
34 
35  protected function createCondition($value){
36  return ($value instanceof HtmlAccordionItem)===false;
37  }
38 
39  public function addPanel($title,$content){
40  return $this->addItem([$title,$content]);
41  }
42 
52  public function forwardPanel(JsUtils $js,$title,$initialController,$controller,$action,$params=array()){
53  return $this->addPanel($title, $js->forward($initialController, $controller, $action,$params));
54  }
55 
64  public function renderViewPanel(JsUtils $js,$title,$initialController, $viewName, $params=array()) {
65  return $this->addPanel($title, $js->renderContent($initialController, $viewName,$params));
66  }
67  /*
68  * (non-PHPdoc)
69  * @see BaseHtml::run()
70  */
71  public function run(JsUtils $js) {
72  if(isset($this->_bsComponent)===false)
73  $this->_bsComponent=$js->semantic()->accordion("#".$this->identifier,$this->params);
74  $this->addEventsOnRun($js);
75  return $this->_bsComponent;
76  }
77 
78  public function setStyled(){
79  return $this->addToProperty("class", "styled");
80  }
81 
82  public function activate($index){
83  $this->getItem($index)->setActive(true);
84  return $this;
85  }
86 
87  public function setExclusive($value){
88  $this->params["exclusive"]=$value;
89  }
90 }
addToProperty($name, $value, $separator=" ")
addEventsOnRun(JsUtils $js=NULL)
addItem($item)
adds and returns an item
renderViewPanel(JsUtils $js, $title, $initialController, $viewName, $params=array())
render the content of an existing view : $controller/$action and set the response to a new panel ...
semantic(Semantic $semantic=NULL)
getter or setter of the Semantic-UI variable
Definition: JsUtils.php:159
forward($initialController, $controller, $action, $params)
Forwards to.
Base class for Semantic Html collections.
JQuery PHP library.
Definition: JsUtils.php:23
forwardPanel(JsUtils $js, $title, $initialController, $controller, $action, $params=array())
render the content of
__construct( $identifier, $tagName="div", $baseClass="ui")
renderContent($initialControllerInstance, $viewName, $params=NULL)
render the content of an existing view : $viewName and set the response to the modal content Used int...