Proyectos de Subversion LeadersLinked - Backend

Rev

| Ultima modificación | Ver Log |

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