Proyectos de Subversion LeadersLinked - Backend

Rev

Rev 17055 | Rev 17057 | 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;
17056 stevensc 8
use Laminas\Form\Element\Text;
9
use Laminas\Form\Element\Textarea;
10
use Laminas\Form\Element\Select;
11
use Laminas\Form\Element\Hidden;
17002 efrain 12
use Laminas\Db\Adapter\AdapterInterface;
13
use Laminas\Log\LoggerInterface;
14
use LeadersLinked\Mapper\CompanySizeMapper;
15
use LeadersLinked\Mapper\IndustryMapper;
16
use LeadersLinked\Model\Feed;
17
use LeadersLinked\Model\MicrolearningTopic;
18
use LeadersLinked\Model\MicrolearningCapsule;
19
use LeadersLinked\Model\Company;
20
 
21
class CapsuleAddForm extends Form
22
{
23
    public function __construct($internal = false)
24
    {
25
        parent::__construct();
26
        $this->setInputFilter(new CapsuleAddFilter());
27
 
28
        $this->add([
29
            'name' => 'name',
17056 stevensc 30
            'type' => Textarea::class,
17002 efrain 31
            'attributes' => [
32
                'id'    => 'name',
33
            ]
34
        ]);
35
 
36
        $this->add([
37
            'name' => 'description',
17056 stevensc 38
            'type' => Textarea::class,
17002 efrain 39
            'attributes' => [
40
                'id'    => 'description',
41
            ]
42
        ]);
43
 
44
        $this->add([
45
            'name' => 'order',
17056 stevensc 46
            'type' => Text::class,
17002 efrain 47
            'attributes' => [
48
                'id'    => 'order',
49
            ],
50
        ]);
51
 
52
        $this->add([
53
            'name' => 'file',
17056 stevensc 54
            'type' => Hidden::class,
17002 efrain 55
            'attributes' => [
56
                'id' => 'file',
57
            ]
58
        ]);
17056 stevensc 59
 
17002 efrain 60
        $this->add([
61
            'name' => 'marketplace',
17056 stevensc 62
            'type' => Hidden::class,
17002 efrain 63
            'attributes' => [
64
                'id' => 'marketplace',
65
            ]
66
        ]);
67
 
68
        $this->add([
69
            'name' => 'status',
17056 stevensc 70
            'type' => Select::class,
17002 efrain 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
 
17055 stevensc 83
        if($internal == Company::INTERNAL_YES) {
17002 efrain 84
            $value_options = [
85
                MicrolearningCapsule::PRIVACY_PRIVATE => 'LABEL_PRIVATE',
86
                MicrolearningCapsule::PRIVACY_PUBLIC => 'LABEL_PUBLIC',
87
            ];
88
        } else {
89
            $value_options = [
90
                MicrolearningCapsule::PRIVACY_PRIVATE => 'LABEL_PRIVATE',
91
            ];
17055 stevensc 92
        }
17002 efrain 93
 
17055 stevensc 94
        $this->add([
17002 efrain 95
            'name' => 'privacy',
17056 stevensc 96
            'type' => Select::class,
17002 efrain 97
            'options' => [
98
                'empty_option' => 'LABEL_PRIVACY',
99
                'value_options' => $value_options,
100
            ],
101
            'attributes' => [
102
                'id' => 'privacy',
103
            ]
17055 stevensc 104
        ]);
17002 efrain 105
 
17055 stevensc 106
        if($internal == Company::INTERNAL_YES) {
17002 efrain 107
            $value_options = [
108
                MicrolearningCapsule::TYPE_FREE => 'LABEL_FREE',
109
                MicrolearningCapsule::TYPE_SELLING => 'LABEL_SELLING',
110
                MicrolearningCapsule::TYPE_PRIVATE => 'LABEL_PRIVATE',
111
            ];
112
        } else {
113
            $value_options = [
114
                MicrolearningCapsule::TYPE_PRIVATE => 'LABEL_PRIVATE',
115
            ];
17055 stevensc 116
        }
17002 efrain 117
 
17055 stevensc 118
        $this->add([
17002 efrain 119
            'name' => 'type',
17056 stevensc 120
            'type' => Select::class,
17002 efrain 121
            'options' => [
122
                'empty_option' => 'LABEL_TYPE',
123
                'value_options' => $value_options,
124
            ],
125
            'attributes' => [
126
                'id' => 'type',
127
            ]
17055 stevensc 128
        ]);
17002 efrain 129
 
130
        $this->add([
131
            'name' => 'cost',
17056 stevensc 132
            'type' => Text::class,
17002 efrain 133
            'attributes' => [
134
                'id'    => 'cost',
135
            ],
136
        ]);
137
    }
138
}