@@ -35,17 +35,19 @@ discard block |
||
35 | 35 | |
36 | 36 | public function addContent($content, $before = false) { |
37 | 37 | if (! \is_array($this->content)) { |
38 | - if (isset($this->content)) |
|
39 | - $this->content = array( |
|
38 | + if (isset($this->content)) { |
|
39 | + $this->content = array( |
|
40 | 40 | $this->content |
41 | 41 | ); |
42 | - else |
|
43 | - $this->content = array(); |
|
42 | + } else { |
|
43 | + $this->content = array(); |
|
44 | + } |
|
45 | + } |
|
46 | + if ($before) { |
|
47 | + \array_unshift($this->content, $content); |
|
48 | + } else { |
|
49 | + $this->content[] = $content; |
|
44 | 50 | } |
45 | - if ($before) |
|
46 | - \array_unshift($this->content, $content); |
|
47 | - else |
|
48 | - $this->content[] = $content; |
|
49 | 51 | return $this; |
50 | 52 | } |
51 | 53 | |
@@ -108,10 +110,12 @@ discard block |
||
108 | 110 | * @return HtmlDoubleElement |
109 | 111 | */ |
110 | 112 | public function asLink($href = NULL, $target = NULL) { |
111 | - if (isset($href)) |
|
112 | - $this->setProperty("href", $href); |
|
113 | - if (isset($target)) |
|
114 | - $this->setProperty("target", $target); |
|
113 | + if (isset($href)) { |
|
114 | + $this->setProperty("href", $href); |
|
115 | + } |
|
116 | + if (isset($target)) { |
|
117 | + $this->setProperty("target", $target); |
|
118 | + } |
|
115 | 119 | return $this->setTagName("a"); |
116 | 120 | } |
117 | 121 |
@@ -73,8 +73,9 @@ discard block |
||
73 | 73 | $retour .= $this->_getOnAjaxDone($responseElement, $jqueryDone, $ajaxTransition, $jsCallback, $hasLoader, ($historize ? $originalSelector : null)) . "});\n"; |
74 | 74 | |
75 | 75 | $retour = $this->_addJsCondition($jsCondition, $retour); |
76 | - if ($immediatly) |
|
77 | - $this->jquery_code_for_compile[] = $retour; |
|
76 | + if ($immediatly) { |
|
77 | + $this->jquery_code_for_compile[] = $retour; |
|
78 | + } |
|
78 | 79 | return $retour; |
79 | 80 | } |
80 | 81 | |
@@ -157,10 +158,11 @@ discard block |
||
157 | 158 | } elseif (isset($this->ajaxTransition)) { |
158 | 159 | $call = $this->ajaxTransition; |
159 | 160 | } |
160 | - if (\is_callable($call)) |
|
161 | - $retour = "\t" . $call($responseElement, $jqueryDone) . ";\n"; |
|
162 | - else |
|
163 | - $retour = "\t{$responseElement}.{$jqueryDone}( data );\n"; |
|
161 | + if (\is_callable($call)) { |
|
162 | + $retour = "\t" . $call($responseElement, $jqueryDone) . ";\n"; |
|
163 | + } else { |
|
164 | + $retour = "\t{$responseElement}.{$jqueryDone}( data );\n"; |
|
165 | + } |
|
164 | 166 | } |
165 | 167 | if (isset($history)) { |
166 | 168 | if ($this->params["autoActiveLinks"]) { |
@@ -194,8 +196,9 @@ discard block |
||
194 | 196 | } |
195 | 197 | |
196 | 198 | protected function _correctAjaxUrl($url) { |
197 | - if ($url !== "/" && JString::endsWith($url, "/") === true) |
|
198 | - $url = substr($url, 0, strlen($url) - 1); |
|
199 | + if ($url !== "/" && JString::endsWith($url, "/") === true) { |
|
200 | + $url = substr($url, 0, strlen($url) - 1); |
|
201 | + } |
|
199 | 202 | if (strncmp($url, 'http://', 7) != 0 && strncmp($url, 'https://', 8) != 0) { |
200 | 203 | $url = $this->getUrl($url); |
201 | 204 | } |
@@ -219,8 +222,9 @@ discard block |
||
219 | 222 | public static function _implodeParams($parameters) { |
220 | 223 | $allParameters = []; |
221 | 224 | foreach ($parameters as $params) { |
222 | - if (isset($params)) |
|
223 | - $allParameters[] = self::_correctParams($params); |
|
225 | + if (isset($params)) { |
|
226 | + $allParameters[] = self::_correctParams($params); |
|
227 | + } |
|
224 | 228 | } |
225 | 229 | return \implode("+'&'+", $allParameters); |
226 | 230 | } |
@@ -254,8 +258,9 @@ discard block |
||
254 | 258 | |
255 | 259 | protected function setDefaultParameters(&$parameters, $default) { |
256 | 260 | foreach ($default as $k => $v) { |
257 | - if (! isset($parameters[$k])) |
|
258 | - $parameters[$k] = $v; |
|
261 | + if (! isset($parameters[$k])) { |
|
262 | + $parameters[$k] = $v; |
|
263 | + } |
|
259 | 264 | } |
260 | 265 | } |
261 | 266 | |
@@ -820,8 +825,9 @@ discard block |
||
820 | 825 | $retour .= "$('#'+" . $form . ").submit();\n"; |
821 | 826 | } |
822 | 827 | $retour = $this->_addJsCondition($jsCondition, $retour); |
823 | - if ($immediatly) |
|
824 | - $this->jquery_code_for_compile[] = $retour; |
|
828 | + if ($immediatly) { |
|
829 | + $this->jquery_code_for_compile[] = $retour; |
|
830 | + } |
|
825 | 831 | return $retour; |
826 | 832 | } |
827 | 833 |
@@ -71,7 +71,7 @@ discard block |
||
71 | 71 | $this->_generateFields($form, [$v], $headers, $i, $wrappers,$nb++,$names[$k]??''); |
72 | 72 | $i++; |
73 | 73 | } |
74 | - }else{ |
|
74 | + } else{ |
|
75 | 75 | $separators[]=$count; |
76 | 76 | for($i=0;$i<$size;$i++){ |
77 | 77 | $fields=\array_slice($values, $separators[$i]+1,$separators[$i+1]-$separators[$i]); |
@@ -85,18 +85,20 @@ discard block |
||
85 | 85 | |
86 | 86 | protected function _generateFields($form, $values, $headers, $sepFirst, $wrappers, $nb, $name){ |
87 | 87 | $wrapper=null; |
88 | - if(isset($headers[$sepFirst+1])) |
|
89 | - $form->addHeader($headers[$sepFirst+1],4,true); |
|
88 | + if(isset($headers[$sepFirst+1])) { |
|
89 | + $form->addHeader($headers[$sepFirst+1],4,true); |
|
90 | + } |
|
90 | 91 | if(isset($wrappers[$sepFirst+1])){ |
91 | 92 | $wrapper=$wrappers[$sepFirst+1]; |
92 | 93 | } |
93 | 94 | $count=\count($values); |
94 | 95 | if($count===1){ |
95 | 96 | $added=$form->addField($values[0]); |
96 | - }elseif($count>1){ |
|
97 | + } elseif($count>1){ |
|
97 | 98 | $added=$form->addFields($values); |
98 | - }else |
|
99 | - return; |
|
99 | + } else { |
|
100 | + return; |
|
101 | + } |
|
100 | 102 | if(isset($wrapper)){ |
101 | 103 | $added->wrap($wrapper[0],$wrapper[1]); |
102 | 104 | } |
@@ -66,8 +66,9 @@ |
||
66 | 66 | $actionO = $action; |
67 | 67 | if (\is_object($action) === false) { |
68 | 68 | $actionO = new HtmlButton("action-" . $this->identifier, $action); |
69 | - if (isset($icon)) |
|
70 | - $actionO->addIcon($icon, true, $labeled); |
|
69 | + if (isset($icon)) { |
|
70 | + $actionO->addIcon($icon, true, $labeled); |
|
71 | + } |
|
71 | 72 | } |
72 | 73 | $this->addContent($actionO, \strstr($direction, Direction::LEFT) !== false); |
73 | 74 | return $actionO; |
@@ -66,8 +66,9 @@ |
||
66 | 66 | |
67 | 67 | protected function setDivider($divider, $index) { |
68 | 68 | if (isset($index)) { |
69 | - if (! \is_array($this->_contentSeparator)) |
|
70 | - $this->_contentSeparator = array_fill(0, $this->count() - 1, $this->_contentSeparator); |
|
69 | + if (! \is_array($this->_contentSeparator)) { |
|
70 | + $this->_contentSeparator = array_fill(0, $this->count() - 1, $this->_contentSeparator); |
|
71 | + } |
|
71 | 72 | $this->_contentSeparator[$index] = $divider; |
72 | 73 | } else { |
73 | 74 | $this->_contentSeparator = $divider; |
@@ -85,8 +85,9 @@ discard block |
||
85 | 85 | $class = 'cancel'; |
86 | 86 | } |
87 | 87 | $action = new HtmlButton('action-' . $this->identifier . '-' . JArray::count($this->content['actions']->getContent()), $action); |
88 | - if ($class !== '') |
|
89 | - $action->addToProperty('class', $class); |
|
88 | + if ($class !== '') { |
|
89 | + $action->addToProperty('class', $class); |
|
90 | + } |
|
90 | 91 | } |
91 | 92 | return $this->addElementInPart($action, 'actions'); |
92 | 93 | } |
@@ -214,8 +215,9 @@ discard block |
||
214 | 215 | * @see BaseHtml::run() |
215 | 216 | */ |
216 | 217 | public function run(JsUtils $js) { |
217 | - if (isset($this->_bsComponent) === false) |
|
218 | - $this->_bsComponent = $js->semantic()->modal('#' . $this->identifier, $this->_params, $this->_paramParts); |
|
218 | + if (isset($this->_bsComponent) === false) { |
|
219 | + $this->_bsComponent = $js->semantic()->modal('#' . $this->identifier, $this->_params, $this->_paramParts); |
|
220 | + } |
|
219 | 221 | $this->addEventsOnRun($js); |
220 | 222 | return $this->_bsComponent; |
221 | 223 | } |
@@ -86,16 +86,19 @@ discard block |
||
86 | 86 | "stopPropagation" => true |
87 | 87 | ]); |
88 | 88 | } |
89 | - if (\is_array($this->_deleteBehavior)) |
|
90 | - $this->_generateBehavior("delete", $this->_deleteBehavior, $js); |
|
91 | - if (\is_array($this->_editBehavior)) |
|
92 | - $this->_generateBehavior("edit", $this->_editBehavior, $js); |
|
89 | + if (\is_array($this->_deleteBehavior)) { |
|
90 | + $this->_generateBehavior("delete", $this->_deleteBehavior, $js); |
|
91 | + } |
|
92 | + if (\is_array($this->_editBehavior)) { |
|
93 | + $this->_generateBehavior("edit", $this->_editBehavior, $js); |
|
94 | + } |
|
93 | 95 | if (\is_array($this->_displayBehavior)) { |
94 | 96 | $this->_generateBehavior("display", $this->_displayBehavior, $js); |
95 | 97 | } |
96 | 98 | parent::run($js); |
97 | - if (isset($this->_pagination)) |
|
98 | - $this->_associatePaginationBehavior($js, $offset); |
|
99 | + if (isset($this->_pagination)) { |
|
100 | + $this->_associatePaginationBehavior($js, $offset); |
|
101 | + } |
|
99 | 102 | $this->_associateSearchFieldBehavior($js, $offset); |
100 | 103 | $this->_runned = true; |
101 | 104 | } |
@@ -146,8 +149,9 @@ discard block |
||
146 | 149 | $table->setRowCount(0, \count($captions)); |
147 | 150 | $this->_generateHeader($table, $captions); |
148 | 151 | |
149 | - if (isset($this->_compileParts)) |
|
150 | - $table->setCompileParts($this->_compileParts); |
|
152 | + if (isset($this->_compileParts)) { |
|
153 | + $table->setCompileParts($this->_compileParts); |
|
154 | + } |
|
151 | 155 | |
152 | 156 | $this->_generateContent($table); |
153 | 157 | |
@@ -182,8 +186,9 @@ discard block |
||
182 | 186 | } |
183 | 187 | |
184 | 188 | protected function _applyStyleAttributes($table) { |
185 | - if (isset($this->_hiddenColumns)) |
|
186 | - $this->_hideColumns(); |
|
189 | + if (isset($this->_hiddenColumns)) { |
|
190 | + $this->_hideColumns(); |
|
191 | + } |
|
187 | 192 | if (isset($this->_colWidths)) { |
188 | 193 | foreach ($this->_colWidths as $colIndex => $width) { |
189 | 194 | $table->setColWidth($colIndex, $width); |
@@ -296,8 +301,9 @@ discard block |
||
296 | 301 | $field = $ck->getField(); |
297 | 302 | $field->setProperty("value", $dataAjax); |
298 | 303 | $field->setProperty("name", "selection[]"); |
299 | - if (isset($checkedClass)) |
|
300 | - $field->setClass($checkedClass); |
|
304 | + if (isset($checkedClass)) { |
|
305 | + $field->setClass($checkedClass); |
|
306 | + } |
|
301 | 307 | \array_unshift($values, $ck); |
302 | 308 | } |
303 | 309 | $result = $table->newRow(); |
@@ -314,8 +320,9 @@ discard block |
||
314 | 320 | |
315 | 321 | protected function _generatePagination($table) { |
316 | 322 | if (isset($this->_toolbar)) { |
317 | - if ($this->_toolbarPosition == PositionInTable::FOOTER) |
|
318 | - $this->_toolbar->setFloated("left"); |
|
323 | + if ($this->_toolbarPosition == PositionInTable::FOOTER) { |
|
324 | + $this->_toolbar->setFloated("left"); |
|
325 | + } |
|
319 | 326 | } |
320 | 327 | $footer = $table->getFooter(); |
321 | 328 | $footer->mergeCol(); |
@@ -356,8 +363,9 @@ discard block |
||
356 | 363 | |
357 | 364 | protected function _getFieldName($index) { |
358 | 365 | $fieldName = parent::_getFieldName($index); |
359 | - if (\is_object($fieldName)) |
|
360 | - $fieldName = "field-" . $index; |
|
366 | + if (\is_object($fieldName)) { |
|
367 | + $fieldName = "field-" . $index; |
|
368 | + } |
|
361 | 369 | return $fieldName . "[]"; |
362 | 370 | } |
363 | 371 | |
@@ -546,8 +554,9 @@ discard block |
||
546 | 554 | |
547 | 555 | protected function getTargetSelector($op) { |
548 | 556 | $result = $this->_targetSelector; |
549 | - if (! isset($result[$op])) |
|
550 | - $result = "#" . $this->identifier; |
|
557 | + if (! isset($result[$op])) { |
|
558 | + $result = "#" . $this->identifier; |
|
559 | + } |
|
551 | 560 | return $result[$op]; |
552 | 561 | } |
553 | 562 | |
@@ -570,8 +579,9 @@ discard block |
||
570 | 579 | } |
571 | 580 | |
572 | 581 | public function getRefreshSelector() { |
573 | - if (isset($this->_refreshSelector)) |
|
574 | - return $this->_refreshSelector; |
|
582 | + if (isset($this->_refreshSelector)) { |
|
583 | + return $this->_refreshSelector; |
|
584 | + } |
|
575 | 585 | return "#" . $this->identifier . " tbody"; |
576 | 586 | } |
577 | 587 | |
@@ -592,8 +602,9 @@ discard block |
||
592 | 602 | */ |
593 | 603 | public function show($modelInstance) { |
594 | 604 | if (\is_array($modelInstance)) { |
595 | - if (isset($modelInstance[0]) && \is_array(array_values($modelInstance)[0])) |
|
596 | - $modelInstance = \json_decode(\json_encode($modelInstance), FALSE); |
|
605 | + if (isset($modelInstance[0]) && \is_array(array_values($modelInstance)[0])) { |
|
606 | + $modelInstance = \json_decode(\json_encode($modelInstance), FALSE); |
|
607 | + } |
|
597 | 608 | } |
598 | 609 | $this->_modelInstance = $modelInstance; |
599 | 610 | } |
@@ -639,8 +650,9 @@ discard block |
||
639 | 650 | } |
640 | 651 | |
641 | 652 | public function hideColumn($colIndex) { |
642 | - if (! \is_array($this->_hiddenColumns)) |
|
643 | - $this->_hiddenColumns = []; |
|
653 | + if (! \is_array($this->_hiddenColumns)) { |
|
654 | + $this->_hiddenColumns = []; |
|
655 | + } |
|
644 | 656 | $this->_hiddenColumns[] = $colIndex; |
645 | 657 | return $this; |
646 | 658 | } |