| 1 |
www |
1 |
<?php
|
|
|
2 |
|
|
|
3 |
declare(strict_types=1);
|
|
|
4 |
|
|
|
5 |
namespace LeadersLinked\Form;
|
|
|
6 |
|
|
|
7 |
use Laminas\Form\Form;
|
|
|
8 |
use Laminas\Db\Adapter\AdapterInterface;
|
|
|
9 |
use Laminas\Log\LoggerInterface;
|
|
|
10 |
use LeadersLinked\Mapper\CompanySizeMapper;
|
|
|
11 |
use LeadersLinked\Mapper\IndustryMapper;
|
|
|
12 |
use LeadersLinked\Mapper\CompetencyTypeMapper;
|
|
|
13 |
use LeadersLinked\Mapper\CompanyMicrolearningExtendUserFunctionMapper;
|
|
|
14 |
use LeadersLinked\Mapper\CompanyMicrolearningExtendUserGroupMapper;
|
|
|
15 |
use LeadersLinked\Mapper\CompanyMicrolearningExtendUserSectorMapper;
|
|
|
16 |
use LeadersLinked\Mapper\CompanyMicrolearningExtendUserCompanyMapper;
|
|
|
17 |
use LeadersLinked\Model\CompanyMicrolearningExtendUserInstitution;
|
|
|
18 |
use LeadersLinked\Mapper\CompanyMicrolearningExtendUserInstitutionMapper;
|
|
|
19 |
use LeadersLinked\Mapper\CompanyMicrolearningExtendUserPartnerMapper;
|
|
|
20 |
use LeadersLinked\Mapper\CompanyMicrolearningExtendUserProgramMapper;
|
|
|
21 |
use LeadersLinked\Mapper\CompanyMicrolearningExtendUserStudentTypeMapper;
|
|
|
22 |
|
|
|
23 |
class ExtendUserMicrolearningForm extends Form
|
|
|
24 |
{
|
|
|
25 |
|
|
|
26 |
/**
|
|
|
27 |
*
|
|
|
28 |
* @param AdapterInterface $adapter
|
|
|
29 |
* @param int $company_id
|
|
|
30 |
*/
|
|
|
31 |
public function __construct($adapter, $company_id)
|
|
|
32 |
{
|
|
|
33 |
parent::__construct();
|
|
|
34 |
$this->setInputFilter(new ExtendUserMicrolearningFilter($adapter, $company_id));
|
|
|
35 |
|
|
|
36 |
$this->add([
|
|
|
37 |
'name' => 'function_id',
|
|
|
38 |
'type' => \Laminas\Form\Element\Select::class,
|
|
|
39 |
'attributes' => [
|
|
|
40 |
'id' => 'function_id',
|
|
|
41 |
],
|
|
|
42 |
'options' => [
|
| 66 |
efrain |
43 |
'empty_option' => 'LABEL_NA',
|
| 1 |
www |
44 |
'value_options' => $this->getSelectOptionsFunctions($adapter, $company_id)
|
|
|
45 |
]
|
|
|
46 |
]);
|
|
|
47 |
|
|
|
48 |
$this->add([
|
|
|
49 |
'name' => 'group_id',
|
|
|
50 |
'type' => \Laminas\Form\Element\Select::class,
|
|
|
51 |
'attributes' => [
|
|
|
52 |
'id' => 'group_id',
|
|
|
53 |
],
|
|
|
54 |
'options' => [
|
| 66 |
efrain |
55 |
'empty_option' => 'LABEL_NA',
|
| 1 |
www |
56 |
'value_options' => $this->getSelectOptionsGroups($adapter, $company_id)
|
|
|
57 |
]
|
|
|
58 |
]);
|
|
|
59 |
|
|
|
60 |
$this->add([
|
|
|
61 |
'name' => 'sector_id',
|
|
|
62 |
'type' => \Laminas\Form\Element\Select::class,
|
|
|
63 |
'attributes' => [
|
|
|
64 |
'id' => 'sector_id',
|
|
|
65 |
],
|
|
|
66 |
'options' => [
|
| 66 |
efrain |
67 |
'empty_option' => 'LABEL_NA',
|
| 1 |
www |
68 |
'value_options' => $this->getSelectOptionsSectors($adapter, $company_id)
|
|
|
69 |
]
|
|
|
70 |
]);
|
|
|
71 |
|
|
|
72 |
|
|
|
73 |
$this->add([
|
|
|
74 |
'name' => 'company_id',
|
|
|
75 |
'type' => \Laminas\Form\Element\Select::class,
|
|
|
76 |
'attributes' => [
|
|
|
77 |
'id' => 'company_id',
|
|
|
78 |
],
|
|
|
79 |
'options' => [
|
| 66 |
efrain |
80 |
'empty_option' => 'LABEL_NA',
|
| 1 |
www |
81 |
'value_options' => $this->getSelectOptionsCompanies($adapter, $company_id)
|
|
|
82 |
]
|
|
|
83 |
]);
|
|
|
84 |
|
|
|
85 |
|
|
|
86 |
$this->add([
|
|
|
87 |
'name' => 'institution_id',
|
|
|
88 |
'type' => \Laminas\Form\Element\Select::class,
|
|
|
89 |
'attributes' => [
|
|
|
90 |
'id' => 'institution_id',
|
|
|
91 |
],
|
|
|
92 |
'options' => [
|
| 66 |
efrain |
93 |
'empty_option' => 'LABEL_NA',
|
| 1 |
www |
94 |
'value_options' => $this->getSelectOptionsInstitutions($adapter, $company_id)
|
|
|
95 |
]
|
|
|
96 |
]);
|
|
|
97 |
|
|
|
98 |
$this->add([
|
|
|
99 |
'name' => 'partner_id',
|
|
|
100 |
'type' => \Laminas\Form\Element\Select::class,
|
|
|
101 |
'attributes' => [
|
|
|
102 |
'id' => 'partner_id',
|
|
|
103 |
],
|
|
|
104 |
'options' => [
|
| 66 |
efrain |
105 |
'empty_option' => 'LABEL_NA',
|
| 1 |
www |
106 |
'value_options' => $this->getSelectOptionsPartners($adapter, $company_id)
|
|
|
107 |
]
|
|
|
108 |
]);
|
|
|
109 |
|
|
|
110 |
$this->add([
|
|
|
111 |
'name' => 'program_id',
|
|
|
112 |
'type' => \Laminas\Form\Element\Select::class,
|
|
|
113 |
'attributes' => [
|
|
|
114 |
'id' => 'program_id',
|
|
|
115 |
],
|
|
|
116 |
'options' => [
|
| 66 |
efrain |
117 |
'empty_option' => 'LABEL_NA',
|
| 1 |
www |
118 |
'value_options' => $this->getSelectOptionsPrograms($adapter, $company_id)
|
|
|
119 |
]
|
|
|
120 |
]);
|
|
|
121 |
|
|
|
122 |
$this->add([
|
|
|
123 |
'name' => 'student_type_id',
|
|
|
124 |
'type' => \Laminas\Form\Element\Select::class,
|
|
|
125 |
'attributes' => [
|
|
|
126 |
'id' => 'student_type_id',
|
|
|
127 |
],
|
|
|
128 |
'options' => [
|
| 66 |
efrain |
129 |
'empty_option' => 'LABEL_NA',
|
| 1 |
www |
130 |
'value_options' => $this->getSelectOptionsStudentTypes($adapter, $company_id)
|
|
|
131 |
]
|
|
|
132 |
]);
|
|
|
133 |
|
|
|
134 |
|
|
|
135 |
|
|
|
136 |
|
|
|
137 |
|
|
|
138 |
}
|
|
|
139 |
|
|
|
140 |
/**
|
|
|
141 |
*
|
|
|
142 |
* @param AdapterInterface $adapter
|
|
|
143 |
* @param int $company_id
|
|
|
144 |
*/
|
|
|
145 |
private function getSelectOptionsFunctions($adapter, $company_id)
|
|
|
146 |
{
|
|
|
147 |
$options = [];
|
|
|
148 |
|
|
|
149 |
$mapper = CompanyMicrolearningExtendUserFunctionMapper::getInstance($adapter);
|
|
|
150 |
$records = $mapper->fetchAllByCompanyId($company_id);
|
|
|
151 |
|
|
|
152 |
foreach($records as $record)
|
|
|
153 |
{
|
|
|
154 |
$options[$record->uuid] = $record->name;
|
|
|
155 |
}
|
|
|
156 |
return $options;
|
|
|
157 |
}
|
|
|
158 |
|
|
|
159 |
/**
|
|
|
160 |
*
|
|
|
161 |
* @param AdapterInterface $adapter
|
|
|
162 |
* @param int $company_id
|
|
|
163 |
*/
|
|
|
164 |
private function getSelectOptionsGroups($adapter, $company_id)
|
|
|
165 |
{
|
|
|
166 |
$options = [];
|
|
|
167 |
|
|
|
168 |
$mapper = CompanyMicrolearningExtendUserGroupMapper::getInstance($adapter);
|
|
|
169 |
$records = $mapper->fetchAllByCompanyId($company_id);
|
|
|
170 |
|
|
|
171 |
foreach($records as $record)
|
|
|
172 |
{
|
|
|
173 |
$options[$record->uuid] = $record->name;
|
|
|
174 |
}
|
|
|
175 |
return $options;
|
|
|
176 |
}
|
|
|
177 |
|
|
|
178 |
/**
|
|
|
179 |
*
|
|
|
180 |
* @param AdapterInterface $adapter
|
|
|
181 |
* @param int $company_id
|
|
|
182 |
*/
|
|
|
183 |
private function getSelectOptionsSectors($adapter, $company_id)
|
|
|
184 |
{
|
|
|
185 |
$options = [];
|
|
|
186 |
|
|
|
187 |
$mapper = CompanyMicrolearningExtendUserSectorMapper::getInstance($adapter);
|
|
|
188 |
$records = $mapper->fetchAllByCompanyId($company_id);
|
|
|
189 |
|
|
|
190 |
foreach($records as $record)
|
|
|
191 |
{
|
|
|
192 |
$options[$record->uuid] = $record->name;
|
|
|
193 |
}
|
|
|
194 |
return $options;
|
|
|
195 |
}
|
|
|
196 |
|
|
|
197 |
/**
|
|
|
198 |
*
|
|
|
199 |
* @param AdapterInterface $adapter
|
|
|
200 |
* @param int $company_id
|
|
|
201 |
*/
|
|
|
202 |
private function getSelectOptionsCompanies($adapter, $company_id)
|
|
|
203 |
{
|
|
|
204 |
$options = [];
|
|
|
205 |
|
|
|
206 |
$mapper = CompanyMicrolearningExtendUserCompanyMapper::getInstance($adapter);
|
|
|
207 |
$records = $mapper->fetchAllByCompanyId($company_id);
|
|
|
208 |
|
|
|
209 |
foreach($records as $record)
|
|
|
210 |
{
|
|
|
211 |
$options[$record->uuid] = $record->name;
|
|
|
212 |
}
|
|
|
213 |
return $options;
|
|
|
214 |
}
|
|
|
215 |
|
|
|
216 |
/**
|
|
|
217 |
*
|
|
|
218 |
* @param AdapterInterface $adapter
|
|
|
219 |
* @param int $company_id
|
|
|
220 |
*/
|
|
|
221 |
private function getSelectOptionsInstitutions($adapter, $company_id)
|
|
|
222 |
{
|
|
|
223 |
$options = [];
|
|
|
224 |
|
|
|
225 |
$mapper = CompanyMicrolearningExtendUserInstitutionMapper::getInstance($adapter);
|
|
|
226 |
$records = $mapper->fetchAllByCompanyId($company_id);
|
|
|
227 |
|
|
|
228 |
foreach($records as $record)
|
|
|
229 |
{
|
|
|
230 |
$options[$record->uuid] = $record->name;
|
|
|
231 |
}
|
|
|
232 |
return $options;
|
|
|
233 |
}
|
|
|
234 |
|
|
|
235 |
/**
|
|
|
236 |
*
|
|
|
237 |
* @param AdapterInterface $adapter
|
|
|
238 |
* @param int $company_id
|
|
|
239 |
*/
|
|
|
240 |
private function getSelectOptionsPartners($adapter, $company_id)
|
|
|
241 |
{
|
|
|
242 |
$options = [];
|
|
|
243 |
|
|
|
244 |
$mapper = CompanyMicrolearningExtendUserPartnerMapper::getInstance($adapter);
|
|
|
245 |
$records = $mapper->fetchAllByCompanyId($company_id);
|
|
|
246 |
|
|
|
247 |
foreach($records as $record)
|
|
|
248 |
{
|
|
|
249 |
$options[$record->uuid] = $record->name;
|
|
|
250 |
}
|
|
|
251 |
return $options;
|
|
|
252 |
}
|
|
|
253 |
|
|
|
254 |
/**
|
|
|
255 |
*
|
|
|
256 |
* @param AdapterInterface $adapter
|
|
|
257 |
* @param int $company_id
|
|
|
258 |
*/
|
|
|
259 |
private function getSelectOptionsPrograms($adapter, $company_id)
|
|
|
260 |
{
|
|
|
261 |
$options = [];
|
|
|
262 |
|
|
|
263 |
$mapper = CompanyMicrolearningExtendUserProgramMapper::getInstance($adapter);
|
|
|
264 |
$records = $mapper->fetchAllByCompanyId($company_id);
|
|
|
265 |
|
|
|
266 |
foreach($records as $record)
|
|
|
267 |
{
|
|
|
268 |
$options[$record->uuid] = $record->name;
|
|
|
269 |
}
|
|
|
270 |
return $options;
|
|
|
271 |
}
|
|
|
272 |
|
|
|
273 |
/**
|
|
|
274 |
*
|
|
|
275 |
* @param AdapterInterface $adapter
|
|
|
276 |
* @param int $company_id
|
|
|
277 |
*/
|
|
|
278 |
private function getSelectOptionsStudentTypes($adapter, $company_id)
|
|
|
279 |
{
|
|
|
280 |
$options = [];
|
|
|
281 |
|
|
|
282 |
$mapper = CompanyMicrolearningExtendUserStudentTypeMapper::getInstance($adapter);
|
|
|
283 |
$records = $mapper->fetchAllByCompanyId($company_id);
|
|
|
284 |
|
|
|
285 |
foreach($records as $record)
|
|
|
286 |
{
|
|
|
287 |
$options[$record->uuid] = $record->name;
|
|
|
288 |
}
|
|
|
289 |
return $options;
|
|
|
290 |
}
|
|
|
291 |
}
|