| 1384 |
efrain |
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\CompanyMicrolearningTopicMapper;
|
|
|
14 |
use LeadersLinked\Mapper\CompanyMicrolearningCapsuleMapper;
|
|
|
15 |
use LeadersLinked\Mapper\CompanyPerformanceEvaluationFormMapper;
|
|
|
16 |
use LeadersLinked\Mapper\UserMapper;
|
|
|
17 |
|
|
|
18 |
class PerformanceEvaluationEvaluationForm extends Form
|
|
|
19 |
{
|
|
|
20 |
|
|
|
21 |
/**
|
|
|
22 |
*
|
|
|
23 |
* @param AdapterInterface $adapter
|
|
|
24 |
* @param int $company_id
|
|
|
25 |
*/
|
|
|
26 |
public function __construct($adapter, $company_id)
|
|
|
27 |
{
|
|
|
28 |
parent::__construct();
|
|
|
29 |
$this->setInputFilter(new PerformanceEvaluationEvaluationtFilter($adapter));
|
|
|
30 |
|
|
|
31 |
$this->add([
|
|
|
32 |
'name' => 'form_id',
|
|
|
33 |
'type' => \Laminas\Form\Element\Select::class,
|
|
|
34 |
'attributes' => [
|
|
|
35 |
'id' => 'form_id',
|
|
|
36 |
],
|
|
|
37 |
'options' => [
|
|
|
38 |
'value_options' => $this->getSelectFormOptions($adapter, $company_id)
|
|
|
39 |
]
|
|
|
40 |
]);
|
|
|
41 |
|
|
|
42 |
$this->add([
|
|
|
43 |
'name' => 'supervisor_id',
|
|
|
44 |
'type' => \Laminas\Form\Element\Select::class,
|
|
|
45 |
'attributes' => [
|
|
|
46 |
'id' => 'supervisor_id',
|
|
|
47 |
],
|
|
|
48 |
'options' => [
|
|
|
49 |
'value_options' => $this->getSelectUserOptions($adapter, $company_id)
|
|
|
50 |
]
|
|
|
51 |
]);
|
|
|
52 |
|
|
|
53 |
$this->add([
|
|
|
54 |
'name' => 'last_date',
|
|
|
55 |
'type' => \Laminas\Form\Element\Text::class,
|
|
|
56 |
'attributes' => [
|
|
|
57 |
'maxlength' => 10,
|
|
|
58 |
'id' => 'last_date',
|
|
|
59 |
]
|
|
|
60 |
]);
|
|
|
61 |
|
|
|
62 |
|
|
|
63 |
}
|
|
|
64 |
|
|
|
65 |
/**
|
|
|
66 |
*
|
|
|
67 |
* @param AdapterInterface $adapter
|
|
|
68 |
*/
|
|
|
69 |
private function getSelectFormOptions($adapter, $company_id)
|
|
|
70 |
{
|
|
|
71 |
$options = [];
|
|
|
72 |
|
|
|
73 |
$mapper = CompanyPerformanceEvaluationFormMapper::getInstance($adapter);
|
|
|
74 |
$records = $mapper->fetchAllByCompanyId($company_id);
|
|
|
75 |
|
|
|
76 |
foreach($records as $record)
|
|
|
77 |
{
|
|
|
78 |
$options[$record->uuid] = $record->name;
|
|
|
79 |
}
|
|
|
80 |
return $options;
|
|
|
81 |
}
|
|
|
82 |
|
|
|
83 |
|
|
|
84 |
/**
|
|
|
85 |
*
|
|
|
86 |
* @param AdapterInterface $adapter
|
|
|
87 |
*/
|
|
|
88 |
private function getSelectUserOptions($adapter, $company_id)
|
|
|
89 |
{
|
|
|
90 |
$options = [];
|
|
|
91 |
|
|
|
92 |
$mapper = UserMapper::getInstance($adapter);
|
|
|
93 |
$records = $mapper->fetchAllByCompanyId($company_id);
|
|
|
94 |
|
|
|
95 |
foreach($records as $record)
|
|
|
96 |
{
|
|
|
97 |
$options[$record->uuid] = (trim($record->first_name) . ' ' . trim($record->last_name)) . ' (' . $record->email . ')';
|
|
|
98 |
}
|
|
|
99 |
return $options;
|
|
|
100 |
}
|
|
|
101 |
|
|
|
102 |
|
|
|
103 |
}
|