@@ -57,7 +57,7 @@ discard block |
||
57 | 57 | $this->setTagName("div"); |
58 | 58 | $this->removeProperty("href"); |
59 | 59 | $this->addToPropertyCtrl("class", "active", array("active")); |
60 | - }else{ |
|
60 | + } else{ |
|
61 | 61 | $this->removePropertyValue("class", "active"); |
62 | 62 | } |
63 | 63 | return $this; |
@@ -65,8 +65,9 @@ discard block |
||
65 | 65 | |
66 | 66 | public function asLink($href=NULL,$part=NULL){ |
67 | 67 | $this->setTagName("a"); |
68 | - if(isset($href)) |
|
69 | - $this->setProperty("href", $href); |
|
68 | + if(isset($href)) { |
|
69 | + $this->setProperty("href", $href); |
|
70 | + } |
|
70 | 71 | return $this; |
71 | 72 | } |
72 | 73 | |
@@ -77,8 +78,9 @@ discard block |
||
77 | 78 | * @see \Ajax\semantic\html\base\HtmlSemDoubleElement::compile() |
78 | 79 | */ |
79 | 80 | public function compile(JsUtils $js=NULL, &$view=NULL) { |
80 | - if(\is_array($this->content)) |
|
81 | - $this->content=JArray::sortAssociative($this->content, [ "icon","image","content" ]); |
|
81 | + if(\is_array($this->content)) { |
|
82 | + $this->content=JArray::sortAssociative($this->content, [ "icon","image","content" ]); |
|
83 | + } |
|
82 | 84 | return parent::compile($js, $view); |
83 | 85 | } |
84 | 86 | } |
85 | 87 | \ No newline at end of file |
@@ -50,8 +50,9 @@ discard block |
||
50 | 50 | } |
51 | 51 | |
52 | 52 | public function getProperty($name) { |
53 | - if (array_key_exists($name, $this->properties)) |
|
54 | - return $this->properties[$name]; |
|
53 | + if (array_key_exists($name, $this->properties)) { |
|
54 | + return $this->properties[$name]; |
|
55 | + } |
|
55 | 56 | } |
56 | 57 | |
57 | 58 | public function addToProperty($name, $value, $separator=" ") { |
@@ -61,10 +62,11 @@ discard block |
||
61 | 62 | } |
62 | 63 | } else if ($value !== "" && $this->propertyContains($name, $value) === false) { |
63 | 64 | $v=@$this->properties[$name]; |
64 | - if (isset($v) && $v !== "") |
|
65 | - $v=$v . $separator . $value; |
|
66 | - else |
|
67 | - $v=$value; |
|
65 | + if (isset($v) && $v !== "") { |
|
66 | + $v=$v . $separator . $value; |
|
67 | + } else { |
|
68 | + $v=$value; |
|
69 | + } |
|
68 | 70 | |
69 | 71 | return $this->setProperty($name, $v); |
70 | 72 | } |
@@ -119,8 +121,9 @@ discard block |
||
119 | 121 | } |
120 | 122 | |
121 | 123 | protected function setPropertyCtrl($name, $value, $typeCtrl) { |
122 | - if ($this->ctrl($name, $value, $typeCtrl) === true) |
|
123 | - return $this->setProperty($name, $value); |
|
124 | + if ($this->ctrl($name, $value, $typeCtrl) === true) { |
|
125 | + return $this->setProperty($name, $value); |
|
126 | + } |
|
124 | 127 | return $this; |
125 | 128 | } |
126 | 129 | |
@@ -150,8 +153,9 @@ discard block |
||
150 | 153 | } |
151 | 154 | |
152 | 155 | public function removeProperty($name) { |
153 | - if (\array_key_exists($name, $this->properties)) |
|
154 | - unset($this->properties[$name]); |
|
156 | + if (\array_key_exists($name, $this->properties)) { |
|
157 | + unset($this->properties[$name]); |
|
158 | + } |
|
155 | 159 | return $this; |
156 | 160 | } |
157 | 161 | |
@@ -171,8 +175,9 @@ discard block |
||
171 | 175 | } |
172 | 176 | |
173 | 177 | protected function addToPropertyUnique($name, $value, $typeCtrl) { |
174 | - if (@class_exists($typeCtrl, true)) |
|
175 | - $typeCtrl=$typeCtrl::getConstants(); |
|
178 | + if (@class_exists($typeCtrl, true)) { |
|
179 | + $typeCtrl=$typeCtrl::getConstants(); |
|
180 | + } |
|
176 | 181 | if (is_array($typeCtrl)) { |
177 | 182 | $this->removeOldValues($this->properties[$name], $typeCtrl); |
178 | 183 | } |
@@ -301,7 +306,7 @@ discard block |
||
301 | 306 | public function onCreate($jsCode){ |
302 | 307 | if(isset($this->_events["_create"])){ |
303 | 308 | $this->_events["_create"][]=$jsCode; |
304 | - }else{ |
|
309 | + } else{ |
|
305 | 310 | $this->_events["_create"]=[$jsCode]; |
306 | 311 | } |
307 | 312 | return $this; |
@@ -313,8 +318,9 @@ discard block |
||
313 | 318 | if(\is_array($create)){ |
314 | 319 | $create=\implode("", $create); |
315 | 320 | } |
316 | - if($create!=="") |
|
317 | - $js->exec($create,true); |
|
321 | + if($create!=="") { |
|
322 | + $js->exec($create,true); |
|
323 | + } |
|
318 | 324 | unset($this->_events["_create"]); |
319 | 325 | } |
320 | 326 | if (isset($this->_bsComponent)) { |
@@ -376,15 +382,18 @@ discard block |
||
376 | 382 | $flag=false; |
377 | 383 | $index=0; |
378 | 384 | while ( !$flag && $index < sizeof($elements) ) { |
379 | - if ($elements[$index] instanceof BaseHtml) |
|
380 | - $flag=($elements[$index]->getIdentifier() === $identifier); |
|
385 | + if ($elements[$index] instanceof BaseHtml) { |
|
386 | + $flag=($elements[$index]->getIdentifier() === $identifier); |
|
387 | + } |
|
381 | 388 | $index++; |
382 | 389 | } |
383 | - if ($flag === true) |
|
384 | - return $elements[$index - 1]; |
|
390 | + if ($flag === true) { |
|
391 | + return $elements[$index - 1]; |
|
392 | + } |
|
385 | 393 | } elseif ($elements instanceof BaseHtml) { |
386 | - if ($elements->getIdentifier() === $identifier) |
|
387 | - return $elements; |
|
394 | + if ($elements->getIdentifier() === $identifier) { |
|
395 | + return $elements; |
|
396 | + } |
|
388 | 397 | } |
389 | 398 | return null; |
390 | 399 | } |
@@ -394,15 +403,18 @@ discard block |
||
394 | 403 | $flag=false; |
395 | 404 | $index=0; |
396 | 405 | while ( !$flag && $index < sizeof($elements) ) { |
397 | - if ($elements[$index] instanceof BaseHtml) |
|
398 | - $flag=($elements[$index]->propertyContains($propertyName, $value) === true); |
|
406 | + if ($elements[$index] instanceof BaseHtml) { |
|
407 | + $flag=($elements[$index]->propertyContains($propertyName, $value) === true); |
|
408 | + } |
|
399 | 409 | $index++; |
400 | 410 | } |
401 | - if ($flag === true) |
|
402 | - return $elements[$index - 1]; |
|
411 | + if ($flag === true) { |
|
412 | + return $elements[$index - 1]; |
|
413 | + } |
|
403 | 414 | } elseif ($elements instanceof BaseHtml) { |
404 | - if ($elements->propertyContains($propertyName, $value) === true) |
|
405 | - return $elements; |
|
415 | + if ($elements->propertyContains($propertyName, $value) === true) { |
|
416 | + return $elements; |
|
417 | + } |
|
406 | 418 | } |
407 | 419 | return null; |
408 | 420 | } |
@@ -31,8 +31,9 @@ |
||
31 | 31 | */ |
32 | 32 | public function htmlMessage($identifier, $content="",$styles=NULL) { |
33 | 33 | $msg= $this->addHtmlComponent(new HtmlMessage($identifier, $content)); |
34 | - if(isset($msg)) |
|
35 | - $msg->setStyle($styles); |
|
34 | + if(isset($msg)) { |
|
35 | + $msg->setStyle($styles); |
|
36 | + } |
|
36 | 37 | return $msg; |
37 | 38 | } |
38 | 39 |
@@ -43,15 +43,16 @@ |
||
43 | 43 | } |
44 | 44 | |
45 | 45 | public function addRule($type,$prompt=NULL,$value=NULL){ |
46 | - if($type instanceof Rule) |
|
47 | - $this->rules[]=$type; |
|
48 | - else if(\is_array($type)){ |
|
46 | + if($type instanceof Rule) { |
|
47 | + $this->rules[]=$type; |
|
48 | + } else if(\is_array($type)){ |
|
49 | 49 | $value=JArray::getValue($type, "value", 2); |
50 | 50 | $prompt=JArray::getValue($type, "prompt", 1); |
51 | 51 | $type=JArray::getValue($type, "type", 0); |
52 | 52 | $this->rules[]=new Rule($type,$prompt,$value); |
53 | - }else |
|
54 | - $this->rules[]=new Rule($type,$prompt,$value); |
|
53 | + } else { |
|
54 | + $this->rules[]=new Rule($type,$prompt,$value); |
|
55 | + } |
|
55 | 56 | } |
56 | 57 | |
57 | 58 | public function jsonSerialize(){ |
@@ -55,10 +55,12 @@ discard block |
||
55 | 55 | |
56 | 56 | public function jsonSerialize() { |
57 | 57 | $result= ["type"=>$this->type]; |
58 | - if(isset($this->prompt)) |
|
59 | - $result["prompt"]=$this->prompt; |
|
60 | - if(isset($this->value)) |
|
61 | - $result["value"]=$this->value; |
|
58 | + if(isset($this->prompt)) { |
|
59 | + $result["prompt"]=$this->prompt; |
|
60 | + } |
|
61 | + if(isset($this->value)) { |
|
62 | + $result["value"]=$this->value; |
|
63 | + } |
|
62 | 64 | return $result; |
63 | 65 | } |
64 | 66 | |
@@ -90,8 +92,9 @@ discard block |
||
90 | 92 | * @return \Ajax\semantic\components\validation\Rule |
91 | 93 | */ |
92 | 94 | public static function integer($min=NULL,$max=NULL,$prompt=NULL){ |
93 | - if(\is_int($min) && \is_int($max)) |
|
94 | - return new Rule("integer[{$min}..{$max}]",$prompt); |
|
95 | + if(\is_int($min) && \is_int($max)) { |
|
96 | + return new Rule("integer[{$min}..{$max}]",$prompt); |
|
97 | + } |
|
95 | 98 | return new Rule("integer",$prompt); |
96 | 99 | } |
97 | 100 |
@@ -47,8 +47,9 @@ discard block |
||
47 | 47 | */ |
48 | 48 | public function addHeader($title, $niveau=1, $dividing=true) { |
49 | 49 | $header=new HtmlHeader("", $niveau, $title); |
50 | - if ($dividing) |
|
51 | - $header->setDividing(); |
|
50 | + if ($dividing) { |
|
51 | + $header->setDividing(); |
|
52 | + } |
|
52 | 53 | return $this->addItem($header); |
53 | 54 | } |
54 | 55 | |
@@ -69,14 +70,16 @@ discard block |
||
69 | 70 | if (\is_string($end)) { |
70 | 71 | $label=$end; |
71 | 72 | \array_pop($fields); |
72 | - } else |
|
73 | - $label=NULL; |
|
73 | + } else { |
|
74 | + $label=NULL; |
|
75 | + } |
|
74 | 76 | } |
75 | 77 | $this->_fields=\array_merge($this->_fields, $fields); |
76 | 78 | $fields=new HtmlFormFields("fields-" . $this->identifier . "-" . $this->count(), $fields); |
77 | 79 | } |
78 | - if (isset($label)) |
|
79 | - $fields=new HtmlFormField("", $fields, $label); |
|
80 | + if (isset($label)) { |
|
81 | + $fields=new HtmlFormField("", $fields, $label); |
|
82 | + } |
|
80 | 83 | } else { |
81 | 84 | $fields=new HtmlFormFields("fields-" . $this->identifier . "-" . $this->count()); |
82 | 85 | } |
@@ -145,12 +148,15 @@ discard block |
||
145 | 148 | */ |
146 | 149 | public function addMessage($identifier, $content, $header=NULL, $icon=NULL, $type=NULL) { |
147 | 150 | $message=new HtmlMessage($identifier, $content); |
148 | - if (isset($header)) |
|
149 | - $message->addHeader($header); |
|
150 | - if (isset($icon)) |
|
151 | - $message->setIcon($icon); |
|
152 | - if (isset($type)) |
|
153 | - $message->setStyle($type); |
|
151 | + if (isset($header)) { |
|
152 | + $message->addHeader($header); |
|
153 | + } |
|
154 | + if (isset($icon)) { |
|
155 | + $message->setIcon($icon); |
|
156 | + } |
|
157 | + if (isset($type)) { |
|
158 | + $message->setStyle($type); |
|
159 | + } |
|
154 | 160 | return $this->addItem($message); |
155 | 161 | } |
156 | 162 | |
@@ -169,15 +175,17 @@ discard block |
||
169 | 175 | public function run(JsUtils $js) { |
170 | 176 | $compo=NULL; |
171 | 177 | foreach ($this->_fields as $field){ |
172 | - if($field instanceof HtmlFormField) |
|
173 | - $compo=$this->addCompoValidation($js, $compo, $field); |
|
178 | + if($field instanceof HtmlFormField) { |
|
179 | + $compo=$this->addCompoValidation($js, $compo, $field); |
|
180 | + } |
|
174 | 181 | } |
175 | 182 | foreach ($this->content as $field){ |
176 | 183 | if($field instanceof HtmlFormFields){ |
177 | 184 | $items=$field->getItems(); |
178 | 185 | foreach ($items as $_field){ |
179 | - if($_field instanceof HtmlFormField) |
|
180 | - $compo=$this->addCompoValidation($js, $compo, $_field); |
|
186 | + if($_field instanceof HtmlFormField) { |
|
187 | + $compo=$this->addCompoValidation($js, $compo, $_field); |
|
188 | + } |
|
181 | 189 | } |
182 | 190 | } |
183 | 191 | } |
@@ -230,8 +238,9 @@ discard block |
||
230 | 238 | |
231 | 239 | public function addSubmit($identifier,$value,$CssStyle=NULL,$url=NULL,$responseElement=NULL){ |
232 | 240 | $bt=$this->addButton($identifier, $value,$CssStyle); |
233 | - if(isset($url) && isset($responseElement)) |
|
234 | - $this->submitOnClick($identifier, $url, $responseElement); |
|
241 | + if(isset($url) && isset($responseElement)) { |
|
242 | + $this->submitOnClick($identifier, $url, $responseElement); |
|
243 | + } |
|
235 | 244 | return $bt; |
236 | 245 | } |
237 | 246 |
@@ -44,8 +44,9 @@ |
||
44 | 44 | $actionO=$action; |
45 | 45 | if (\is_object($action) === false) { |
46 | 46 | $actionO=new HtmlButton("action-" . $this->identifier, $action); |
47 | - if (isset($icon)) |
|
48 | - $actionO->addIcon($icon, true, $labeled); |
|
47 | + if (isset($icon)) { |
|
48 | + $actionO->addIcon($icon, true, $labeled); |
|
49 | + } |
|
49 | 50 | } |
50 | 51 | $this->addToProperty("class", $direction . " action"); |
51 | 52 | $this->addContent($actionO, \strstr($direction, Direction::LEFT) !== false); |
@@ -10,15 +10,17 @@ |
||
10 | 10 | use TextFieldsTrait,FieldTrait; |
11 | 11 | |
12 | 12 | public function __construct($identifier, $label=NULL,$type="text",$value=NULL,$placeholder=NULL) { |
13 | - if(!isset($placeholder) && $type==="text") |
|
14 | - $placeholder=$label; |
|
13 | + if(!isset($placeholder) && $type==="text") { |
|
14 | + $placeholder=$label; |
|
15 | + } |
|
15 | 16 | parent::__construct("field-".$identifier, new HtmlInput($identifier,$type,$value,$placeholder), $label); |
16 | 17 | } |
17 | 18 | |
18 | 19 | public function getDataField(){ |
19 | 20 | $field= $this->getField(); |
20 | - if($field instanceof HtmlInput) |
|
21 | - $field=$field->getField(); |
|
21 | + if($field instanceof HtmlInput) { |
|
22 | + $field=$field->getField(); |
|
23 | + } |
|
22 | 24 | return $field; |
23 | 25 | } |
24 | 26 | } |
25 | 27 | \ No newline at end of file |
@@ -18,11 +18,12 @@ |
||
18 | 18 | if(\is_array($value)){ |
19 | 19 | $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))); |
20 | 20 | return $itemO; |
21 | - }elseif(\is_object($value)){ |
|
21 | + } elseif(\is_object($value)){ |
|
22 | 22 | $itemO=new HtmlFormField("field-".$this->identifier, $value); |
23 | 23 | return $itemO; |
24 | - }else |
|
25 | - return new HtmlFormInput($value); |
|
24 | + } else { |
|
25 | + return new HtmlFormInput($value); |
|
26 | + } |
|
26 | 27 | } |
27 | 28 | |
28 | 29 | protected function createCondition($value){ |