Proyectos de Subversion LeadersLinked - Backend

Rev

Rev 17057 | Rev 17178 | Ir a la última revisión | | Comparar con el anterior | 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' => 'file',
44
            'type' => \Laminas\Form\Element\Hidden::class,
45
            'attributes' => [
46
                'id' => 'file',
47
            ]
48
        ]);
49
 
50
 
51
        $this->add([
52
            'name' => 'marketplace',
53
            'type' => \Laminas\Form\Element\Hidden::class,
54
            'attributes' => [
55
                'id' => 'marketplace',
56
            ]
57
        ]);
58
 
59
 
60
        $this->add([
61
            'name' => 'status',
62
            'type' => \Laminas\Form\Element\Select::class,
63
            'options' => [
64
                'empty_option' => 'LABEL_STATUS',
65
                'value_options' => [
66
                    MicrolearningCapsule::STATUS_ACTIVE => 'LABEL_ACTIVE',
67
                    MicrolearningCapsule::STATUS_INACTIVE => 'LABEL_INACTIVE',
68
                ],
69
            ],
70
            'attributes' => [
71
                'id' => 'status',
72
            ]
73
        ]);
74
 
75
 
17057 stevensc 76
        if($internal == Company::INTERNAL_YES) {
17002 efrain 77
            $value_options = [
78
                MicrolearningCapsule::PRIVACY_PRIVATE => 'LABEL_PRIVATE',
79
                MicrolearningCapsule::PRIVACY_PUBLIC => 'LABEL_PUBLIC',
80
            ];
81
        } else {
82
            $value_options = [
83
                MicrolearningCapsule::PRIVACY_PRIVATE => 'LABEL_PRIVATE',
84
            ];
85
        }
86
 
87
        $this->add([
88
            'name' => 'privacy',
89
            'type' => \Laminas\Form\Element\Select::class,
90
            'options' => [
91
                'empty_option' => 'LABEL_PRIVACY',
92
                'value_options' => $value_options,
93
            ],
94
            'attributes' => [
95
                'id' => 'privacy',
96
            ]
17057 stevensc 97
        ]);
17002 efrain 98
 
17057 stevensc 99
        if($internal == Company::INTERNAL_YES) {
17002 efrain 100
            $value_options = [
101
                    MicrolearningCapsule::TYPE_FREE => 'LABEL_FREE',
102
                    MicrolearningCapsule::TYPE_SELLING => 'LABEL_SELLING',
103
                    MicrolearningCapsule::TYPE_PRIVATE => 'LABEL_PRIVATE',
104
            ];
105
        } else {
106
            $value_options = [
107
                MicrolearningCapsule::TYPE_PRIVATE => 'LABEL_PRIVATE',
108
            ];
109
        }
110
 
111
        $this->add([
112
            'name' => 'type',
113
            'type' => \Laminas\Form\Element\Select::class,
114
            'options' => [
115
                'empty_option' => 'LABEL_TYPE',
116
                'value_options' => $value_options,
117
            ],
118
            'attributes' => [
119
                'id' => 'type',
120
            ]
17057 stevensc 121
        ]);
17002 efrain 122
 
123
        $this->add([
124
            'name' => 'cost',
125
            'type' => \Laminas\Form\Element\Text::class,
126
            'attributes' => [
127
                'id'    => 'cost',
128
            ],
129
        ]);
130
 
131
    }
132
}