phpMv  -UI toolkit 2.4.12
jQuery, jQuery UI, Twitter Bootstrap and Semantic-UI library for php & php MVC Frameworks
HtmlListgroupItem.php
Go to the documentation of this file.
1 <?php
2 
4 
8 use Ajax\JsUtils;
9 
12 
20 
21  public function __construct($element) {
22  parent::__construct($element);
23  $this->element->setProperty("class", "list-group-item");
24  }
25 
26  public function setActive() {
27  $this->element->addToProperty("class", "active");
28  return $this->element;
29  }
30 
31  public function setDisabled() {
32  $this->element->addToProperty("class", "disabled");
33  return $this->element;
34  }
35 
42  public function setStyle($cssStyle) {
43  if (!JString::startsWith($cssStyle, "list-group-item"))
44  $cssStyle="list-group-item".$cssStyle;
45  $this->element->addToPropertyCtrl("class", $cssStyle, CssRef::Styles("list-group-item"));
46  return $this->element;
47  }
48 
49  public function __toString() {
50  return $this->element->compile();
51  }
52 
53  /*
54  * (non-PHPdoc)
55  * @see \Ajax\bootstrap\html\base\BaseHtml::compile()
56  */
57  public function compile(JsUtils $js=NULL, &$view=NULL) {
58  return $this->element->compile($js, $view);
59  }
60 
61  public function setHeadingAndContent($title, $content="", $niveau="1") {
62  if (\is_array($title)) {
63  $array=$title;
64  $title=JArray::getValue($array, "title", 0);
65  $content=JArray::getValue($array, "content", 1);
66  $niveau=JArray::getValue($array, "niveau", 2);
67  }
68  $elementHeader=new HtmlBsDoubleElement("", "h".$niveau);
69  $elementHeader->setContent($title);
70  $elementHeader->setClass("list-group-item-heading");
71  $element=new HtmlBsDoubleElement("", "p");
72  $element->setContent($content);
73  $element->setClass("list-group-item-text");
74  $this->element->setContent(array (
75  $elementHeader,
76  $element
77  ));
78  return $this->element;
79  }
80 }
static getValue($array, $key, $pos)
Definition: JArray.php:10
setStyle($cssStyle)
define the Panel style avaible values : "list-group-item-default","list-group-item-primary","list-group-item-success","list-group-item-info","list-group-item-warning","list-group-item-danger"
setHeadingAndContent($title, $content="", $niveau="1")
static Styles($prefix="btn")
Definition: CssRef.php:27
JQuery PHP library.
Definition: JsUtils.php:23
Inner element for Twitter Bootstrap HTML Listgroup component.