Proyectos de Subversion LeadersLinked - Backend

Rev

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

<?php

declare(strict_types=1);

namespace LeadersLinked\Form\FastSurvey;

use Laminas\Form\Form;
use LeadersLinked\Model\FastSurvey;


class FastSurveyForm extends Form
{

    public function __construct() 
    {
        parent::__construct();
        $this->setInputFilter(new FastSurveyFilter());
        

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

        
        $this->add([
            'name' => 'number_of_answers',
            'type' => \Laminas\Form\Element\Select::class,
            'attributes' => [
                'id' => 'number_of_answers',
            ],
            'options' => [
                'value_options' => [
                    2 => '2',
                    3 => '3',
                    4 => '4',
                    5 => '5'
                ]
            ]
        ]);
        
        $this->add([
            'name' => 'answer1',
            'type' => \Laminas\Form\Element\Text::class,
            'attributes' => [
                'maxlength'     => 100,
                'id'                    => 'answer1',
            ]
        ]);
        
        $this->add([
            'name' => 'answer2',
            'type' => \Laminas\Form\Element\Text::class,
            'attributes' => [
                'maxlength'     => 100,
                'id'                    => 'answer2',
            ]
        ]);
        
        $this->add([
            'name' => 'answer3',
            'type' => \Laminas\Form\Element\Text::class,
            'attributes' => [
                'maxlength'     => 100,
                'id'                    => 'answer3',
            ]
        ]);
        
        
        $this->add([
            'name' => 'answer4',
            'type' => \Laminas\Form\Element\Text::class,
            'attributes' => [
                'maxlength'     => 100,
                'id'                    => 'answer4',
            ]
        ]);
        
        $this->add([
            'name' => 'answer5',
            'type' => \Laminas\Form\Element\Text::class,
            'attributes' => [
                'maxlength'     => 100,
                'id'                    => 'answer5',
            ]
        ]);
        
        
        $this->add([
            'name' => 'privacy',
            'type' => \Laminas\Form\Element\Select::class,
            'attributes' => [
                'id' => 'privacy',
            ],
            'options' => [
                'value_options' => [
                    FastSurvey::PRIVACY_COMPANY => 'LABEL_COMPANY',
                    FastSurvey::PRIVACY_PUBLIC => 'LABEL_PUBLIC',
                ]
            ]
        ]);
        
        $this->add([
            'name' => 'result_type',
            'type' => \Laminas\Form\Element\Select::class,
            'attributes' => [
                'id' => 'result_type',
            ],
            'options' => [
                'value_options' => [
                    FastSurvey::RESULT_TYPE_PRIVATE => 'LABEL_PRIVATE',
                    FastSurvey::RESULT_TYPE_PUBLIC => 'LABEL_PUBLIC',
                ]
            ]
        ]);
        
        
        $this->add([
            'name' => 'duration_days',
            'type' => \Laminas\Form\Element\Number::class,
            'attributes' => [
                'min'   => 1,
                'max'   => 29,
                'step'  => 1,
                'id'    => 'duration_days',
            ]
        ]);
        
        $this->add([
            'name' => 'duration_hours',
            'type' => \Laminas\Form\Element\Number::class,
            'attributes' => [
                'min'   => 0,
                'max'   => 23,
                'step'  => 1,
                'id'    => 'duration_hours',
            ]
        ]);
        
        $this->add([
            'name' => 'duration_minutes',
            'type' => \Laminas\Form\Element\Number::class,
            'attributes' => [
                'min'   => 0,
                'max'   => 59,
                'step'  => 1,
                'id'    => 'duration_minutes',
            ]
        ]);
    }
}