Proyectos de Subversion LeadersLinked - Backend

Rev

| Ultima modificación | Ver Log |

Rev Autor Línea Nro. Línea
15341 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;
15441 efrain 12
use LeadersLinked\Mapper\ThemeMapper;
15341 efrain 13
 
14
class NetworkEditForm extends Form
15
{
16
 
15441 efrain 17
    /**
18
     *
19
     * @param AdapterInterface $adapter
20
     */
21
    public function __construct($adapter)
15341 efrain 22
    {
23
 
24
        parent::__construct();
15441 efrain 25
        $this->setInputFilter(new NetworkEditFilter($adapter));
15341 efrain 26
 
27
 
28
        $this->add([
29
            'name' => 'name',
30
            'type' => \Laminas\Form\Element\Text::class,
31
             'attributes' => [
32
                'maxlength' 	=> 128,
33
                'id' 			=> 'name',
34
            ]
35
         ]);
36
 
37
        $this->add([
38
            'name' => 'main_hostname',
39
            'type' => \Laminas\Form\Element\Text::class,
40
            'attributes' => [
41
                'maxlength' 	=> 250,
42
                'id' 			=> 'main_hostname',
43
            ]
44
        ]);
45
 
46
        $this->add([
15452 efrain 47
            'name' => 'alternative_hostname',
48
            'type' => \Laminas\Form\Element\Text::class,
49
            'attributes' => [
50
                'maxlength' 	=> 250,
51
                'id' 			=> 'alternative_hostname',
52
            ]
53
        ]);
54
 
55
 
56
 
57
        $this->add([
15341 efrain 58
            'name' => 'admin_hostname',
59
            'type' => \Laminas\Form\Element\Text::class,
60
            'attributes' => [
61
                'maxlength' 	=> 250,
62
                'id' 			=> 'admin_hostname',
63
            ]
64
        ]);
65
 
66
        $this->add([
67
            'name' => 'status',
68
            'type' => \Laminas\Form\Element\Checkbox::class,
69
            'attributes' => [
70
                'id' 			=> 'status',
71
            ],
72
            'options' => [
73
                'use_hidden_element' => 0,
74
                'unchecked_value' => \LeadersLinked\Model\Network::STATUS_INACTIVE,
75
                'checked_value'=> \LeadersLinked\Model\Network::STATUS_ACTIVE,
76
            ]
77
        ]);
15441 efrain 78
 
79
 
80
 
81
        $this->add([
82
            'name' => 'theme_id',
83
            'type' => \Laminas\Form\Element\Select::class,
84
            'attributes' => [
85
                'id' => 'theme_id',
86
            ],
87
            'options' => [
88
                'disable_inarray_validator' => true,
89
                'value_options' => $this->optionsTheme($adapter)
90
            ]
91
        ]);
92
 
93
 
15341 efrain 94
    }
95
 
15441 efrain 96
    /**
97
     *
98
     * @param AdapterInterface $adapter
99
     */
100
    private function optionsTheme($adapter)
101
    {
102
        $options = [];
103
 
104
        $mapper = ThemeMapper::getInstance($adapter);
105
        $records = $mapper->fetchAll();
106
 
107
        foreach($records as $record)
108
        {
109
            $options[$record->uuid] = $record->name;
110
        }
111
        return $options;
112
    }
15341 efrain 113
 
15441 efrain 114
 
15341 efrain 115
 
116
}