@@ -64,8 +64,9 @@ |
||
64 | 64 | } |
65 | 65 | |
66 | 66 | public static function doubleBackSlashes($value){ |
67 | - if(is_string($value)) |
|
68 | - return str_replace("\\", "\\\\", $value); |
|
67 | + if(is_string($value)) { |
|
68 | + return str_replace("\\", "\\\\", $value); |
|
69 | + } |
|
69 | 70 | return $value; |
70 | 71 | } |
71 | 72 |
@@ -59,8 +59,9 @@ |
||
59 | 59 | $callback.=$js->trigger("#".$id." [name='selection[]']","change",false)."$('#".$id." tbody .ui.checkbox').checkbox();".$js->execOn("change", "#".$id." [name='selection[]']", $this->_getCheckedChange($js)); |
60 | 60 | $callback.=$this->_generatePaginationScript($id); |
61 | 61 | if(isset($this->_urls["refresh"])){ |
62 | - if(isset($menu)) |
|
63 | - $js->jsonArrayOn("click", "#".$menu->getIdentifier()." a","#".$this->_identifier." tr.".$this->_modelClass, $this->_urls["refresh"],"post",["params"=>"{'p':$(this).attr('data-page'),'_model':'".JString::doubleBackSlashes($this->_model)."'}","jsCallback"=>$callback]); |
|
62 | + if(isset($menu)) { |
|
63 | + $js->jsonArrayOn("click", "#".$menu->getIdentifier()." a","#".$this->_identifier." tr.".$this->_modelClass, $this->_urls["refresh"],"post",["params"=>"{'p':$(this).attr('data-page'),'_model':'".JString::doubleBackSlashes($this->_model)."'}","jsCallback"=>$callback]); |
|
64 | + } |
|
64 | 65 | } |
65 | 66 | } |
66 | 67 |
@@ -26,8 +26,9 @@ discard block |
||
26 | 26 | */ |
27 | 27 | public function __construct($identifier, $tagName="tbody", $rowCount=NULL, $colCount=NULL) { |
28 | 28 | parent::__construct($identifier, $tagName, ""); |
29 | - if (isset($rowCount) && isset($colCount)) |
|
30 | - $this->setRowCount($rowCount, $colCount); |
|
29 | + if (isset($rowCount) && isset($colCount)) { |
|
30 | + $this->setRowCount($rowCount, $colCount); |
|
31 | + } |
|
31 | 32 | } |
32 | 33 | |
33 | 34 | /** |
@@ -112,7 +113,7 @@ discard block |
||
112 | 113 | $row=$this->getItem($row); |
113 | 114 | if (isset($row) && $row instanceof HtmlCollection) { |
114 | 115 | $col=$row->getItem($col); |
115 | - }else{ |
|
116 | + } else{ |
|
116 | 117 | $col=$row; |
117 | 118 | } |
118 | 119 | return $col; |
@@ -170,8 +171,9 @@ discard block |
||
170 | 171 | $values=\array_fill(0, $count, $values); |
171 | 172 | $isArray=false; |
172 | 173 | } |
173 | - if (JArray::dimension($values) == 1 && $isArray) |
|
174 | - $values=[ $values ]; |
|
174 | + if (JArray::dimension($values) == 1 && $isArray) { |
|
175 | + $values=[ $values ]; |
|
176 | + } |
|
175 | 177 | |
176 | 178 | $count=\min(\sizeof($values), $count); |
177 | 179 | |
@@ -198,8 +200,9 @@ discard block |
||
198 | 200 | $count=$this->count(); |
199 | 201 | for($i=0; $i < $count; $i++) { |
200 | 202 | $cell=$this->getCell($i, $colIndex); |
201 | - if($cell instanceof BaseTrait) |
|
202 | - $cell->addVariations($variations); |
|
203 | + if($cell instanceof BaseTrait) { |
|
204 | + $cell->addVariations($variations); |
|
205 | + } |
|
203 | 206 | } |
204 | 207 | return $this; |
205 | 208 | } |
@@ -208,8 +211,9 @@ discard block |
||
208 | 211 | $count=$this->count(); |
209 | 212 | for($i=0; $i < $count; $i++) { |
210 | 213 | $cell=$this->getCell($i, $colIndex); |
211 | - if(isset($cell)) |
|
212 | - $cell->addToProperty($name,$value); |
|
214 | + if(isset($cell)) { |
|
215 | + $cell->addToProperty($name,$value); |
|
216 | + } |
|
213 | 217 | } |
214 | 218 | return $this; |
215 | 219 | } |
@@ -227,8 +231,9 @@ discard block |
||
227 | 231 | $count=$this->count(); |
228 | 232 | for($i=0; $i < $count; $i++) { |
229 | 233 | $index=$this->content[$i]->getColPosition($colIndex); |
230 | - if ($index !== NULL) |
|
231 | - $this->getCell($i, $index)->$function(); |
|
234 | + if ($index !== NULL) { |
|
235 | + $this->getCell($i, $index)->$function(); |
|
236 | + } |
|
232 | 237 | } |
233 | 238 | return $this; |
234 | 239 | } |
@@ -239,8 +244,9 @@ discard block |
||
239 | 244 | $maxRow=$this->content[$i]->count(); |
240 | 245 | $index=$maxRow-$colIndex-1; |
241 | 246 | if (($cell=$this->getCell($i, $index))!== NULL){ |
242 | - if($cell->getColspan()==1) |
|
243 | - $cell->$function(); |
|
247 | + if($cell->getColspan()==1) { |
|
248 | + $cell->$function(); |
|
249 | + } |
|
244 | 250 | } |
245 | 251 | } |
246 | 252 | return $this; |
@@ -284,8 +290,9 @@ discard block |
||
284 | 290 | */ |
285 | 291 | public function getColCount() { |
286 | 292 | $result=0; |
287 | - if ($this->count() > 0) |
|
288 | - $result=$this->getItem(0)->count(); |
|
293 | + if ($this->count() > 0) { |
|
294 | + $result=$this->getItem(0)->count(); |
|
295 | + } |
|
289 | 296 | return $result; |
290 | 297 | } |
291 | 298 | |
@@ -309,8 +316,9 @@ discard block |
||
309 | 316 | |
310 | 317 | public function toDelete($rowIndex, $colIndex){ |
311 | 318 | $row=$this->getItem($rowIndex); |
312 | - if (isset($row) === true) |
|
313 | - $row->toDelete($colIndex); |
|
319 | + if (isset($row) === true) { |
|
320 | + $row->toDelete($colIndex); |
|
321 | + } |
|
314 | 322 | return $this; |
315 | 323 | } |
316 | 324 | |
@@ -408,8 +416,9 @@ discard block |
||
408 | 416 | foreach ( $rows as $row ) { |
409 | 417 | $cell=$row->getItem($colIndex); |
410 | 418 | $value=$cell->getContent(); |
411 | - if($functionExists) |
|
412 | - $value=\call_user_func($function,$value); |
|
419 | + if($functionExists) { |
|
420 | + $value=\call_user_func($function,$value); |
|
421 | + } |
|
413 | 422 | if($value!==$identiqual){ |
414 | 423 | if($counter>0 && isset($cellToMerge)){ |
415 | 424 | $cellToMerge->setRowspan($counter); |
@@ -32,15 +32,17 @@ discard block |
||
32 | 32 | |
33 | 33 | public function addContent($content,$before=false) { |
34 | 34 | if (!\is_array($this->content)) { |
35 | - if(isset($this->content)) |
|
36 | - $this->content=array ($this->content); |
|
37 | - else |
|
38 | - $this->content=array(); |
|
35 | + if(isset($this->content)) { |
|
36 | + $this->content=array ($this->content); |
|
37 | + } else { |
|
38 | + $this->content=array(); |
|
39 | + } |
|
40 | + } |
|
41 | + if($before) { |
|
42 | + array_unshift($this->content,$content); |
|
43 | + } else { |
|
44 | + $this->content []=$content; |
|
39 | 45 | } |
40 | - if($before) |
|
41 | - array_unshift($this->content,$content); |
|
42 | - else |
|
43 | - $this->content []=$content; |
|
44 | 46 | return $this; |
45 | 47 | } |
46 | 48 | |
@@ -78,9 +80,9 @@ discard block |
||
78 | 80 | $instances=[]; |
79 | 81 | if($content instanceof $class){ |
80 | 82 | $instances[]=$content; |
81 | - }elseif($content instanceof HtmlDoubleElement){ |
|
83 | + } elseif($content instanceof HtmlDoubleElement){ |
|
82 | 84 | $instances=\array_merge($instances,$content->getContentInstances($class)); |
83 | - }elseif (\is_array($content)){ |
|
85 | + } elseif (\is_array($content)){ |
|
84 | 86 | foreach ($content as $element){ |
85 | 87 | $instances=\array_merge($instances,$this->_getContentInstances($class, $element)); |
86 | 88 | } |
@@ -93,10 +95,12 @@ discard block |
||
93 | 95 | * @return HtmlDoubleElement |
94 | 96 | */ |
95 | 97 | public function asLink($href=NULL,$target=NULL) { |
96 | - if (isset($href)) |
|
97 | - $this->setProperty("href", $href); |
|
98 | - if(isset($target)) |
|
99 | - $this->setProperty("target", $target); |
|
98 | + if (isset($href)) { |
|
99 | + $this->setProperty("href", $href); |
|
100 | + } |
|
101 | + if(isset($target)) { |
|
102 | + $this->setProperty("target", $target); |
|
103 | + } |
|
100 | 104 | return $this->setTagName("a"); |
101 | 105 | } |
102 | 106 | |
@@ -121,7 +125,7 @@ discard block |
||
121 | 125 | $this->_editableContent=$frm; |
122 | 126 | $keypress=""; |
123 | 127 | $focusOut=""; |
124 | - }else{ |
|
128 | + } else{ |
|
125 | 129 | $focusOut="if(e.relatedTarget==null)elm.trigger('endEdit');"; |
126 | 130 | $this->_editableContent=$field; |
127 | 131 | $keypress="$('#".$idF."').keyup(function(e){if(e.which == 13) {\$('#".$idE."').trigger('validate',{value: $('#'+idF+' input').val()});}if(e.keyCode===27) {\$('#".$idE."').trigger('endEdit');}});"; |
@@ -64,7 +64,7 @@ discard block |
||
64 | 64 | $this->_generateFields($form, [$v], $headers, $i, $wrappers,$nb++); |
65 | 65 | $i++; |
66 | 66 | } |
67 | - }else{ |
|
67 | + } else{ |
|
68 | 68 | $separators[]=$count; |
69 | 69 | for($i=0;$i<$size;$i++){ |
70 | 70 | $fields=\array_slice($values, $separators[$i]+1,$separators[$i+1]-$separators[$i]); |
@@ -78,17 +78,19 @@ discard block |
||
78 | 78 | |
79 | 79 | protected function _generateFields($form,$values,$headers,$sepFirst,$wrappers,$nb){ |
80 | 80 | $wrapper=null; |
81 | - if(isset($headers[$sepFirst+1])) |
|
82 | - $form->addHeader($headers[$sepFirst+1],4,true); |
|
81 | + if(isset($headers[$sepFirst+1])) { |
|
82 | + $form->addHeader($headers[$sepFirst+1],4,true); |
|
83 | + } |
|
83 | 84 | if(isset($wrappers[$sepFirst+1])){ |
84 | 85 | $wrapper=$wrappers[$sepFirst+1]; |
85 | 86 | } |
86 | 87 | if(\sizeof($values)===1){ |
87 | 88 | $added=$form->addField($values[0]); |
88 | - }elseif(\sizeof($values)>1){ |
|
89 | + } elseif(\sizeof($values)>1){ |
|
89 | 90 | $added=$form->addFields($values); |
90 | - }else |
|
91 | - return; |
|
91 | + } else { |
|
92 | + return; |
|
93 | + } |
|
92 | 94 | if(isset($wrapper)){ |
93 | 95 | $added->wrap($wrapper[0],$wrapper[1]); |
94 | 96 | } |
@@ -79,8 +79,9 @@ discard block |
||
79 | 79 | $actionO=$action; |
80 | 80 | if (\is_object($action) === false) { |
81 | 81 | $actionO=new HtmlButton("action-" . $this->identifier, $action); |
82 | - if (isset($icon)) |
|
83 | - $actionO->addIcon($icon, true, $labeled); |
|
82 | + if (isset($icon)) { |
|
83 | + $actionO->addIcon($icon, true, $labeled); |
|
84 | + } |
|
84 | 85 | } |
85 | 86 | $field->addToProperty("class", $direction . " action"); |
86 | 87 | $field->addContent($actionO, \strstr($direction, Direction::LEFT) !== false); |
@@ -120,8 +121,9 @@ discard block |
||
120 | 121 | |
121 | 122 | public function setDisabled($disable=true) { |
122 | 123 | $field=$this->getField(); |
123 | - if($disable) |
|
124 | - $field->addToProperty("class", "disabled"); |
|
124 | + if($disable) { |
|
125 | + $field->addToProperty("class", "disabled"); |
|
126 | + } |
|
125 | 127 | return $this; |
126 | 128 | } |
127 | 129 |
@@ -29,11 +29,12 @@ discard block |
||
29 | 29 | if(\is_array($value)){ |
30 | 30 | $itemO=new HtmlFormInput(JArray::getDefaultValue($value, "id",""),JArray::getDefaultValue($value, "label",null),JArray::getDefaultValue($value, "type", "text"),JArray::getDefaultValue($value, "value",""),JArray::getDefaultValue($value, "placeholder",JArray::getDefaultValue($value, "label",null))); |
31 | 31 | return $itemO; |
32 | - }elseif(\is_object($value)){ |
|
32 | + } elseif(\is_object($value)){ |
|
33 | 33 | $itemO=new HtmlFormField("field-".$this->identifier, $value); |
34 | 34 | return $itemO; |
35 | - }else |
|
36 | - return new HtmlFormInput($value); |
|
35 | + } else { |
|
36 | + return new HtmlFormInput($value); |
|
37 | + } |
|
37 | 38 | } |
38 | 39 | |
39 | 40 | protected function createCondition($value){ |
@@ -67,8 +68,7 @@ discard block |
||
67 | 68 | if(isset($c)){ |
68 | 69 | $df=$c->getDataField(); |
69 | 70 | $df->setProperty($property,$value); |
70 | - } |
|
71 | - else{ |
|
71 | + } else{ |
|
72 | 72 | return $this; |
73 | 73 | } |
74 | 74 | } |
@@ -163,10 +163,12 @@ discard block |
||
163 | 163 | public function addButtonIcon($identifier,$icon,$cssStyle=NULL,$onClick=NULL){ |
164 | 164 | $bt=new HtmlButton($identifier); |
165 | 165 | $bt->asIcon($icon); |
166 | - if(isset($onClick)) |
|
167 | - $bt->onClick($onClick); |
|
168 | - if (isset($cssStyle)) |
|
169 | - $bt->addClass($cssStyle); |
|
166 | + if(isset($onClick)) { |
|
167 | + $bt->onClick($onClick); |
|
168 | + } |
|
169 | + if (isset($cssStyle)) { |
|
170 | + $bt->addClass($cssStyle); |
|
171 | + } |
|
170 | 172 | return $this->addItem($bt); |
171 | 173 | } |
172 | 174 |
@@ -35,8 +35,9 @@ |
||
35 | 35 | */ |
36 | 36 | public function htmlMessage($identifier, $content="",$styles=NULL) { |
37 | 37 | $msg= $this->addHtmlComponent(new HtmlMessage($identifier, $content)); |
38 | - if(isset($msg) && $styles!==null) |
|
39 | - $msg->setStyle($styles); |
|
38 | + if(isset($msg) && $styles!==null) { |
|
39 | + $msg->setStyle($styles); |
|
40 | + } |
|
40 | 41 | return $msg; |
41 | 42 | } |
42 | 43 |
@@ -58,8 +58,9 @@ discard block |
||
58 | 58 | */ |
59 | 59 | public function addHeader($title, $niveau=1, $dividing=true) { |
60 | 60 | $header=new HtmlHeader("", $niveau, $title); |
61 | - if ($dividing) |
|
62 | - $header->setDividing(); |
|
61 | + if ($dividing) { |
|
62 | + $header->setDividing(); |
|
63 | + } |
|
63 | 64 | return $this->addItem($header); |
64 | 65 | } |
65 | 66 | |
@@ -87,8 +88,9 @@ discard block |
||
87 | 88 | if (\is_string($end)) { |
88 | 89 | $label=$end; |
89 | 90 | \array_pop($fields); |
90 | - } else |
|
91 | - $label=NULL; |
|
91 | + } else { |
|
92 | + $label=NULL; |
|
93 | + } |
|
92 | 94 | } |
93 | 95 | $this->_fields=\array_merge($this->_fields, $fields); |
94 | 96 | $fields=new HtmlFormFields("fields-" . $this->identifier . "-" . $this->count(), $fields); |
@@ -152,27 +154,31 @@ discard block |
||
152 | 154 | */ |
153 | 155 | public function addMessage($identifier, $content, $header=NULL, $icon=NULL, $type=NULL) { |
154 | 156 | $message=new HtmlMessage($identifier, $content); |
155 | - if (isset($header)) |
|
156 | - $message->addHeader($header); |
|
157 | - if (isset($icon)) |
|
158 | - $message->setIcon($icon); |
|
159 | - if (isset($type)) |
|
160 | - $message->setStyle($type); |
|
157 | + if (isset($header)) { |
|
158 | + $message->addHeader($header); |
|
159 | + } |
|
160 | + if (isset($icon)) { |
|
161 | + $message->setIcon($icon); |
|
162 | + } |
|
163 | + if (isset($type)) { |
|
164 | + $message->setStyle($type); |
|
165 | + } |
|
161 | 166 | return $this->addItem($message); |
162 | 167 | } |
163 | 168 | |
164 | 169 | |
165 | 170 | |
166 | 171 | public function compile(JsUtils $js=NULL,&$view=NULL){ |
167 | - if(\sizeof($this->_validationParams)>0) |
|
168 | - $this->setProperty("novalidate", ""); |
|
172 | + if(\sizeof($this->_validationParams)>0) { |
|
173 | + $this->setProperty("novalidate", ""); |
|
174 | + } |
|
169 | 175 | return parent::compile($js,$view); |
170 | 176 | } |
171 | 177 | |
172 | 178 | public function run(JsUtils $js) { |
173 | 179 | if(isset($js)){ |
174 | 180 | $compo=$js->semantic()->form("#".$this->identifier); |
175 | - }else{ |
|
181 | + } else{ |
|
176 | 182 | $compo=new Form(); |
177 | 183 | $compo->attach("#".$this->identifier); |
178 | 184 | } |
@@ -185,8 +191,9 @@ discard block |
||
185 | 191 | if($field instanceof HtmlFormFields){ |
186 | 192 | $items=$field->getItems(); |
187 | 193 | foreach ($items as $_field){ |
188 | - if($_field instanceof HtmlFormField) |
|
189 | - $this->addCompoValidation($compo, $_field); |
|
194 | + if($_field instanceof HtmlFormField) { |
|
195 | + $this->addCompoValidation($compo, $_field); |
|
196 | + } |
|
190 | 197 | } |
191 | 198 | } |
192 | 199 | } |