phpMv -UI toolkit 2.4.12
jQuery, jQuery UI, Twitter Bootstrap and Semantic-UI library for php & php MVC Frameworks
Loading...
Searching...
No Matches
HtmlButtontoolbar.php
Go to the documentation of this file.
1<?php
2
3namespace Ajax\bootstrap\html;
4
13
14 public function __construct($identifier, $elements=array(), $cssStyle=NULL, $size=NULL, $tagName="div") {
15 parent::__construct($identifier, $elements, $cssStyle, $size, $tagName);
16 $this->setClass("btn-toolbar");
17 }
18
19 /*
20 * (non-PHPdoc)
21 * @see \Ajax\bootstrap\html\HtmlButtongroups::addElement()
22 */
23 public function addElement($element) {
24 if ($element instanceof HtmlButtongroups) {
25 $this->elements []=$element;
26 } else {
27 $this->getLastButtonGroup()->addElement($element);
28 }
29 }
30
35 public function addGroup() {
36 $nb=sizeof($this->elements);
37 $bg=new HtmlButtongroups($this->identifier."-buttongroups-".$nb);
38 $this->elements []=$bg;
39 return $bg;
40 }
41
46 private function getLastButtonGroup() {
47 $nb=sizeof($this->elements);
48 if ($nb>0)
49 $bg=$this->elements [$nb-1];
50 else {
51 $bg=new HtmlButtongroups($this->identifier."-buttongroups-".$nb);
52 $this->elements []=$bg;
53 }
54 return $bg;
55 }
56
61 public function getGroup($index) {
62 return parent::getElement($index);
63 }
64
65 public function getLastGroup() {
66 $bg=null;
67 $nb=sizeof($this->elements);
68 if ($nb>0)
69 $bg=$this->elements [$nb-1];
70 return $bg;
71 }
72
73
77 public function getElement($index) {
78 $element=null;
79 $i=0;
80 if (is_int($index)) {
81 $elements=array ();
82 foreach ( $this->elements as $group ) {
83 $elements=array_merge($elements, $group->getElements());
84 }
85 if ($index<sizeof($elements)) {
86 $element=$elements [$index];
87 }
88 } else {
89 while ( $element===null && $i<sizeof($this->elements) ) {
90 $element=$this->elements [$i]->getElement($index);
91 $i++;
92 }
93 }
94 return $element;
95 }
96}
Twitter Bootstrap Buttongroups component.
Twitter Bootstrap HTML Button toolbar.
getGroup($index)
return the Buttongroups at position $index
addGroup()
Add and return a new buttongroup.
__construct($identifier, $elements=array(), $cssStyle=NULL, $size=NULL, $tagName="div")