@@ -34,8 +34,9 @@ |
||
34 | 34 | public function addContent($content) { |
35 | 35 | if (is_array($this->content)===false) { |
36 | 36 | $newContent=array (); |
37 | - if (isset($this->content)) |
|
38 | - $newContent []=$this->content; |
|
37 | + if (isset($this->content)) { |
|
38 | + $newContent []=$this->content; |
|
39 | + } |
|
39 | 40 | $newContent []=$content; |
40 | 41 | $this->content=$newContent; |
41 | 42 | } else { |
@@ -32,12 +32,12 @@ discard block |
||
32 | 32 | |
33 | 33 | public function addContent($content) { |
34 | 34 | if (is_array($this->content)===false) { |
35 | - $newContent=array (); |
|
35 | + $newContent=array(); |
|
36 | 36 | if (isset($this->content)) |
37 | 37 | $newContent []=$this->content; |
38 | 38 | $newContent []=$content; |
39 | 39 | $this->content=$newContent; |
40 | - } else { |
|
40 | + }else { |
|
41 | 41 | $this->content []=$content; |
42 | 42 | } |
43 | 43 | return $this; |
@@ -51,8 +51,8 @@ discard block |
||
51 | 51 | parent::run($js); |
52 | 52 | if ($this->content instanceof HtmlDoubleElement) { |
53 | 53 | $this->content->run($js); |
54 | - } else if (is_array($this->content)) { |
|
55 | - foreach ( $this->content as $itemContent ) { |
|
54 | + }else if (is_array($this->content)) { |
|
55 | + foreach ($this->content as $itemContent) { |
|
56 | 56 | if ($itemContent instanceof HtmlDoubleElement) { |
57 | 57 | $itemContent->run($js); |
58 | 58 | } |
@@ -74,7 +74,7 @@ discard block |
||
74 | 74 | return $this; |
75 | 75 | } |
76 | 76 | |
77 | - public function addGlyph($glyphicon,$index=0){ |
|
77 | + public function addGlyph($glyphicon, $index=0) { |
|
78 | 78 | $glyph=new HtmlGlyphicon(""); |
79 | 79 | $glyph->setGlyphicon($glyphicon); |
80 | 80 | $this->addContent($glyph); |
@@ -90,12 +90,12 @@ discard block |
||
90 | 90 | return $this; |
91 | 91 | } |
92 | 92 | |
93 | - public function wrapContentWithGlyph($glyphBefore,$glyphAfter=""){ |
|
93 | + public function wrapContentWithGlyph($glyphBefore, $glyphAfter="") { |
|
94 | 94 | $before=HtmlGlyphicon::getGlyphicon($glyphBefore)." "; |
95 | 95 | $after=""; |
96 | - if($glyphAfter!==""){ |
|
96 | + if ($glyphAfter!=="") { |
|
97 | 97 | $after=" ".HtmlGlyphicon::getGlyphicon($glyphAfter); |
98 | 98 | } |
99 | - return $this->wrapContent($before,$after); |
|
99 | + return $this->wrapContent($before, $after); |
|
100 | 100 | } |
101 | 101 | } |
102 | 102 | \ No newline at end of file |
@@ -26,11 +26,11 @@ |
||
26 | 26 | } |
27 | 27 | |
28 | 28 | public function addBadge($caption, $leftSeparator=" ") { |
29 | - return $this->element->addBadge($caption,$leftSeparator); |
|
29 | + return $this->element->addBadge($caption, $leftSeparator); |
|
30 | 30 | } |
31 | 31 | |
32 | 32 | public function addLabel($caption, $style="label-default", $leftSeparator=" ") { |
33 | - return $this->element->addLabel($caption,$style,$leftSeparator); |
|
33 | + return $this->element->addLabel($caption, $style, $leftSeparator); |
|
34 | 34 | } |
35 | 35 | |
36 | 36 | public function run(JsUtils $js) { |
@@ -149,7 +149,7 @@ |
||
149 | 149 | $glyph->setGlyphicon($glyphicon); |
150 | 150 | if ($left) { |
151 | 151 | $this->content=$glyph->compile().$separator.$this->content; |
152 | - } else { |
|
152 | + }else { |
|
153 | 153 | $this->content.=$separator.$glyph->compile(); |
154 | 154 | } |
155 | 155 | return $this; |
@@ -27,7 +27,7 @@ discard block |
||
27 | 27 | parent::__construct($identifier); |
28 | 28 | $this->tagName="ul"; |
29 | 29 | $this->_template='<%tagName% class="nav navbar-nav %class%">%elements%</%tagName%>'; |
30 | - $this->elements=array (); |
|
30 | + $this->elements=array(); |
|
31 | 31 | } |
32 | 32 | |
33 | 33 | public function setClass($value) { |
@@ -35,13 +35,13 @@ discard block |
||
35 | 35 | } |
36 | 36 | |
37 | 37 | public function addElement($element) { |
38 | - if($element instanceof HtmlLink){ |
|
38 | + if ($element instanceof HtmlLink) { |
|
39 | 39 | $this->addLink($element); |
40 | - } else if (is_object($element)) { |
|
40 | + }else if (is_object($element)) { |
|
41 | 41 | $this->elements []=$element; |
42 | - } else if (is_array($element)) { |
|
42 | + }else if (is_array($element)) { |
|
43 | 43 | $this->addLink(array_pop($element), array_pop($element)); |
44 | - } else { |
|
44 | + }else { |
|
45 | 45 | $this->addLink($element); |
46 | 46 | } |
47 | 47 | } |
@@ -55,7 +55,7 @@ discard block |
||
55 | 55 | |
56 | 56 | public function addElements($elements) { |
57 | 57 | if (is_array($elements)) { |
58 | - foreach ( $elements as $key => $element ) { |
|
58 | + foreach ($elements as $key => $element) { |
|
59 | 59 | $iid=$this->getElementsCount()+1; |
60 | 60 | if ($element instanceof HtmlDropdownItem) |
61 | 61 | $this->elements []=$element; |
@@ -66,12 +66,12 @@ discard block |
||
66 | 66 | $dropdown->setBtnCaption($key); |
67 | 67 | $dropdown->setMTagName("li"); |
68 | 68 | $this->addElement($dropdown); |
69 | - } else { |
|
69 | + }else { |
|
70 | 70 | $this->addLink(array_pop($element), array_pop($element)); |
71 | 71 | } |
72 | - } else if (is_object($element)) { |
|
72 | + }else if (is_object($element)) { |
|
73 | 73 | $this->addElement($element); |
74 | - } else if (is_string($element)) { |
|
74 | + }else if (is_string($element)) { |
|
75 | 75 | $this->addLink($element); |
76 | 76 | } |
77 | 77 | // TODO A vérifier |
@@ -83,9 +83,9 @@ discard block |
||
83 | 83 | public function addLink($caption, $href="#") { |
84 | 84 | $iid=$this->getElementsCount()+1; |
85 | 85 | $li=new HtmlDoubleElement($this->identifier."-li-".$iid, "li"); |
86 | - if($caption instanceof HtmlLink){ |
|
86 | + if ($caption instanceof HtmlLink) { |
|
87 | 87 | $link=$caption; |
88 | - }else{ |
|
88 | + }else { |
|
89 | 89 | $link=new HtmlLink($this->identifier."-link-".$iid, $href, $caption); |
90 | 90 | } |
91 | 91 | $li->setContent($link); |
@@ -113,7 +113,7 @@ discard block |
||
113 | 113 | } |
114 | 114 | |
115 | 115 | public function run(JsUtils $js) { |
116 | - foreach ( $this->elements as $element ) { |
|
116 | + foreach ($this->elements as $element) { |
|
117 | 117 | $element->run($js); |
118 | 118 | } |
119 | 119 | } |
@@ -134,7 +134,7 @@ discard block |
||
134 | 134 | * @param int $index |
135 | 135 | * @return BaseHtml |
136 | 136 | */ |
137 | - public function getElement($index){ |
|
137 | + public function getElement($index) { |
|
138 | 138 | return $this->elements[$index]; |
139 | 139 | } |
140 | 140 | } |
141 | 141 | \ No newline at end of file |
@@ -57,9 +57,9 @@ discard block |
||
57 | 57 | if (is_array($elements)) { |
58 | 58 | foreach ( $elements as $key => $element ) { |
59 | 59 | $iid=$this->getElementsCount()+1; |
60 | - if ($element instanceof HtmlDropdownItem) |
|
61 | - $this->elements []=$element; |
|
62 | - else if (is_array($element)) { |
|
60 | + if ($element instanceof HtmlDropdownItem) { |
|
61 | + $this->elements []=$element; |
|
62 | + } else if (is_array($element)) { |
|
63 | 63 | if (is_string($key)===true) { |
64 | 64 | $dropdown=new HtmlDropdown($this->identifier."-dropdown-".$iid); |
65 | 65 | $dropdown->addItems($element); |
@@ -85,7 +85,7 @@ discard block |
||
85 | 85 | $li=new HtmlDoubleElement($this->identifier."-li-".$iid, "li"); |
86 | 86 | if($caption instanceof HtmlLink){ |
87 | 87 | $link=$caption; |
88 | - }else{ |
|
88 | + } else{ |
|
89 | 89 | $link=new HtmlLink($this->identifier."-link-".$iid, $href, $caption); |
90 | 90 | } |
91 | 91 | $li->setContent($link); |
@@ -14,7 +14,7 @@ |
||
14 | 14 | public function __construct($identifier, $tagName="div") { |
15 | 15 | parent::__construct($identifier, $tagName); |
16 | 16 | $this->setProperty("class", "tab-content"); |
17 | - $this->content=array (); // HtmlTabContentItem |
|
17 | + $this->content=array(); // HtmlTabContentItem |
|
18 | 18 | } |
19 | 19 | |
20 | 20 | public function addTabItem($identifier) { |
@@ -23,8 +23,9 @@ |
||
23 | 23 | } |
24 | 24 | |
25 | 25 | public function getTabItem($index) { |
26 | - if ($index<sizeof($this->content)) |
|
27 | - return $this->content [$index]; |
|
26 | + if ($index<sizeof($this->content)) { |
|
27 | + return $this->content [$index]; |
|
28 | + } |
|
28 | 29 | } |
29 | 30 | |
30 | 31 | public function getTabItems() { |
@@ -62,15 +62,15 @@ |
||
62 | 62 | */ |
63 | 63 | public function setIdentifier($identifier) { |
64 | 64 | parent::setIdentifier($identifier); |
65 | - if($this->content instanceof HtmlLink){ |
|
65 | + if ($this->content instanceof HtmlLink) { |
|
66 | 66 | $this->content->setIdentifier("link-".$identifier); |
67 | 67 | } |
68 | 68 | } |
69 | - public function setActive($value=true){ |
|
70 | - $this->setProperty("class", ($value)?"active":""); |
|
69 | + public function setActive($value=true) { |
|
70 | + $this->setProperty("class", ($value) ? "active" : ""); |
|
71 | 71 | } |
72 | 72 | |
73 | - public function disable(){ |
|
73 | + public function disable() { |
|
74 | 74 | $this->setProperty("class", "disabled"); |
75 | 75 | } |
76 | 76 | } |
77 | 77 | \ No newline at end of file |
@@ -1,10 +1,10 @@ |
||
1 | 1 | <?php |
2 | 2 | namespace Ajax\bootstrap\html\html5; |
3 | 3 | /** |
4 | - * HTML Select |
|
5 | - * @author jc |
|
6 | - * @version 1.002 |
|
7 | - */ |
|
4 | + * HTML Select |
|
5 | + * @author jc |
|
6 | + * @version 1.002 |
|
7 | + */ |
|
8 | 8 | use Ajax\bootstrap\html\base\HtmlDoubleElement; |
9 | 9 | |
10 | 10 | class HtmlOption extends HtmlDoubleElement { |
@@ -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 |
@@ -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 | } |
@@ -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 | } |
@@ -29,7 +29,7 @@ discard block |
||
29 | 29 | |
30 | 30 | public function compile(JsUtils $js=NULL, View $view=NULL) { |
31 | 31 | $result=""; |
32 | - foreach ( $this->_elements as $element ) { |
|
32 | + foreach ($this->_elements as $element) { |
|
33 | 33 | if ($element instanceof PhBsElement) |
34 | 34 | $result.=$element->compile($js, $view); |
35 | 35 | } |
@@ -37,7 +37,7 @@ discard block |
||
37 | 37 | } |
38 | 38 | |
39 | 39 | public function run(JsUtils $js) { |
40 | - foreach ( $this->_elements as $element ) { |
|
40 | + foreach ($this->_elements as $element) { |
|
41 | 41 | if ($element instanceof PhBsElement) |
42 | 42 | $element->run($js); |
43 | 43 | } |
@@ -30,16 +30,18 @@ |
||
30 | 30 | public function compile(JsUtils $js=NULL, View $view=NULL) { |
31 | 31 | $result=""; |
32 | 32 | foreach ( $this->_elements as $element ) { |
33 | - if ($element instanceof PhBsElement) |
|
34 | - $result.=$element->compile($js, $view); |
|
33 | + if ($element instanceof PhBsElement) { |
|
34 | + $result.=$element->compile($js, $view); |
|
35 | + } |
|
35 | 36 | } |
36 | 37 | return $result; |
37 | 38 | } |
38 | 39 | |
39 | 40 | public function run(JsUtils $js) { |
40 | 41 | foreach ( $this->_elements as $element ) { |
41 | - if ($element instanceof PhBsElement) |
|
42 | - $element->run($js); |
|
42 | + if ($element instanceof PhBsElement) { |
|
43 | + $element->run($js); |
|
44 | + } |
|
43 | 45 | } |
44 | 46 | } |
45 | 47 | } |
46 | 48 | \ No newline at end of file |