@@ -61,19 +61,22 @@ public function createRegisterForm()
61
61
$ email = new Zend_Form_Element_Text ('email ' );
62
62
$ email ->setRequired (true )
63
63
->addValidator ('NotEmpty ' , true )
64
+ ->setAttrib ('maxLength ' , 255 )
64
65
->addValidator ('EmailAddress ' );
65
66
66
67
67
68
$ firstname = new Zend_Form_Element_Text ('firstname ' );
68
69
$ firstname
69
70
->setRequired (true )
70
71
->addValidator ('NotEmpty ' , true )
72
+ ->setAttrib ('maxLength ' , 255 )
71
73
->addValidator (new Zend_Validate_Alnum ());
72
74
73
75
$ lastname = new Zend_Form_Element_Text ('lastname ' );
74
76
$ lastname
75
77
->setRequired (true )
76
78
->addValidator ('NotEmpty ' , true )
79
+ ->setAttrib ('maxLength ' , 255 )
77
80
->addValidator (new Zend_Validate_Alnum ());
78
81
79
82
$ password1 = new Zend_Form_Element_Password ('password1 ' );
@@ -98,7 +101,7 @@ public function createRegisterForm()
98
101
99
102
100
103
/** acount form */
101
- public function createAccountForm ($ firstname_value = null , $ lastname_value = null , $ company_value = null , $ policy_value = null )
104
+ public function createAccountForm ($ defaultValue = array () )
102
105
{
103
106
$ form = new Zend_Form ;
104
107
$ form ->setAction ($ this ->webroot .'/user/settings ' )
@@ -108,16 +111,39 @@ public function createAccountForm($firstname_value = null, $lastname_value = nul
108
111
$ firstname
109
112
->setRequired (true )
110
113
->addValidator ('NotEmpty ' , true )
114
+ ->setAttrib ('maxLength ' , 255 )
111
115
->addValidator (new Zend_Validate_Alnum ());
112
116
113
117
$ lastname = new Zend_Form_Element_Text ('lastname ' );
114
118
$ lastname
115
119
->setRequired (true )
116
120
->addValidator ('NotEmpty ' , true )
121
+ ->setAttrib ('maxLength ' , 255 )
117
122
->addValidator (new Zend_Validate_Alnum ());
118
123
119
124
$ company = new Zend_Form_Element_Text ('company ' );
120
125
$ company
126
+ ->setAttrib ('maxLength ' , 255 )
127
+ ->addValidator (new Zend_Validate_Alnum ());
128
+
129
+ $ city = new Zend_Form_Element_Text ('city ' );
130
+ $ city
131
+ ->setAttrib ('maxLength ' , 100 )
132
+ ->addValidator (new Zend_Validate_Alnum ());
133
+
134
+ $ country = new Zend_Form_Element_Text ('country ' );
135
+ $ country
136
+ ->setAttrib ('maxLength ' , 100 )
137
+ ->addValidator (new Zend_Validate_Alnum ());
138
+
139
+ $ validator = new Zend_Validate_Callback (array ('Zend_Uri ' , 'check ' ));
140
+ $ website = new Zend_Form_Element_Text ('website ' );
141
+ $ website
142
+ ->setAttrib ('maxLength ' , 255 )
143
+ ->addValidator ($ validator );
144
+
145
+ $ biography = new Zend_Form_Element_Textarea ('biography ' );
146
+ $ biography
121
147
->addValidator (new Zend_Validate_Alnum ());
122
148
123
149
$ submit = new Zend_Form_Element_Submit ('modifyAccount ' );
@@ -131,24 +157,40 @@ public function createAccountForm($firstname_value = null, $lastname_value = nul
131
157
->setRequired (true )
132
158
->setValue (MIDAS_COMMUNITY_PUBLIC );
133
159
134
- if ($ firstname_value != null )
160
+ if (isset ($ defaultValue ['firstname ' ]))
161
+ {
162
+ $ firstname ->setValue ($ defaultValue ['firstname ' ]);
163
+ }
164
+ if (isset ($ defaultValue ['lastname ' ]))
165
+ {
166
+ $ lastname ->setValue ($ defaultValue ['lastname ' ]);
167
+ }
168
+ if (isset ($ defaultValue ['company ' ]))
169
+ {
170
+ $ company ->setValue ($ defaultValue ['company ' ]);
171
+ }
172
+ if (isset ($ defaultValue ['privacy ' ]))
173
+ {
174
+ $ privacy ->setValue ($ defaultValue ['privacy ' ]);
175
+ }
176
+ if (isset ($ defaultValue ['city ' ]))
135
177
{
136
- $ firstname ->setValue ($ firstname_value );
178
+ $ city ->setValue ($ defaultValue [ ' city ' ] );
137
179
}
138
- if ($ lastname_value != null )
180
+ if (isset ( $ defaultValue [ ' country ' ]) )
139
181
{
140
- $ lastname ->setValue ($ lastname_value );
182
+ $ country ->setValue ($ defaultValue [ ' country ' ] );
141
183
}
142
- if ($ company_value != null )
184
+ if (isset ( $ defaultValue [ ' website ' ]) )
143
185
{
144
- $ company ->setValue ($ company_value );
186
+ $ website ->setValue ($ defaultValue [ ' website ' ] );
145
187
}
146
- if ($ policy_value != null )
188
+ if (isset ( $ defaultValue [ ' biography ' ]) )
147
189
{
148
- $ privacy ->setValue ($ policy_value );
190
+ $ biography ->setValue ($ defaultValue [ ' biography ' ] );
149
191
}
150
192
151
- $ form ->addElements (array ($ firstname , $ lastname , $ company , $ privacy , $ submit ));
193
+ $ form ->addElements (array ($ website , $ city , $ country , $ biography , $ firstname , $ lastname , $ company , $ privacy , $ submit ));
152
194
153
195
return $ form ;
154
196
}
0 commit comments