phpMv -UI toolkit 2.4.12
jQuery, jQuery UI, Twitter Bootstrap and Semantic-UI library for php & php MVC Frameworks
Loading...
Searching...
No Matches
HtmlListgroup.php
Go to the documentation of this file.
1<?php
2
3namespace Ajax\bootstrap\html;
4
7
15
16 public function __construct($identifier, $tagName="ul") {
17 parent::__construct($identifier, $tagName);
18 $this->content=array ();
19 $this->_template='<%tagName% %properties%>%content%</%tagName%>';
20 $this->setProperty("class", "list-group");
21 }
22
23 public function addItem($text="") {
24 if (is_object($text)) {
25 $element=$text;
26 } else {
27 switch($this->tagName) {
28 case "ul":
29 $element=new HtmlBsDoubleElement("list-gi-".$this->identifier);
30 $element->setTagName("li");
31 break;
32 default:
33 $element=new HtmlLink("list-gi-".$this->identifier);
34 break;
35 }
36 $element->setContent($text);
37 }
38
39 $item=new HtmlListgroupItem($element);
40 if (\is_array($text)) {
41 $item->setHeadingAndContent($text);
42 }
43 $this->content []=$item;
44 return $item;
45 }
46
47 public function addItems($items) {
48 foreach ( $items as $item ) {
49 if (is_string($item)) {
50 $this->addItem($item);
51 } else
52 $this->content []=$item;
53 }
54 }
55
56 public function getItem($index) {
57 if ($index<sizeof($this->content))
58 return $this->content [$index];
59 }
60
61 /* (non-PHPdoc)
62 * @see \Ajax\bootstrap\html\base\BaseHtml::fromDatabaseObject()
63 */
64 public function fromDatabaseObject($object, $function) {
65 $this->addItem($function($object));
66 }
67}
Composant Twitter Bootstrap Listgroup.
__construct($identifier, $tagName="ul")
fromDatabaseObject($object, $function)
Inner element for Twitter Bootstrap HTML Listgroup component.