@@ -49,6 +49,9 @@ |
||
49 | 49 | $element->setStyle($value); |
50 | 50 | } |
51 | 51 | |
52 | + /** |
|
53 | + * @param HtmlDropdown $bt |
|
54 | + */ |
|
52 | 55 | private function dropdownAsButton($bt) { |
53 | 56 | $this->addExistingDropDown($bt); |
54 | 57 | $bt->setTagName("button"); |
@@ -39,7 +39,7 @@ discard block |
||
39 | 39 | * @return HtmlButtongroups default : "" |
40 | 40 | */ |
41 | 41 | public function setSize($size) { |
42 | - foreach ( $this->elements as $element ) { |
|
42 | + foreach ($this->elements as $element) { |
|
43 | 43 | $element->setSize($size); |
44 | 44 | } |
45 | 45 | if (is_int($size)) { |
@@ -49,7 +49,7 @@ discard block |
||
49 | 49 | } |
50 | 50 | |
51 | 51 | public function setStyle($value) { |
52 | - foreach ( $this->elements as $element ) |
|
52 | + foreach ($this->elements as $element) |
|
53 | 53 | $element->setStyle($value); |
54 | 54 | } |
55 | 55 | |
@@ -69,25 +69,25 @@ discard block |
||
69 | 69 | public function addElement($element) { |
70 | 70 | $result=$element; |
71 | 71 | $iid=sizeof($this->elements)+1; |
72 | - if (($element instanceof HtmlDropdown)||($element instanceof HtmlSplitbutton)) { |
|
72 | + if (($element instanceof HtmlDropdown) || ($element instanceof HtmlSplitbutton)) { |
|
73 | 73 | $this->addExistingDropDown($element); |
74 | 74 | } elseif (\is_array($element)) { |
75 | - $result=$this->_addArrayElement($element,$iid); |
|
75 | + $result=$this->_addArrayElement($element, $iid); |
|
76 | 76 | } elseif (is_string($element)) { |
77 | - $result=new HtmlButton($this->identifier."-button-".$iid,$element); |
|
77 | + $result=new HtmlButton($this->identifier."-button-".$iid, $element); |
|
78 | 78 | } |
79 | - if($result instanceof HtmlButton) |
|
79 | + if ($result instanceof HtmlButton) |
|
80 | 80 | $this->elements[]=$result; |
81 | 81 | return $result; |
82 | 82 | } |
83 | 83 | |
84 | - private function _addArrayElement(array $element,int $iid){ |
|
84 | + private function _addArrayElement(array $element, int $iid) { |
|
85 | 85 | if (array_key_exists("glyph", $element)) |
86 | 86 | $bt=new HtmlGlyphButton($this->identifier."-button-".$iid); |
87 | 87 | elseif (array_key_exists("btnCaption", $element)) { |
88 | 88 | if (array_key_exists("split", $element)) |
89 | 89 | $bt=new HtmlSplitbutton($this->identifier."-dropdown-".$iid); |
90 | - else{ |
|
90 | + else { |
|
91 | 91 | $bt=new HtmlDropdown($this->identifier."-dropdown-".$iid); |
92 | 92 | $this->dropdownAsButton($bt); |
93 | 93 | } |
@@ -98,7 +98,7 @@ discard block |
||
98 | 98 | } |
99 | 99 | |
100 | 100 | public function addElements($elements) { |
101 | - foreach ( $elements as $element ) { |
|
101 | + foreach ($elements as $element) { |
|
102 | 102 | $this->addElement($element); |
103 | 103 | } |
104 | 104 | return $this; |
@@ -118,7 +118,7 @@ discard block |
||
118 | 118 | } else |
119 | 119 | $value="btn-group-".$value; |
120 | 120 | if (strstr($value, "justified")) { |
121 | - foreach ( $this->elements as $element ) { |
|
121 | + foreach ($this->elements as $element) { |
|
122 | 122 | $element->wrap('<div class="btn-group" role="group">', '</div>'); |
123 | 123 | } |
124 | 124 | } |
@@ -149,7 +149,7 @@ discard block |
||
149 | 149 | * @see \Ajax\bootstrap\html\base\BaseHtml::on() |
150 | 150 | */ |
151 | 151 | public function on($event, $jsCode, $stopPropagation=false, $preventDefault=false) { |
152 | - foreach ( $this->elements as $element ) { |
|
152 | + foreach ($this->elements as $element) { |
|
153 | 153 | $element->on($event, $jsCode, $stopPropagation, $preventDefault); |
154 | 154 | } |
155 | 155 | return $this; |
@@ -49,8 +49,9 @@ discard block |
||
49 | 49 | } |
50 | 50 | |
51 | 51 | public function setStyle($value) { |
52 | - foreach ( $this->elements as $element ) |
|
53 | - $element->setStyle($value); |
|
52 | + foreach ( $this->elements as $element ) { |
|
53 | + $element->setStyle($value); |
|
54 | + } |
|
54 | 55 | } |
55 | 56 | |
56 | 57 | private function dropdownAsButton($bt) { |
@@ -76,23 +77,25 @@ discard block |
||
76 | 77 | } elseif (is_string($element)) { |
77 | 78 | $result=new HtmlButton($this->identifier."-button-".$iid,$element); |
78 | 79 | } |
79 | - if($result instanceof HtmlButton) |
|
80 | - $this->elements[]=$result; |
|
80 | + if($result instanceof HtmlButton) { |
|
81 | + $this->elements[]=$result; |
|
82 | + } |
|
81 | 83 | return $result; |
82 | 84 | } |
83 | 85 | |
84 | 86 | private function _addArrayElement(array $element,int $iid){ |
85 | - if (array_key_exists("glyph", $element)) |
|
86 | - $bt=new HtmlGlyphButton($this->identifier."-button-".$iid); |
|
87 | - elseif (array_key_exists("btnCaption", $element)) { |
|
88 | - if (array_key_exists("split", $element)) |
|
89 | - $bt=new HtmlSplitbutton($this->identifier."-dropdown-".$iid); |
|
90 | - else{ |
|
87 | + if (array_key_exists("glyph", $element)) { |
|
88 | + $bt=new HtmlGlyphButton($this->identifier."-button-".$iid); |
|
89 | + } elseif (array_key_exists("btnCaption", $element)) { |
|
90 | + if (array_key_exists("split", $element)) { |
|
91 | + $bt=new HtmlSplitbutton($this->identifier."-dropdown-".$iid); |
|
92 | + } else{ |
|
91 | 93 | $bt=new HtmlDropdown($this->identifier."-dropdown-".$iid); |
92 | 94 | $this->dropdownAsButton($bt); |
93 | 95 | } |
94 | - } else |
|
95 | - $bt=new HtmlButton($this->identifier."-button-".$iid); |
|
96 | + } else { |
|
97 | + $bt=new HtmlButton($this->identifier."-button-".$iid); |
|
98 | + } |
|
96 | 99 | $bt->fromArray($element); |
97 | 100 | return $bt; |
98 | 101 | } |
@@ -115,8 +118,9 @@ discard block |
||
115 | 118 | public function setAlignment($value) { |
116 | 119 | if (is_int($value)) { |
117 | 120 | $value=CssRef::alignment("btn-group")[$value]; |
118 | - } else |
|
119 | - $value="btn-group-".$value; |
|
121 | + } else { |
|
122 | + $value="btn-group-".$value; |
|
123 | + } |
|
120 | 124 | if (strstr($value, "justified")) { |
121 | 125 | foreach ( $this->elements as $element ) { |
122 | 126 | $element->wrap('<div class="btn-group" role="group">', '</div>'); |
@@ -131,9 +135,9 @@ discard block |
||
131 | 135 | * @return HtmlButton |
132 | 136 | */ |
133 | 137 | public function getElement($index) { |
134 | - if (is_int($index)) |
|
135 | - return $this->elements[$index]; |
|
136 | - else { |
|
138 | + if (is_int($index)) { |
|
139 | + return $this->elements[$index]; |
|
140 | + } else { |
|
137 | 141 | $elm=$this->getElementById($index, $this->elements); |
138 | 142 | return $elm; |
139 | 143 | } |
@@ -12,6 +12,11 @@ discard block |
||
12 | 12 | |
13 | 13 | class HtmlButtontoolbar extends HtmlButtongroups { |
14 | 14 | |
15 | + /** |
|
16 | + * @param string $identifier |
|
17 | + * @param string $cssStyle |
|
18 | + * @param string $size |
|
19 | + */ |
|
15 | 20 | public function __construct($identifier, $elements=array(), $cssStyle=NULL, $size=NULL, $tagName="div") { |
16 | 21 | parent::__construct($identifier, $elements, $cssStyle, $size, $tagName); |
17 | 22 | $this->setClass("btn-toolbar"); |
@@ -57,7 +62,7 @@ discard block |
||
57 | 62 | |
58 | 63 | /** |
59 | 64 | * return the Buttongroups at position $index |
60 | - * @return \Ajax\bootstrap\html\HtmlButtongroups |
|
65 | + * @return HtmlButton |
|
61 | 66 | */ |
62 | 67 | public function getGroup($index) { |
63 | 68 | return parent::getElement($index); |
@@ -79,15 +79,15 @@ |
||
79 | 79 | $element=null; |
80 | 80 | $i=0; |
81 | 81 | if (is_int($index)) { |
82 | - $elements=array (); |
|
83 | - foreach ( $this->elements as $group ) { |
|
82 | + $elements=array(); |
|
83 | + foreach ($this->elements as $group) { |
|
84 | 84 | $elements=array_merge($elements, $group->getElements()); |
85 | 85 | } |
86 | 86 | if ($index<sizeof($elements)) { |
87 | 87 | $element=$elements [$index]; |
88 | 88 | } |
89 | 89 | } else { |
90 | - while ( $element==null&&$i<sizeof($this->elements) ) { |
|
90 | + while ($element==null && $i<sizeof($this->elements)) { |
|
91 | 91 | $element=$this->elements [$i]->getElement($index); |
92 | 92 | $i++; |
93 | 93 | } |
@@ -46,9 +46,9 @@ discard block |
||
46 | 46 | */ |
47 | 47 | private function getLastButtonGroup() { |
48 | 48 | $nb=sizeof($this->elements); |
49 | - if ($nb>0) |
|
50 | - $bg=$this->elements [$nb-1]; |
|
51 | - else { |
|
49 | + if ($nb>0) { |
|
50 | + $bg=$this->elements [$nb-1]; |
|
51 | + } else { |
|
52 | 52 | $bg=new HtmlButtongroups($this->identifier."-buttongroups-".$nb); |
53 | 53 | $this->elements []=$bg; |
54 | 54 | } |
@@ -66,8 +66,9 @@ discard block |
||
66 | 66 | public function getLastGroup() { |
67 | 67 | $bg=null; |
68 | 68 | $nb=sizeof($this->elements); |
69 | - if ($nb>0) |
|
70 | - $bg=$this->elements [$nb-1]; |
|
69 | + if ($nb>0) { |
|
70 | + $bg=$this->elements [$nb-1]; |
|
71 | + } |
|
71 | 72 | return $bg; |
72 | 73 | } |
73 | 74 |
@@ -7,7 +7,6 @@ |
||
7 | 7 | use Ajax\bootstrap\html\base\CssRef; |
8 | 8 | use Ajax\bootstrap\html\base\HtmlBsDoubleElement; |
9 | 9 | use Ajax\bootstrap\html\content\HtmlCarouselItem; |
10 | - |
|
11 | 10 | use Ajax\common\html\BaseHtml; |
12 | 11 | /** |
13 | 12 | * Composant Twitter Bootstrap Carousel |
@@ -16,12 +16,12 @@ discard block |
||
16 | 16 | * @version 1.001 |
17 | 17 | */ |
18 | 18 | class HtmlCarousel extends BaseHtml { |
19 | - protected $indicators=array (); |
|
20 | - protected $slides=array (); |
|
19 | + protected $indicators=array(); |
|
20 | + protected $slides=array(); |
|
21 | 21 | protected $leftControl=""; |
22 | 22 | protected $rightControl=""; |
23 | 23 | protected $_base=""; |
24 | - protected $_glyphs=array (); |
|
24 | + protected $_glyphs=array(); |
|
25 | 25 | |
26 | 26 | public function __construct($identifier, $images=NULL) { |
27 | 27 | parent::__construct($identifier); |
@@ -38,7 +38,7 @@ discard block |
||
38 | 38 | } |
39 | 39 | |
40 | 40 | public function setBase($_base) { |
41 | - foreach ($this->slides as $slide){ |
|
41 | + foreach ($this->slides as $slide) { |
|
42 | 42 | $imgSrc=$slide->getImageSrc(); |
43 | 43 | $slide->setImageSrc(str_replace($this->_base.$imgSrc, $_base.$imgSrc, $imgSrc)); |
44 | 44 | } |
@@ -93,9 +93,9 @@ discard block |
||
93 | 93 | } |
94 | 94 | |
95 | 95 | public function addImage($imageSrc, $imageAlt="", $caption=NULL, $description=NULL) { |
96 | - if(\is_array($imageSrc)){ |
|
97 | - $this->addImage($imageSrc[0],@$imageSrc[1],@$imageSrc[2],@$imageSrc[3]); |
|
98 | - }else{ |
|
96 | + if (\is_array($imageSrc)) { |
|
97 | + $this->addImage($imageSrc[0], @$imageSrc[1], @$imageSrc[2], @$imageSrc[3]); |
|
98 | + } else { |
|
99 | 99 | $image=new HtmlCarouselItem("item-".$this->identifier); |
100 | 100 | $image->setImageSrc($this->_base.$imageSrc); |
101 | 101 | $image->setImageAlt($imageAlt); |
@@ -118,7 +118,7 @@ discard block |
||
118 | 118 | */ |
119 | 119 | public function fromArray($array) { |
120 | 120 | if (\is_array($array) && sizeof($array)>0) { |
121 | - foreach ( $array as $value ) { |
|
121 | + foreach ($array as $value) { |
|
122 | 122 | if (\is_array($value)) { |
123 | 123 | $this->addImage($value ["src"], @$value ["alt"], @$value ["caption"], @$value ["description"]); |
124 | 124 | } else { |
@@ -23,6 +23,9 @@ |
||
23 | 23 | protected $_base=""; |
24 | 24 | protected $_glyphs=array (); |
25 | 25 | |
26 | + /** |
|
27 | + * @param string $identifier |
|
28 | + */ |
|
26 | 29 | public function __construct($identifier, $images=NULL) { |
27 | 30 | parent::__construct($identifier); |
28 | 31 | $this->_template=include 'templates/tplCarousel.php'; |
@@ -75,27 +75,30 @@ |
||
75 | 75 | } |
76 | 76 | |
77 | 77 | private function getGlyph($sens="left") { |
78 | - if (array_key_exists($sens, $this->_glyphs)) |
|
79 | - return $this->_glyphs [$sens]; |
|
78 | + if (array_key_exists($sens, $this->_glyphs)) { |
|
79 | + return $this->_glyphs [$sens]; |
|
80 | + } |
|
80 | 81 | return "glyphicon-chevron-".$sens; |
81 | 82 | } |
82 | 83 | |
83 | 84 | public function setRightGlyph($glyphicon) { |
84 | 85 | $glyphs=CssRef::glyphIcons(); |
85 | - if (array_search($glyphicon, $glyphs)!==false) |
|
86 | - $this->_glyphs ["right"]=$glyphicon; |
|
86 | + if (array_search($glyphicon, $glyphs)!==false) { |
|
87 | + $this->_glyphs ["right"]=$glyphicon; |
|
88 | + } |
|
87 | 89 | } |
88 | 90 | |
89 | 91 | public function setLeftGlyph($glyphicon) { |
90 | 92 | $glyphs=CssRef::glyphIcons(); |
91 | - if (array_search($glyphicon, $glyphs)!==false) |
|
92 | - $this->_glyphs ["left"]=$glyphicon; |
|
93 | + if (array_search($glyphicon, $glyphs)!==false) { |
|
94 | + $this->_glyphs ["left"]=$glyphicon; |
|
95 | + } |
|
93 | 96 | } |
94 | 97 | |
95 | 98 | public function addImage($imageSrc, $imageAlt="", $caption=NULL, $description=NULL) { |
96 | 99 | if(\is_array($imageSrc)){ |
97 | 100 | $this->addImage($imageSrc[0],@$imageSrc[1],@$imageSrc[2],@$imageSrc[3]); |
98 | - }else{ |
|
101 | + } else{ |
|
99 | 102 | $image=new HtmlCarouselItem("item-".$this->identifier); |
100 | 103 | $image->setImageSrc($this->_base.$imageSrc); |
101 | 104 | $image->setImageAlt($imageAlt); |
@@ -87,6 +87,9 @@ |
||
87 | 87 | return $result; |
88 | 88 | } |
89 | 89 | |
90 | + /** |
|
91 | + * @return string |
|
92 | + */ |
|
90 | 93 | private function getPrefix($element) { |
91 | 94 | $result="input_text"; |
92 | 95 | foreach ( $this->formElementsPrefix as $k => $v ) { |
@@ -4,7 +4,6 @@ |
||
4 | 4 | |
5 | 5 | use Ajax\bootstrap\html\base\HtmlBsDoubleElement; |
6 | 6 | use Ajax\JsUtils; |
7 | - |
|
8 | 7 | use Ajax\common\html\html5\HtmlSelect; |
9 | 8 | |
10 | 9 | class HtmlForm extends HtmlBsDoubleElement { |
@@ -99,8 +99,9 @@ |
||
99 | 99 | } |
100 | 100 | |
101 | 101 | public function addGroup($identifier="") { |
102 | - if ($identifier==="") |
|
103 | - $identifier="form-".$this->identifier; |
|
102 | + if ($identifier==="") { |
|
103 | + $identifier="form-".$this->identifier; |
|
104 | + } |
|
104 | 105 | $group=new HtmlBsDoubleElement($identifier); |
105 | 106 | $group->setTagName("div"); |
106 | 107 | $group->setClass("form-group"); |
@@ -15,8 +15,8 @@ discard block |
||
15 | 15 | public function __construct($identifier) { |
16 | 16 | parent::__construct($identifier, "form"); |
17 | 17 | $this->_template='<form id="%identifier%" name="%identifier%" %properties%>%content%</form>'; |
18 | - $this->futureElements=array (); |
|
19 | - $this->formGroups=array (); |
|
18 | + $this->futureElements=array(); |
|
19 | + $this->formGroups=array(); |
|
20 | 20 | } |
21 | 21 | |
22 | 22 | /* |
@@ -26,10 +26,10 @@ discard block |
||
26 | 26 | public function compile(JsUtils $js=NULL, &$view=NULL) { |
27 | 27 | if (isset($js)) { |
28 | 28 | $this->formElementsPrefix=$js->config()->getVar("formElementsPrefix"); |
29 | - foreach ( $this->futureElements as $futureElement ) { |
|
29 | + foreach ($this->futureElements as $futureElement) { |
|
30 | 30 | $futureElementValue=$this->getPrefix($futureElement); |
31 | 31 | $futureElementValues=explode("_", $futureElementValue); |
32 | - switch($futureElementValues [0]) { |
|
32 | + switch ($futureElementValues [0]) { |
|
33 | 33 | case "input": |
34 | 34 | $control=new HtmlInput($futureElement); |
35 | 35 | $control->setClass("form-control"); |
@@ -47,7 +47,7 @@ discard block |
||
47 | 47 | $control->setLabel($label, false); |
48 | 48 | break; |
49 | 49 | case "select": |
50 | - $control=new HtmlSelect($futureElement,""); |
|
50 | + $control=new HtmlSelect($futureElement, ""); |
|
51 | 51 | $control->setProperty("size", $futureElementValues [1]); |
52 | 52 | $control->setClass("form-control"); |
53 | 53 | //$control->setLabel($this->getPart($futureElement)); |
@@ -62,7 +62,7 @@ discard block |
||
62 | 62 | $this->addElement($control); |
63 | 63 | } |
64 | 64 | } |
65 | - foreach ( $this->formGroups as $group ) { |
|
65 | + foreach ($this->formGroups as $group) { |
|
66 | 66 | $this->addContent($group); |
67 | 67 | } |
68 | 68 | return parent::compile($js, $view); |
@@ -90,7 +90,7 @@ discard block |
||
90 | 90 | |
91 | 91 | private function getPrefix($element) { |
92 | 92 | $result="input_text"; |
93 | - foreach ( $this->formElementsPrefix as $k => $v ) { |
|
93 | + foreach ($this->formElementsPrefix as $k => $v) { |
|
94 | 94 | if (Text::startsWith($element, $k)) { |
95 | 95 | $result=$v; |
96 | 96 | break; |
@@ -120,7 +120,7 @@ discard block |
||
120 | 120 | |
121 | 121 | public function getElement($name) { |
122 | 122 | $element=null; |
123 | - foreach ( $this->formGroups as $group ) { |
|
123 | + foreach ($this->formGroups as $group) { |
|
124 | 124 | } |
125 | 125 | return $element; |
126 | 126 | } |
@@ -130,7 +130,7 @@ discard block |
||
130 | 130 | * @see \Ajax\bootstrap\html\base\HtmlSingleElement::fromArray() |
131 | 131 | */ |
132 | 132 | public function fromArray($array) { |
133 | - foreach ( $array as $value ) { |
|
133 | + foreach ($array as $value) { |
|
134 | 134 | if (is_string($value)) { |
135 | 135 | $this->futureElements []=$value; |
136 | 136 | } |
@@ -16,6 +16,10 @@ |
||
16 | 16 | class HtmlGridSystem extends HtmlBsDoubleElement { |
17 | 17 | private $rows; |
18 | 18 | |
19 | + /** |
|
20 | + * @param string $identifier |
|
21 | + * @param integer $numCols |
|
22 | + */ |
|
19 | 23 | public function __construct($identifier,$numRows=1,$numCols=NULL){ |
20 | 24 | parent::__construct($identifier,"div"); |
21 | 25 | $this->setProperty("class", "container-fluid"); |
@@ -16,11 +16,11 @@ discard block |
||
16 | 16 | class HtmlGridSystem extends HtmlBsDoubleElement { |
17 | 17 | private $rows; |
18 | 18 | |
19 | - public function __construct($identifier,$numRows=1,$numCols=NULL){ |
|
20 | - parent::__construct($identifier,"div"); |
|
19 | + public function __construct($identifier, $numRows=1, $numCols=NULL) { |
|
20 | + parent::__construct($identifier, "div"); |
|
21 | 21 | $this->setProperty("class", "container-fluid"); |
22 | 22 | $this->rows=array(); |
23 | - $this->setNumRows($numRows,$numCols); |
|
23 | + $this->setNumRows($numRows, $numCols); |
|
24 | 24 | } |
25 | 25 | |
26 | 26 | /** |
@@ -28,8 +28,8 @@ discard block |
||
28 | 28 | * @param int $numCols |
29 | 29 | * @return \Ajax\bootstrap\html\content\HtmlGridRow |
30 | 30 | */ |
31 | - public function addRow($numCols=NULL){ |
|
32 | - $row=new HtmlGridRow($this->identifier."-row-".(sizeof($this->rows)+1),$numCols); |
|
31 | + public function addRow($numCols=NULL) { |
|
32 | + $row=new HtmlGridRow($this->identifier."-row-".(sizeof($this->rows)+1), $numCols); |
|
33 | 33 | $this->rows[]=$row; |
34 | 34 | return $row; |
35 | 35 | } |
@@ -40,10 +40,10 @@ discard block |
||
40 | 40 | * @param boolean $force add the row at $index if true |
41 | 41 | * @return \Ajax\bootstrap\html\content\HtmlGridRow |
42 | 42 | */ |
43 | - public function getRow($index,$force=true){ |
|
44 | - if($index<sizeof($this->rows)){ |
|
43 | + public function getRow($index, $force=true) { |
|
44 | + if ($index<sizeof($this->rows)) { |
|
45 | 45 | $result=$this->rows[$index-1]; |
46 | - }else if ($force){ |
|
46 | + } else if ($force) { |
|
47 | 47 | $this->setNumRows($index); |
48 | 48 | $result=$this->rows[$index-1]; |
49 | 49 | } |
@@ -56,8 +56,8 @@ discard block |
||
56 | 56 | * @param int $numCols |
57 | 57 | * @return \Ajax\bootstrap\html\HtmlGridSystem |
58 | 58 | */ |
59 | - public function setNumRows($numRows,$numCols=NULL){ |
|
60 | - for($i=sizeof($this->rows);$i<$numRows;$i++){ |
|
59 | + public function setNumRows($numRows, $numCols=NULL) { |
|
60 | + for ($i=sizeof($this->rows); $i<$numRows; $i++) { |
|
61 | 61 | $this->addRow($numCols); |
62 | 62 | } |
63 | 63 | return $this; |
@@ -69,10 +69,10 @@ discard block |
||
69 | 69 | * @param $force add the cell at $row,$col if true |
70 | 70 | * @return HtmlGridCol |
71 | 71 | */ |
72 | - public function getCell($row,$col,$force=true){ |
|
73 | - $row=$this->getRow($row,$force); |
|
74 | - if(isset($row)){ |
|
75 | - $col=$row->getCol($col,$force); |
|
72 | + public function getCell($row, $col, $force=true) { |
|
73 | + $row=$this->getRow($row, $force); |
|
74 | + if (isset($row)) { |
|
75 | + $col=$row->getCol($col, $force); |
|
76 | 76 | } |
77 | 77 | return $col; |
78 | 78 | } |
@@ -82,22 +82,22 @@ discard block |
||
82 | 82 | * @param int $col |
83 | 83 | * @return HtmlGridCol |
84 | 84 | */ |
85 | - public function getCellAt($row,$col,$force=true){ |
|
86 | - $row=$this->getRow($row,$force); |
|
87 | - if(isset($row)){ |
|
88 | - $col=$row->getColAt($col,$force); |
|
85 | + public function getCellAt($row, $col, $force=true) { |
|
86 | + $row=$this->getRow($row, $force); |
|
87 | + if (isset($row)) { |
|
88 | + $col=$row->getColAt($col, $force); |
|
89 | 89 | } |
90 | 90 | return $col; |
91 | 91 | } |
92 | 92 | |
93 | 93 | public function compile(JsUtils $js=NULL, &$view=NULL) { |
94 | - foreach ($this->rows as $row){ |
|
94 | + foreach ($this->rows as $row) { |
|
95 | 95 | $this->addContent($row); |
96 | 96 | } |
97 | - return parent::compile($js,$view); |
|
97 | + return parent::compile($js, $view); |
|
98 | 98 | } |
99 | - public function setContentForAll($content){ |
|
100 | - foreach ($this->rows as $row){ |
|
99 | + public function setContentForAll($content) { |
|
100 | + foreach ($this->rows as $row) { |
|
101 | 101 | $row->setContentForAll($content); |
102 | 102 | } |
103 | 103 | } |
@@ -43,7 +43,7 @@ |
||
43 | 43 | public function getRow($index,$force=true){ |
44 | 44 | if($index<sizeof($this->rows)){ |
45 | 45 | $result=$this->rows[$index-1]; |
46 | - }else if ($force){ |
|
46 | + } else if ($force){ |
|
47 | 47 | $this->setNumRows($index); |
48 | 48 | $result=$this->rows[$index-1]; |
49 | 49 | } |
@@ -4,7 +4,6 @@ |
||
4 | 4 | |
5 | 5 | use Ajax\bootstrap\html\base\HtmlBsDoubleElement; |
6 | 6 | use Ajax\JsUtils; |
7 | - |
|
8 | 7 | use Ajax\bootstrap\html\base\CssRef; |
9 | 8 | use Ajax\service\JArray; |
10 | 9 |
@@ -33,11 +33,12 @@ discard block |
||
33 | 33 | foreach ($this->content as $pb){ |
34 | 34 | $pb->setActive($value); |
35 | 35 | } |
36 | - }else{ |
|
37 | - if ($value===true) |
|
38 | - $this->active="active"; |
|
39 | - else |
|
40 | - $this->active=""; |
|
36 | + } else{ |
|
37 | + if ($value===true) { |
|
38 | + $this->active="active"; |
|
39 | + } else { |
|
40 | + $this->active=""; |
|
41 | + } |
|
41 | 42 | } |
42 | 43 | return $this; |
43 | 44 | } |
@@ -47,11 +48,12 @@ discard block |
||
47 | 48 | foreach ($this->content as $pb){ |
48 | 49 | $pb->setStriped($value); |
49 | 50 | } |
50 | - }else{ |
|
51 | - if ($value===true) |
|
52 | - $this->striped="progress-bar-striped"; |
|
53 | - else |
|
54 | - $this->striped=""; |
|
51 | + } else{ |
|
52 | + if ($value===true) { |
|
53 | + $this->striped="progress-bar-striped"; |
|
54 | + } else { |
|
55 | + $this->striped=""; |
|
56 | + } |
|
55 | 57 | } |
56 | 58 | return $this; |
57 | 59 | } |
@@ -61,11 +63,12 @@ discard block |
||
61 | 63 | foreach ($this->content as $pb){ |
62 | 64 | $pb->showCaption($value); |
63 | 65 | } |
64 | - }else{ |
|
65 | - if ($value===true) |
|
66 | - $this->caption="%value%%"; |
|
67 | - else |
|
68 | - $this->caption='<span class="sr-only">%value%% Complete (%style%)</span>'; |
|
66 | + } else{ |
|
67 | + if ($value===true) { |
|
68 | + $this->caption="%value%%"; |
|
69 | + } else { |
|
70 | + $this->caption='<span class="sr-only">%value%% Complete (%style%)</span>'; |
|
71 | + } |
|
69 | 72 | } |
70 | 73 | return $this; |
71 | 74 | } |
@@ -137,8 +140,9 @@ discard block |
||
137 | 140 | if(isset($this->styleLimits)&& JArray::isAssociative($this->styleLimits)){ |
138 | 141 | foreach ($this->styleLimits as $k=>$v){ |
139 | 142 | $actualStyle=$k; |
140 | - if($v>$this->value) |
|
141 | - break; |
|
143 | + if($v>$this->value) { |
|
144 | + break; |
|
145 | + } |
|
142 | 146 | } |
143 | 147 | } |
144 | 148 | $this->style=$actualStyle; |
@@ -29,11 +29,11 @@ discard block |
||
29 | 29 | } |
30 | 30 | |
31 | 31 | public function setActive($value) { |
32 | - if(\is_array($this->content)){ |
|
33 | - foreach ($this->content as $pb){ |
|
32 | + if (\is_array($this->content)) { |
|
33 | + foreach ($this->content as $pb) { |
|
34 | 34 | $pb->setActive($value); |
35 | 35 | } |
36 | - }else{ |
|
36 | + } else { |
|
37 | 37 | if ($value===true) |
38 | 38 | $this->active="active"; |
39 | 39 | else |
@@ -43,11 +43,11 @@ discard block |
||
43 | 43 | } |
44 | 44 | |
45 | 45 | public function setStriped($value) { |
46 | - if(\is_array($this->content)){ |
|
47 | - foreach ($this->content as $pb){ |
|
46 | + if (\is_array($this->content)) { |
|
47 | + foreach ($this->content as $pb) { |
|
48 | 48 | $pb->setStriped($value); |
49 | 49 | } |
50 | - }else{ |
|
50 | + } else { |
|
51 | 51 | if ($value===true) |
52 | 52 | $this->striped="progress-bar-striped"; |
53 | 53 | else |
@@ -57,11 +57,11 @@ discard block |
||
57 | 57 | } |
58 | 58 | |
59 | 59 | public function showCaption($value) { |
60 | - if(\is_array($this->content)){ |
|
61 | - foreach ($this->content as $pb){ |
|
60 | + if (\is_array($this->content)) { |
|
61 | + foreach ($this->content as $pb) { |
|
62 | 62 | $pb->showCaption($value); |
63 | 63 | } |
64 | - }else{ |
|
64 | + } else { |
|
65 | 65 | if ($value===true) |
66 | 66 | $this->caption="%value%%"; |
67 | 67 | else |
@@ -81,7 +81,7 @@ discard block |
||
81 | 81 | $progressBar->setStriped($this->striped!=="" || $progressBar->isStriped()); |
82 | 82 | $progressBar->setActive($this->active==="active" || $progressBar->isActive()); |
83 | 83 | if (!is_array($this->content)) { |
84 | - $this->content=array (); |
|
84 | + $this->content=array(); |
|
85 | 85 | } |
86 | 86 | $this->content []=$progressBar; |
87 | 87 | } |
@@ -125,7 +125,7 @@ discard block |
||
125 | 125 | * @return \Ajax\bootstrap\html\HtmlProgressbar default : "" |
126 | 126 | */ |
127 | 127 | public function setStyle($cssStyle) { |
128 | - return $this->setMemberCtrl($this->style,CssRef::getStyle($cssStyle, "progress-bar"), CssRef::Styles("progress-bar")); |
|
128 | + return $this->setMemberCtrl($this->style, CssRef::getStyle($cssStyle, "progress-bar"), CssRef::Styles("progress-bar")); |
|
129 | 129 | } |
130 | 130 | |
131 | 131 | /* |
@@ -134,10 +134,10 @@ discard block |
||
134 | 134 | */ |
135 | 135 | public function compile(JsUtils $js=NULL, &$view=NULL) { |
136 | 136 | $actualStyle=$this->style; |
137 | - if(isset($this->styleLimits)&& JArray::isAssociative($this->styleLimits)){ |
|
138 | - foreach ($this->styleLimits as $k=>$v){ |
|
137 | + if (isset($this->styleLimits) && JArray::isAssociative($this->styleLimits)) { |
|
138 | + foreach ($this->styleLimits as $k=>$v) { |
|
139 | 139 | $actualStyle=$k; |
140 | - if($v>$this->value) |
|
140 | + if ($v>$this->value) |
|
141 | 141 | break; |
142 | 142 | } |
143 | 143 | } |
@@ -19,6 +19,9 @@ discard block |
||
19 | 19 | protected $style=""; |
20 | 20 | protected $styleLimits=null; |
21 | 21 | |
22 | + /** |
|
23 | + * @param string $identifier |
|
24 | + */ |
|
22 | 25 | public function __construct($identifier, $style="info", $value=0, $max=100, $min=0) { |
23 | 26 | parent::__construct($identifier); |
24 | 27 | $this->_template=include 'templates/tplProgressbar.php'; |
@@ -28,6 +31,9 @@ discard block |
||
28 | 31 | $this->setStyle($style); |
29 | 32 | } |
30 | 33 | |
34 | + /** |
|
35 | + * @param boolean $value |
|
36 | + */ |
|
31 | 37 | public function setActive($value) { |
32 | 38 | if(\is_array($this->content)){ |
33 | 39 | foreach ($this->content as $pb){ |
@@ -42,6 +48,9 @@ discard block |
||
42 | 48 | return $this; |
43 | 49 | } |
44 | 50 | |
51 | + /** |
|
52 | + * @param boolean $value |
|
53 | + */ |
|
45 | 54 | public function setStriped($value) { |
46 | 55 | if(\is_array($this->content)){ |
47 | 56 | foreach ($this->content as $pb){ |
@@ -56,6 +65,9 @@ discard block |
||
56 | 65 | return $this; |
57 | 66 | } |
58 | 67 | |
68 | + /** |
|
69 | + * @param boolean $value |
|
70 | + */ |
|
59 | 71 | public function showCaption($value) { |
60 | 72 | if(\is_array($this->content)){ |
61 | 73 | foreach ($this->content as $pb){ |
@@ -113,6 +125,9 @@ discard block |
||
113 | 125 | return $this->isStacked; |
114 | 126 | } |
115 | 127 | |
128 | + /** |
|
129 | + * @param boolean $isStacked |
|
130 | + */ |
|
116 | 131 | public function setIsStacked($isStacked) { |
117 | 132 | $this->isStacked=$isStacked; |
118 | 133 | return $this; |
@@ -121,7 +136,7 @@ discard block |
||
121 | 136 | /** |
122 | 137 | * define the progressbar style |
123 | 138 | * avaible values : "success","info","warning","danger" |
124 | - * @param string|int $cssStyle |
|
139 | + * @param string $cssStyle |
|
125 | 140 | * @return \Ajax\bootstrap\html\HtmlProgressbar default : "" |
126 | 141 | */ |
127 | 142 | public function setStyle($cssStyle) { |
@@ -20,6 +20,9 @@ |
||
20 | 20 | protected $_tabsType="tabs"; |
21 | 21 | protected $stacked=""; |
22 | 22 | |
23 | + /** |
|
24 | + * @param string $identifier |
|
25 | + */ |
|
23 | 26 | public function __construct($identifier, $tagName="ul") { |
24 | 27 | parent::__construct($identifier, $tagName); |
25 | 28 | $this->_template="<%tagName% %properties%>%tabs%</%tagName%>%content%"; |
@@ -35,8 +35,9 @@ discard block |
||
35 | 35 | $tab |
36 | 36 | ); |
37 | 37 | array_splice($this->tabs, $index, 0, $inserted); |
38 | - } else |
|
39 | - $this->tabs []=$tab; |
|
38 | + } else { |
|
39 | + $this->tabs []=$tab; |
|
40 | + } |
|
40 | 41 | } |
41 | 42 | |
42 | 43 | public function setActive($index){ |
@@ -116,9 +117,9 @@ discard block |
||
116 | 117 | public function createTabContents() { |
117 | 118 | $tabContent=new HtmlTabContent("tabcontent-".$this->identifier); |
118 | 119 | foreach ( $this->tabs as $tab ) { |
119 | - if ($tab instanceof HtmlTabItem) |
|
120 | - $tabContent->addTabItem($tab->getHref()); |
|
121 | - elseif ($tab instanceof HtmlDropdown) { |
|
120 | + if ($tab instanceof HtmlTabItem) { |
|
121 | + $tabContent->addTabItem($tab->getHref()); |
|
122 | + } elseif ($tab instanceof HtmlDropdown) { |
|
122 | 123 | foreach ( $tab->getItems() as $dropdownItem ) { |
123 | 124 | $tabContent->addTabItem($dropdownItem->getHref()); |
124 | 125 | } |
@@ -137,8 +138,9 @@ discard block |
||
137 | 138 | |
138 | 139 | public function setContentToTab($index, $text) { |
139 | 140 | $tabContentItem=$this->content->getTabItem($index); |
140 | - if (isset($tabContentItem)) |
|
141 | - $tabContentItem->setContent($text); |
|
141 | + if (isset($tabContentItem)) { |
|
142 | + $tabContentItem->setContent($text); |
|
143 | + } |
|
142 | 144 | } |
143 | 145 | |
144 | 146 | public function countTabs() { |
@@ -146,8 +148,9 @@ discard block |
||
146 | 148 | } |
147 | 149 | |
148 | 150 | public function getTabItem($index) { |
149 | - if ($index<sizeof($this->content->get)) |
|
150 | - return $this->content; |
|
151 | + if ($index<sizeof($this->content->get)) { |
|
152 | + return $this->content; |
|
153 | + } |
|
151 | 154 | } |
152 | 155 | |
153 | 156 | public function fadeEffect() { |
@@ -168,9 +171,11 @@ discard block |
||
168 | 171 | } |
169 | 172 | |
170 | 173 | public function setStacked($stacked=true){ |
171 | - if($stacked) |
|
172 | - $this->stacked="nav-stacked"; |
|
173 | - else $this->stacked=""; |
|
174 | + if($stacked) { |
|
175 | + $this->stacked="nav-stacked"; |
|
176 | + } else { |
|
177 | + $this->stacked=""; |
|
178 | + } |
|
174 | 179 | } |
175 | 180 | |
176 | 181 | /* (non-PHPdoc) |
@@ -16,7 +16,7 @@ discard block |
||
16 | 16 | |
17 | 17 | |
18 | 18 | class HtmlTabs extends HtmlBsDoubleElement { |
19 | - protected $tabs=array (); |
|
19 | + protected $tabs=array(); |
|
20 | 20 | protected $_tabsType="tabs"; |
21 | 21 | protected $stacked=""; |
22 | 22 | |
@@ -27,11 +27,11 @@ discard block |
||
27 | 27 | } |
28 | 28 | |
29 | 29 | protected function addTab_($tab, $index=null) { |
30 | - if($tab instanceof HtmlDropdown){ |
|
30 | + if ($tab instanceof HtmlDropdown) { |
|
31 | 31 | $tab->setMTagName("li"); |
32 | 32 | } |
33 | 33 | if (isset($index)) { |
34 | - $inserted=array ( |
|
34 | + $inserted=array( |
|
35 | 35 | $tab |
36 | 36 | ); |
37 | 37 | array_splice($this->tabs, $index, 0, $inserted); |
@@ -39,14 +39,14 @@ discard block |
||
39 | 39 | $this->tabs []=$tab; |
40 | 40 | } |
41 | 41 | |
42 | - public function setActive($index){ |
|
42 | + public function setActive($index) { |
|
43 | 43 | $size=\sizeof($this->tabs); |
44 | - for ($i=0;$i<$size;$i++){ |
|
44 | + for ($i=0; $i<$size; $i++) { |
|
45 | 45 | $this->tabs[$i]->setActive($i==$index); |
46 | 46 | } |
47 | 47 | } |
48 | 48 | |
49 | - public function disable($index){ |
|
49 | + public function disable($index) { |
|
50 | 50 | $this->tabs[$index]->disable(); |
51 | 51 | } |
52 | 52 | |
@@ -77,7 +77,7 @@ discard block |
||
77 | 77 | } |
78 | 78 | |
79 | 79 | public function addTabs($tabs) { |
80 | - foreach ( $tabs as $tab ) { |
|
80 | + foreach ($tabs as $tab) { |
|
81 | 81 | $this->addTab($tab); |
82 | 82 | } |
83 | 83 | return $this; |
@@ -107,7 +107,7 @@ discard block |
||
107 | 107 | */ |
108 | 108 | public function run(JsUtils $js) { |
109 | 109 | $this->_bsComponent=new Tabs($js); |
110 | - foreach ( $this->tabs as $tab ) { |
|
110 | + foreach ($this->tabs as $tab) { |
|
111 | 111 | $this->_bsComponent->addTab($tab->run($js)); |
112 | 112 | } |
113 | 113 | $this->addEventsOnRun($js); |
@@ -116,11 +116,11 @@ discard block |
||
116 | 116 | |
117 | 117 | public function createTabContents() { |
118 | 118 | $tabContent=new HtmlTabContent("tabcontent-".$this->identifier); |
119 | - foreach ( $this->tabs as $tab ) { |
|
119 | + foreach ($this->tabs as $tab) { |
|
120 | 120 | if ($tab instanceof HtmlTabItem) |
121 | 121 | $tabContent->addTabItem($tab->getHref()); |
122 | 122 | elseif ($tab instanceof HtmlDropdown) { |
123 | - foreach ( $tab->getItems() as $dropdownItem ) { |
|
123 | + foreach ($tab->getItems() as $dropdownItem) { |
|
124 | 124 | $tabContent->addTabItem($dropdownItem->getHref()); |
125 | 125 | } |
126 | 126 | } |
@@ -155,21 +155,21 @@ discard block |
||
155 | 155 | if (sizeof($this->content->getTabItems())>0) { |
156 | 156 | $this->content->getTabItem(0)->addToProperty("class", "fade in"); |
157 | 157 | $size=sizeof($this->tabs); |
158 | - for($index=0; $index<$size; $index++) { |
|
158 | + for ($index=0; $index<$size; $index++) { |
|
159 | 159 | $this->content->getTabItem($index)->addToProperty("class", "fade"); |
160 | 160 | } |
161 | 161 | } |
162 | 162 | } |
163 | 163 | |
164 | - public function on($event, $jsCode,$stopPropagation=false,$preventDefault=false){ |
|
165 | - foreach ($this->tabs as $tab){ |
|
166 | - $tab->on($event,$jsCode,$stopPropagation,$preventDefault); |
|
164 | + public function on($event, $jsCode, $stopPropagation=false, $preventDefault=false) { |
|
165 | + foreach ($this->tabs as $tab) { |
|
166 | + $tab->on($event, $jsCode, $stopPropagation, $preventDefault); |
|
167 | 167 | } |
168 | 168 | return $this; |
169 | 169 | } |
170 | 170 | |
171 | - public function setStacked($stacked=true){ |
|
172 | - if($stacked) |
|
171 | + public function setStacked($stacked=true) { |
|
172 | + if ($stacked) |
|
173 | 173 | $this->stacked="nav-stacked"; |
174 | 174 | else $this->stacked=""; |
175 | 175 | } |
@@ -84,6 +84,9 @@ discard block |
||
84 | 84 | return $this; |
85 | 85 | } |
86 | 86 | |
87 | + /** |
|
88 | + * @param integer $index |
|
89 | + */ |
|
87 | 90 | public function removeItem($index){ |
88 | 91 | return array_splice($this->content, $index, 1); |
89 | 92 | } |
@@ -99,6 +102,9 @@ discard block |
||
99 | 102 | return $this->addItem($function($object)); |
100 | 103 | } |
101 | 104 | |
105 | + /** |
|
106 | + * @param \Closure $callBack |
|
107 | + */ |
|
102 | 108 | public function apply($callBack){ |
103 | 109 | foreach ($this->content as $item){ |
104 | 110 | $callBack($item); |
@@ -12,36 +12,36 @@ discard block |
||
12 | 12 | */ |
13 | 13 | abstract class HtmlCollection extends HtmlDoubleElement { |
14 | 14 | |
15 | - public function __construct($identifier,$tagName="div"){ |
|
16 | - parent::__construct($identifier,$tagName); |
|
15 | + public function __construct($identifier, $tagName="div") { |
|
16 | + parent::__construct($identifier, $tagName); |
|
17 | 17 | $this->content=array(); |
18 | 18 | } |
19 | 19 | |
20 | - public function addItems($items){ |
|
21 | - if(JArray::isAssociative($items)){ |
|
22 | - foreach ($items as $k=>$v){ |
|
23 | - $this->addItem([$k,$v]); |
|
20 | + public function addItems($items) { |
|
21 | + if (JArray::isAssociative($items)) { |
|
22 | + foreach ($items as $k=>$v) { |
|
23 | + $this->addItem([$k, $v]); |
|
24 | 24 | } |
25 | - }else{ |
|
26 | - foreach ($items as $item){ |
|
25 | + } else { |
|
26 | + foreach ($items as $item) { |
|
27 | 27 | $this->addItem($item); |
28 | 28 | } |
29 | 29 | } |
30 | 30 | return $this; |
31 | 31 | } |
32 | 32 | |
33 | - public function setItems($items){ |
|
33 | + public function setItems($items) { |
|
34 | 34 | $this->content=$items; |
35 | 35 | return $this; |
36 | 36 | } |
37 | 37 | |
38 | - public function getItems(){ |
|
38 | + public function getItems() { |
|
39 | 39 | return $this->content; |
40 | 40 | } |
41 | 41 | |
42 | - protected function getItemToAdd($item){ |
|
42 | + protected function getItemToAdd($item) { |
|
43 | 43 | $itemO=$item; |
44 | - if($this->createCondition($item)===true){ |
|
44 | + if ($this->createCondition($item)===true) { |
|
45 | 45 | $itemO=$this->createItem($item); |
46 | 46 | } |
47 | 47 | return $itemO; |
@@ -52,15 +52,15 @@ discard block |
||
52 | 52 | * @param HtmlDoubleElement|string|array $item |
53 | 53 | * @return \Ajax\common\html\HtmlDoubleElement |
54 | 54 | */ |
55 | - public function addItem($item){ |
|
55 | + public function addItem($item) { |
|
56 | 56 | $itemO=$this->getItemToAdd($item); |
57 | 57 | $this->addContent($itemO); |
58 | 58 | return $itemO; |
59 | 59 | } |
60 | 60 | |
61 | - public function insertItem($item,$position=0){ |
|
61 | + public function insertItem($item, $position=0) { |
|
62 | 62 | $itemO=$this->getItemToAdd($item); |
63 | - \array_splice( $this->content, $position, 0, array($itemO)); |
|
63 | + \array_splice($this->content, $position, 0, array($itemO)); |
|
64 | 64 | return $itemO; |
65 | 65 | } |
66 | 66 | |
@@ -83,11 +83,11 @@ discard block |
||
83 | 83 | return $this; |
84 | 84 | } |
85 | 85 | |
86 | - public function removeItem($index){ |
|
86 | + public function removeItem($index) { |
|
87 | 87 | return array_splice($this->content, $index, 1); |
88 | 88 | } |
89 | 89 | |
90 | - public function count(){ |
|
90 | + public function count() { |
|
91 | 91 | return \sizeof($this->content); |
92 | 92 | } |
93 | 93 | |
@@ -98,8 +98,8 @@ discard block |
||
98 | 98 | return $this->addItem($function($object)); |
99 | 99 | } |
100 | 100 | |
101 | - public function apply($callBack){ |
|
102 | - foreach ($this->content as $item){ |
|
101 | + public function apply($callBack) { |
|
102 | + foreach ($this->content as $item) { |
|
103 | 103 | $callBack($item); |
104 | 104 | } |
105 | 105 | return $this; |
@@ -119,40 +119,40 @@ discard block |
||
119 | 119 | */ |
120 | 120 | abstract protected function createItem($value); |
121 | 121 | |
122 | - protected function createCondition($value){ |
|
122 | + protected function createCondition($value) { |
|
123 | 123 | return \is_object($value)===false; |
124 | 124 | } |
125 | 125 | |
126 | - protected function contentAs($tagName){ |
|
127 | - foreach ($this->content as $item){ |
|
126 | + protected function contentAs($tagName) { |
|
127 | + foreach ($this->content as $item) { |
|
128 | 128 | $item->setTagName($tagName); |
129 | 129 | } |
130 | 130 | return $this; |
131 | 131 | } |
132 | 132 | |
133 | - public function setProperties($properties){ |
|
133 | + public function setProperties($properties) { |
|
134 | 134 | $i=0; |
135 | - foreach ($properties as $k=>$v){ |
|
135 | + foreach ($properties as $k=>$v) { |
|
136 | 136 | $c=$this->content[$i++]; |
137 | - if(isset($c)) |
|
138 | - $c->setProperty($k,$v); |
|
137 | + if (isset($c)) |
|
138 | + $c->setProperty($k, $v); |
|
139 | 139 | else |
140 | 140 | return $this; |
141 | 141 | } |
142 | 142 | return $this; |
143 | 143 | } |
144 | 144 | |
145 | - public function setPropertyValues($property,$values){ |
|
145 | + public function setPropertyValues($property, $values) { |
|
146 | 146 | $i=0; |
147 | - if(\is_array($values)===false){ |
|
148 | - $values=\array_fill(0, $this->count(),$values); |
|
147 | + if (\is_array($values)===false) { |
|
148 | + $values=\array_fill(0, $this->count(), $values); |
|
149 | 149 | } |
150 | - foreach ($values as $value){ |
|
150 | + foreach ($values as $value) { |
|
151 | 151 | $c=$this->content[$i++]; |
152 | - if(isset($c)){ |
|
153 | - $c->setProperty($property,$value); |
|
152 | + if (isset($c)) { |
|
153 | + $c->setProperty($property, $value); |
|
154 | 154 | } |
155 | - else{ |
|
155 | + else { |
|
156 | 156 | return $this; |
157 | 157 | } |
158 | 158 | } |
@@ -22,7 +22,7 @@ discard block |
||
22 | 22 | foreach ($items as $k=>$v){ |
23 | 23 | $this->addItem([$k,$v]); |
24 | 24 | } |
25 | - }else{ |
|
25 | + } else{ |
|
26 | 26 | foreach ($items as $item){ |
27 | 27 | $this->addItem($item); |
28 | 28 | } |
@@ -70,9 +70,9 @@ discard block |
||
70 | 70 | * @return \Ajax\common\html\HtmlDoubleElement |
71 | 71 | */ |
72 | 72 | public function getItem($index) { |
73 | - if (is_int($index)) |
|
74 | - return $this->content[$index]; |
|
75 | - else { |
|
73 | + if (is_int($index)) { |
|
74 | + return $this->content[$index]; |
|
75 | + } else { |
|
76 | 76 | $elm=$this->getElementById($index, $this->content); |
77 | 77 | return $elm; |
78 | 78 | } |
@@ -134,10 +134,11 @@ discard block |
||
134 | 134 | $i=0; |
135 | 135 | foreach ($properties as $k=>$v){ |
136 | 136 | $c=$this->content[$i++]; |
137 | - if(isset($c)) |
|
138 | - $c->setProperty($k,$v); |
|
139 | - else |
|
140 | - return $this; |
|
137 | + if(isset($c)) { |
|
138 | + $c->setProperty($k,$v); |
|
139 | + } else { |
|
140 | + return $this; |
|
141 | + } |
|
141 | 142 | } |
142 | 143 | return $this; |
143 | 144 | } |
@@ -151,8 +152,7 @@ discard block |
||
151 | 152 | $c=$this->content[$i++]; |
152 | 153 | if(isset($c)){ |
153 | 154 | $c->setProperty($property,$value); |
154 | - } |
|
155 | - else{ |
|
155 | + } else{ |
|
156 | 156 | return $this; |
157 | 157 | } |
158 | 158 | } |
@@ -15,6 +15,9 @@ |
||
15 | 15 | protected $_equalWidth; |
16 | 16 | protected $_name; |
17 | 17 | |
18 | + /** |
|
19 | + * @param string $identifier |
|
20 | + */ |
|
18 | 21 | public function __construct($identifier, $fields=array(), $equalWidth=true) { |
19 | 22 | parent::__construct($identifier, "div"); |
20 | 23 | $this->_equalWidth=$equalWidth; |
@@ -5,7 +5,6 @@ |
||
5 | 5 | use Ajax\semantic\html\base\HtmlSemCollection; |
6 | 6 | use Ajax\semantic\html\base\constants\Wide; |
7 | 7 | use Ajax\JsUtils; |
8 | - |
|
9 | 8 | use Ajax\semantic\html\base\HtmlSemDoubleElement; |
10 | 9 | use Ajax\semantic\html\collections\form\traits\FieldsTrait; |
11 | 10 |
@@ -29,12 +29,14 @@ discard block |
||
29 | 29 | if (\is_string($end)) { |
30 | 30 | $label=$end; |
31 | 31 | \array_pop($fields); |
32 | - } else |
|
33 | - $label=NULL; |
|
32 | + } else { |
|
33 | + $label=NULL; |
|
34 | + } |
|
34 | 35 | } |
35 | 36 | } |
36 | - if (isset($label)) |
|
37 | - $this->setLabel($label); |
|
37 | + if (isset($label)) { |
|
38 | + $this->setLabel($label); |
|
39 | + } |
|
38 | 40 | foreach ( $fields as $field ) { |
39 | 41 | $this->addItem($field); |
40 | 42 | } |
@@ -57,8 +59,9 @@ discard block |
||
57 | 59 | |
58 | 60 | public function addItem($item) { |
59 | 61 | $item=parent::addItem($item); |
60 | - if($item instanceof HtmlFormField) |
|
61 | - $item->setContainer($this); |
|
62 | + if($item instanceof HtmlFormField) { |
|
63 | + $item->setContainer($this); |
|
64 | + } |
|
62 | 65 | return $item; |
63 | 66 | } |
64 | 67 | |
@@ -66,8 +69,9 @@ discard block |
||
66 | 69 | if ($this->_equalWidth) { |
67 | 70 | $count=$this->count(); |
68 | 71 | $this->addToProperty("class", Wide::getConstants()["W".$count]." fields"); |
69 | - } else |
|
70 | - $this->addToProperty("class", "fields"); |
|
72 | + } else { |
|
73 | + $this->addToProperty("class", "fields"); |
|
74 | + } |
|
71 | 75 | return parent::compile($js, $view); |
72 | 76 | } |
73 | 77 | |
@@ -108,8 +112,9 @@ discard block |
||
108 | 112 | $fields[]=$itemO; |
109 | 113 | } |
110 | 114 | $radios=new HtmlFormFields("fields-".$name, $fields); |
111 | - if (isset($label)) |
|
112 | - $radios->setLabel($label)->setProperty("for", $name); |
|
115 | + if (isset($label)) { |
|
116 | + $radios->setLabel($label)->setProperty("for", $name); |
|
117 | + } |
|
113 | 118 | return $radios; |
114 | 119 | } |
115 | 120 | |
@@ -124,8 +129,9 @@ discard block |
||
124 | 129 | $fields[]=$itemO; |
125 | 130 | } |
126 | 131 | $radios=new HtmlFormFields("fields-".$name, $fields); |
127 | - if (isset($label)) |
|
128 | - $radios->setLabel($label)->setProperty("for", $name); |
|
132 | + if (isset($label)) { |
|
133 | + $radios->setLabel($label)->setProperty("for", $name); |
|
134 | + } |
|
129 | 135 | return $radios; |
130 | 136 | } |
131 | 137 |
@@ -35,7 +35,7 @@ discard block |
||
35 | 35 | } |
36 | 36 | if (isset($label)) |
37 | 37 | $this->setLabel($label); |
38 | - foreach ( $fields as $field ) { |
|
38 | + foreach ($fields as $field) { |
|
39 | 39 | $this->addItem($field); |
40 | 40 | } |
41 | 41 | return $this; |
@@ -57,7 +57,7 @@ discard block |
||
57 | 57 | |
58 | 58 | public function addItem($item) { |
59 | 59 | $item=parent::addItem($item); |
60 | - if($item instanceof HtmlFormField) |
|
60 | + if ($item instanceof HtmlFormField) |
|
61 | 61 | $item->setContainer($this); |
62 | 62 | return $item; |
63 | 63 | } |
@@ -98,9 +98,9 @@ discard block |
||
98 | 98 | |
99 | 99 | |
100 | 100 | public static function radios($name, $items=array(), $label=NULL, $value=null, $type=NULL) { |
101 | - $fields=array (); |
|
101 | + $fields=array(); |
|
102 | 102 | $i=0; |
103 | - foreach ( $items as $val => $caption ) { |
|
103 | + foreach ($items as $val => $caption) { |
|
104 | 104 | $itemO=new HtmlFormRadio($name."-".$i++, $name, $caption, $val, $type); |
105 | 105 | if ($val===$value) { |
106 | 106 | $itemO->getField()->setProperty("checked", ""); |
@@ -114,9 +114,9 @@ discard block |
||
114 | 114 | } |
115 | 115 | |
116 | 116 | public static function checkeds($name, $items=array(), $label=NULL, $values=array(), $type=NULL) { |
117 | - $fields=array (); |
|
117 | + $fields=array(); |
|
118 | 118 | $i=0; |
119 | - foreach ( $items as $val => $caption ) { |
|
119 | + foreach ($items as $val => $caption) { |
|
120 | 120 | $itemO=new HtmlFormCheckbox($name."-".$i++, $name, $caption, $val, $type); |
121 | 121 | if (\array_search($val, $values)!==false) { |
122 | 122 | //TODO check getField |