@@ -15,22 +15,22 @@ discard block |
||
15 | 15 | class HtmlGridCol extends HtmlDoubleElement { |
16 | 16 | private $positions; |
17 | 17 | private $offsets; |
18 | - public function __construct($identifier,$size=CssSize::SIZE_MD,$width=1){ |
|
19 | - parent::__construct($identifier,"div"); |
|
18 | + public function __construct($identifier, $size=CssSize::SIZE_MD, $width=1) { |
|
19 | + parent::__construct($identifier, "div"); |
|
20 | 20 | $this->positions=array(); |
21 | 21 | $this->offsets=array(); |
22 | - $this->addPosition($size,$width); |
|
22 | + $this->addPosition($size, $width); |
|
23 | 23 | } |
24 | - public function addPosition($size=CssSize::SIZE_MD,$width=1){ |
|
24 | + public function addPosition($size=CssSize::SIZE_MD, $width=1) { |
|
25 | 25 | $this->positions[$size]=$width; |
26 | 26 | return $this; |
27 | 27 | } |
28 | - private function _generateClass(){ |
|
28 | + private function _generateClass() { |
|
29 | 29 | $result=array(); |
30 | - foreach ($this->positions as $size=>$width){ |
|
30 | + foreach ($this->positions as $size=>$width) { |
|
31 | 31 | $result[]="col-".$size."-".$width; |
32 | 32 | } |
33 | - foreach ($this->offsets as $size=>$offset){ |
|
33 | + foreach ($this->offsets as $size=>$offset) { |
|
34 | 34 | $result[]="col-".$size."-offset-".$offset; |
35 | 35 | } |
36 | 36 | return implode(" ", $result); |
@@ -38,63 +38,63 @@ discard block |
||
38 | 38 | |
39 | 39 | public function compile(JsUtils $js=NULL, View $view=NULL) { |
40 | 40 | $this->setProperty("class", $this->_generateClass()); |
41 | - return parent::compile($js,$view); |
|
41 | + return parent::compile($js, $view); |
|
42 | 42 | } |
43 | 43 | |
44 | - public function setOffset($size,$offset){ |
|
44 | + public function setOffset($size, $offset) { |
|
45 | 45 | $this->offsets[$size]=$offset; |
46 | 46 | return $this; |
47 | 47 | } |
48 | 48 | |
49 | - public function setOffsetForAll($newOffset){ |
|
50 | - foreach ($this->offsets as &$value){ |
|
49 | + public function setOffsetForAll($newOffset) { |
|
50 | + foreach ($this->offsets as &$value) { |
|
51 | 51 | $value=$newOffset; |
52 | 52 | } |
53 | 53 | unset($value); |
54 | 54 | return $this; |
55 | 55 | } |
56 | 56 | |
57 | - public function setWidthForAll($newWidth){ |
|
58 | - foreach ($this->positions as &$pos){ |
|
57 | + public function setWidthForAll($newWidth) { |
|
58 | + foreach ($this->positions as &$pos) { |
|
59 | 59 | $pos=$newWidth; |
60 | 60 | } |
61 | 61 | unset($pos); |
62 | 62 | return $this; |
63 | 63 | } |
64 | 64 | |
65 | - public function setWidth($size=CssSize::SIZE_MD,$width=1){ |
|
65 | + public function setWidth($size=CssSize::SIZE_MD, $width=1) { |
|
66 | 66 | $this->positions[$size]=$width; |
67 | 67 | return $this; |
68 | 68 | } |
69 | 69 | |
70 | - public function setPosition($size=CssSize::SIZE_MD,$width=1){ |
|
71 | - return $this->addPosition($size,$width); |
|
70 | + public function setPosition($size=CssSize::SIZE_MD, $width=1) { |
|
71 | + return $this->addPosition($size, $width); |
|
72 | 72 | } |
73 | 73 | |
74 | - public function getWidth($size){ |
|
74 | + public function getWidth($size) { |
|
75 | 75 | return @$this->positions[$size]; |
76 | 76 | } |
77 | 77 | |
78 | - public function getOffest($size){ |
|
78 | + public function getOffest($size) { |
|
79 | 79 | return @$this->offsets[$size]; |
80 | 80 | } |
81 | 81 | |
82 | - public function addClear(){ |
|
83 | - $this->wrap("","<div class='clearfix'></div>"); |
|
82 | + public function addClear() { |
|
83 | + $this->wrap("", "<div class='clearfix'></div>"); |
|
84 | 84 | } |
85 | 85 | public function setOffsets($offsets) { |
86 | - $this->offsets = $offsets; |
|
86 | + $this->offsets=$offsets; |
|
87 | 87 | return $this; |
88 | 88 | } |
89 | 89 | |
90 | - public function copy($identifier){ |
|
90 | + public function copy($identifier) { |
|
91 | 91 | $result=new HtmlGridCol($identifier); |
92 | 92 | $result->setPositions($this->positions); |
93 | 93 | $result->setOffsets($this->offsets); |
94 | 94 | return $result; |
95 | 95 | } |
96 | 96 | public function setPositions($positions) { |
97 | - $this->positions = $positions; |
|
97 | + $this->positions=$positions; |
|
98 | 98 | return $this; |
99 | 99 | } |
100 | 100 | public function getOffsets() { |
@@ -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) { |
@@ -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)===false) { |
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 $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 | } |
@@ -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; |
@@ -5,7 +5,6 @@ |
||
5 | 5 | use Ajax\semantic\html\base\HtmlSemDoubleElement; |
6 | 6 | use Ajax\JsUtils; |
7 | 7 | use Ajax\service\JArray; |
8 | - |
|
9 | 8 | use Ajax\semantic\html\base\constants\State; |
10 | 9 | |
11 | 10 | class HtmlProgress extends HtmlSemDoubleElement { |
@@ -269,8 +269,8 @@ discard block |
||
269 | 269 | * @param string $tagName container tagName |
270 | 270 | * @return HtmlListgroup |
271 | 271 | */ |
272 | - public function htmlListgroup($identifier,$items=array(),$tagName="ul"){ |
|
273 | - $listGroup=new HtmlListgroup($identifier,$tagName); |
|
272 | + public function htmlListgroup($identifier, $items=array(), $tagName="ul") { |
|
273 | + $listGroup=new HtmlListgroup($identifier, $tagName); |
|
274 | 274 | $listGroup->addItems($items); |
275 | 275 | return $this->addHtmlComponent($listGroup); |
276 | 276 | } |
@@ -295,8 +295,8 @@ discard block |
||
295 | 295 | * @param string $onClick |
296 | 296 | * @return HtmlSplitbutton |
297 | 297 | */ |
298 | - public function htmlSplitbutton($identifier,$value="", $items=array(), $cssStyle="btn-default", $onClick=NULL) { |
|
299 | - return $this->addHtmlComponent(new HtmlSplitbutton($identifier, $value, $items, $cssStyle,$onClick)); |
|
298 | + public function htmlSplitbutton($identifier, $value="", $items=array(), $cssStyle="btn-default", $onClick=NULL) { |
|
299 | + return $this->addHtmlComponent(new HtmlSplitbutton($identifier, $value, $items, $cssStyle, $onClick)); |
|
300 | 300 | } |
301 | 301 | |
302 | 302 | /** |
@@ -304,7 +304,7 @@ discard block |
||
304 | 304 | * @param string $identifier |
305 | 305 | * @return HtmlInputgroup |
306 | 306 | */ |
307 | - public function htmlInputgroup($identifier){ |
|
307 | + public function htmlInputgroup($identifier) { |
|
308 | 308 | return $this->addHtmlComponent(new HtmlInputgroup($identifier)); |
309 | 309 | } |
310 | 310 | |
@@ -316,8 +316,8 @@ discard block |
||
316 | 316 | * @param function $hrefFunction the function who generates the href elements. default : function($e){return $e->getContent()} |
317 | 317 | * @return HtmlBreadcrumbs |
318 | 318 | */ |
319 | - public function htmlBreadcrumbs($identifier,$elements=array(),$autoActive=true,$startIndex=0,$hrefFunction=NULL){ |
|
320 | - return $this->addHtmlComponent(new HtmlBreadcrumbs($identifier,$elements,$autoActive,$startIndex,$hrefFunction)); |
|
319 | + public function htmlBreadcrumbs($identifier, $elements=array(), $autoActive=true, $startIndex=0, $hrefFunction=NULL) { |
|
320 | + return $this->addHtmlComponent(new HtmlBreadcrumbs($identifier, $elements, $autoActive, $startIndex, $hrefFunction)); |
|
321 | 321 | } |
322 | 322 | |
323 | 323 | /** |
@@ -329,8 +329,8 @@ discard block |
||
329 | 329 | * @param int $active The active page |
330 | 330 | * @return HtmlPagination |
331 | 331 | */ |
332 | - public function htmlPagination($identifier,$from=1,$to=1,$active=NULL,$countVisible=NULL){ |
|
333 | - return $this->addHtmlComponent(new HtmlPagination($identifier,$from,$to,$active,$countVisible)); |
|
332 | + public function htmlPagination($identifier, $from=1, $to=1, $active=NULL, $countVisible=NULL) { |
|
333 | + return $this->addHtmlComponent(new HtmlPagination($identifier, $from, $to, $active, $countVisible)); |
|
334 | 334 | } |
335 | 335 | |
336 | 336 | /** |
@@ -341,7 +341,7 @@ discard block |
||
341 | 341 | * @param int $numCols |
342 | 342 | * @return HtmlGridSystem |
343 | 343 | */ |
344 | - public function htmlGridSystem($identifier,$numRows=1,$numCols=NULL){ |
|
345 | - return $this->addHtmlComponent(new HtmlGridSystem($identifier,$numRows,$numCols)); |
|
344 | + public function htmlGridSystem($identifier, $numRows=1, $numCols=NULL) { |
|
345 | + return $this->addHtmlComponent(new HtmlGridSystem($identifier, $numRows, $numCols)); |
|
346 | 346 | } |
347 | 347 | } |
348 | 348 | \ No newline at end of file |
@@ -23,19 +23,19 @@ |
||
23 | 23 | return $this; |
24 | 24 | } |
25 | 25 | |
26 | - public function addGlyph($glyphicon,$before=true){ |
|
26 | + public function addGlyph($glyphicon, $before=true) { |
|
27 | 27 | $glyph=new HtmlGlyphicon(""); |
28 | 28 | $glyph->setGlyphicon($glyphicon); |
29 | - $this->addContent($glyph,$before); |
|
29 | + $this->addContent($glyph, $before); |
|
30 | 30 | return $this; |
31 | 31 | } |
32 | 32 | |
33 | - public function wrapContentWithGlyph($glyphBefore,$glyphAfter=""){ |
|
33 | + public function wrapContentWithGlyph($glyphBefore, $glyphAfter="") { |
|
34 | 34 | $before=HtmlGlyphicon::getGlyphicon($glyphBefore)." "; |
35 | 35 | $after=""; |
36 | - if($glyphAfter!==""){ |
|
36 | + if ($glyphAfter!=="") { |
|
37 | 37 | $after=" ".HtmlGlyphicon::getGlyphicon($glyphAfter); |
38 | 38 | } |
39 | - return $this->wrapContent($before,$after); |
|
39 | + return $this->wrapContent($before, $after); |
|
40 | 40 | } |
41 | 41 | } |
42 | 42 | \ No newline at end of file |
@@ -27,15 +27,15 @@ discard block |
||
27 | 27 | return $this->content; |
28 | 28 | } |
29 | 29 | |
30 | - public function addContent($content,$before=false) { |
|
30 | + public function addContent($content, $before=false) { |
|
31 | 31 | if (is_array($this->content)===false) { |
32 | - if(isset($this->content)) |
|
33 | - $this->content=array ($this->content); |
|
32 | + if (isset($this->content)) |
|
33 | + $this->content=array($this->content); |
|
34 | 34 | else |
35 | 35 | $this->content=array(); |
36 | 36 | } |
37 | - if($before) |
|
38 | - array_unshift($this->content,$content); |
|
37 | + if ($before) |
|
38 | + array_unshift($this->content, $content); |
|
39 | 39 | else |
40 | 40 | $this->content []=$content; |
41 | 41 | return $this; |
@@ -49,8 +49,8 @@ discard block |
||
49 | 49 | parent::run($js); |
50 | 50 | if ($this->content instanceof HtmlDoubleElement) { |
51 | 51 | $this->content->run($js); |
52 | - } else if (is_array($this->content)) { |
|
53 | - foreach ( $this->content as $itemContent ) { |
|
52 | + }else if (is_array($this->content)) { |
|
53 | + foreach ($this->content as $itemContent) { |
|
54 | 54 | if ($itemContent instanceof HtmlDoubleElement) { |
55 | 55 | $itemContent->run($js); |
56 | 56 | } |
@@ -29,15 +29,17 @@ |
||
29 | 29 | |
30 | 30 | public function addContent($content,$before=false) { |
31 | 31 | if (is_array($this->content)===false) { |
32 | - if(isset($this->content)) |
|
33 | - $this->content=array ($this->content); |
|
34 | - else |
|
35 | - $this->content=array(); |
|
32 | + if(isset($this->content)) { |
|
33 | + $this->content=array ($this->content); |
|
34 | + } else { |
|
35 | + $this->content=array(); |
|
36 | + } |
|
37 | + } |
|
38 | + if($before) { |
|
39 | + array_unshift($this->content,$content); |
|
40 | + } else { |
|
41 | + $this->content []=$content; |
|
36 | 42 | } |
37 | - if($before) |
|
38 | - array_unshift($this->content,$content); |
|
39 | - else |
|
40 | - $this->content []=$content; |
|
41 | 43 | return $this; |
42 | 44 | } |
43 | 45 |
@@ -13,7 +13,7 @@ discard block |
||
13 | 13 | } |
14 | 14 | |
15 | 15 | public function setClass($classNames) { |
16 | - if(is_array($classNames)){ |
|
16 | + if (is_array($classNames)) { |
|
17 | 17 | $classNames=implode(" ", $classNames); |
18 | 18 | } |
19 | 19 | $this->setProperty("class", $classNames); |
@@ -40,7 +40,7 @@ discard block |
||
40 | 40 | */ |
41 | 41 | public function fromArray($array) { |
42 | 42 | $array=parent::fromArray($array); |
43 | - foreach ( $array as $key => $value ) { |
|
43 | + foreach ($array as $key => $value) { |
|
44 | 44 | $this->setProperty($key, $value); |
45 | 45 | } |
46 | 46 | return $array; |
@@ -10,7 +10,7 @@ discard block |
||
10 | 10 | class HtmlOption extends HtmlDoubleElement { |
11 | 11 | protected $value; |
12 | 12 | protected $selected; |
13 | - public function __construct($identifier,$caption,$value="") { |
|
13 | + public function __construct($identifier, $caption, $value="") { |
|
14 | 14 | parent::__construct($identifier, "option"); |
15 | 15 | $this->_template='<option id="%identifier%" value="%value%" %selected% %properties%>%content%</option>'; |
16 | 16 | $this->content=$caption; |
@@ -18,7 +18,7 @@ discard block |
||
18 | 18 | $this->selected=""; |
19 | 19 | } |
20 | 20 | |
21 | - public function select(){ |
|
21 | + public function select() { |
|
22 | 22 | $this->selected="selected"; |
23 | 23 | return $this; |
24 | 24 | } |
@@ -27,7 +27,7 @@ discard block |
||
27 | 27 | return $this->value; |
28 | 28 | } |
29 | 29 | public function setValue($value) { |
30 | - $this->value = $value; |
|
30 | + $this->value=$value; |
|
31 | 31 | return $this; |
32 | 32 | } |
33 | 33 |
@@ -16,7 +16,7 @@ discard block |
||
16 | 16 | private $default; |
17 | 17 | private $options; |
18 | 18 | |
19 | - public function __construct($identifier, $caption,$default=NULL) { |
|
19 | + public function __construct($identifier, $caption, $default=NULL) { |
|
20 | 20 | parent::__construct($identifier, "select"); |
21 | 21 | $this->setProperty("name", $identifier); |
22 | 22 | $this->setProperty("class", "form-control"); |
@@ -25,21 +25,21 @@ discard block |
||
25 | 25 | $this->options=array(); |
26 | 26 | } |
27 | 27 | |
28 | - public function addOption($element,$value="",$selected=false){ |
|
29 | - if($element instanceof HtmlOption){ |
|
28 | + public function addOption($element, $value="", $selected=false) { |
|
29 | + if ($element instanceof HtmlOption) { |
|
30 | 30 | $option=$element; |
31 | - }else{ |
|
32 | - $option=new HtmlOption($this->identifier."-".count($this->options), $element,$value); |
|
31 | + }else { |
|
32 | + $option=new HtmlOption($this->identifier."-".count($this->options), $element, $value); |
|
33 | 33 | } |
34 | - if($selected || $option->getValue()==$this->getProperty("value")){ |
|
34 | + if ($selected || $option->getValue()==$this->getProperty("value")) { |
|
35 | 35 | $option->select(); |
36 | 36 | } |
37 | 37 | $this->options[]=$option; |
38 | 38 | } |
39 | 39 | |
40 | 40 | public function setValue($value) { |
41 | - foreach ( $this->options as $option ) { |
|
42 | - if (strcasecmp($option->getValue(),$value)===0) { |
|
41 | + foreach ($this->options as $option) { |
|
42 | + if (strcasecmp($option->getValue(), $value)===0) { |
|
43 | 43 | $option->setProperty("selected", ""); |
44 | 44 | } |
45 | 45 | } |
@@ -52,23 +52,23 @@ discard block |
||
52 | 52 | */ |
53 | 53 | public function compile(JsUtils $js=NULL, View $view=NULL) { |
54 | 54 | $this->content=array(); |
55 | - if(isset($this->default)){ |
|
55 | + if (isset($this->default)) { |
|
56 | 56 | $default=new HtmlOption("", $this->default); |
57 | 57 | $this->content[]=$default; |
58 | 58 | } |
59 | - foreach ($this->options as $option){ |
|
59 | + foreach ($this->options as $option) { |
|
60 | 60 | $this->content[]=$option; |
61 | 61 | } |
62 | 62 | return parent::compile($js, $view); |
63 | 63 | } |
64 | 64 | |
65 | - public function fromArray($array){ |
|
66 | - if(JArray::isAssociative($array)){ |
|
67 | - foreach ($array as $k=>$v){ |
|
65 | + public function fromArray($array) { |
|
66 | + if (JArray::isAssociative($array)) { |
|
67 | + foreach ($array as $k=>$v) { |
|
68 | 68 | $this->addOption($v, $k); |
69 | 69 | } |
70 | - }else{ |
|
71 | - foreach ($array as $v){ |
|
70 | + }else { |
|
71 | + foreach ($array as $v) { |
|
72 | 72 | $this->addOption($v, $v); |
73 | 73 | } |
74 | 74 | } |
@@ -101,7 +101,7 @@ discard block |
||
101 | 101 | $this->addOption($function($object)); |
102 | 102 | } |
103 | 103 | |
104 | - public function setSize($size){ |
|
104 | + public function setSize($size) { |
|
105 | 105 | return $this->setProperty("size", $size); |
106 | 106 | } |
107 | 107 | } |
@@ -28,7 +28,7 @@ discard block |
||
28 | 28 | public function addOption($element,$value="",$selected=false){ |
29 | 29 | if($element instanceof HtmlOption){ |
30 | 30 | $option=$element; |
31 | - }else{ |
|
31 | + } else{ |
|
32 | 32 | $option=new HtmlOption($this->identifier."-".count($this->options), $element,$value); |
33 | 33 | } |
34 | 34 | if($selected || $option->getValue()==$this->getProperty("value")){ |
@@ -67,7 +67,7 @@ discard block |
||
67 | 67 | foreach ($array as $k=>$v){ |
68 | 68 | $this->addOption($v, $k); |
69 | 69 | } |
70 | - }else{ |
|
70 | + } else{ |
|
71 | 71 | foreach ($array as $v){ |
72 | 72 | $this->addOption($v, $v); |
73 | 73 | } |
@@ -7,7 +7,7 @@ |
||
7 | 7 | |
8 | 8 | class HtmlImg extends HtmlSingleElement { |
9 | 9 | |
10 | - public function __construct($identifier,$src="",$alt="") { |
|
10 | + public function __construct($identifier, $src="", $alt="") { |
|
11 | 11 | parent::__construct($identifier, "img"); |
12 | 12 | $this->setSrc($src); |
13 | 13 | $this->setAlt($alt); |