Proyectos de Subversion LeadersLinked - Backend

Rev

Rev 16984 | | 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 Laminas\Db\Adapter\AdapterInterface;
11
use LeadersLinked\Mapper\ThemeMapper;
12
 
13
class NetworkEditFilter extends InputFilter
14
{
15
    /**
16
     *
17
     * @param AdapterInterface $adapter
18
     */
19
    public function __construct($adapter)
20
    {
21
 
22
 
23
        $this->add([
24
            'name' => 'name',
25
            'required' => true,
26
            'filters' => [
27
                ['name' => \Laminas\Filter\StripTags::class],
28
                ['name' => \Laminas\Filter\StringTrim::class],
29
            ],
30
            'validators' => [
31
                [
32
                    'name' => \Laminas\Validator\StringLength::class,
33
                    'options' => [
34
                        'encoding' => 'UTF-8',
35
                        'max' => 128,
36
                    ],
37
                ],
38
                [
39
                    'name' => \Laminas\Validator\NotEmpty::class,
40
                ],
41
            ],
42
        ]);
43
 
44
 
45
 
46
        $this->add([
47
            'name' => 'main_hostname',
48
            'required' => true,
49
            'filters' => [
50
                ['name' => \Laminas\Filter\StripTags::class],
51
                ['name' => \Laminas\Filter\StringTrim::class],
52
            ],
53
            'validators' => [
54
                [
55
                    'name' => \Laminas\Validator\StringLength::class,
56
                    'options' => [
57
                        'encoding' => 'UTF-8',
58
                        'max' => 250,
59
                    ],
60
                ],
61
                [
62
                    'name' => \Laminas\Validator\NotEmpty::class,
63
                ],
16984 efrain 64
 
15459 efrain 65
            ],
66
        ]);
67
 
68
 
69
 
70
        $this->add([
71
            'name' => 'alternative_hostname',
72
            'required' => false,
73
            'filters' => [
74
                ['name' => \Laminas\Filter\StripTags::class],
75
                ['name' => \Laminas\Filter\StringTrim::class],
76
            ],
77
            'validators' => [
78
                [
79
                    'name' => \Laminas\Validator\StringLength::class,
80
                    'options' => [
81
                        'encoding' => 'UTF-8',
82
                        'max' => 250,
83
                    ],
84
                ],
85
                [
86
                    'name' => \Laminas\Validator\NotEmpty::class,
87
                ],
16984 efrain 88
 
15459 efrain 89
            ],
90
        ]);
91
 
92
        $this->add([
93
            'name' => 'admin_hostname',
94
            'required' => true,
95
            'filters' => [
96
                ['name' => \Laminas\Filter\StripTags::class],
97
                ['name' => \Laminas\Filter\StringTrim::class],
98
            ],
99
            'validators' => [
100
                [
101
                    'name' => \Laminas\Validator\StringLength::class,
102
                    'options' => [
103
                        'encoding' => 'UTF-8',
104
                        'max' => 250,
105
                    ],
106
                ],
107
                [
108
                    'name' => \Laminas\Validator\NotEmpty::class,
109
                ],
16984 efrain 110
 
15459 efrain 111
            ],
112
        ]);
113
 
16948 efrain 114
 
15459 efrain 115
        $this->add([
16948 efrain 116
            'name' => 'service_hostname',
117
            'required' => true,
118
            'filters' => [
119
                ['name' => \Laminas\Filter\StripTags::class],
120
                ['name' => \Laminas\Filter\StringTrim::class],
121
            ],
122
            'validators' => [
123
                [
124
                    'name' => \Laminas\Validator\StringLength::class,
125
                    'options' => [
126
                        'encoding' => 'UTF-8',
127
                        'max' => 250,
128
                    ],
129
                ],
130
                [
131
                    'name' => \Laminas\Validator\NotEmpty::class,
132
                ],
16984 efrain 133
 
16948 efrain 134
            ],
135
        ]);
136
 
137
 
138
        $this->add([
15459 efrain 139
            'name' => 'status',
140
            'required' => false,
141
            'filters' => [
142
                ['name' => \Laminas\Filter\StripTags::class],
143
                ['name' => \Laminas\Filter\StringTrim::class],
144
            ],
145
            'validators' =>[
146
                [
147
                    'name' =>\Laminas\Validator\NotEmpty::class,
148
                ],
149
            ]
150
        ]);
151
 
152
        $this->add([
153
            'name' => 'theme_id',
154
            'required' => true,
155
            'filters' => [
156
                ['name' => \Laminas\Filter\StripTags::class],
157
                ['name' => \Laminas\Filter\StringTrim::class],
158
            ],
159
            'validators' =>[
160
                [
161
                    'name' =>\Laminas\Validator\NotEmpty::class,
162
                ],
163
                [
164
                    'name' => \Laminas\Validator\Db\RecordExists::class,
165
                    'options' => [
166
                        'adapter' => $adapter,
167
                        'table' => ThemeMapper::_TABLE,
168
                        'field' => 'uuid',
169
                    ]
170
                ]
171
            ]
172
        ]);
173
 
174
        $this->add([
15831 efrain 175
            'name' => 'moodle_name',
176
            'required' => false,
177
            'filters' => [
178
                ['name' => \Laminas\Filter\StripTags::class],
179
                ['name' => \Laminas\Filter\StringTrim::class],
180
            ],
181
            'validators' => [
182
                [
183
                    'name' => \Laminas\Validator\StringLength::class,
184
                    'options' => [
185
                        'encoding' => 'UTF-8',
186
                        'max' => 20,
187
                    ],
188
                ],
189
                [
190
                    'name' => \Laminas\Validator\NotEmpty::class,
191
                ],
192
            ],
193
        ]);
194
 
195
        $this->add([
15459 efrain 196
            'name' => 'moodle_url',
197
            'required' => true,
198
            'filters' => [
199
                ['name' => \Laminas\Filter\StripTags::class],
200
                ['name' => \Laminas\Filter\StringTrim::class],
201
            ],
202
            'validators' => [
203
                [
204
                    'name' => \Laminas\Validator\StringLength::class,
205
                    'options' => [
206
                        'encoding' => 'UTF-8',
207
                        'max' => 250,
208
                    ],
209
                ],
210
                [
211
                    'name' => \Laminas\Validator\NotEmpty::class,
212
                ],
213
                [
214
                    'name' => \Laminas\Validator\Uri::class,
215
                ],
216
            ],
217
        ]);
218
 
219
        $this->add([
16985 efrain 220
            'name' => 'microlearning_name',
221
            'required' => false,
222
            'filters' => [
223
                ['name' => \Laminas\Filter\StripTags::class],
224
                ['name' => \Laminas\Filter\StringTrim::class],
225
            ],
226
            'validators' => [
227
                [
228
                    'name' => \Laminas\Validator\StringLength::class,
229
                    'options' => [
230
                        'encoding' => 'UTF-8',
231
                        'max' => 250,
232
                    ],
233
                ],
234
                [
235
                    'name' => \Laminas\Validator\NotEmpty::class,
236
                ],
237
            ],
238
        ]);
239
 
240
        $this->add([
15831 efrain 241
            'name' => 'microlearning_appstore',
16286 efrain 242
            'required' => false,
15831 efrain 243
            'filters' => [
244
                ['name' => \Laminas\Filter\StripTags::class],
245
                ['name' => \Laminas\Filter\StringTrim::class],
246
            ],
247
            'validators' => [
248
                [
249
                    'name' => \Laminas\Validator\StringLength::class,
250
                    'options' => [
251
                        'encoding' => 'UTF-8',
252
                        'max' => 250,
253
                    ],
254
                ],
255
                [
256
                    'name' => \Laminas\Validator\NotEmpty::class,
257
                ],
258
                [
259
                    'name' => \Laminas\Validator\Uri::class,
260
                ],
261
            ],
262
        ]);
263
 
264
        $this->add([
265
            'name' => 'microlearning_playstore',
16286 efrain 266
            'required' => false,
15831 efrain 267
            'filters' => [
268
                ['name' => \Laminas\Filter\StripTags::class],
269
                ['name' => \Laminas\Filter\StringTrim::class],
270
            ],
271
            'validators' => [
272
                [
273
                    'name' => \Laminas\Validator\StringLength::class,
274
                    'options' => [
275
                        'encoding' => 'UTF-8',
276
                        'max' => 250,
277
                    ],
278
                ],
279
                [
280
                    'name' => \Laminas\Validator\NotEmpty::class,
281
                ],
282
                [
283
                    'name' => \Laminas\Validator\Uri::class,
284
                ],
285
            ],
286
        ]);
287
 
288
        $this->add([
15459 efrain 289
            'name' => 'relationship_user_mode',
290
            'required' => true,
291
            'filters' => [
292
                ['name' => \Laminas\Filter\StripTags::class],
293
                ['name' => \Laminas\Filter\StringTrim::class],
294
            ],
295
            'validators' => [
296
                [
297
                    'name' => \Laminas\Validator\NotEmpty::class,
298
                ],
299
            ],
300
        ]);
301
 
302
 
303
    }
304
}