@@ -49,8 +49,9 @@ discard block |
||
| 49 | 49 | } |
| 50 | 50 | |
| 51 | 51 | public function setStyle($value) { |
| 52 | - foreach ( $this->elements as $element ) |
|
| 53 | - $element->setStyle($value); |
|
| 52 | + foreach ( $this->elements as $element ) { |
|
| 53 | + $element->setStyle($value); |
|
| 54 | + } |
|
| 54 | 55 | } |
| 55 | 56 | |
| 56 | 57 | private function dropdownAsButton($bt) { |
@@ -75,16 +76,18 @@ discard block |
||
| 75 | 76 | } elseif ($element instanceof HtmlButton) { |
| 76 | 77 | $this->elements[]=$element; |
| 77 | 78 | } elseif (\is_array($element)) { |
| 78 | - if (array_key_exists("glyph", $element)) |
|
| 79 | - $bt=new HtmlGlyphButton($this->identifier."-button-".$iid); |
|
| 80 | - elseif (array_key_exists("btnCaption", $element)) { |
|
| 81 | - if (array_key_exists("split", $element)) |
|
| 82 | - $bt=new HtmlSplitbutton($this->identifier."-dropdown-".$iid); |
|
| 83 | - else |
|
| 84 | - $bt=new HtmlDropdown($this->identifier."-dropdown-".$iid); |
|
| 79 | + if (array_key_exists("glyph", $element)) { |
|
| 80 | + $bt=new HtmlGlyphButton($this->identifier."-button-".$iid); |
|
| 81 | + } elseif (array_key_exists("btnCaption", $element)) { |
|
| 82 | + if (array_key_exists("split", $element)) { |
|
| 83 | + $bt=new HtmlSplitbutton($this->identifier."-dropdown-".$iid); |
|
| 84 | + } else { |
|
| 85 | + $bt=new HtmlDropdown($this->identifier."-dropdown-".$iid); |
|
| 86 | + } |
|
| 85 | 87 | $this->dropdownAsButton($bt); |
| 86 | - } else |
|
| 87 | - $bt=new HtmlButton($this->identifier."-button-".$iid); |
|
| 88 | + } else { |
|
| 89 | + $bt=new HtmlButton($this->identifier."-button-".$iid); |
|
| 90 | + } |
|
| 88 | 91 | $bt->fromArray($element); |
| 89 | 92 | $this->elements[]=$bt; |
| 90 | 93 | $result=$bt; |
@@ -115,8 +118,9 @@ discard block |
||
| 115 | 118 | public function setAlignment($value) { |
| 116 | 119 | if (is_int($value)) { |
| 117 | 120 | $value=CssRef::alignment("btn-group")[$value]; |
| 118 | - } else |
|
| 119 | - $value="btn-group-".$value; |
|
| 121 | + } else { |
|
| 122 | + $value="btn-group-".$value; |
|
| 123 | + } |
|
| 120 | 124 | if (strstr($value, "justified")) { |
| 121 | 125 | foreach ( $this->elements as $element ) { |
| 122 | 126 | $element->wrap('<div class="btn-group" role="group">', '</div>'); |
@@ -131,9 +135,9 @@ discard block |
||
| 131 | 135 | * @return HtmlButton |
| 132 | 136 | */ |
| 133 | 137 | public function getElement($index) { |
| 134 | - if (is_int($index)) |
|
| 135 | - return $this->elements[$index]; |
|
| 136 | - else { |
|
| 138 | + if (is_int($index)) { |
|
| 139 | + return $this->elements[$index]; |
|
| 140 | + } else { |
|
| 137 | 141 | $elm=$this->getElementById($index, $this->elements); |
| 138 | 142 | return $elm; |
| 139 | 143 | } |
@@ -65,9 +65,9 @@ discard block |
||
| 65 | 65 | if(\is_array($element)){ |
| 66 | 66 | $elm=new HtmlLink("lnk-".$this->identifier."-".$size); |
| 67 | 67 | $elm->fromArray($element); |
| 68 | - }else if($element instanceof HtmlLink){ |
|
| 68 | + } else if($element instanceof HtmlLink){ |
|
| 69 | 69 | $elm=$element; |
| 70 | - }else{ |
|
| 70 | + } else{ |
|
| 71 | 71 | $elm=new HtmlLink("lnk-".$this->identifier."-".$size,$href,$element); |
| 72 | 72 | if(isset($glyph)){ |
| 73 | 73 | $elm->wrapContentWithGlyph($glyph); |
@@ -114,7 +114,7 @@ discard block |
||
| 114 | 114 | } |
| 115 | 115 | if($this->absolutePaths===true){ |
| 116 | 116 | return $this->_hrefFunction($this->content[$index]); |
| 117 | - }else{ |
|
| 117 | + } else{ |
|
| 118 | 118 | return $this->root.implode($separator, array_slice(array_map(function($e){return $this->_hrefFunction($e);}, $this->content),$this->startIndex,$index+1)); |
| 119 | 119 | } |
| 120 | 120 | } |
@@ -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); |
@@ -13,7 +13,7 @@ |
||
| 13 | 13 | if(isset($router)){ |
| 14 | 14 | try { |
| 15 | 15 | $url=$router->generate($url); |
| 16 | - }catch (\Exception $e){ |
|
| 16 | + } catch (\Exception $e){ |
|
| 17 | 17 | return $router->getContext()->getBaseUrl(); |
| 18 | 18 | } |
| 19 | 19 | } |
@@ -51,14 +51,15 @@ |
||
| 51 | 51 | foreach ($values as $v){ |
| 52 | 52 | $form->addField($v); |
| 53 | 53 | } |
| 54 | - }else{ |
|
| 54 | + } else{ |
|
| 55 | 55 | $separators[]=$count; |
| 56 | 56 | for($i=0;$i<$size;$i++){ |
| 57 | 57 | $fields=\array_slice($values, $separators[$i]+1,$separators[$i+1]-$separators[$i]); |
| 58 | 58 | if(\sizeof($fields)===1){ |
| 59 | 59 | $form->addField($fields[0]); |
| 60 | - }else |
|
| 61 | - $form->addFields($fields); |
|
| 60 | + } else { |
|
| 61 | + $form->addFields($fields); |
|
| 62 | + } |
|
| 62 | 63 | } |
| 63 | 64 | } |
| 64 | 65 | } |
@@ -56,8 +56,9 @@ discard block |
||
| 56 | 56 | $name=$attributes["name"]; |
| 57 | 57 | } |
| 58 | 58 | $element=$elementCallback($this->_getFieldIdentifier($prefix),$name,$value,""); |
| 59 | - if(\is_array($attributes)) |
|
| 60 | - $this->_applyAttributes($element, $attributes,$index); |
|
| 59 | + if(\is_array($attributes)) { |
|
| 60 | + $this->_applyAttributes($element, $attributes,$index); |
|
| 61 | + } |
|
| 61 | 62 | $element->setDisabled(!$this->_edition); |
| 62 | 63 | return $element; |
| 63 | 64 | }); |
@@ -92,8 +93,9 @@ discard block |
||
| 92 | 93 | public function fieldAsHeader($index,$niveau=1,$icon=NULL,$attributes=NULL){ |
| 93 | 94 | return $this->_fieldAs(function($id,$name,$value) use($niveau,$icon){ |
| 94 | 95 | $header=new HtmlHeader($id,$niveau,$value); |
| 95 | - if(isset($icon)) |
|
| 96 | - $header->asIcon($icon, $value); |
|
| 96 | + if(isset($icon)) { |
|
| 97 | + $header->asIcon($icon, $value); |
|
| 98 | + } |
|
| 97 | 99 | return $header; |
| 98 | 100 | }, $index,$attributes,"header"); |
| 99 | 101 | } |
@@ -101,7 +103,9 @@ discard block |
||
| 101 | 103 | |
| 102 | 104 | public function fieldAsImage($index,$size=Size::MINI,$circular=false){ |
| 103 | 105 | $this->setValueFunction($index,function($img) use($size,$circular){ |
| 104 | - $image=new HtmlImage($this->_getFieldIdentifier("image"),$img);$image->setSize($size);if($circular)$image->setCircular(); |
|
| 106 | + $image=new HtmlImage($this->_getFieldIdentifier("image"),$img);$image->setSize($size);if($circular) { |
|
| 107 | + $image->setCircular(); |
|
| 108 | + } |
|
| 105 | 109 | return $image; |
| 106 | 110 | }); |
| 107 | 111 | return $this; |
@@ -47,8 +47,9 @@ discard block |
||
| 47 | 47 | $actionO=$action; |
| 48 | 48 | if (\is_object($action) === false) { |
| 49 | 49 | $actionO=new HtmlButton("action-" . $this->identifier, $action); |
| 50 | - if (isset($icon)) |
|
| 51 | - $actionO->addIcon($icon, true, $labeled); |
|
| 50 | + if (isset($icon)) { |
|
| 51 | + $actionO->addIcon($icon, true, $labeled); |
|
| 52 | + } |
|
| 52 | 53 | } |
| 53 | 54 | $field->addToProperty("class", $direction . " action"); |
| 54 | 55 | $field->addContent($actionO, \strstr($direction, Direction::LEFT) !== false); |
@@ -82,8 +83,9 @@ discard block |
||
| 82 | 83 | |
| 83 | 84 | public function setDisabled($disable=true) { |
| 84 | 85 | $field=$this->getField(); |
| 85 | - if($disable) |
|
| 86 | - $field->addToProperty("class", "disabled"); |
|
| 86 | + if($disable) { |
|
| 87 | + $field->addToProperty("class", "disabled"); |
|
| 88 | + } |
|
| 87 | 89 | return $this; |
| 88 | 90 | } |
| 89 | 91 | } |
| 90 | 92 | \ No newline at end of file |
@@ -49,8 +49,9 @@ discard block |
||
| 49 | 49 | |
| 50 | 50 | public function getDataField(){ |
| 51 | 51 | $field= $this->getField(); |
| 52 | - if($field instanceof AbstractCheckbox) |
|
| 53 | - $field=$field->getField(); |
|
| 52 | + if($field instanceof AbstractCheckbox) { |
|
| 53 | + $field=$field->getField(); |
|
| 54 | + } |
|
| 54 | 55 | return $field; |
| 55 | 56 | } |
| 56 | 57 | |
@@ -62,7 +63,7 @@ discard block |
||
| 62 | 63 | public function setChecked($value=true){ |
| 63 | 64 | if($value===true){ |
| 64 | 65 | $this->getDataField()->setProperty("checked", "checked"); |
| 65 | - }else{ |
|
| 66 | + } else{ |
|
| 66 | 67 | $this->getDataField()->removeProperty("checked"); |
| 67 | 68 | } |
| 68 | 69 | return $this; |
@@ -18,8 +18,9 @@ discard block |
||
| 18 | 18 | parent::__construct($identifier, "div","field"); |
| 19 | 19 | $this->content=array(); |
| 20 | 20 | $this->_states=[State::ERROR,State::DISABLED]; |
| 21 | - if(isset($label)) |
|
| 22 | - $this->setLabel($label); |
|
| 21 | + if(isset($label)) { |
|
| 22 | + $this->setLabel($label); |
|
| 23 | + } |
|
| 23 | 24 | $this->setField($field); |
| 24 | 25 | $this->_validation=NULL; |
| 25 | 26 | } |
@@ -50,8 +51,9 @@ discard block |
||
| 50 | 51 | * @return mixed |
| 51 | 52 | */ |
| 52 | 53 | public function getLabel(){ |
| 53 | - if(\array_key_exists("label", $this->content)) |
|
| 54 | - return $this->content["label"]; |
|
| 54 | + if(\array_key_exists("label", $this->content)) { |
|
| 55 | + return $this->content["label"]; |
|
| 56 | + } |
|
| 55 | 57 | } |
| 56 | 58 | |
| 57 | 59 | /** |