Proyectos de Subversion LeadersLinked - Backend

Rev

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

Rev Autor Línea Nro. Línea
16785 efrain 1
<?php
2
 
3
declare(strict_types=1);
4
 
5
namespace LeadersLinked\Form\Planning;
6
 
7
use Laminas\InputFilter\InputFilter;
8
 
9
class PlanningTaskFilter extends InputFilter
10
{
11
 
12
    public function __construct()
13
    {
14
        $this->add([
15
            'name' => 'title',
16
            'required' => true,
17
            'filters' => [
18
                ['name' => \Laminas\Filter\StripTags::class],
19
                ['name' => \Laminas\Filter\StringTrim::class],
20
            ],
21
            'validators' => [
22
                [
23
                    'name' => \Laminas\Validator\StringLength::class,
24
                    'options' => [
25
                        'encoding' => 'UTF-8',
26
                        'max' => 128,
27
                    ],
28
                ],
29
                [
30
                    'name' => \Laminas\Validator\NotEmpty::class,
31
                ],
32
            ],
33
        ]);
34
 
35
        $this->add([
36
            'name' => 'description',
37
            'required' => true,
38
            'filters' => [
39
                ['name' => \Laminas\Filter\StripTags::class],
40
                ['name' => \Laminas\Filter\StringTrim::class],
41
            ],
42
            'validators' => [
43
                [
44
                    'name' => \Laminas\Validator\StringLength::class,
45
                    'options' => [
46
                        'encoding' => 'UTF-8',
47
                        'max' => 1024,
48
                    ],
49
                ],
50
                [
51
                    'name' => \Laminas\Validator\NotEmpty::class,
52
                ],
53
            ],
54
        ]);
55
 
56
        $this->add([
57
            'name' => 'place',
58
            'required' => true,
59
            'filters' => [
60
                ['name' => \Laminas\Filter\StripTags::class],
61
                ['name' => \Laminas\Filter\StringTrim::class],
62
            ],
63
            'validators' => [
64
                [
65
                    'name' => \Laminas\Validator\StringLength::class,
66
                    'options' => [
67
                        'encoding' => 'UTF-8',
68
                        'max' => 254,
69
                    ],
70
                ],
71
                [
72
                    'name' => \Laminas\Validator\NotEmpty::class,
73
                ],
74
            ],
75
        ]);
76
 
77
        $this->add([
78
            'name' => 'how',
79
            'required' => true,
80
            'filters' => [
81
                ['name' => \Laminas\Filter\StripTags::class],
82
                ['name' => \Laminas\Filter\StringTrim::class],
83
            ],
84
            'validators' => [
85
                [
86
                    'name' => \Laminas\Validator\StringLength::class,
87
                    'options' => [
88
                        'encoding' => 'UTF-8',
89
                        'max' => 1024,
90
                    ],
91
                ],
92
                [
93
                    'name' => \Laminas\Validator\NotEmpty::class,
94
                ],
95
            ],
96
        ]);
97
 
98
        $this->add([
99
            'name' => 'detour',
100
            'required' => false,
101
            'filters' => [
102
                ['name' => \Laminas\Filter\StripTags::class],
103
                ['name' => \Laminas\Filter\StringTrim::class],
104
            ],
105
            'validators' => [
106
                [
107
                    'name' => \Laminas\Validator\StringLength::class,
108
                    'options' => [
109
                        'encoding' => 'UTF-8',
110
                        'max' => 1024,
111
                    ],
112
                ],
113
                [
114
                    'name' => \Laminas\Validator\NotEmpty::class,
115
                ],
116
            ],
117
        ]);
118
 
119
        $this->add([
120
            'name' => 'evaluation',
121
            'required' => false,
122
            'filters' => [
123
                ['name' => \Laminas\Filter\StripTags::class],
124
                ['name' => \Laminas\Filter\StringTrim::class],
125
            ],
126
            'validators' => [
127
                [
128
                    'name' => \Laminas\Validator\StringLength::class,
129
                    'options' => [
130
                        'encoding' => 'UTF-8',
131
                        'max' => 1024,
132
                    ],
133
                ],
134
                [
135
                    'name' => \Laminas\Validator\NotEmpty::class,
136
                ],
137
            ],
138
        ]);
139
 
140
 
141
        $this->add([
142
            'name' => 'progress',
143
            'required' => true,
144
            'filters' => [
145
                ['name' => \LeadersLinked\Filter\Intval::class],
146
 
147
            ],
148
            'validators' => [
149
                [
150
                    'name' => \Laminas\Validator\GreaterThan::class,
151
                    'options' => [
152
                        'min' => 0,
16768 efrain 153
                        'inclusive' => true,
16785 efrain 154
                    ]
155
                ],
156
                [
157
                    'name' => \Laminas\Validator\LessThan::class,
158
                    'options' => [
159
                        'max' => 100,
160
                        'inclusive' => true,
161
                    ]
162
                ],
163
            ],
164
        ]);
165
 
166
        $this->add([
167
            'name' => 'status',
168
            'required' => false,
169
            'filters' => [
170
                ['name' => \Laminas\Filter\StripTags::class],
171
                ['name' => \Laminas\Filter\StringTrim::class],
172
            ],
173
            'validators' => [
174
                [
175
                    'name' => \Laminas\Validator\NotEmpty::class,
176
                ],
177
            ],
178
        ]);
179
 
180
        $this->add([
181
            'name' => 'priority',
182
            'required' => false,
183
            'filters' => [
184
                ['name' => \Laminas\Filter\StripTags::class],
185
                ['name' => \Laminas\Filter\StringTrim::class],
186
            ],
187
            'validators' => [
188
                [
189
                    'name' => \Laminas\Validator\NotEmpty::class,
190
                ],
191
            ],
192
        ]);
193
 
194
        $this->add([
195
            'name' => 'urgent',
196
            'required' => false,
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
        ]);
207
 
208
        $this->add([
209
            'name' => 'date_range',
210
            'required' => true,
211
            'filters' => [
212
                ['name' => \Laminas\Filter\StripTags::class],
213
                ['name' => \Laminas\Filter\StringTrim::class],
214
            ],
215
            'validators' => [
216
                [
217
                    'name' => \Laminas\Validator\NotEmpty::class,
218
                ],
219
            ],
220
        ]);
221
 
222
 
223
        $this->add([
224
            'name' => 'start',
225
            'required' => true,
226
            'filters' => [
227
                ['name' => \Laminas\Filter\StripTags::class],
228
                ['name' => \Laminas\Filter\StringTrim::class],
229
            ],
230
            'validators' => [
231
                [
232
                    'name' => \Laminas\Validator\NotEmpty::class,
233
                ],
234
                [
235
                    'name' => \Laminas\Validator\Date::class,
236
                    'options' => [
237
                        'format' => 'Y-m-d'
238
                    ]
239
                ],
240
            ],
241
        ]);
242
 
243
 
244
        $this->add([
245
            'name' => 'end',
246
            'required' => true,
247
            'filters' => [
248
                ['name' => \Laminas\Filter\StripTags::class],
249
                ['name' => \Laminas\Filter\StringTrim::class],
250
            ],
251
            'validators' => [
252
                [
253
                    'name' => \Laminas\Validator\NotEmpty::class,
254
                ],
255
                [
256
                    'name' => \Laminas\Validator\Date::class,
257
                    'options' => [
258
                        'format' => 'Y-m-d'
259
                    ]
260
                ],
261
 
262
            ],
263
        ]);
264
 
265
 
266
 
267
        $this->add([
268
            'name' => 'date_range',
269
            'required' => true,
270
            'filters' => [
271
                ['name' => \Laminas\Filter\StripTags::class],
272
                ['name' => \Laminas\Filter\StringTrim::class],
273
            ],
274
            'validators' => [
275
                [
276
                    'name' => \Laminas\Validator\NotEmpty::class,
277
                ],
278
            ],
279
        ]);
280
 
281
        $this->add([
282
            'name' => 'cost',
283
            'required' => true,
284
            'filters' => [
285
                ['name' => \LeadersLinked\Filter\Floatval::class],
286
            ],
287
            'validators' => [
288
                [
289
                    'name' => \Laminas\Validator\NotEmpty::class,
290
                ],
291
                [
292
                    'name' => \Laminas\Validator\GreaterThan::class,
293
                    'options' => [
294
                        'min' => 0,
295
                        'inclusive' => true,
296
                    ]
297
                ],
298
                [
299
                    'name' => \Laminas\Validator\LessThan::class,
300
                    'options' => [
301
                        'max' => 999999999999.99,
302
                        'inclusive' => true,
303
                    ]
304
                ],
305
 
306
            ],
307
        ]);
308
 
309
        $this->add([
310
            'name' => 'hours',
311
            'required' => true,
312
            'filters' => [
313
                ['name' => \LeadersLinked\Filter\Floatval::class],
314
            ],
315
            'validators' => [
316
                [
317
                    'name' => \Laminas\Validator\NotEmpty::class,
318
                ],
319
                [
320
                    'name' => \Laminas\Validator\GreaterThan::class,
321
                    'options' => [
322
                        'min' => 0,
323
                        'inclusive' => true,
324
                    ]
325
                ],
326
                [
327
                    'name' => \Laminas\Validator\LessThan::class,
328
                    'options' => [
329
                        'max' => 9999,
330
                        'inclusive' => true,
331
                    ]
332
                ],
333
 
334
            ],
335
        ]);
336
 
337
        $this->add([
338
            'name' => 'user_id',
339
            'required' => true,
340
            'filters' => [
341
                ['name' => \Laminas\Filter\StripTags::class],
342
                ['name' => \Laminas\Filter\StringTrim::class],
343
            ],
344
            'validators' => [
345
                [
346
                    'name' => \Laminas\Validator\NotEmpty::class,
347
                ],
348
            ],
349
        ]);
350
 
351
 
352
    }
16766 efrain 353
}