@@ -14,8 +14,8 @@ discard block |
||
| 14 | 14 | |
| 15 | 15 | public function __construct($identifier, $elements=array(), $asIcons=false) { |
| 16 | 16 | parent::__construct($identifier, "div", "ui buttons"); |
| 17 | - $this->content=array (); |
|
| 18 | - if ($asIcons === true) |
|
| 17 | + $this->content=array(); |
|
| 18 | + if ($asIcons===true) |
|
| 19 | 19 | $this->asIcons(); |
| 20 | 20 | $this->addElements($elements, $asIcons); |
| 21 | 21 | } |
@@ -24,25 +24,25 @@ discard block |
||
| 24 | 24 | $elementO=$element; |
| 25 | 25 | if (\is_string($element)) { |
| 26 | 26 | if ($asIcon) { |
| 27 | - $elementO=new HtmlButton("button-" . $this->identifier . "-" . \sizeof($this->content)); |
|
| 27 | + $elementO=new HtmlButton("button-".$this->identifier."-".\sizeof($this->content)); |
|
| 28 | 28 | $elementO->asIcon($element); |
| 29 | - } else |
|
| 30 | - $elementO=new HtmlButton("button-" . $this->identifier . "-" . \sizeof($this->content), $element); |
|
| 29 | + }else |
|
| 30 | + $elementO=new HtmlButton("button-".$this->identifier."-".\sizeof($this->content), $element); |
|
| 31 | 31 | } |
| 32 | 32 | $this->addContent($elementO); |
| 33 | 33 | } |
| 34 | 34 | |
| 35 | 35 | public function addElements($elements, $asIcons=false) { |
| 36 | - foreach ( $elements as $element ) { |
|
| 36 | + foreach ($elements as $element) { |
|
| 37 | 37 | $this->addElement($element, $asIcons); |
| 38 | 38 | } |
| 39 | 39 | return $this; |
| 40 | 40 | } |
| 41 | 41 | |
| 42 | 42 | public function insertOr($aferIndex=0, $or="or") { |
| 43 | - $orElement=new HtmlSemDoubleElement("or-" . $this->identifier, "div", "or"); |
|
| 43 | + $orElement=new HtmlSemDoubleElement("or-".$this->identifier, "div", "or"); |
|
| 44 | 44 | $orElement->setProperty("data-text", $or); |
| 45 | - array_splice($this->content, $aferIndex + 1, 0, array ($orElement )); |
|
| 45 | + array_splice($this->content, $aferIndex+1, 0, array($orElement)); |
|
| 46 | 46 | return $this; |
| 47 | 47 | } |
| 48 | 48 | |
@@ -55,7 +55,7 @@ discard block |
||
| 55 | 55 | } |
| 56 | 56 | |
| 57 | 57 | public function asIcons() { |
| 58 | - foreach ( $this->content as $item ) { |
|
| 58 | + foreach ($this->content as $item) { |
|
| 59 | 59 | $item->asIcon($item->getContent()); |
| 60 | 60 | } |
| 61 | 61 | return $this->addToProperty("class", "icons"); |
@@ -93,7 +93,7 @@ discard block |
||
| 93 | 93 | * @see \Ajax\bootstrap\html\base\BaseHtml::on() |
| 94 | 94 | */ |
| 95 | 95 | public function on($event, $jsCode, $stopPropagation=false, $preventDefault=false) { |
| 96 | - foreach ( $this->content as $element ) { |
|
| 96 | + foreach ($this->content as $element) { |
|
| 97 | 97 | $element->on($event, $jsCode, $stopPropagation, $preventDefault); |
| 98 | 98 | } |
| 99 | 99 | return $this; |
@@ -105,7 +105,7 @@ discard block |
||
| 105 | 105 | |
| 106 | 106 | public function addClasses($classes=array()) { |
| 107 | 107 | $i=0; |
| 108 | - foreach ( $this->content as $button ) { |
|
| 108 | + foreach ($this->content as $button) { |
|
| 109 | 109 | $button->addToProperty("class", $classes[$i++]); |
| 110 | 110 | } |
| 111 | 111 | return $this; |
@@ -15,8 +15,9 @@ discard block |
||
| 15 | 15 | public function __construct($identifier, $elements=array(), $asIcons=false) { |
| 16 | 16 | parent::__construct($identifier, "div", "ui buttons"); |
| 17 | 17 | $this->content=array (); |
| 18 | - if ($asIcons === true) |
|
| 19 | - $this->asIcons(); |
|
| 18 | + if ($asIcons === true) { |
|
| 19 | + $this->asIcons(); |
|
| 20 | + } |
|
| 20 | 21 | $this->addElements($elements, $asIcons); |
| 21 | 22 | } |
| 22 | 23 | |
@@ -26,8 +27,9 @@ discard block |
||
| 26 | 27 | if ($asIcon) { |
| 27 | 28 | $elementO=new HtmlButton("button-" . $this->identifier . "-" . \sizeof($this->content)); |
| 28 | 29 | $elementO->asIcon($element); |
| 29 | - } else |
|
| 30 | - $elementO=new HtmlButton("button-" . $this->identifier . "-" . \sizeof($this->content), $element); |
|
| 30 | + } else { |
|
| 31 | + $elementO=new HtmlButton("button-" . $this->identifier . "-" . \sizeof($this->content), $element); |
|
| 32 | + } |
|
| 31 | 33 | } |
| 32 | 34 | $this->addContent($elementO); |
| 33 | 35 | } |
@@ -75,9 +77,9 @@ discard block |
||
| 75 | 77 | * @return HtmlButton |
| 76 | 78 | */ |
| 77 | 79 | public function getElement($index) { |
| 78 | - if (is_int($index)) |
|
| 79 | - return $this->content[$index]; |
|
| 80 | - else { |
|
| 80 | + if (is_int($index)) { |
|
| 81 | + return $this->content[$index]; |
|
| 82 | + } else { |
|
| 81 | 83 | $elm=$this->getElementById($index, $this->content); |
| 82 | 84 | return $elm; |
| 83 | 85 | } |