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',
6990 nelberth 52
            'type' => \Laminas\Form\Element\Hidden::class,
53
            'attributes' => [
1 www 54
                'id' => 'file',
55
            ]
6990 nelberth 56
        ]);
1 www 57
        $this->add([
58
            'name' => 'marketplace',
6990 nelberth 59
            'type' => \Laminas\Form\Element\Hidden::class,
1 www 60
            'attributes' => [
61
                'id' => 'marketplace',
6990 nelberth 62
            ]
1 www 63
        ]);
64
 
65
 
66
        $this->add([
67
            'name' => 'status',
68
            'type' => \Laminas\Form\Element\Select::class,
69
            'options' => [
70
                'empty_option' => 'LABEL_STATUS',
71
                'value_options' => [
72
                    CompanyMicrolearningCapsule::STATUS_ACTIVE => 'LABEL_ACTIVE',
73
                    CompanyMicrolearningCapsule::STATUS_INACTIVE => 'LABEL_INACTIVE',
74
                ],
75
            ],
76
            'attributes' => [
77
                'id' => 'status',
78
            ]
79
        ]);
80
 
81
 
82
        if($internal == Company::INTERNAL_YES) {
83
            $value_options = [
84
                CompanyMicrolearningCapsule::PRIVACY_PRIVATE => 'LABEL_PRIVATE',
85
                CompanyMicrolearningCapsule::PRIVACY_PUBLIC => 'LABEL_PUBLIC',
86
            ];
87
        } else {
88
            $value_options = [
89
                CompanyMicrolearningCapsule::PRIVACY_PRIVATE => 'LABEL_PRIVATE',
90
            ];
91
        }
92
 
93
        $this->add([
94
            'name' => 'privacy',
95
            'type' => \Laminas\Form\Element\Select::class,
96
            'options' => [
97
                'empty_option' => 'LABEL_PRIVACY',
98
                'value_options' => $value_options,
99
            ],
100
            'attributes' => [
101
                'id' => 'privacy',
102
            ]
103
        ]);
104
 
105
        if($internal == Company::INTERNAL_YES) {
106
            $value_options = [
107
                    CompanyMicrolearningCapsule::TYPE_FREE => 'LABEL_FREE',
108
                    CompanyMicrolearningCapsule::TYPE_SELLING => 'LABEL_SELLING',
109
                    CompanyMicrolearningCapsule::TYPE_PRIVATE => 'LABEL_PRIVATE',
110
            ];
111
        } else {
112
            $value_options = [
113
                CompanyMicrolearningCapsule::TYPE_PRIVATE => 'LABEL_PRIVATE',
114
            ];
115
        }
116
 
117
        $this->add([
118
            'name' => 'type',
119
            'type' => \Laminas\Form\Element\Select::class,
120
            'options' => [
121
                'empty_option' => 'LABEL_TYPE',
122
                'value_options' => $value_options,
123
            ],
124
            'attributes' => [
125
                'id' => 'type',
126
            ]
127
        ]);
128
 
129
        $this->add([
130
            'name' => 'cost',
131
            'type' => \Laminas\Form\Element\Text::class,
132
            'attributes' => [
133
                'id'    => 'cost',
134
            ],
135
        ]);
136
 
137
    }
138
}