Proyectos de Subversion LeadersLinked - Backend

Rev

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

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