Newer
Older
* Copyright (C) 2020 Leipzig University Library
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along
* with this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*
* @author Sebastian Kehr <kehr@ub.uni-leipzig.de>
* @license http://opensource.org/licenses/gpl-2.0.php GNU GPLv2
*/
use fid\Hydrator\UserHydrator;
use fid\InputFilter\RootAwareBaseInputFilter;
use Zend\Form\Element\Collection;
use Zend\Form\Element\Hidden;
use Zend\Form\Element\Radio;
use Zend\Form\Element\Select;
use Zend\Form\Element\Submit;
use Zend\Form\Element\Text;
use Zend\Form\Fieldset;
use Zend\Form\InputFilterProviderFieldset;
'name' => 'user-update-form',
'hydrator' => UserHydrator::class,
'validation_group' => [
'id',
'job_title',
'permissions'
],
'elements' => [
'id' => [
'spec' => [
'name' => 'id',
'type' => Hidden::class,
],
],
'salutation' => [
'spec' => [
'name' => 'salutation',
'type' => Select::class,
'options' => [
'label' => 'label_salutation',
'options' => [
'mr' => [
'value' => 'mr',
'label' => 'label_salutation_mr',
],
'mrs' => [
'value' => 'mrs',
'label' => 'label_salutation_mrs',
]
],
'empty_option' => '',
],
'attributes' => [
'disabled' => true,
],
],
],
'academic_title' => [
'spec' => [
'name' => 'academic_title',
'type' => Text::class,
'options' => [
'label' => 'label_academic_title',
],
'attributes' => [
'readonly' => true,
],
],
],
'firstname' => [
'spec' => [
'name' => 'firstname',
'type' => Text::class,
'options' => [
'label' => 'label_firstname',
],
'attributes' => [
],
],
],
'lastname' => [
'spec' => [
'name' => 'lastname',
'type' => Text::class,
'options' => [
'label' => 'label_lastname',
],
'attributes' => [
],
],
],
'home_library' => [
'spec' => [
'name' => 'home_library',
'type' => Select::class,
'options' => [
'label' => 'label_home_library',
],
'attributes' => [
],
],
],
'college' => [
'spec' => [
'name' => 'college',
'type' => Text::class,
'options' => [
'label' => 'label_college',
],
'attributes' => [
'readonly' => true,
],
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
],
],
'job_title' => [
'spec' => [
'name' => 'job_title',
'type' => Radio::class,
'options' => [
'label' => 'label_job_title',
'value_options' => [
'job_title_0',
'job_title_1'
],
],
'attributes' => [
'required' => true,
],
],
],
'permissions' => [
'spec' => [
'name' => 'permissions',
'type' => Collection::class,
'options' => [
'label' => 'label_permissions',
'target_element' => [
'name' => 'permission',
'type' => Select::class,
'options' => [
'value_options' => [
'denied' => 'permission_status_denied',
'requested' => 'permission_status_requested',
'granted' => 'permission_status_granted',
],
],
],
],
],
],
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
'addresses' => [
'spec' => [
'name' => 'addresses',
'type' => Fieldset::class,
'elements' => [
'address_0' => [
'spec' => [
'name' => 0,
'type' => Fieldset::class,
'options' => [
'template' => 'fid/user/address-fieldset.phtml',
],
'elements' => [
'id' => [
'spec' => [
'name' => 'id',
'type' => Hidden::class,
],
],
'line1' => [
'spec' => [
'name' => 'line1',
'options' => [
'label' => 'label_address_0_line_1',
],
'attributes' => [
'readonly' => true,
],
],
],
'line2' => [
'spec' => [
'name' => 'line2',
'options' => [
'label' => 'label_address_0_line_2',
],
'attributes' => [
'readonly' => true,
],
],
],
'zip' => [
'spec' => [
'name' => 'zip',
'options' => [
'label' => 'label_address_0_zip',
],
'attributes' => [
'readonly' => true,
],
],
],
'city' => [
'spec' => [
'name' => 'city',
'options' => [
'label' => 'label_address_0_city',
],
'attributes' => [
'readonly' => true,
],
],
],
'country' => [
'spec' => [
'name' => 'country',
'options' => [
'label' => 'label_address_0_country',
],
'attributes' => [
'readonly' => true,
],
],
],
],
],
],
],
],
],
'data' => [
'spec' => [
'name' => 'data',
'type' => InputFilterProviderFieldset::class,
'submit' => [
'spec' => [
'name' => 'submit',
'type' => Submit::class,
'attributes' => [
'value' => 'label_update_submit',
],
],
],
],
'input_filter' => [
'type' => RootAwareBaseInputFilter::class,
'id' => [
'name' => 'id',
'required' => true,
'job_title' => [
'name' => 'job_title',
'required' => true,
],
'submit' => [
'name' => 'submit',
'required' => true,