Proyectos de Subversion LeadersLinked - Backend

Rev

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

Rev Autor Línea Nro. Línea
15457 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\IndustryMapper;
11
use LeadersLinked\Mapper\RecruitmentSelectionVacancyMapper;
12
use LeadersLinked\Mapper\RecruitmentSelectionCandidateMapper;
13
use LeadersLinked\Model\RecruitmentSelectionCandidate;
14
 
15
class RecruitmentSelectionCandidateFormForm extends Form
16
{
17
 
18
    /**
19
     *
20
     * @param AdapterInterface $adapter
21
     * @param int $company_id
22
     */
23
    public function __construct($adapter, $company_id)
24
    {
25
        parent::__construct();
26
        $this->setInputFilter(new RecruitmentSelectionCandidateFormFilter($adapter));
27
 
28
        $this->add([
29
            'name' => 'user_id',
30
            'type' => \Laminas\Form\Element\Text::class,
31
             'attributes' => [
32
                'id' 			=> 'user_id',
33
            ]
34
        ]);
35
 
36
        $this->add([
37
            'name' => 'first_name',
38
            'type' => \Laminas\Form\Element\Text::class,
39
             'attributes' => [
40
                'maxlength' 	=> 128,
41
                'id' 			=> 'first_name',
42
            ]
43
         ]);
44
 
45
         $this->add([
46
            'name' => 'last_name',
47
            'type' => \Laminas\Form\Element\Text::class,
48
             'attributes' => [
49
                'maxlength' 	=> 128,
50
                'id' 			=> 'last_name',
51
            ]
52
         ]);
53
 
54
         $this->add([
55
            'name' => 'email',
56
            'type' => \Laminas\Form\Element\Text::class,
57
             'attributes' => [
17002 efrain 58
                'maxlength' 	=> 250,
15457 efrain 59
                'id' 			=> 'email',
60
            ]
61
         ]);
62
 
63
        $this->add([
64
            'name' => 'form_uuid',
65
            'type' => \Laminas\Form\Element\Select::class,
66
            'attributes' => [
67
                'id' => 'form_uuid',
68
            ],
69
            'options' => [
70
                'value_options' => $this->getSelectFormOptions($adapter, $company_id)
71
            ]
72
        ]);
73
 
74
        $this->add([
75
            'name' => 'file',
76
            'type' => \Laminas\Form\Element\File::class,
77
             'attributes' => [
78
                'id' => 'file',
79
            ]
80
         ]);
81
 
82
         $this->add([
83
            'name' => 'status',
84
            'type' => \Laminas\Form\Element\Select::class,
85
            'options' => [
86
                'empty_option' => 'LABEL_STATUS',
87
                'value_options' => [
88
                    RecruitmentSelectionCandidate::STATUS_ACEPTED => 'LABEL_ACCEPTED',
89
                    RecruitmentSelectionCandidate::STATUS_REJECTED => 'LABEL_REJECTED',
90
                ],
91
            ],
92
            'attributes' => [
93
                'id' => 'status',
94
            ]
95
        ]);
96
 
97
        $this->add([
98
            'name' => 'coment',
99
            'type' => \Laminas\Form\Element\Textarea::class,
100
             'attributes' => [
101
                'id' 			=> 'coment',
102
             ],
103
        ]);
104
 
105
        $this->add([
106
            'name' => 'evaluation',
107
            'type' => \Laminas\Form\Element\Select::class,
108
            'options' => [
109
                'empty_option' => 'LABEL_EVALUATION',
110
                'value_options' => [
111
                    RecruitmentSelectionCandidate::EVALUATION_0 => 'LABEL_ANOTHER',
112
                    RecruitmentSelectionCandidate::EVALUATION_1 => '25%',
113
                    RecruitmentSelectionCandidate::EVALUATION_2 => '50%',
114
                    RecruitmentSelectionCandidate::EVALUATION_3 => '75%',
115
                    RecruitmentSelectionCandidate::EVALUATION_4 => '100%',
116
 
117
                ],
118
            ],
119
            'attributes' => [
120
                'id' => 'evaluation',
121
            ]
122
        ]);
123
 
124
 
125
    }
126
 
127
    /**
128
     *
129
     * @param AdapterInterface $adapter
130
     */
131
    private function getSelectFormOptions($adapter, $company_id)
132
    {
133
        $options = [];
134
 
135
        $mapper = RecruitmentSelectionVacancyMapper::getInstance($adapter);
136
        $records = $mapper->fetchAllByCompanyId($company_id);
137
 
138
        foreach($records as $record)
139
        {
140
            $options[$record->uuid] = $record->name;
141
        }
142
        return $options;
143
    }
144
 
145
 
146
}