@@ -3,7 +3,6 @@ |
||
3 | 3 | |
4 | 4 | use Ajax\bootstrap\html\base\CssSize; |
5 | 5 | use Ajax\JsUtils; |
6 | - |
|
7 | 6 | use Ajax\bootstrap\html\base\HtmlBsDoubleElement; |
8 | 7 | |
9 | 8 | /** |
@@ -43,7 +43,7 @@ discard block |
||
43 | 43 | $result=null; |
44 | 44 | if($index<sizeof($this->cols)+1){ |
45 | 45 | $result=$this->cols[$index-1]; |
46 | - }else if ($force){ |
|
46 | + } else if ($force){ |
|
47 | 47 | $result=$this->addColAt(CssSize::SIZE_MD,1,$index); |
48 | 48 | } |
49 | 49 | return $result; |
@@ -96,7 +96,7 @@ discard block |
||
96 | 96 | $this->cols = array_values($this->cols); |
97 | 97 | $width=$width-$widthCol; |
98 | 98 | } |
99 | - }else{ |
|
99 | + } else{ |
|
100 | 100 | $width=0; |
101 | 101 | } |
102 | 102 | } |
@@ -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 |
@@ -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); |
@@ -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"); |
@@ -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; |
@@ -11,7 +11,6 @@ |
||
11 | 11 | use Ajax\bootstrap\components\Tab; |
12 | 12 | use Ajax\bootstrap\components\Carousel; |
13 | 13 | use Ajax\bootstrap\components\Collapse; |
14 | -use Ajax\Bootstrap; |
|
15 | 14 | use Ajax\common\components\SimpleComponent; |
16 | 15 | |
17 | 16 | trait BootstrapComponentsTrait { |
@@ -4,7 +4,6 @@ |
||
4 | 4 | |
5 | 5 | use Ajax\common\html\HtmlDoubleElement; |
6 | 6 | use Ajax\service\JArray; |
7 | -use Ajax\JsUtils; |
|
8 | 7 | |
9 | 8 | /** |
10 | 9 | * Base class for Html collections |
@@ -23,7 +23,7 @@ discard block |
||
23 | 23 | foreach ($items as $k=>$v){ |
24 | 24 | $this->addItem([$k,$v]); |
25 | 25 | } |
26 | - }else{ |
|
26 | + } else{ |
|
27 | 27 | foreach ($items as $item){ |
28 | 28 | $this->addItem($item); |
29 | 29 | } |
@@ -71,9 +71,9 @@ discard block |
||
71 | 71 | * @return \Ajax\common\html\HtmlDoubleElement |
72 | 72 | */ |
73 | 73 | public function getItem($index) { |
74 | - if (is_int($index)) |
|
75 | - return $this->content[$index]; |
|
76 | - else { |
|
74 | + if (is_int($index)) { |
|
75 | + return $this->content[$index]; |
|
76 | + } else { |
|
77 | 77 | $elm=$this->getElementById($index, $this->content); |
78 | 78 | return $elm; |
79 | 79 | } |
@@ -3,8 +3,6 @@ |
||
3 | 3 | namespace Ajax\common\traits; |
4 | 4 | |
5 | 5 | use Ajax\service\JString; |
6 | -use Ajax\service\PhalconUtils; |
|
7 | -use Symfony\Component\Config\Definition\Exception\Exception; |
|
8 | 6 | trait JqueryAjaxTrait { |
9 | 7 | |
10 | 8 | protected $ajaxLoader='<span></span><span></span><span></span><span></span><span></span>'; |
@@ -41,8 +41,9 @@ discard block |
||
41 | 41 | } |
42 | 42 | $retour.="$.".$method."(url,".$params.").done(function( data ) {\n"; |
43 | 43 | $retour.=$this->_getOnAjaxDone($responseElement, $jsCallback)."});\n"; |
44 | - if ($immediatly) |
|
45 | - $this->jquery_code_for_compile[]=$retour; |
|
44 | + if ($immediatly) { |
|
45 | + $this->jquery_code_for_compile[]=$retour; |
|
46 | + } |
|
46 | 47 | return $retour; |
47 | 48 | } |
48 | 49 | |
@@ -50,13 +51,15 @@ discard block |
||
50 | 51 | $url=$this->_correctAjaxUrl($url); |
51 | 52 | $retour="url='".$url."';\n"; |
52 | 53 | $slash="/"; |
53 | - if(JString::endswith($url, "/")===true) |
|
54 | - $slash=""; |
|
54 | + if(JString::endswith($url, "/")===true) { |
|
55 | + $slash=""; |
|
56 | + } |
|
55 | 57 | if(JString::isNotNull($attr)){ |
56 | - if ($attr=="value") |
|
57 | - $retour.="url=url+'".$slash."'+$(this).val();\n"; |
|
58 | - else if($attr!=null && $attr!=="") |
|
59 | - $retour.="url=url+'".$slash."'+($(this).attr('".$attr."')||'');\n"; |
|
58 | + if ($attr=="value") { |
|
59 | + $retour.="url=url+'".$slash."'+$(this).val();\n"; |
|
60 | + } else if($attr!=null && $attr!=="") { |
|
61 | + $retour.="url=url+'".$slash."'+($(this).attr('".$attr."')||'');\n"; |
|
62 | + } |
|
60 | 63 | } |
61 | 64 | return $retour; |
62 | 65 | } |
@@ -78,8 +81,9 @@ discard block |
||
78 | 81 | } |
79 | 82 | |
80 | 83 | protected function _correctAjaxUrl($url) { |
81 | - if ($url!=="/" && JString::endsWith($url, "/")===true) |
|
82 | - $url=substr($url, 0, strlen($url)-1); |
|
84 | + if ($url!=="/" && JString::endsWith($url, "/")===true) { |
|
85 | + $url=substr($url, 0, strlen($url)-1); |
|
86 | + } |
|
83 | 87 | if (strncmp($url, 'http://', 7)!=0&&strncmp($url, 'https://', 8)!=0) { |
84 | 88 | $url=$this->jsUtils->getUrl($url); |
85 | 89 | } |
@@ -103,8 +107,9 @@ discard block |
||
103 | 107 | $retour.="\t".$jsCallback."\n". |
104 | 108 | "\t$(document).trigger('jsonReady',[data]);\n". |
105 | 109 | "});\n"; |
106 | - if ($immediatly) |
|
107 | - $this->jquery_code_for_compile[]=$retour; |
|
110 | + if ($immediatly) { |
|
111 | + $this->jquery_code_for_compile[]=$retour; |
|
112 | + } |
|
108 | 113 | return $retour; |
109 | 114 | } |
110 | 115 | |
@@ -143,7 +148,7 @@ discard block |
||
143 | 148 | if($context===null){ |
144 | 149 | $appendTo="\t\tnewElm.appendTo($('".$maskSelector."').parent());\n"; |
145 | 150 | $newElm = "$('#'+newId)"; |
146 | - }else{ |
|
151 | + } else{ |
|
147 | 152 | $appendTo="\t\tnewElm.appendTo(".$context.");\n"; |
148 | 153 | $newElm = $context.".find('#'+newId)"; |
149 | 154 | } |
@@ -153,8 +158,9 @@ discard block |
||
153 | 158 | $retour.="\t}\n"."\tfor(var key in value){\n"."\t\t\tvar html = $('<div />').append($(newElm).clone()).html();\n"."\t\t\tif(html.indexOf('[['+key+']]')>-1){\n"."\t\t\t\tcontent=$(html.split('[['+key+']]').join(value[key]));\n"."\t\t\t\t$(newElm).replaceWith(content);newElm=content;\n"."\t\t\t}\n"."\t\tvar sel='[data-id=\"'+key+'\"]';if($(sel,newElm).length){\n"."\t\t\tvar selElm=$(sel,newElm);\n"."\t\t\t if(selElm.is('[value]')) { selElm.attr('value',value[key]);selElm.val(value[key]);} else { selElm.html(value[key]); }\n"."\t\t}\n"."}\n"."\t$(newElm).show(true);"."\n"."\t$(newElm).removeClass('hide');"."});\n"; |
154 | 159 | $retour.="\t$(document).trigger('jsonReady',[data]);\n"; |
155 | 160 | $retour.="\t".$jsCallback."\n"."});\n"; |
156 | - if ($immediatly) |
|
157 | - $this->jquery_code_for_compile[]=$retour; |
|
161 | + if ($immediatly) { |
|
162 | + $this->jquery_code_for_compile[]=$retour; |
|
163 | + } |
|
158 | 164 | return $retour; |
159 | 165 | } |
160 | 166 | /** |
@@ -195,8 +201,9 @@ discard block |
||
195 | 201 | }});\n"; |
196 | 202 | $retour.="$('#".$form."').submit();\n"; |
197 | 203 | } |
198 | - if ($immediatly) |
|
199 | - $this->jquery_code_for_compile[]=$retour; |
|
204 | + if ($immediatly) { |
|
205 | + $this->jquery_code_for_compile[]=$retour; |
|
206 | + } |
|
200 | 207 | return $retour; |
201 | 208 | } |
202 | 209 |
@@ -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 | } |
@@ -65,8 +67,9 @@ discard block |
||
65 | 67 | if ($this->_equalWidth) { |
66 | 68 | $count=$this->count(); |
67 | 69 | $this->addToProperty("class", Wide::getConstants()["W".$count]." fields"); |
68 | - } else |
|
69 | - $this->addToProperty("class", "fields"); |
|
70 | + } else { |
|
71 | + $this->addToProperty("class", "fields"); |
|
72 | + } |
|
70 | 73 | return parent::compile($js, $view); |
71 | 74 | } |
72 | 75 | |
@@ -106,8 +109,9 @@ discard block |
||
106 | 109 | $fields[]=$itemO; |
107 | 110 | } |
108 | 111 | $radios=new HtmlFormFields("fields-".$name, $fields); |
109 | - if (isset($label)) |
|
110 | - $radios->setLabel($label)->setProperty("for", $name); |
|
112 | + if (isset($label)) { |
|
113 | + $radios->setLabel($label)->setProperty("for", $name); |
|
114 | + } |
|
111 | 115 | return $radios; |
112 | 116 | } |
113 | 117 | |
@@ -122,8 +126,9 @@ discard block |
||
122 | 126 | $fields[]=$itemO; |
123 | 127 | } |
124 | 128 | $radios=new HtmlFormFields("fields-".$name, $fields); |
125 | - if (isset($label)) |
|
126 | - $radios->setLabel($label)->setProperty("for", $name); |
|
129 | + if (isset($label)) { |
|
130 | + $radios->setLabel($label)->setProperty("for", $name); |
|
131 | + } |
|
127 | 132 | return $radios; |
128 | 133 | } |
129 | 134 |
@@ -4,7 +4,6 @@ |
||
4 | 4 | |
5 | 5 | use Ajax\semantic\html\base\HtmlSemNavElement; |
6 | 6 | use Ajax\semantic\html\base\HtmlSemDoubleElement; |
7 | - |
|
8 | 7 | use Ajax\semantic\html\elements\HtmlIcon; |
9 | 8 | use Ajax\JsUtils; |
10 | 9 |
@@ -181,9 +181,9 @@ |
||
181 | 181 | protected function createItem($value) { |
182 | 182 | $count=$this->count(); |
183 | 183 | $itemO=new HtmlSemDoubleElement("item-" . $this->identifier . "-" . $count, "a", "section"); |
184 | - if (\is_array($value)) |
|
185 | - $itemO->fromArray($value); |
|
186 | - else { |
|
184 | + if (\is_array($value)) { |
|
185 | + $itemO->fromArray($value); |
|
186 | + } else { |
|
187 | 187 | $itemO->setContent($value); |
188 | 188 | } |
189 | 189 | return $itemO; |