Proyectos de Subversion LeadersLinked - Backend

Rev

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

Rev Autor Línea Nro. Línea
17002 efrain 1
<?php
2
 
3
declare(strict_types=1);
4
 
17020 efrain 5
namespace LeadersLinked\Form\Job;
17002 efrain 6
 
7
use Laminas\Form\Form;
8
use Laminas\Db\Adapter\AdapterInterface;
9
use LeadersLinked\Mapper\IndustryMapper;
10
use LeadersLinked\Mapper\CompanySizeMapper;
11
use LeadersLinked\Mapper\CurrencyMapper;
12
 
13
class JobSalaryForm extends Form
14
{
15
    /**
16
     *
17
     * @param AdapterInterface $adapter
18
     */
19
    public function __construct($adapter)
20
    {
21
        parent::__construct();
22
 
23
        $this->setInputFilter(new JobSalaryFilter($adapter));
24
 
25
        $this->add([
26
            'name' => 'salary_visible',
27
            'type' => \Laminas\Form\Element\Checkbox::class,
28
            'attributes' => [
29
                'id' 			=> 'salary_visible',
30
            ],
31
            'options' => [
32
                'use_hidden_element' => false,
33
                'unchecked_value' => \LeadersLinked\Model\Job::SALARY_VISIBLE_NO,
34
                'checked_value'=>  \LeadersLinked\Model\Job::SALARY_VISIBLE_YES,
35
            ]
36
        ]);
37
 
38
 
39
 
40
        $this->add([
41
            'name' => 'salary_min',
42
            'type' => \Laminas\Form\Element\Text::class,
43
            'attributes' => [
44
                'maxlength' 	=> 10,
45
                'id' 			=> 'salary_min',
46
            ]
47
        ]);
48
 
49
        $this->add([
50
            'name' => 'salary_max',
51
            'type' => \Laminas\Form\Element\Text::class,
52
            'attributes' => [
53
                'maxlength' 	=> 10,
54
                'id' 			=> 'salary_max',
55
            ]
56
        ]);
57
 
58
 
59
        $this->add([
60
            'name' => 'salary_currency',
61
            'type' => \Laminas\Form\Element\Select::class,
62
            'options' => [
63
                'value_options' => $this->currencyCombo($adapter)
64
            ],
65
            'attributes' => [
66
                'id' => 'salary_currency',
67
            ]
68
        ]);
69
 
70
 
71
    }
72
 
73
    /**
74
     *
75
     * @param AdapterInterface $adapter
76
     * @return array
77
     */
78
    function currencyCombo($adapter)
79
    {
80
        $mapper = CurrencyMapper::getInstance($adapter);
81
        $records = $mapper->fetchAllActive();
82
 
83
        $items = [];
84
        foreach($records as $record)
85
        {
86
            $items[$record->currency] = $record->name;
87
        }
88
 
89
        return $items;
90
    }
91
 
92
 
93
}