@@ -25,23 +25,23 @@ discard block |
||
| 25 | 25 | * @property boolean $_edition |
| 26 | 26 | * @property mixed _modelInstance |
| 27 | 27 | */ |
| 28 | -trait FieldAsTrait{ |
|
| 28 | +trait FieldAsTrait { |
|
| 29 | 29 | |
| 30 | - abstract protected function _getFieldIdentifier($prefix,$name=""); |
|
| 31 | - abstract public function setValueFunction($index,$callback); |
|
| 30 | + abstract protected function _getFieldIdentifier($prefix, $name=""); |
|
| 31 | + abstract public function setValueFunction($index, $callback); |
|
| 32 | 32 | abstract protected function _getFieldName($index); |
| 33 | 33 | abstract protected function _getFieldCaption($index); |
| 34 | - abstract protected function _buttonAsSubmit(HtmlButton &$button,$event,$url,$responseElement=NULL,$parameters=NULL); |
|
| 34 | + abstract protected function _buttonAsSubmit(HtmlButton&$button, $event, $url, $responseElement=NULL, $parameters=NULL); |
|
| 35 | 35 | |
| 36 | 36 | /** |
| 37 | 37 | * @param HtmlFormField $element |
| 38 | 38 | * @param array $attributes |
| 39 | 39 | */ |
| 40 | - protected function _applyAttributes($element,&$attributes,$index){ |
|
| 41 | - if(isset($attributes["callback"])){ |
|
| 40 | + protected function _applyAttributes($element, &$attributes, $index) { |
|
| 41 | + if (isset($attributes["callback"])) { |
|
| 42 | 42 | $callback=$attributes["callback"]; |
| 43 | - if(\is_callable($callback)){ |
|
| 44 | - $callback($element,$this->_modelInstance,$index); |
|
| 43 | + if (\is_callable($callback)) { |
|
| 44 | + $callback($element, $this->_modelInstance, $index); |
|
| 45 | 45 | unset($attributes["callback"]); |
| 46 | 46 | } |
| 47 | 47 | } |
@@ -51,43 +51,43 @@ discard block |
||
| 51 | 51 | $element->fromArray($attributes); |
| 52 | 52 | } |
| 53 | 53 | |
| 54 | - private function _getLabelField($caption,$icon=NULL){ |
|
| 55 | - $label=new HtmlLabel($this->_getFieldIdentifier("lbl"),$caption,$icon); |
|
| 54 | + private function _getLabelField($caption, $icon=NULL) { |
|
| 55 | + $label=new HtmlLabel($this->_getFieldIdentifier("lbl"), $caption, $icon); |
|
| 56 | 56 | return $label; |
| 57 | 57 | } |
| 58 | 58 | |
| 59 | 59 | |
| 60 | - protected function _addRules($element,&$attributes){ |
|
| 61 | - if(isset($attributes["rules"])){ |
|
| 60 | + protected function _addRules($element, &$attributes) { |
|
| 61 | + if (isset($attributes["rules"])) { |
|
| 62 | 62 | $rules=$attributes["rules"]; |
| 63 | - if(\is_array($rules)){ |
|
| 63 | + if (\is_array($rules)) { |
|
| 64 | 64 | $element->addRules($rules); |
| 65 | 65 | } |
| 66 | - else{ |
|
| 66 | + else { |
|
| 67 | 67 | $element->addRule($rules); |
| 68 | 68 | } |
| 69 | 69 | unset($attributes["rules"]); |
| 70 | 70 | } |
| 71 | 71 | } |
| 72 | 72 | |
| 73 | - protected function _prepareFormFields(&$field,$name,&$attributes){ |
|
| 73 | + protected function _prepareFormFields(&$field, $name, &$attributes) { |
|
| 74 | 74 | $field->setName($name); |
| 75 | 75 | $this->_addRules($field, $attributes); |
| 76 | 76 | return $field; |
| 77 | 77 | } |
| 78 | 78 | |
| 79 | - protected function _fieldAs($elementCallback,&$index,$attributes=NULL,$prefix=null){ |
|
| 80 | - $this->setValueFunction($index,function($value,$instance,$index) use (&$attributes,$elementCallback,$prefix){ |
|
| 79 | + protected function _fieldAs($elementCallback, &$index, $attributes=NULL, $prefix=null) { |
|
| 80 | + $this->setValueFunction($index, function($value, $instance, $index) use (&$attributes, $elementCallback, $prefix){ |
|
| 81 | 81 | $caption=$this->_getFieldCaption($index); |
| 82 | 82 | $name=$this->_getFieldName($index); |
| 83 | - $id=$this->_getFieldIdentifier($prefix,$name); |
|
| 84 | - if(isset($attributes["name"])){ |
|
| 83 | + $id=$this->_getFieldIdentifier($prefix, $name); |
|
| 84 | + if (isset($attributes["name"])) { |
|
| 85 | 85 | $name=$attributes["name"]; |
| 86 | 86 | unset($attributes["name"]); |
| 87 | 87 | } |
| 88 | - $element=$elementCallback($id,$name,$value,$caption); |
|
| 89 | - if(\is_array($attributes)){ |
|
| 90 | - $this->_applyAttributes($element, $attributes,$index); |
|
| 88 | + $element=$elementCallback($id, $name, $value, $caption); |
|
| 89 | + if (\is_array($attributes)) { |
|
| 90 | + $this->_applyAttributes($element, $attributes, $index); |
|
| 91 | 91 | } |
| 92 | 92 | $element->setDisabled(!$this->_edition); |
| 93 | 93 | return $element; |
@@ -96,169 +96,169 @@ discard block |
||
| 96 | 96 | } |
| 97 | 97 | |
| 98 | 98 | |
| 99 | - public function fieldAsProgress($index,$label=NULL, $attributes=array()){ |
|
| 100 | - $this->setValueFunction($index,function($value) use($label,$attributes){ |
|
| 101 | - $pb=new HtmlProgress($this->_getFieldIdentifier("pb"),$value,$label,$attributes); |
|
| 99 | + public function fieldAsProgress($index, $label=NULL, $attributes=array()) { |
|
| 100 | + $this->setValueFunction($index, function($value) use($label, $attributes){ |
|
| 101 | + $pb=new HtmlProgress($this->_getFieldIdentifier("pb"), $value, $label, $attributes); |
|
| 102 | 102 | return $pb; |
| 103 | 103 | }); |
| 104 | 104 | return $this; |
| 105 | 105 | } |
| 106 | 106 | |
| 107 | - public function fieldAsRating($index,$max=5, $icon=""){ |
|
| 108 | - $this->setValueFunction($index,function($value) use($max,$icon){ |
|
| 109 | - $rating=new HtmlRating($this->_getFieldIdentifier("rat"),$value,$max,$icon); |
|
| 107 | + public function fieldAsRating($index, $max=5, $icon="") { |
|
| 108 | + $this->setValueFunction($index, function($value) use($max, $icon){ |
|
| 109 | + $rating=new HtmlRating($this->_getFieldIdentifier("rat"), $value, $max, $icon); |
|
| 110 | 110 | return $rating; |
| 111 | 111 | }); |
| 112 | 112 | return $this; |
| 113 | 113 | } |
| 114 | 114 | |
| 115 | - public function fieldAsLabel($index,$icon=NULL){ |
|
| 116 | - $this->setValueFunction($index,function($caption) use($icon){ |
|
| 117 | - $lbl=$this->_getLabelField($caption,$icon); |
|
| 115 | + public function fieldAsLabel($index, $icon=NULL) { |
|
| 116 | + $this->setValueFunction($index, function($caption) use($icon){ |
|
| 117 | + $lbl=$this->_getLabelField($caption, $icon); |
|
| 118 | 118 | return $lbl; |
| 119 | 119 | }); |
| 120 | 120 | return $this; |
| 121 | 121 | } |
| 122 | 122 | |
| 123 | - public function fieldAsHeader($index,$niveau=1,$icon=NULL,$attributes=NULL){ |
|
| 124 | - return $this->_fieldAs(function($id,$name,$value) use($niveau,$icon){ |
|
| 125 | - $header=new HtmlHeader($id,$niveau,$value); |
|
| 126 | - if(isset($icon)) |
|
| 123 | + public function fieldAsHeader($index, $niveau=1, $icon=NULL, $attributes=NULL) { |
|
| 124 | + return $this->_fieldAs(function($id, $name, $value) use($niveau, $icon){ |
|
| 125 | + $header=new HtmlHeader($id, $niveau, $value); |
|
| 126 | + if (isset($icon)) |
|
| 127 | 127 | $header->asIcon($icon, $value); |
| 128 | 128 | return $header; |
| 129 | - }, $index,$attributes,"header"); |
|
| 129 | + }, $index, $attributes, "header"); |
|
| 130 | 130 | } |
| 131 | 131 | |
| 132 | 132 | |
| 133 | - public function fieldAsImage($index,$size=Size::MINI,$circular=false){ |
|
| 134 | - $this->setValueFunction($index,function($img) use($size,$circular){ |
|
| 135 | - $image=new HtmlImage($this->_getFieldIdentifier("image"),$img);$image->setSize($size);if($circular)$image->setCircular(); |
|
| 133 | + public function fieldAsImage($index, $size=Size::MINI, $circular=false) { |
|
| 134 | + $this->setValueFunction($index, function($img) use($size, $circular){ |
|
| 135 | + $image=new HtmlImage($this->_getFieldIdentifier("image"), $img); $image->setSize($size); if ($circular)$image->setCircular(); |
|
| 136 | 136 | return $image; |
| 137 | 137 | }); |
| 138 | 138 | return $this; |
| 139 | 139 | } |
| 140 | 140 | |
| 141 | - public function fieldAsAvatar($index,$attributes=NULL){ |
|
| 142 | - return $this->_fieldAs(function($id,$name,$value){ |
|
| 143 | - $img=new HtmlImage($id,$value); |
|
| 141 | + public function fieldAsAvatar($index, $attributes=NULL) { |
|
| 142 | + return $this->_fieldAs(function($id, $name, $value) { |
|
| 143 | + $img=new HtmlImage($id, $value); |
|
| 144 | 144 | $img->asAvatar(); |
| 145 | 145 | return $img; |
| 146 | - }, $index,$attributes,"avatar"); |
|
| 146 | + }, $index, $attributes, "avatar"); |
|
| 147 | 147 | } |
| 148 | 148 | |
| 149 | - public function fieldAsRadio($index,$attributes=NULL){ |
|
| 150 | - return $this->_fieldAs(function($id,$name,$value){ |
|
| 151 | - $input= new HtmlRadio($id,$name,$value,$value); |
|
| 149 | + public function fieldAsRadio($index, $attributes=NULL) { |
|
| 150 | + return $this->_fieldAs(function($id, $name, $value) { |
|
| 151 | + $input=new HtmlRadio($id, $name, $value, $value); |
|
| 152 | 152 | return $input; |
| 153 | - }, $index,$attributes,"radio"); |
|
| 153 | + }, $index, $attributes, "radio"); |
|
| 154 | 154 | } |
| 155 | 155 | |
| 156 | - public function fieldAsRadios($index,$elements=[],$attributes=NULL){ |
|
| 157 | - return $this->_fieldAs(function($id,$name,$value,$caption) use ($elements){ |
|
| 158 | - return HtmlFormFields::radios($name,$elements,$caption,$value); |
|
| 159 | - }, $index,$attributes,"radios"); |
|
| 156 | + public function fieldAsRadios($index, $elements=[], $attributes=NULL) { |
|
| 157 | + return $this->_fieldAs(function($id, $name, $value, $caption) use ($elements){ |
|
| 158 | + return HtmlFormFields::radios($name, $elements, $caption, $value); |
|
| 159 | + }, $index, $attributes, "radios"); |
|
| 160 | 160 | } |
| 161 | 161 | |
| 162 | - public function fieldAsInput($index,$attributes=NULL){ |
|
| 163 | - return $this->_fieldAs(function($id,$name,$value,$caption) use ($attributes){ |
|
| 164 | - $input= new HtmlFormInput($id,$caption,"text",$value); |
|
| 162 | + public function fieldAsInput($index, $attributes=NULL) { |
|
| 163 | + return $this->_fieldAs(function($id, $name, $value, $caption) use ($attributes){ |
|
| 164 | + $input=new HtmlFormInput($id, $caption, "text", $value); |
|
| 165 | 165 | return $this->_prepareFormFields($input, $name, $attributes); |
| 166 | - }, $index,$attributes,"input"); |
|
| 166 | + }, $index, $attributes, "input"); |
|
| 167 | 167 | } |
| 168 | 168 | |
| 169 | - public function fieldAsTextarea($index,$attributes=NULL){ |
|
| 170 | - return $this->_fieldAs(function($id,$name,$value,$caption){ |
|
| 171 | - $textarea=new HtmlFormTextarea($id,$caption,$value); |
|
| 169 | + public function fieldAsTextarea($index, $attributes=NULL) { |
|
| 170 | + return $this->_fieldAs(function($id, $name, $value, $caption) { |
|
| 171 | + $textarea=new HtmlFormTextarea($id, $caption, $value); |
|
| 172 | 172 | $textarea->setName($name); |
| 173 | 173 | return $textarea; |
| 174 | - }, $index,$attributes,"textarea"); |
|
| 174 | + }, $index, $attributes, "textarea"); |
|
| 175 | 175 | } |
| 176 | 176 | |
| 177 | - public function fieldAsHidden($index,$attributes=NULL){ |
|
| 178 | - if(!\is_array($attributes)){ |
|
| 177 | + public function fieldAsHidden($index, $attributes=NULL) { |
|
| 178 | + if (!\is_array($attributes)) { |
|
| 179 | 179 | $attributes=[]; |
| 180 | 180 | } |
| 181 | 181 | $attributes["imputType"]="hidden"; |
| 182 | - return $this->fieldAsInput($index,$attributes); |
|
| 182 | + return $this->fieldAsInput($index, $attributes); |
|
| 183 | 183 | } |
| 184 | 184 | |
| 185 | - public function fieldAsCheckbox($index,$attributes=NULL){ |
|
| 186 | - return $this->_fieldAs(function($id,$name,$value,$caption){ |
|
| 187 | - $input=new HtmlFormCheckbox($id,$caption,$this->_instanceViewer->getIdentifier()); |
|
| 185 | + public function fieldAsCheckbox($index, $attributes=NULL) { |
|
| 186 | + return $this->_fieldAs(function($id, $name, $value, $caption) { |
|
| 187 | + $input=new HtmlFormCheckbox($id, $caption, $this->_instanceViewer->getIdentifier()); |
|
| 188 | 188 | $input->setChecked(JString::isBooleanTrue($value)); |
| 189 | 189 | $input->setName($name); |
| 190 | 190 | return $input; |
| 191 | - }, $index,$attributes,"ck"); |
|
| 191 | + }, $index, $attributes, "ck"); |
|
| 192 | 192 | } |
| 193 | 193 | |
| 194 | - public function fieldAsDropDown($index,$elements=[],$multiple=false,$attributes=NULL){ |
|
| 195 | - return $this->_fieldAs(function($id,$name,$value,$caption) use($elements,$multiple){ |
|
| 196 | - $dd=new HtmlFormDropdown($id,$elements,$caption,$value); |
|
| 197 | - $dd->asSelect($name,$multiple); |
|
| 194 | + public function fieldAsDropDown($index, $elements=[], $multiple=false, $attributes=NULL) { |
|
| 195 | + return $this->_fieldAs(function($id, $name, $value, $caption) use($elements, $multiple){ |
|
| 196 | + $dd=new HtmlFormDropdown($id, $elements, $caption, $value); |
|
| 197 | + $dd->asSelect($name, $multiple); |
|
| 198 | 198 | return $dd; |
| 199 | - }, $index,$attributes,"dd"); |
|
| 199 | + }, $index, $attributes, "dd"); |
|
| 200 | 200 | } |
| 201 | 201 | |
| 202 | - public function fieldAsMessage($index,$attributes=NULL){ |
|
| 203 | - return $this->_fieldAs(function($id,$name,$value,$caption){ |
|
| 204 | - $mess= new HtmlMessage("message-".$id,$caption); |
|
| 202 | + public function fieldAsMessage($index, $attributes=NULL) { |
|
| 203 | + return $this->_fieldAs(function($id, $name, $value, $caption) { |
|
| 204 | + $mess=new HtmlMessage("message-".$id, $caption); |
|
| 205 | 205 | $mess->addHeader($value); |
| 206 | 206 | return $mess; |
| 207 | - }, $index,$attributes,"message"); |
|
| 207 | + }, $index, $attributes, "message"); |
|
| 208 | 208 | } |
| 209 | 209 | |
| 210 | - public function fieldAsLink($index,$attributes=NULL){ |
|
| 211 | - return $this->_fieldAs(function($id,$name,$value,$caption){ |
|
| 212 | - $lnk= new HtmlLink("message-".$id,"#",$caption); |
|
| 210 | + public function fieldAsLink($index, $attributes=NULL) { |
|
| 211 | + return $this->_fieldAs(function($id, $name, $value, $caption) { |
|
| 212 | + $lnk=new HtmlLink("message-".$id, "#", $caption); |
|
| 213 | 213 | return $lnk; |
| 214 | - }, $index,$attributes,"link"); |
|
| 214 | + }, $index, $attributes, "link"); |
|
| 215 | 215 | } |
| 216 | 216 | |
| 217 | 217 | /**Change fields type |
| 218 | 218 | * @param array $types an array or associative array $type=>$attributes |
| 219 | 219 | */ |
| 220 | - public function fieldsAs(array $types){ |
|
| 220 | + public function fieldsAs(array $types) { |
|
| 221 | 221 | $i=0; |
| 222 | - if(JArray::isAssociative($types)){ |
|
| 223 | - foreach ($types as $type=>$attributes){ |
|
| 224 | - if(\is_int($type)) |
|
| 225 | - $this->fieldAs($i++,$attributes,[]); |
|
| 226 | - else{ |
|
| 227 | - $type=preg_replace('/\d/', '', $type ); |
|
| 228 | - $this->fieldAs($i++,$type,$attributes); |
|
| 222 | + if (JArray::isAssociative($types)) { |
|
| 223 | + foreach ($types as $type=>$attributes) { |
|
| 224 | + if (\is_int($type)) |
|
| 225 | + $this->fieldAs($i++, $attributes, []); |
|
| 226 | + else { |
|
| 227 | + $type=preg_replace('/\d/', '', $type); |
|
| 228 | + $this->fieldAs($i++, $type, $attributes); |
|
| 229 | 229 | } |
| 230 | 230 | } |
| 231 | - }else{ |
|
| 232 | - foreach ($types as $type){ |
|
| 233 | - $this->fieldAs($i++,$type); |
|
| 231 | + } else { |
|
| 232 | + foreach ($types as $type) { |
|
| 233 | + $this->fieldAs($i++, $type); |
|
| 234 | 234 | } |
| 235 | 235 | } |
| 236 | 236 | } |
| 237 | 237 | |
| 238 | - public function fieldAs($index,$type,$attributes=NULL){ |
|
| 238 | + public function fieldAs($index, $type, $attributes=NULL) { |
|
| 239 | 239 | $method="fieldAs".\ucfirst($type); |
| 240 | - if(\method_exists($this, $method)){ |
|
| 241 | - if(!\is_array($attributes)){ |
|
| 240 | + if (\method_exists($this, $method)) { |
|
| 241 | + if (!\is_array($attributes)) { |
|
| 242 | 242 | $attributes=[$index]; |
| 243 | - }else{ |
|
| 243 | + } else { |
|
| 244 | 244 | \array_unshift($attributes, $index); |
| 245 | 245 | } |
| 246 | - \call_user_func_array([$this,$method], $attributes); |
|
| 246 | + \call_user_func_array([$this, $method], $attributes); |
|
| 247 | 247 | } |
| 248 | 248 | } |
| 249 | 249 | |
| 250 | - public function fieldAsSubmit($index,$cssStyle=NULL,$url=NULL,$responseElement=NULL,$attributes=NULL){ |
|
| 251 | - return $this->_fieldAs(function($id,$name,$value,$caption) use ($url,$responseElement,$cssStyle,$attributes){ |
|
| 252 | - $button=new HtmlButton($id,$caption,$cssStyle); |
|
| 253 | - $this->_buttonAsSubmit($button,"click",$url,$responseElement,@$attributes["ajax"]); |
|
| 250 | + public function fieldAsSubmit($index, $cssStyle=NULL, $url=NULL, $responseElement=NULL, $attributes=NULL) { |
|
| 251 | + return $this->_fieldAs(function($id, $name, $value, $caption) use ($url, $responseElement, $cssStyle, $attributes){ |
|
| 252 | + $button=new HtmlButton($id, $caption, $cssStyle); |
|
| 253 | + $this->_buttonAsSubmit($button, "click", $url, $responseElement, @$attributes["ajax"]); |
|
| 254 | 254 | return $button; |
| 255 | - }, $index,$attributes,"submit"); |
|
| 255 | + }, $index, $attributes, "submit"); |
|
| 256 | 256 | } |
| 257 | 257 | |
| 258 | - public function fieldAsButton($index,$cssStyle=NULL,$attributes=NULL){ |
|
| 259 | - return $this->_fieldAs(function($id,$name,$value,$caption) use ($cssStyle){ |
|
| 260 | - $button=new HtmlButton($id,$value,$cssStyle); |
|
| 258 | + public function fieldAsButton($index, $cssStyle=NULL, $attributes=NULL) { |
|
| 259 | + return $this->_fieldAs(function($id, $name, $value, $caption) use ($cssStyle){ |
|
| 260 | + $button=new HtmlButton($id, $value, $cssStyle); |
|
| 261 | 261 | return $button; |
| 262 | - }, $index,$attributes,"button"); |
|
| 262 | + }, $index, $attributes, "button"); |
|
| 263 | 263 | } |
| 264 | 264 | } |
| 265 | 265 | \ No newline at end of file |
@@ -62,8 +62,7 @@ discard block |
||
| 62 | 62 | $rules=$attributes["rules"]; |
| 63 | 63 | if(\is_array($rules)){ |
| 64 | 64 | $element->addRules($rules); |
| 65 | - } |
|
| 66 | - else{ |
|
| 65 | + } else{ |
|
| 67 | 66 | $element->addRule($rules); |
| 68 | 67 | } |
| 69 | 68 | unset($attributes["rules"]); |
@@ -123,8 +122,9 @@ discard block |
||
| 123 | 122 | public function fieldAsHeader($index,$niveau=1,$icon=NULL,$attributes=NULL){ |
| 124 | 123 | return $this->_fieldAs(function($id,$name,$value) use($niveau,$icon){ |
| 125 | 124 | $header=new HtmlHeader($id,$niveau,$value); |
| 126 | - if(isset($icon)) |
|
| 127 | - $header->asIcon($icon, $value); |
|
| 125 | + if(isset($icon)) { |
|
| 126 | + $header->asIcon($icon, $value); |
|
| 127 | + } |
|
| 128 | 128 | return $header; |
| 129 | 129 | }, $index,$attributes,"header"); |
| 130 | 130 | } |
@@ -132,7 +132,9 @@ discard block |
||
| 132 | 132 | |
| 133 | 133 | public function fieldAsImage($index,$size=Size::MINI,$circular=false){ |
| 134 | 134 | $this->setValueFunction($index,function($img) use($size,$circular){ |
| 135 | - $image=new HtmlImage($this->_getFieldIdentifier("image"),$img);$image->setSize($size);if($circular)$image->setCircular(); |
|
| 135 | + $image=new HtmlImage($this->_getFieldIdentifier("image"),$img);$image->setSize($size);if($circular) { |
|
| 136 | + $image->setCircular(); |
|
| 137 | + } |
|
| 136 | 138 | return $image; |
| 137 | 139 | }); |
| 138 | 140 | return $this; |
@@ -221,14 +223,14 @@ discard block |
||
| 221 | 223 | $i=0; |
| 222 | 224 | if(JArray::isAssociative($types)){ |
| 223 | 225 | foreach ($types as $type=>$attributes){ |
| 224 | - if(\is_int($type)) |
|
| 225 | - $this->fieldAs($i++,$attributes,[]); |
|
| 226 | - else{ |
|
| 226 | + if(\is_int($type)) { |
|
| 227 | + $this->fieldAs($i++,$attributes,[]); |
|
| 228 | + } else{ |
|
| 227 | 229 | $type=preg_replace('/\d/', '', $type ); |
| 228 | 230 | $this->fieldAs($i++,$type,$attributes); |
| 229 | 231 | } |
| 230 | 232 | } |
| 231 | - }else{ |
|
| 233 | + } else{ |
|
| 232 | 234 | foreach ($types as $type){ |
| 233 | 235 | $this->fieldAs($i++,$type); |
| 234 | 236 | } |
@@ -240,7 +242,7 @@ discard block |
||
| 240 | 242 | if(\method_exists($this, $method)){ |
| 241 | 243 | if(!\is_array($attributes)){ |
| 242 | 244 | $attributes=[$index]; |
| 243 | - }else{ |
|
| 245 | + } else{ |
|
| 244 | 246 | \array_unshift($attributes, $index); |
| 245 | 247 | } |
| 246 | 248 | \call_user_func_array([$this,$method], $attributes); |
@@ -13,41 +13,41 @@ |
||
| 13 | 13 | * @param string $identifier |
| 14 | 14 | * @param object $modelInstance |
| 15 | 15 | */ |
| 16 | - public function __construct($identifier,$modelInstance=null,$fieldsOrder=[],$fieldsDefinition=[],$fields=[],$captions=[],$separators=[]) { |
|
| 17 | - parent::__construct($identifier,$modelInstance,$fieldsOrder,$fieldsDefinition,$fields,$captions,$separators); |
|
| 16 | + public function __construct($identifier, $modelInstance=null, $fieldsOrder=[], $fieldsDefinition=[], $fields=[], $captions=[], $separators=[]) { |
|
| 17 | + parent::__construct($identifier, $modelInstance, $fieldsOrder, $fieldsDefinition, $fields, $captions, $separators); |
|
| 18 | 18 | } |
| 19 | 19 | |
| 20 | - protected function getDefaultModelInstance(){ |
|
| 20 | + protected function getDefaultModelInstance() { |
|
| 21 | 21 | return new UserModel(); |
| 22 | 22 | } |
| 23 | 23 | |
| 24 | - public static function regular($identifier,$modelInstance=null){ |
|
| 25 | - return new FormLogin($identifier,$modelInstance, |
|
| 26 | - ["message","login","password","remember","forget","submit"], |
|
| 27 | - ["message"=>["icon"=>"sign in"],"input0"=>["rules"=>"empty"],"input1"=>["inputType"=>"password","rules"=>"empty"],"checkbox","link","submit"=>"green fluid"], |
|
| 28 | - ["Connection","login","password","remember","forget","submit"], |
|
| 29 | - ["Please enter login and password to connect","Login","Password","Remember me.","Forgot your password?","Connection"], |
|
| 30 | - [0,2,4,5]); |
|
| 24 | + public static function regular($identifier, $modelInstance=null) { |
|
| 25 | + return new FormLogin($identifier, $modelInstance, |
|
| 26 | + ["message", "login", "password", "remember", "forget", "submit"], |
|
| 27 | + ["message"=>["icon"=>"sign in"], "input0"=>["rules"=>"empty"], "input1"=>["inputType"=>"password", "rules"=>"empty"], "checkbox", "link", "submit"=>"green fluid"], |
|
| 28 | + ["Connection", "login", "password", "remember", "forget", "submit"], |
|
| 29 | + ["Please enter login and password to connect", "Login", "Password", "Remember me.", "Forgot your password?", "Connection"], |
|
| 30 | + [0, 2, 4, 5]); |
|
| 31 | 31 | } |
| 32 | 32 | |
| 33 | - public static function smallInline($identifier,$modelInstance=null){ |
|
| 34 | - $result=new FormLogin($identifier,$modelInstance, |
|
| 35 | - ["login","password","submit"], |
|
| 36 | - ["input0"=>["rules"=>"empty"],"input1"=>["inputType"=>"password","rules"=>"empty"],"submit"=>"green basic"], |
|
| 37 | - ["login","password","submit"], |
|
| 38 | - ["","","Connection"], |
|
| 33 | + public static function smallInline($identifier, $modelInstance=null) { |
|
| 34 | + $result=new FormLogin($identifier, $modelInstance, |
|
| 35 | + ["login", "password", "submit"], |
|
| 36 | + ["input0"=>["rules"=>"empty"], "input1"=>["inputType"=>"password", "rules"=>"empty"], "submit"=>"green basic"], |
|
| 37 | + ["login", "password", "submit"], |
|
| 38 | + ["", "", "Connection"], |
|
| 39 | 39 | [2]); |
| 40 | 40 | $result->addDividerBefore(0, "Connection"); |
| 41 | 41 | return $result; |
| 42 | 42 | } |
| 43 | 43 | |
| 44 | - public static function small($identifier,$modelInstance=null){ |
|
| 45 | - $result=new FormLogin($identifier,$modelInstance, |
|
| 46 | - ["login","password","submit"], |
|
| 47 | - ["input0"=>["rules"=>"empty"],"input1"=>["inputType"=>"password","rules"=>"empty"],"submit"=>"green basic"], |
|
| 48 | - ["login","password","submit"], |
|
| 49 | - ["Login","Password","Connection"], |
|
| 50 | - [1,2]); |
|
| 44 | + public static function small($identifier, $modelInstance=null) { |
|
| 45 | + $result=new FormLogin($identifier, $modelInstance, |
|
| 46 | + ["login", "password", "submit"], |
|
| 47 | + ["input0"=>["rules"=>"empty"], "input1"=>["inputType"=>"password", "rules"=>"empty"], "submit"=>"green basic"], |
|
| 48 | + ["login", "password", "submit"], |
|
| 49 | + ["Login", "Password", "Connection"], |
|
| 50 | + [1, 2]); |
|
| 51 | 51 | $result->addDividerBefore(0, "Connection"); |
| 52 | 52 | return $result; |
| 53 | 53 | } |
@@ -16,8 +16,8 @@ discard block |
||
| 16 | 16 | * @param array $instances |
| 17 | 17 | * @return DataTable |
| 18 | 18 | */ |
| 19 | - public function dataTable($identifier,$model, $instances){ |
|
| 20 | - return $this->addHtmlComponent(new DataTable($identifier,$model,$instances)); |
|
| 19 | + public function dataTable($identifier, $model, $instances) { |
|
| 20 | + return $this->addHtmlComponent(new DataTable($identifier, $model, $instances)); |
|
| 21 | 21 | } |
| 22 | 22 | |
| 23 | 23 | /** |
@@ -25,8 +25,8 @@ discard block |
||
| 25 | 25 | * @param object $instance |
| 26 | 26 | * @return DataElement |
| 27 | 27 | */ |
| 28 | - public function dataElement($identifier, $instance){ |
|
| 29 | - return $this->addHtmlComponent(new DataElement($identifier,$instance)); |
|
| 28 | + public function dataElement($identifier, $instance) { |
|
| 29 | + return $this->addHtmlComponent(new DataElement($identifier, $instance)); |
|
| 30 | 30 | } |
| 31 | 31 | |
| 32 | 32 | /** |
@@ -34,15 +34,15 @@ discard block |
||
| 34 | 34 | * @param object $instance |
| 35 | 35 | * @return DataForm |
| 36 | 36 | */ |
| 37 | - public function dataForm($identifier, $instance){ |
|
| 38 | - return $this->addHtmlComponent(new DataForm($identifier,$instance)); |
|
| 37 | + public function dataForm($identifier, $instance) { |
|
| 38 | + return $this->addHtmlComponent(new DataForm($identifier, $instance)); |
|
| 39 | 39 | } |
| 40 | 40 | |
| 41 | - public function defaultLogin($identifier,$instance=null){ |
|
| 42 | - return $this->addHtmlComponent(FormLogin::regular($identifier,$instance)); |
|
| 41 | + public function defaultLogin($identifier, $instance=null) { |
|
| 42 | + return $this->addHtmlComponent(FormLogin::regular($identifier, $instance)); |
|
| 43 | 43 | } |
| 44 | 44 | |
| 45 | - public function smallLogin($identifier,$instance=null){ |
|
| 46 | - return $this->addHtmlComponent(FormLogin::small($identifier,$instance)); |
|
| 45 | + public function smallLogin($identifier, $instance=null) { |
|
| 46 | + return $this->addHtmlComponent(FormLogin::small($identifier, $instance)); |
|
| 47 | 47 | } |
| 48 | 48 | } |
| 49 | 49 | \ No newline at end of file |