Proyectos de Subversion LeadersLinked - Backend

Rev

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

<?php

declare(strict_types=1);

namespace LeadersLinked\Form\KnowledgeArea;

use Laminas\Form\Form;


class KnowledgeAreaCategoryForm extends Form
{

    /**
     * 
     * @param int $allowPrivacyPublic
     */
    public function __construct($allowPrivacyPublic) {
        parent::__construct();
        $this->setInputFilter(new KnowledgeAreaCategoryFilter());

         $this->add([
            'name' => 'name',
            'type' => \Laminas\Form\Element\Text::class,
            'attributes' => [
                'maxlength'     => 128,
                'id'                    => 'name',
            ]
        ]);


        $this->add([
            'name' => 'status',
            'type' => \Laminas\Form\Element\Checkbox::class,
            'attributes' => [
                'id'                    => 'status',
            ],
            'options' => [
                'use_hidden_element' => false,
                'unchecked_value' => \LeadersLinked\Model\MyCoachCategory::STATUS_INACTIVE,
                'checked_value'=> \LeadersLinked\Model\MyCoachCategory::STATUS_ACTIVE
            ]
        ]);
        
        $options = [];
        if($allowPrivacyPublic) {
            $options = [ 
                \LeadersLinked\Model\MyCoachCategory::PRIVACY_PUBLIC => 'LABEL_PUBLIC',
                \LeadersLinked\Model\MyCoachCategory::PRIVACY_COMPANY => 'LABEL_COMPANY',
            ];    
        } else {
            $options = [
                \LeadersLinked\Model\MyCoachCategory::PRIVACY_COMPANY => 'LABEL_COMPANY',
            ]; 
        }
        
        
        $this->add([
            'name' => 'privacy',
            'type' => \Laminas\Form\Element\Select::class,
            'attributes' => [
                'id' =>  'privacy',
            ],
            'options' => [
                //'disable_inarray_validator' => true,
                'value_options' =>  $options
            ]
        ]);
        

        
    }


}