Proyectos de Subversion LeadersLinked - Backend

Rev

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

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