Proyectos de Subversion LeadersLinked - Backend

Rev

Rev 16987 | | Comparar con el anterior | Ultima modificación | Ver Log |

Rev Autor Línea Nro. Línea
15459 efrain 1
<?php
2
 
3
declare(strict_types=1);
4
 
5
namespace LeadersLinked\Form\Network;
6
 
7
use Laminas\InputFilter\InputFilter;
8
use LeadersLinked\Mapper\IndustryMapper;
9
use LeadersLinked\Mapper\CompanySizeMapper;
10
use LeadersLinked\Mapper\ThemeMapper;
11
 
12
class NetworkCreateFilter extends InputFilter
13
{
14
    public function __construct($adapter)
15
    {
16
        $this->add([
17
            'name' => 'first_name',
18
            'required' => true,
19
            'filters' => [
20
                ['name' => \Laminas\Filter\StripTags::class],
21
                ['name' => \Laminas\Filter\StringTrim::class],
22
            ],
23
            'validators' => [
24
                [
25
                    'name' => \Laminas\Validator\StringLength::class,
26
                    'options' => [
27
                        'encoding' => 'UTF-8',
28
                        'max' => 64,
29
                    ],
30
                ],
31
                [
32
                    'name' => \Laminas\Validator\NotEmpty::class,
33
                ],
34
            ],
35
        ]);
36
        $this->add([
37
            'name' => 'last_name',
38
            'required' => true,
39
            'filters' => [
40
                ['name' => \Laminas\Filter\StripTags::class],
41
                ['name' => \Laminas\Filter\StringTrim::class],
42
            ],
43
            'validators' => [
44
                [
45
                    'name' => \Laminas\Validator\StringLength::class,
46
                    'options' => [
47
                        'encoding' => 'UTF-8',
48
                        'max' => 64,
49
                    ],
50
                ],
51
                [
52
                    'name' => \Laminas\Validator\NotEmpty::class,
53
                ],
54
 
55
            ],
56
        ]);
57
 
58
 
59
        $this->add([
60
            'name' => 'email',
61
            'required' => true,
62
            'filters' => [
63
                ['name' => \Laminas\Filter\StripTags::class],
64
                ['name' => \Laminas\Filter\StringTrim::class],
65
            ],
66
            'validators' => [
67
                [
68
                    'name' => \Laminas\Validator\StringLength::class,
69
                    'options' => [
70
                        'encoding' => 'UTF-8',
17002 efrain 71
                        'max' => 250,
15459 efrain 72
                    ],
73
                ],
74
                [
75
                    'name' => \Laminas\Validator\NotEmpty::class,
76
                ],
77
                [
78
                    'name' => \Laminas\Validator\EmailAddress::class,
79
                ],
80
                /*[
81
                 'name' => \Laminas\Validator\Db\NoRecordExists::class,
82
                 'options' => [
83
                 'table' => UserMapper::_TABLE,
84
                 'field' => 'email',
85
                 'adapter' => $adapter,
86
                 ],
87
                 ],*/
88
 
89
            ],
90
        ]);
91
 
92
 
93
        $this->add([
94
            'name' => 'password',
95
            'required' => true,
96
            'filters' => [
97
                ['name' => \Laminas\Filter\StripTags::class],
98
                ['name' => \Laminas\Filter\StringTrim::class],
99
            ],
100
            'validators' =>[
101
                [
102
                    'name' =>\Laminas\Validator\NotEmpty::class,
103
                ],
104
                [
105
                    'name' => \Laminas\Validator\StringLength::class,
106
                    'options' => [
107
                        'encoding' => 'UTF-8',
108
                        'min' => 6,
17002 efrain 109
                        'max' => 25
15459 efrain 110
                    ],
111
                ],
112
                [
113
                    'name' => \LeadersLinked\Validator\PasswordStrengthCheck::class,
114
                ],
115
            ]
116
        ]);
117
 
118
        $this->add([
119
            'name' => 'confirmation',
120
            'required' => true,
121
            'filters' => [
122
                ['name' => \Laminas\Filter\StripTags::class],
123
                ['name' => \Laminas\Filter\StringTrim::class],
124
            ],
125
            'validators' =>[
126
                [
127
                    'name' => \Laminas\Validator\NotEmpty::class,
128
                ],
129
                [
130
                    'name' => \Laminas\Validator\StringLength::class,
131
                    'options' => [
132
                        'encoding' => 'UTF-8',
133
                        'min' => 6,
17002 efrain 134
                        'max' => 25
15459 efrain 135
                    ],
136
                ],
137
                [
138
                    'name' => \LeadersLinked\Validator\PasswordStrengthCheck::class,
139
                ],
140
                [
141
                    'name' => \Laminas\Validator\Identical::class,
142
                    'options' => [
143
                        'strict' => 'false',
144
                        'token' =>'password'
145
                    ],
146
                ]
147
            ]
148
        ]);
149
 
150
        $this->add([
151
            'name' => 'company',
152
            'required' => true,
153
            'filters' => [
154
                ['name' => \Laminas\Filter\StripTags::class],
155
                ['name' => \Laminas\Filter\StringTrim::class],
156
            ],
157
            'validators' => [
158
                [
159
                    'name' => \Laminas\Validator\StringLength::class,
160
                    'options' => [
161
                        'encoding' => 'UTF-8',
162
                        'max' => 128,
163
                    ],
164
                ],
165
                [
166
                    'name' => \Laminas\Validator\NotEmpty::class,
167
                ],
168
            ],
169
        ]);
170
 
171
        $this->add([
172
            'name' => 'industry_id',
173
            'required' => true,
174
            'filters' => [
175
                ['name' => \Laminas\Filter\StripTags::class],
176
                ['name' => \Laminas\Filter\StringTrim::class],
177
            ],
178
            'validators' =>[
179
                [
180
                    'name' =>\Laminas\Validator\NotEmpty::class,
181
                ],
182
                [
183
                    'name' => \Laminas\Validator\Db\RecordExists::class,
184
                    'options' => [
185
                        'adapter' => $adapter,
186
                        'table' => IndustryMapper::_TABLE,
187
                        'field' => 'uuid'
188
                    ]
189
                ]
190
            ]
191
        ]);
192
 
193
 
194
        $this->add([
195
            'name' => 'company_size_id',
196
            'required' => true,
197
            'filters' => [
198
                ['name' => \Laminas\Filter\StripTags::class],
199
                ['name' => \Laminas\Filter\StringTrim::class],
200
            ],
201
            'validators' =>[
202
                [
203
                    'name' =>\Laminas\Validator\NotEmpty::class,
204
                ],
205
                [
206
                    'name' => \Laminas\Validator\Db\RecordExists::class,
207
                    'options' => [
208
                        'adapter' => $adapter,
209
                        'table' => CompanySizeMapper::_TABLE,
210
                        'field' => 'uuid'
211
                    ]
212
                ]
213
 
214
            ]
215
        ]);
216
 
217
        $this->add([
218
            'name' => 'main_hostname',
219
            'required' => true,
220
            'filters' => [
221
                ['name' => \Laminas\Filter\StripTags::class],
222
                ['name' => \Laminas\Filter\StringTrim::class],
223
            ],
224
            'validators' => [
225
                [
226
                    'name' => \Laminas\Validator\StringLength::class,
227
                    'options' => [
228
                        'encoding' => 'UTF-8',
229
                        'max' => 250,
230
                    ],
231
                ],
232
                [
233
                    'name' => \Laminas\Validator\NotEmpty::class,
234
                ],
235
            ],
236
        ]);
237
 
238
        $this->add([
239
            'name' => 'alternative_hostname',
240
            'required' => false,
241
            'filters' => [
242
                ['name' => \Laminas\Filter\StripTags::class],
243
                ['name' => \Laminas\Filter\StringTrim::class],
244
            ],
245
            'validators' => [
246
                [
247
                    'name' => \Laminas\Validator\StringLength::class,
248
                    'options' => [
249
                        'encoding' => 'UTF-8',
250
                        'max' => 250,
251
                    ],
252
                ],
253
                [
254
                    'name' => \Laminas\Validator\NotEmpty::class,
255
                ],
16984 efrain 256
 
15459 efrain 257
            ],
258
        ]);
259
 
260
        $this->add([
261
            'name' => 'admin_hostname',
262
            'required' => true,
263
            'filters' => [
264
                ['name' => \Laminas\Filter\StripTags::class],
265
                ['name' => \Laminas\Filter\StringTrim::class],
266
            ],
267
            'validators' => [
268
                [
269
                    'name' => \Laminas\Validator\StringLength::class,
270
                    'options' => [
271
                        'encoding' => 'UTF-8',
272
                        'max' => 250,
273
                    ],
274
                ],
275
                [
276
                    'name' => \Laminas\Validator\NotEmpty::class,
277
                ],
278
            ],
279
        ]);
280
 
281
        $this->add([
16948 efrain 282
            'name' => 'service_hostname',
283
            'required' => true,
284
            'filters' => [
285
                ['name' => \Laminas\Filter\StripTags::class],
286
                ['name' => \Laminas\Filter\StringTrim::class],
287
            ],
288
            'validators' => [
289
                [
290
                    'name' => \Laminas\Validator\StringLength::class,
291
                    'options' => [
292
                        'encoding' => 'UTF-8',
293
                        'max' => 250,
294
                    ],
295
                ],
296
                [
297
                    'name' => \Laminas\Validator\NotEmpty::class,
298
                ],
299
            ],
300
        ]);
301
 
302
        $this->add([
15459 efrain 303
            'name' => 'theme_id',
304
            'required' => true,
305
            'filters' => [
306
                ['name' => \Laminas\Filter\StripTags::class],
307
                ['name' => \Laminas\Filter\StringTrim::class],
308
            ],
309
            'validators' =>[
310
                [
311
                    'name' =>\Laminas\Validator\NotEmpty::class,
312
                ],
313
                [
314
                    'name' => \Laminas\Validator\Db\RecordExists::class,
315
                    'options' => [
316
                        'adapter' => $adapter,
317
                        'table' => ThemeMapper::_TABLE,
318
                        'field' => 'uuid',
319
                    ]
320
                ]
321
            ]
322
        ]);
323
 
324
        $this->add([
15831 efrain 325
            'name' => 'moodle_name',
326
            'required' => false,
327
            'filters' => [
328
                ['name' => \Laminas\Filter\StripTags::class],
329
                ['name' => \Laminas\Filter\StringTrim::class],
330
            ],
331
            'validators' => [
332
                [
333
                    'name' => \Laminas\Validator\StringLength::class,
334
                    'options' => [
335
                        'encoding' => 'UTF-8',
336
                        'max' => 20,
337
                    ],
338
                ],
339
                [
340
                    'name' => \Laminas\Validator\NotEmpty::class,
341
                ],
342
            ],
343
        ]);
344
 
345
 
346
        $this->add([
15459 efrain 347
            'name' => 'moodle_url',
348
            'required' => true,
349
            'filters' => [
350
                ['name' => \Laminas\Filter\StripTags::class],
351
                ['name' => \Laminas\Filter\StringTrim::class],
352
            ],
353
            'validators' => [
354
                [
355
                    'name' => \Laminas\Validator\StringLength::class,
356
                    'options' => [
357
                        'encoding' => 'UTF-8',
358
                        'max' => 250,
359
                    ],
360
                ],
361
                [
362
                    'name' => \Laminas\Validator\NotEmpty::class,
363
                ],
364
                [
365
                    'name' => \Laminas\Validator\Uri::class,
366
                ],
367
            ],
368
        ]);
16987 efrain 369
 
370
        $this->add([
371
            'name' => 'microlearning_name',
372
            'required' => false,
373
            'filters' => [
374
                ['name' => \Laminas\Filter\StripTags::class],
375
                ['name' => \Laminas\Filter\StringTrim::class],
376
            ],
377
            'validators' => [
378
                [
379
                    'name' => \Laminas\Validator\StringLength::class,
380
                    'options' => [
381
                        'encoding' => 'UTF-8',
382
                        'max' => 250,
383
                    ],
384
                ],
385
                [
386
                    'name' => \Laminas\Validator\NotEmpty::class,
387
                ],
388
            ],
389
        ]);
15459 efrain 390
 
391
        $this->add([
15831 efrain 392
            'name' => 'microlearning_appstore',
16286 efrain 393
            'required' => false,
15831 efrain 394
            'filters' => [
395
                ['name' => \Laminas\Filter\StripTags::class],
396
                ['name' => \Laminas\Filter\StringTrim::class],
397
            ],
398
            'validators' => [
399
                [
400
                    'name' => \Laminas\Validator\StringLength::class,
401
                    'options' => [
402
                        'encoding' => 'UTF-8',
403
                        'max' => 250,
404
                    ],
405
                ],
406
                [
407
                    'name' => \Laminas\Validator\NotEmpty::class,
408
                ],
409
                [
410
                    'name' => \Laminas\Validator\Uri::class,
411
                ],
412
            ],
413
        ]);
414
 
415
        $this->add([
416
            'name' => 'microlearning_playstore',
16286 efrain 417
            'required' => false,
15831 efrain 418
            'filters' => [
419
                ['name' => \Laminas\Filter\StripTags::class],
420
                ['name' => \Laminas\Filter\StringTrim::class],
421
            ],
422
            'validators' => [
423
                [
424
                    'name' => \Laminas\Validator\StringLength::class,
425
                    'options' => [
426
                        'encoding' => 'UTF-8',
427
                        'max' => 250,
428
                    ],
429
                ],
430
                [
431
                    'name' => \Laminas\Validator\NotEmpty::class,
432
                ],
433
                [
434
                    'name' => \Laminas\Validator\Uri::class,
435
                ],
436
            ],
437
        ]);
438
 
439
 
440
        $this->add([
15459 efrain 441
            'name' => 'relationship_user_mode',
442
            'required' => true,
443
            'filters' => [
444
                ['name' => \Laminas\Filter\StripTags::class],
445
                ['name' => \Laminas\Filter\StringTrim::class],
446
            ],
447
            'validators' => [
448
                [
449
                    'name' => \Laminas\Validator\NotEmpty::class,
450
                ],
451
            ],
452
        ]);
453
 
454
 
455
 
456
    }
457
}