@@ -14,8 +14,9 @@ |
||
| 14 | 14 | class DialogButton extends BaseComponent { |
| 15 | 15 | |
| 16 | 16 | private function addFunction($jsCode) { |
| 17 | - if (! JString::startsWith($jsCode, "function")) |
|
| 18 | - $jsCode = "%function(){" . $jsCode . "}%"; |
|
| 17 | + if (! JString::startsWith($jsCode, "function")) { |
|
| 18 | + $jsCode = "%function(){" . $jsCode . "}%"; |
|
| 19 | + } |
|
| 19 | 20 | return $jsCode; |
| 20 | 21 | } |
| 21 | 22 | |
@@ -84,8 +84,9 @@ |
||
| 84 | 84 | protected function setParamCtrl($key, $value, $typeCtrl) { |
| 85 | 85 | if (! $typeCtrl($value)) { |
| 86 | 86 | throw new \Exception("La fonction " . $typeCtrl . " a retourné faux pour l'affectation de la propriété " . $key . " à la position"); |
| 87 | - } else |
|
| 88 | - $this->setParam($key, $value); |
|
| 87 | + } else { |
|
| 88 | + $this->setParam($key, $value); |
|
| 89 | + } |
|
| 89 | 90 | } |
| 90 | 91 | |
| 91 | 92 | /* |
@@ -49,8 +49,9 @@ discard block |
||
| 49 | 49 | * @param string $popupEvent |
| 50 | 50 | */ |
| 51 | 51 | public function setPopupAttributes($variation = NULL, $popupEvent = NULL) { |
| 52 | - if (isset($this->_popup)) |
|
| 53 | - $this->_popup->setAttributes($variation, $popupEvent); |
|
| 52 | + if (isset($this->_popup)) { |
|
| 53 | + $this->_popup->setAttributes($variation, $popupEvent); |
|
| 54 | + } |
|
| 54 | 55 | } |
| 55 | 56 | |
| 56 | 57 | /** |
@@ -109,8 +110,9 @@ discard block |
||
| 109 | 110 | $labelO = $label; |
| 110 | 111 | if (\is_object($label) === false) { |
| 111 | 112 | $labelO = new HtmlLabel("label-" . $this->identifier, $label); |
| 112 | - if (isset($icon)) |
|
| 113 | - $labelO->addIcon($icon); |
|
| 113 | + if (isset($icon)) { |
|
| 114 | + $labelO->addIcon($icon); |
|
| 115 | + } |
|
| 114 | 116 | } else { |
| 115 | 117 | $labelO->addToPropertyCtrl("class", "label", array( |
| 116 | 118 | "label" |
@@ -141,10 +143,12 @@ discard block |
||
| 141 | 143 | * @return HtmlSemDoubleElement |
| 142 | 144 | */ |
| 143 | 145 | public function asLink($href = NULL, $target = NULL) { |
| 144 | - if (isset($href)) |
|
| 145 | - $this->setProperty("href", $href); |
|
| 146 | - if (isset($target)) |
|
| 147 | - $this->setProperty("target", $target); |
|
| 146 | + if (isset($href)) { |
|
| 147 | + $this->setProperty("href", $href); |
|
| 148 | + } |
|
| 149 | + if (isset($target)) { |
|
| 150 | + $this->setProperty("target", $target); |
|
| 151 | + } |
|
| 148 | 152 | return $this->setTagName("a"); |
| 149 | 153 | } |
| 150 | 154 | |
@@ -156,8 +160,9 @@ discard block |
||
| 156 | 160 | */ |
| 157 | 161 | public function jsShowDimmer($show = true) { |
| 158 | 162 | $status = "hide"; |
| 159 | - if ($show === true) |
|
| 160 | - $status = "show"; |
|
| 163 | + if ($show === true) { |
|
| 164 | + $status = "show"; |
|
| 165 | + } |
|
| 161 | 166 | return '$("#.' . $this->identifier . ').dimmer("' . $status . '");'; |
| 162 | 167 | } |
| 163 | 168 | |
@@ -15,8 +15,9 @@ |
||
| 15 | 15 | } |
| 16 | 16 | |
| 17 | 17 | public function compile(JsUtils $js = null) { |
| 18 | - if ($js === null) |
|
| 19 | - return; |
|
| 18 | + if ($js === null) { |
|
| 19 | + return; |
|
| 20 | + } |
|
| 20 | 21 | $params = "{}"; |
| 21 | 22 | $stopPropagation = true; |
| 22 | 23 | $preventDefault = true; |
@@ -126,8 +126,9 @@ discard block |
||
| 126 | 126 | public function fieldAsLabel($index, $icon = NULL, $attributes = NULL) { |
| 127 | 127 | return $this->_fieldAs(function ($id, $name, $value) use ($icon) { |
| 128 | 128 | $lbl = new HtmlLabel($id, $value); |
| 129 | - if (isset($icon)) |
|
| 130 | - $lbl->addIcon($icon); |
|
| 129 | + if (isset($icon)) { |
|
| 130 | + $lbl->addIcon($icon); |
|
| 131 | + } |
|
| 131 | 132 | return $lbl; |
| 132 | 133 | }, $index, $attributes, "label"); |
| 133 | 134 | } |
@@ -135,8 +136,9 @@ discard block |
||
| 135 | 136 | public function fieldAsHeader($index, $niveau = 1, $icon = NULL, $attributes = NULL) { |
| 136 | 137 | return $this->_fieldAs(function ($id, $name, $value) use ($niveau, $icon) { |
| 137 | 138 | $header = new HtmlHeader($id, $niveau, $value); |
| 138 | - if (isset($icon)) |
|
| 139 | - $header->asIcon($icon, $value); |
|
| 139 | + if (isset($icon)) { |
|
| 140 | + $header->asIcon($icon, $value); |
|
| 141 | + } |
|
| 140 | 142 | return $header; |
| 141 | 143 | }, $index, $attributes, "header"); |
| 142 | 144 | } |
@@ -145,8 +147,9 @@ discard block |
||
| 145 | 147 | $this->setValueFunction($index, function ($img) use ($size, $circular) { |
| 146 | 148 | $image = new HtmlImage($this->_getFieldIdentifier("image"), $img); |
| 147 | 149 | $image->setSize($size); |
| 148 | - if ($circular) |
|
| 149 | - $image->setCircular(); |
|
| 150 | + if ($circular) { |
|
| 151 | + $image->setCircular(); |
|
| 152 | + } |
|
| 150 | 153 | return $image; |
| 151 | 154 | }); |
| 152 | 155 | return $this; |
@@ -251,8 +254,9 @@ discard block |
||
| 251 | 254 | |
| 252 | 255 | public function fieldAsCheckbox($index, $attributes = NULL) { |
| 253 | 256 | return $this->_fieldAs(function ($id, $name, $value, $caption) use ($attributes) { |
| 254 | - if ($caption === null || $caption === "") |
|
| 255 | - $caption = ""; |
|
| 257 | + if ($caption === null || $caption === "") { |
|
| 258 | + $caption = ""; |
|
| 259 | + } |
|
| 256 | 260 | $input = new HtmlFormCheckbox($id, $caption, $this->_instanceViewer->getIdentifier()); |
| 257 | 261 | $input->setChecked(JString::isBooleanTrue($value)); |
| 258 | 262 | return $this->_prepareFormFields($input, $name, $attributes); |
@@ -292,9 +296,9 @@ discard block |
||
| 292 | 296 | $i = 0; |
| 293 | 297 | if (JArray::isAssociative($types)) { |
| 294 | 298 | foreach ($types as $type => $attributes) { |
| 295 | - if (\is_int($type)) |
|
| 296 | - $this->fieldAs($i ++, $attributes, []); |
|
| 297 | - else { |
|
| 299 | + if (\is_int($type)) { |
|
| 300 | + $this->fieldAs($i ++, $attributes, []); |
|
| 301 | + } else { |
|
| 298 | 302 | $type = preg_replace('/\d/', '', $type); |
| 299 | 303 | $this->fieldAs($i ++, $type, $attributes); |
| 300 | 304 | } |
@@ -34,8 +34,9 @@ discard block |
||
| 34 | 34 | $callback = ", function(){\n{$callback}\n}"; |
| 35 | 35 | } |
| 36 | 36 | $str = "$({$element}).{$action}({$speed}{$callback});"; |
| 37 | - if ($immediatly) |
|
| 38 | - $this->jquery_code_for_compile [] = $str; |
|
| 37 | + if ($immediatly) { |
|
| 38 | + $this->jquery_code_for_compile [] = $str; |
|
| 39 | + } |
|
| 39 | 40 | return $str; |
| 40 | 41 | } |
| 41 | 42 | |
@@ -73,10 +74,12 @@ discard block |
||
| 73 | 74 | if (isset ( $param )) { |
| 74 | 75 | $param = Javascript::prep_value ( $param ); |
| 75 | 76 | $str = "$({$element}).{$jQueryCall}({$param});"; |
| 76 | - } else |
|
| 77 | - $str = "$({$element}).{$jQueryCall}();"; |
|
| 78 | - if ($immediatly) |
|
| 79 | - $this->jquery_code_for_compile [] = $str; |
|
| 77 | + } else { |
|
| 78 | + $str = "$({$element}).{$jQueryCall}();"; |
|
| 79 | + } |
|
| 80 | + if ($immediatly) { |
|
| 81 | + $this->jquery_code_for_compile [] = $str; |
|
| 82 | + } |
|
| 80 | 83 | return $str; |
| 81 | 84 | } |
| 82 | 85 | |
@@ -94,8 +97,9 @@ discard block |
||
| 94 | 97 | $to = Javascript::prep_element ( $to ); |
| 95 | 98 | $element = Javascript::prep_element ( $element ); |
| 96 | 99 | $str = "$({$to}).{$jQueryCall}({$element});"; |
| 97 | - if ($immediatly) |
|
| 98 | - $this->jquery_code_for_compile [] = $str; |
|
| 100 | + if ($immediatly) { |
|
| 101 | + $this->jquery_code_for_compile [] = $str; |
|
| 102 | + } |
|
| 99 | 103 | return $str; |
| 100 | 104 | } |
| 101 | 105 | |
@@ -153,10 +157,12 @@ discard block |
||
| 153 | 157 | if (isset ( $value )) { |
| 154 | 158 | $value = Javascript::prep_value ( $value ); |
| 155 | 159 | $str = "$({$element}).attr(\"$attributeName\",{$value});"; |
| 156 | - } else |
|
| 157 | - $str = "$({$element}).attr(\"$attributeName\");"; |
|
| 158 | - if ($immediatly) |
|
| 159 | - $this->jquery_code_for_compile [] = $str; |
|
| 160 | + } else { |
|
| 161 | + $str = "$({$element}).attr(\"$attributeName\");"; |
|
| 162 | + } |
|
| 163 | + if ($immediatly) { |
|
| 164 | + $this->jquery_code_for_compile [] = $str; |
|
| 165 | + } |
|
| 160 | 166 | return $str; |
| 161 | 167 | } |
| 162 | 168 | |
@@ -219,8 +225,9 @@ discard block |
||
| 219 | 225 | |
| 220 | 226 | $str = "$({$element}).animate({\n$animations\n\t\t}" . $speed . $extra . ");"; |
| 221 | 227 | |
| 222 | - if ($immediatly) |
|
| 223 | - $this->jquery_code_for_compile [] = $str; |
|
| 228 | + if ($immediatly) { |
|
| 229 | + $this->jquery_code_for_compile [] = $str; |
|
| 230 | + } |
|
| 224 | 231 | return $str; |
| 225 | 232 | } |
| 226 | 233 | |
@@ -410,8 +417,9 @@ discard block |
||
| 410 | 417 | $element = Javascript::prep_element ( $element ); |
| 411 | 418 | $str = "$({$element}).trigger(\"$event\");"; |
| 412 | 419 | |
| 413 | - if ($immediatly) |
|
| 414 | - $this->jquery_code_for_compile [] = $str; |
|
| 420 | + if ($immediatly) { |
|
| 421 | + $this->jquery_code_for_compile [] = $str; |
|
| 422 | + } |
|
| 415 | 423 | return $str; |
| 416 | 424 | } |
| 417 | 425 | |
@@ -481,8 +489,9 @@ discard block |
||
| 481 | 489 | $str .= "else{" . $jsCodeIfFalse . "}"; |
| 482 | 490 | } |
| 483 | 491 | |
| 484 | - if ($immediatly) |
|
| 485 | - $this->jquery_code_for_compile [] = $str; |
|
| 492 | + if ($immediatly) { |
|
| 493 | + $this->jquery_code_for_compile [] = $str; |
|
| 494 | + } |
|
| 486 | 495 | return $str; |
| 487 | 496 | } |
| 488 | 497 | |
@@ -500,11 +509,13 @@ discard block |
||
| 500 | 509 | private function _doJQuery($element, $jqueryCall, $param = "", $jsCallback = "", $immediatly = false) { |
| 501 | 510 | $param = Javascript::prep_value ( $param ); |
| 502 | 511 | $callback = ""; |
| 503 | - if ($jsCallback != "") |
|
| 504 | - $callback = ", function(event){\n{$jsCallback}\n}"; |
|
| 512 | + if ($jsCallback != "") { |
|
| 513 | + $callback = ", function(event){\n{$jsCallback}\n}"; |
|
| 514 | + } |
|
| 505 | 515 | $script = "$(" . Javascript::prep_element ( $element ) . ")." . $jqueryCall . "(" . $param . $callback . ");\n"; |
| 506 | - if ($immediatly) |
|
| 507 | - $this->jquery_code_for_compile [] = $script; |
|
| 516 | + if ($immediatly) { |
|
| 517 | + $this->jquery_code_for_compile [] = $script; |
|
| 518 | + } |
|
| 508 | 519 | return $script; |
| 509 | 520 | } |
| 510 | 521 | |
@@ -591,8 +602,9 @@ discard block |
||
| 591 | 602 | */ |
| 592 | 603 | public function exec($js, $immediatly = false) { |
| 593 | 604 | $script = $js . "\n"; |
| 594 | - if ($immediatly) |
|
| 595 | - $this->jquery_code_for_compile [] = $script; |
|
| 605 | + if ($immediatly) { |
|
| 606 | + $this->jquery_code_for_compile [] = $script; |
|
| 607 | + } |
|
| 596 | 608 | return $script; |
| 597 | 609 | } |
| 598 | 610 | |
@@ -86,8 +86,9 @@ discard block |
||
| 86 | 86 | if (isset($this->content[$index]) === false) { |
| 87 | 87 | $this->content[$index] = $this->createSegment($index, $content, $menu->getItem($index) |
| 88 | 88 | ->getIdentifier()); |
| 89 | - } else |
|
| 90 | - $this->content[$index]->setContent($content); |
|
| 89 | + } else { |
|
| 90 | + $this->content[$index]->setContent($content); |
|
| 91 | + } |
|
| 91 | 92 | } |
| 92 | 93 | return $this; |
| 93 | 94 | } |
@@ -281,15 +282,17 @@ discard block |
||
| 281 | 282 | * @see BaseHtml::run() |
| 282 | 283 | */ |
| 283 | 284 | public function run(JsUtils $js) { |
| 284 | - if (isset($this->_bsComponent) === false) |
|
| 285 | - $this->_bsComponent = $js->semantic()->tab("#" . $this->identifier . " .item", $this->params); |
|
| 285 | + if (isset($this->_bsComponent) === false) { |
|
| 286 | + $this->_bsComponent = $js->semantic()->tab("#" . $this->identifier . " .item", $this->params); |
|
| 287 | + } |
|
| 286 | 288 | $this->addEventsOnRun($js); |
| 287 | 289 | return $this->_bsComponent; |
| 288 | 290 | } |
| 289 | 291 | |
| 290 | 292 | public function compile(JsUtils $js = NULL, &$view = NULL) { |
| 291 | - if (! $this->_activated && $this->content["menu"]->count() > 0 && \sizeof($this->content) > 1) |
|
| 292 | - $this->activate(0); |
|
| 293 | + if (! $this->_activated && $this->content["menu"]->count() > 0 && \sizeof($this->content) > 1) { |
|
| 294 | + $this->activate(0); |
|
| 295 | + } |
|
| 293 | 296 | return parent::compile($js, $view); |
| 294 | 297 | } |
| 295 | 298 | |
@@ -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 | |
@@ -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 | } |