Proyectos de Subversion LeadersLinked - Backend

Rev

Rev 16325 | | Comparar con el anterior | Ultima modificación | Ver Log |

Rev Autor Línea Nro. Línea
16248 efrain 1
<?php
2
 
3
declare(strict_types=1);
4
 
5
namespace LeadersLinked\Form\KnowledgeArea;
6
 
7
use Laminas\Form\Form;
8
 
9
 
10
class KnowledgeAreaCategoryForm extends Form
11
{
12
 
13
    /**
14
     *
15
     * @param int $allowPrivacyPublic
16
     */
17
    public function __construct($allowPrivacyPublic) {
18
        parent::__construct();
19
        $this->setInputFilter(new KnowledgeAreaCategoryFilter());
20
 
21
         $this->add([
22
            'name' => 'name',
23
            'type' => \Laminas\Form\Element\Text::class,
24
            'attributes' => [
25
                'maxlength' 	=> 128,
26
                'id' 			=> 'name',
27
            ]
28
        ]);
29
 
30
 
31
        $this->add([
32
            'name' => 'status',
33
            'type' => \Laminas\Form\Element\Checkbox::class,
34
            'attributes' => [
35
                'id' 			=> 'status',
36
            ],
37
            'options' => [
16766 efrain 38
                'use_hidden_element' => false,
16248 efrain 39
                'unchecked_value' => \LeadersLinked\Model\MyCoachCategory::STATUS_INACTIVE,
40
                'checked_value'=> \LeadersLinked\Model\MyCoachCategory::STATUS_ACTIVE
41
            ]
42
        ]);
43
 
44
        $options = [];
45
        if($allowPrivacyPublic) {
46
            $options = [
16325 efrain 47
                \LeadersLinked\Model\MyCoachCategory::PRIVACY_PUBLIC => 'LABEL_PUBLIC',
16248 efrain 48
                \LeadersLinked\Model\MyCoachCategory::PRIVACY_COMPANY => 'LABEL_COMPANY',
49
            ];
50
        } else {
51
            $options = [
52
                \LeadersLinked\Model\MyCoachCategory::PRIVACY_COMPANY => 'LABEL_COMPANY',
53
            ];
54
        }
55
 
56
 
57
        $this->add([
58
            'name' => 'privacy',
59
            'type' => \Laminas\Form\Element\Select::class,
60
            'attributes' => [
61
                'id' =>  'privacy',
62
            ],
63
            'options' => [
64
                //'disable_inarray_validator' => true,
65
                'value_options' =>  $options
66
            ]
67
        ]);
68
 
69
 
70
 
71
    }
72
 
73
 
74
}
75