|
| 1 | +<?php |
| 2 | +namespace Ajax\semantic\widgets\business\user; |
| 3 | +use Ajax\semantic\widgets\business\BusinessForm; |
| 4 | +/** |
| 5 | + * Form for user Account |
| 6 | + * @author jc |
| 7 | + */ |
| 8 | +class FormAccount extends BusinessForm { |
| 9 | + /** |
| 10 | + * @param string $identifier |
| 11 | + * @param object $modelInstance |
| 12 | + */ |
| 13 | + public function __construct($identifier,$modelInstance=null,$fieldsOrder=[],$fieldsDefinition=[],$fields=[],$captions=[],$separators=[]) { |
| 14 | + parent::__construct($identifier,$modelInstance,$fieldsOrder,$fieldsDefinition,$fields,$captions,$separators); |
| 15 | + } |
| 16 | + |
| 17 | + protected function getDefaultModelInstance(){ |
| 18 | + return new UserModel(); |
| 19 | + } |
| 20 | + |
| 21 | + public static function regular($identifier,$modelInstance=null){ |
| 22 | + return new FormAccount($identifier,$modelInstance, |
| 23 | + ["message","login","password","passwordConf","email","submit","error"], |
| 24 | + ["message"=>[["icon"=>"sign in"]], |
| 25 | + "input0"=>[["rules"=>"empty"]], |
| 26 | + "input1"=>[["inputType"=>"password","rules"=> ['minLength[6]', 'empty']]], |
| 27 | + "input2"=>[["inputType"=>"password","rules"=> ['minLength[6]', 'empty', 'match[password]']]], |
| 28 | + "input3"=>[["rules"=>"email"]], |
| 29 | + "submit"=>["green fluid"], |
| 30 | + "message2"=>[["error"=>true]]], |
| 31 | + ["Account","login","password","passwordConf","email","submit","error"], |
| 32 | + ["Please enter your account informations","Login","Password","Password confirmation","Email address","Creation"], |
| 33 | + [0,1,3,4,5,6]); |
| 34 | + } |
| 35 | + |
| 36 | + public static function smallInline($identifier,$modelInstance=null){ |
| 37 | + $result=new FormAccount($identifier,$modelInstance, |
| 38 | + ["login","password","submit"], |
| 39 | + ["input0"=>[["rules"=>"empty"]],"input1"=>[["inputType"=>"password","rules"=>"empty"]],"submit"=>["green basic"]], |
| 40 | + ["login","password","submit"], |
| 41 | + ["","","Connection"], |
| 42 | + [2]); |
| 43 | + $result->addDividerBefore(0, "Connection"); |
| 44 | + return $result; |
| 45 | + } |
| 46 | + |
| 47 | + public static function small($identifier,$modelInstance=null){ |
| 48 | + $result=new FormAccount($identifier,$modelInstance, |
| 49 | + ["login","password","submit"], |
| 50 | + ["input0"=>[["rules"=>"empty"]],"input1"=>[["inputType"=>"password","rules"=>"empty"]],"submit"=>["green basic"]], |
| 51 | + ["login","password","submit"], |
| 52 | + ["Login","Password","Connection"], |
| 53 | + [1,2]); |
| 54 | + $result->addDividerBefore(0, "Connection"); |
| 55 | + return $result; |
| 56 | + } |
| 57 | + |
| 58 | + public static function attachedSegment($identifier,$modelInstance=null){ |
| 59 | + $result=self::regular($identifier,$modelInstance); |
| 60 | + $result->fieldAsMessage("message",["icon"=>"sign in","attached"=>true]); |
| 61 | + $result->addWrapper("message",null,"<div class='ui attached segment'>"); |
| 62 | + $result->addWrapper("error", null,"</div>"); |
| 63 | + return $result; |
| 64 | + } |
| 65 | +} |
0 commit comments