Proyectos de Subversion LeadersLinked - Backend

Rev

| Ultima modificación | Ver Log |

Rev Autor Línea Nro. Línea
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\Model\Feed;
13
use LeadersLinked\Model\CompanyMicrolearningTopic;
14
use LeadersLinked\Model\CompanyMicrolearningCapsule;
15
use LeadersLinked\Model\Company;
16
 
17
class CapsuleEditForm extends Form
18
{
19
 
20
    public function __construct($internal = false)
21
    {
22
        parent::__construct();
23
        $this->setInputFilter(new CapsuleEditFilter());
24
 
25
 
26
        $this->add([
27
            'name' => 'name',
28
            'type' => \Laminas\Form\Element\Textarea::class,
29
            'attributes' => [
30
                'id'    => 'name',
31
            ]
32
        ]);
33
 
34
        $this->add([
35
            'name' => 'description',
36
            'type' => \Laminas\Form\Element\Textarea::class,
37
            'attributes' => [
38
                'id'    => 'description',
39
            ]
40
        ]);
41
 
42
        $this->add([
43
            'name' => 'order',
44
            'type' => \Laminas\Form\Element\Text::class,
45
            'attributes' => [
46
                'id'    => 'order',
47
            ],
48
        ]);
49
 
50
        $this->add([
51
            'name' => 'file',
52
            'type' => \Laminas\Form\Element\File::class,
53
             'attributes' => [
54
                'id' => 'file',
55
            ]
56
         ]);
57
 
58
        $this->add([
59
            'name' => 'marketplace',
60
            'type' => \Laminas\Form\Element\File::class,
61
            'attributes' => [
62
                'id' => 'marketplace',
63
            ],
64
        ]);
65
 
66
 
67
        $this->add([
68
            'name' => 'status',
69
            'type' => \Laminas\Form\Element\Select::class,
70
            'options' => [
71
                'empty_option' => 'LABEL_STATUS',
72
                'value_options' => [
73
                    CompanyMicrolearningCapsule::STATUS_ACTIVE => 'LABEL_ACTIVE',
74
                    CompanyMicrolearningCapsule::STATUS_INACTIVE => 'LABEL_INACTIVE',
75
                ],
76
            ],
77
            'attributes' => [
78
                'id' => 'status',
79
            ]
80
        ]);
81
 
82
 
83
        if($internal == Company::INTERNAL_YES) {
84
            $value_options = [
85
                CompanyMicrolearningCapsule::PRIVACY_PRIVATE => 'LABEL_PRIVATE',
86
                CompanyMicrolearningCapsule::PRIVACY_PUBLIC => 'LABEL_PUBLIC',
87
            ];
88
        } else {
89
            $value_options = [
90
                CompanyMicrolearningCapsule::PRIVACY_PRIVATE => 'LABEL_PRIVATE',
91
            ];
92
        }
93
 
94
        $this->add([
95
            'name' => 'privacy',
96
            'type' => \Laminas\Form\Element\Select::class,
97
            'options' => [
98
                'empty_option' => 'LABEL_PRIVACY',
99
                'value_options' => $value_options,
100
            ],
101
            'attributes' => [
102
                'id' => 'privacy',
103
            ]
104
        ]);
105
 
106
        if($internal == Company::INTERNAL_YES) {
107
            $value_options = [
108
                    CompanyMicrolearningCapsule::TYPE_FREE => 'LABEL_FREE',
109
                    CompanyMicrolearningCapsule::TYPE_SELLING => 'LABEL_SELLING',
110
                    CompanyMicrolearningCapsule::TYPE_PRIVATE => 'LABEL_PRIVATE',
111
            ];
112
        } else {
113
            $value_options = [
114
                CompanyMicrolearningCapsule::TYPE_PRIVATE => 'LABEL_PRIVATE',
115
            ];
116
        }
117
 
118
        $this->add([
119
            'name' => 'type',
120
            'type' => \Laminas\Form\Element\Select::class,
121
            'options' => [
122
                'empty_option' => 'LABEL_TYPE',
123
                'value_options' => $value_options,
124
            ],
125
            'attributes' => [
126
                'id' => 'type',
127
            ]
128
        ]);
129
 
130
        $this->add([
131
            'name' => 'cost',
132
            'type' => \Laminas\Form\Element\Text::class,
133
            'attributes' => [
134
                'id'    => 'cost',
135
            ],
136
        ]);
137
 
138
    }
139
}