Proyectos de Subversion LeadersLinked - Backend

Rev

Rev 17020 | Mostrar el archivo completo | | | Autoría | Ultima modificación | Ver Log |

Rev 17020 Rev 17288
Línea 16... Línea 16...
16
{
16
{
17
    /**
17
    /**
18
     * 
18
     * 
19
     * @param AdapterInterface $adapter
19
     * @param AdapterInterface $adapter
20
     */
20
     */
21
    public function __construct($adapter) 
21
    public function __construct($adapter)
22
    {
22
    {
23
        parent::__construct();
23
        parent::__construct();
24
        $this->setInputFilter(new JobCreateFilter($adapter));
24
        $this->setInputFilter(new JobCreateFilter($adapter));
25
        
25
 
26
        $this->add([
26
        $this->add([
27
            'name' => 'title',
27
            'name' => 'title',
28
            'type' => \Laminas\Form\Element\Text::class,
28
            'type' => \Laminas\Form\Element\Text::class,
29
             'attributes' => [
29
            'attributes' => [
30
                'maxlength' 	=> 128,
30
                'maxlength'     => 128,
31
                'id' 			=> 'title',
31
                'id'             => 'title',
32
            ]
32
            ]
33
         ]);
33
        ]);
34
        
34
 
35
        $this->add([
35
        $this->add([
36
            'name' => 'last_date_of_application',
36
            'name' => 'last_date_of_application',
37
            'type' => \Laminas\Form\Element\Text::class,
37
            'type' => \Laminas\Form\Element\Text::class,
38
            'attributes' => [
38
            'attributes' => [
39
                'maxlength' 	=> 10,
39
                'maxlength'     => 10,
40
                'id' 			=> 'last_date_of_application',
40
                'id'             => 'last_date_of_application',
41
            ]
41
            ]
42
        ]);
42
        ]);
43
       
43
 
44
        $this->add([
44
        $this->add([
45
            'name' => 'job_category_id',
45
            'name' => 'job_category_id',
46
            'type' => \Laminas\Form\Element\Select::class,
46
            'type' => \Laminas\Form\Element\Select::class,
47
            'options' => [
47
            'options' => [
48
                'value_options' => $this->optionsJobCategory($adapter),
48
                'value_options' => $this->optionsJobCategory($adapter),
49
            ],
49
            ],
50
            'attributes' => [
50
            'attributes' => [
51
                'id' => 'job_category_id',
51
                'id' => 'job_category_id',
52
            ]
52
            ]
53
        ]);
53
        ]);
54
        
54
 
55
        $this->add([
55
        $this->add([
56
            'name' => 'employment_type',
56
            'name' => 'employment_type',
57
            'type' => \Laminas\Form\Element\Select::class,
57
            'type' => \Laminas\Form\Element\Select::class,
58
            'options' => [
58
            'options' => [
59
                'value_options' => [
59
                'value_options' => [
60
                    Job::EMPLOYMENT_TYPE_FULL_TIME => 'LABEL_EMPLOYMENT_TYPE_FULL_TIME',
60
                    Job::EMPLOYMENT_TYPE_FULL_TIME => 'LABEL_EMPLOYMENT_TYPE_FULL_TIME',
61
                    Job::EMPLOYMENT_TYPE_PART_TIME => 'LABEL_EMPLOYMENT_TYPE_PART_TIME',
61
                    Job::EMPLOYMENT_TYPE_PART_TIME => 'LABEL_EMPLOYMENT_TYPE_PART_TIME',
62
                    Job::EMPLOYMENT_TYPE_CONTRACT => 'LABEL_EMPLOYMENT_TYPE_CONTRACT',
62
                    Job::EMPLOYMENT_TYPE_CONTRACT => 'LABEL_EMPLOYMENT_TYPE_CONTRACT',
63
                    Job::EMPLOYMENT_TYPE_TEMPORARY => 'LABEL_EMPLOYMENT_TYPE_TEMPORARY',
63
                    Job::EMPLOYMENT_TYPE_TEMPORARY => 'LABEL_EMPLOYMENT_TYPE_TEMPORARY',
-
 
64
                    Job::EMPLOYMENT_TYPE_FREELANCE => 'LABEL_EMPLOYMENT_TYPE_FREELANCE',
64
                ]
65
                ]
65
            ],
66
            ],
66
            'attributes' => [
67
            'attributes' => [
67
                'id' => 'employment_type',
68
                'id' => 'employment_type',
68
            ]
69
            ]
69
        ]);
70
        ]);
70
        
71
 
71
        $this->add([
72
        $this->add([
72
            'name' => 'location_search',
73
            'name' => 'location_search',
73
            'type' => \Laminas\Form\Element\Text::class,
74
            'type' => \Laminas\Form\Element\Text::class,
74
            'attributes' => [
75
            'attributes' => [
75
                'maxlength' 	=> 250,
76
                'maxlength'     => 250,
76
                'id' 			=> 'location_search',
77
                'id'             => 'location_search',
77
            ]
78
            ]
78
        ]);
79
        ]);
79
        
80
 
80
        
81
 
81
        $this->add([
82
        $this->add([
82
            'name' => 'formatted_address',
83
            'name' => 'formatted_address',
83
            'type' => \Laminas\Form\Element\Hidden::class,
84
            'type' => \Laminas\Form\Element\Hidden::class,
84
            'attributes' => [
85
            'attributes' => [
85
                'id'    => 'formatted_address',
86
                'id'    => 'formatted_address',
86
            ]
87
            ]
87
        ]);
88
        ]);
88
        
89
 
89
        $this->add([
90
        $this->add([
90
            'name' => 'address1',
91
            'name' => 'address1',
91
            'type' => \Laminas\Form\Element\Hidden::class,
92
            'type' => \Laminas\Form\Element\Hidden::class,
92
            'attributes' => [
93
            'attributes' => [
93
                'id'    => 'address1',
94
                'id'    => 'address1',
94
            ]
95
            ]
95
        ]);
96
        ]);
96
        
97
 
97
        $this->add([
98
        $this->add([
98
            'name' => 'address2',
99
            'name' => 'address2',
99
            'type' => \Laminas\Form\Element\Hidden::class,
100
            'type' => \Laminas\Form\Element\Hidden::class,
100
            'attributes' => [
101
            'attributes' => [
101
                'id'    => 'address2',
102
                'id'    => 'address2',
102
            ]
103
            ]
103
        ]);
104
        ]);
104
        
105
 
105
        $this->add([
106
        $this->add([
106
            'name' => 'country',
107
            'name' => 'country',
107
            'type' => \Laminas\Form\Element\Hidden::class,
108
            'type' => \Laminas\Form\Element\Hidden::class,
108
            'attributes' => [
109
            'attributes' => [
109
                'id'    => 'country',
110
                'id'    => 'country',
110
            ]
111
            ]
111
        ]);
112
        ]);
112
        
113
 
113
        $this->add([
114
        $this->add([
114
            'name' => 'state',
115
            'name' => 'state',
115
            'type' => \Laminas\Form\Element\Hidden::class,
116
            'type' => \Laminas\Form\Element\Hidden::class,
116
            'attributes' => [
117
            'attributes' => [
117
                'id'    => 'state',
118
                'id'    => 'state',
118
            ]
119
            ]
119
        ]);
120
        ]);
120
        
121
 
121
        $this->add([
122
        $this->add([
122
            'name' => 'city1',
123
            'name' => 'city1',
123
            'type' => \Laminas\Form\Element\Hidden::class,
124
            'type' => \Laminas\Form\Element\Hidden::class,
124
            'attributes' => [
125
            'attributes' => [
125
                'id'    => 'city1',
126
                'id'    => 'city1',
126
            ]
127
            ]
127
        ]);
128
        ]);
128
        
129
 
129
        $this->add([
130
        $this->add([
130
            'name' => 'city2',
131
            'name' => 'city2',
131
            'type' => \Laminas\Form\Element\Hidden::class,
132
            'type' => \Laminas\Form\Element\Hidden::class,
132
            'attributes' => [
133
            'attributes' => [
133
                'id'    => 'city2',
134
                'id'    => 'city2',
134
            ]
135
            ]
135
        ]);
136
        ]);
136
        
137
 
137
        $this->add([
138
        $this->add([
138
            'name' => 'postal_code',
139
            'name' => 'postal_code',
139
            'type' => \Laminas\Form\Element\Hidden::class,
140
            'type' => \Laminas\Form\Element\Hidden::class,
140
            'attributes' => [
141
            'attributes' => [
141
                'id'    => 'postal_code',
142
                'id'    => 'postal_code',
142
            ]
143
            ]
143
        ]);
144
        ]);
144
        
145
 
145
        $this->add([
146
        $this->add([
146
            'name' => 'latitude',
147
            'name' => 'latitude',
147
            'type' => \Laminas\Form\Element\Hidden::class,
148
            'type' => \Laminas\Form\Element\Hidden::class,
148
            'attributes' => [
149
            'attributes' => [
149
                'id'    => 'latitude',
150
                'id'    => 'latitude',
150
            ]
151
            ]
151
        ]);
152
        ]);
152
        
153
 
153
        $this->add([
154
        $this->add([
154
            'name' => 'longitude',
155
            'name' => 'longitude',
155
            'type' => \Laminas\Form\Element\Hidden::class,
156
            'type' => \Laminas\Form\Element\Hidden::class,
156
            'attributes' => [
157
            'attributes' => [
157
                'id'    => 'longitude',
158
                'id'    => 'longitude',
158
            ]
159
            ]
159
        ]);
160
        ]);
160
        
-
 
161
        
-
 
162
    }
161
    }
163
    
162
 
164
    /**
163
    /**
165
     *
164
     *
166
     * @param AdapterInterface $adapter
165
     * @param AdapterInterface $adapter
167
     * @param LoggerInterface $logger
166
     * @param LoggerInterface $logger
168
     * @return array
167
     * @return array
169
     */
168
     */
170
    private function optionsJobCategory($adapter)
169
    private function optionsJobCategory($adapter)
171
    {
170
    {
172
        $jobCategoryMapper = JobCategoryMapper::getInstance($adapter);
171
        $jobCategoryMapper = JobCategoryMapper::getInstance($adapter);
173
        $jobCategories = $jobCategoryMapper->fetchAllActive();
172
        $jobCategories = $jobCategoryMapper->fetchAllActive();
174
        
173
 
175
        $options = [];
174
        $options = [];
176
        foreach($jobCategories as $jobCategory)
175
        foreach ($jobCategories as $jobCategory) {
177
        {
-
 
178
            $options[$jobCategory->uuid] = $jobCategory->name;
176
            $options[$jobCategory->uuid] = $jobCategory->name;
179
        }
177
        }
180
        
178
 
181
        return $options;
179
        return $options;
182
    }
180
    }
183
    
-
 
184
    
-
 
185
}
-
 
186
181
}
-
 
182