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
 
18
class CapsuleAddForm extends Form
19
{
20
 
21
    public function __construct($internal = false)
22
    {
23
        parent::__construct();
24
        $this->setInputFilter(new CapsuleAddFilter());
25
 
26
 
27
        $this->add([
28
            'name' => 'name',
29
            'type' => \Laminas\Form\Element\Textarea::class,
30
            'attributes' => [
31
                'id'    => 'name',
32
            ]
33
        ]);
34
 
35
        $this->add([
36
            'name' => 'description',
37
            'type' => \Laminas\Form\Element\Textarea::class,
38
            'attributes' => [
39
                'id'    => 'description',
40
            ]
41
        ]);
42
 
43
        $this->add([
44
            'name' => 'order',
45
            'type' => \Laminas\Form\Element\Text::class,
46
            'attributes' => [
47
                'id'    => 'order',
48
            ],
49
        ]);
50
 
51
        $this->add([
52
            'name' => 'file',
53
            'type' => \Laminas\Form\Element\Hidden::class,
54
            'attributes' => [
55
                'id' => 'file',
56
            ]
57
        ]);
58
        $this->add([
59
            'name' => 'marketplace',
60
            'type' => \Laminas\Form\Element\Hidden::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
                    MicrolearningCapsule::STATUS_ACTIVE => 'LABEL_ACTIVE',
74
                    MicrolearningCapsule::STATUS_INACTIVE => 'LABEL_INACTIVE',
75
                ],
76
            ],
77
            'attributes' => [
78
                'id' => 'status',
79
            ]
80
        ]);
81
 
82
        if($internal == Company::INTERNAL_YES) {
83
            $value_options = [
84
                MicrolearningCapsule::PRIVACY_PRIVATE => 'LABEL_PRIVATE',
85
                MicrolearningCapsule::PRIVACY_PUBLIC => 'LABEL_PUBLIC',
86
            ];
87
        } else {
88
            $value_options = [
89
                MicrolearningCapsule::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
                MicrolearningCapsule::TYPE_FREE => 'LABEL_FREE',
108
                MicrolearningCapsule::TYPE_SELLING => 'LABEL_SELLING',
109
                MicrolearningCapsule::TYPE_PRIVATE => 'LABEL_PRIVATE',
110
            ];
111
        } else {
112
            $value_options = [
113
                MicrolearningCapsule::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
}