Proyectos de Subversion LeadersLinked - Backend

Rev

Rev 17078 | Rev 17235 | Ir a la última revisión | Mostrar el archivo completo | | | Autoría | Ultima modificación | Ver Log |

Rev 17078 Rev 17178
Línea 3... Línea 3...
3
declare(strict_types=1);
3
declare(strict_types=1);
Línea 4... Línea 4...
4
 
4
 
Línea 5... Línea 5...
5
namespace LeadersLinked\Form\Microlearning;
5
namespace LeadersLinked\Form\Microlearning;
6
 
6
 
7
use Laminas\Form\Form;
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;
-
 
Línea 14... Línea 8...
14
use LeadersLinked\Model\MicrolearningCapsule;
8
use Laminas\Form\Element\Textarea;
15
use LeadersLinked\Model\Company;
9
use Laminas\Form\Element\Hidden;
Línea 16... Línea 10...
16
 
10
 
17
class CapsuleEditForm extends Form
11
class CapsuleEditForm extends Form
18
{
12
{
19
 
13
 
Línea 20... Línea 14...
20
    public function __construct($internal = false) 
14
    public function __construct() 
21
    {
15
    {
22
        parent::__construct();
16
        parent::__construct();
23
        $this->setInputFilter(new CapsuleEditFilter());
17
        $this->setInputFilter(new CapsuleEditFilter());
24
 
18
 
25
        
19
        
26
        $this->add([
20
        $this->add([
Línea 27... Línea 21...
27
            'name' => 'name',
21
            'name' => 'name',
28
            'type' => \Laminas\Form\Element\Textarea::class,
22
            'type' => Textarea::class,
29
            'attributes' => [
23
            'attributes' => [
30
                'id'    => 'name',
24
                'id'    => 'name',
31
            ]
25
            ]
32
        ]);
26
        ]);
33
        
27
        
Línea 34... Línea 28...
34
        $this->add([
28
        $this->add([
35
            'name' => 'description',
29
            'name' => 'description',
36
            'type' => \Laminas\Form\Element\Textarea::class,
30
            'type' => Textarea::class,
37
            'attributes' => [
31
            'attributes' => [
38
                'id'    => 'description',
32
                'id'    => 'description',
39
            ]
33
            ]
40
        ]);
34
        ]);
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
        
-
 
76
        if($internal == Company::INTERNAL_YES) {
-
 
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
            ]
-
 
97
        ]);
-
 
98
        
-
 
99
        if($internal == Company::INTERNAL_YES) {
-
 
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
            ]
-
 
121
        ]);
-
 
122
        
-
 
123
        $this->add([
35
        
124
            'name' => 'cost',
36
        $this->add([