/** {@inheritdoc} */ public function init() { parent::init(); $this->_types = $this->getOption('customFieldManager')->getFields(); $fields = new \Zend\Form\Fieldset('Fields'); $inputFilterField = new \Zend\InputFilter\InputFilter(); foreach ($this->_types as $name => $type) { if ($type == 'clob') { $element = new \Zend\Form\Element\Textarea($name); } else { $element = new \Zend\Form\Element\Text($name); } if ($name == 'TAG') { $element->setLabel('Category'); } else { $element->setLabel($name); } $fields->add($element); $filter = array('name' => $name, 'required' => false, 'filters' => array(array('name' => 'Callback', 'options' => array('callback' => array($this, 'filterField'), 'callback_params' => $type))), 'validators' => array(array('name' => 'Callback', 'options' => array('callback' => array($this, 'validateField'), 'callbackOptions' => $type)))); $inputFilterField->add($filter); } $this->add($fields); $submit = new \Library\Form\Element\Submit('Submit'); $submit->setLabel('Change'); $this->add($submit); $inputFilter = new \Zend\InputFilter\InputFilter(); $inputFilter->add($inputFilterField, 'Fields'); $this->setInputFilter($inputFilter); }
/** {@inheritdoc} */ public function init() { parent::init(); $preferences = $this->get('Preferences'); $inputFilter = new \Zend\InputFilter\InputFilter(); $integerFilter = array('name' => 'Callback', 'options' => array('callback' => array($this, 'normalize'), 'callback_params' => 'integer')); $integerValidator = new \Zend\Validator\Callback(array('callback' => array($this, 'validateType'), 'callbackOptions' => 'integer')); $contactInterval = new \Zend\Form\Element\Text('contactInterval'); $contactInterval->setLabel('Agent contact interval (in hours)')->setAttribute('size', 5); $preferences->add($contactInterval); $validatorChain = new \Zend\Validator\ValidatorChain(); $validatorChain->attach($integerValidator, true)->attachByName('GreaterThan', array('min' => 0)); $inputFilter->add(array('name' => 'contactInterval', 'filters' => array($integerFilter), 'validators' => $validatorChain)); $inventoryInterval = new \Zend\Form\Element\Text('inventoryInterval'); $inventoryInterval->setLabel('Inventory interval (in days, 0 = always, -1 = never)')->setAttribute('size', 5); $preferences->add($inventoryInterval); $validatorChain = new \Zend\Validator\ValidatorChain(); $validatorChain->attach($integerValidator, true)->attachByName('GreaterThan', array('min' => -2)); $inputFilter->add(array('name' => 'inventoryInterval', 'filters' => array($integerFilter), 'validators' => $validatorChain)); $agentWhitelistFile = new \Zend\Form\Element\Text('agentWhitelistFile'); $agentWhitelistFile->setLabel('File with allowed non-OCS agents (FusionInventory etc.)'); $preferences->add($agentWhitelistFile); $inputFilter->add(array('name' => 'agentWhitelistFile', 'required' => false, 'validators' => array(array('name' => 'Library\\Validator\\FileReadable')))); $parentFilter = new \Zend\InputFilter\InputFilter(); $parentFilter->add($inputFilter, 'Preferences'); $this->setInputFilter($parentFilter); }
/** {@inheritdoc} */ public function init() { parent::init(); $what = new \Zend\Form\Element\Radio('What'); $what->setValueOptions(array(\Model\Client\Client::MEMBERSHIP_AUTOMATIC => $this->_('Store search parameters. Group memberships will be updated automatically.'), \Model\Client\Client::MEMBERSHIP_ALWAYS => $this->_('Add current search results. Group memberships will be set only this time.'), \Model\Client\Client::MEMBERSHIP_NEVER => $this->_('Exclude search results from a group.'))); $what->setValue(\Model\Client\Client::MEMBERSHIP_AUTOMATIC); $this->add($what); $where = new \Zend\Form\Element\Radio('Where'); $where->setValueOptions(array('new' => $this->_('Store in new group'), 'existing' => $this->_('Store in existing group'))); $where->setValue('new')->setAttribute('onchange', 'selectElements()'); $this->add($where); $newGroup = new \Zend\Form\Element\Text('NewGroup'); $newGroup->setLabel('Name'); $this->add($newGroup); $description = new \Zend\Form\Element\Text('Description'); $description->setLabel('Description'); $this->add($description); $existingGroup = new \Library\Form\Element\SelectSimple('ExistingGroup'); $existingGroup->setLabel('Group'); $groups = array(); foreach ($this->getOption('GroupManager')->getGroups(null, null, 'Name') as $group) { $groups[] = $group['Name']; } $existingGroup->setValueOptions($groups); $this->add($existingGroup); $submit = new \Library\Form\Element\Submit('Submit'); $submit->setLabel('OK'); $this->add($submit); $inputFilter = new \Zend\InputFilter\InputFilter(); $inputFilter->add(array('name' => 'NewGroup', 'continue_if_empty' => true, 'filters' => array(array('name' => 'StringTrim')), 'validators' => array(array('name' => 'Callback', 'options' => array('callback' => array($this, 'validateLength'), 'callbackOptions' => array(0, 255), 'message' => $this->_('The input is more than 255 characters long')), 'break_chain_on_failure' => true), array('name' => 'Callback', 'options' => array('callback' => array($this, 'validateLength'), 'callbackOptions' => array(1, 255), 'message' => "Value is required and can't be empty"), 'break_chain_on_failure' => true), array('name' => 'Callback', 'options' => array('callback' => array($this, 'validateGroupExists'), 'message' => $this->_('The name already exists')))))); $inputFilter->add(array('name' => 'Description', 'required' => false, 'filters' => array(array('name' => 'StringTrim'), array('name' => 'Null', 'options' => array('type' => 'string'))), 'validators' => array(array('name' => 'Callback', 'options' => array('callback' => array($this, 'validateLength'), 'callbackOptions' => array(0, 255), 'message' => $this->_('The input is more than 255 characters long')))))); $this->setInputFilter($inputFilter); }
public function __construct($name = null, $options = array()) { parent::__construct('user', $options); $this->setInputFilter(new UserFilter()); $this->setAttribute('methos', 'post'); $id = new \Zend\Form\Element\Hidden('id'); $this->add($id); $nome = new \Zend\Form\Element\Text("nome"); $nome->setLabel("Nome")->setAttribute('placeholder', 'Entre com o nome'); $this->add($nome); $email = new \Zend\Form\Element\Text("email"); $email->setLabel("Email")->setAttribute('placeholder', 'Entre com o email'); $this->add($email); $cpf = new \Zend\Form\Element\Text("cpf"); $cpf->setLabel("CPF")->setAttribute('placeholder', 'Entre com o CPF'); $this->add($cpf); $passsword = new \Zend\Form\Element\Password("password"); $passsword->setLabel("Senha")->setAttribute('placeholder', 'Entre com a Senha'); $this->add($passsword); $confirmation = new \Zend\Form\Element\Password("confirmation"); $confirmation->setLabel("Redigite: ")->setAttribute('placeholder', 'Redigite a Senha'); $this->add($confirmation); $csrf = new \Zend\Form\Element\Csrf("security"); $this->add($csrf); $this->add(array('name' => 'submit', 'type' => 'Zend\\Form\\Element\\Submit', 'attributes' => array('value' => 'Salvar', 'class' => 'btn-success'))); }
public function __construct($name = null, array $modulos = null) { parent::__construct('aula'); $this->modulos = $modulos; $this->setInputFilter(new AulaFilter()); $this->setAttribute('method', 'post'); $id = new \Zend\Form\Element\Hidden('id'); $this->add($id); $descricao = new \Zend\Form\Element\Text("descricao"); $descricao->setLabel("Descricao: ")->setAttribute('placeholder', 'Entre com a descrição'); $this->add($descricao); $modulo = new Select(); $modulo->setLabel("Modulo: ")->setName("modulo")->setOptions(array('value_options' => $this->modulos)); $this->add($modulo); $videos = new \Zend\Form\Element\Text("videos"); $videos->setLabel("Dados Videos: ")->setAttribute('placeholder', 'Entre com os dados do video'); $this->add($videos); $allSituacao = array_merge(array(0 => 'DESATIVADO', 1 => 'ATIVADO')); $situacao = new Select(); $situacao->setLabel("Situacao: ")->setName("situacao")->setOptions(array('value_options' => $allSituacao)); $this->add($situacao); $material = new \Zend\Form\Element\Text("material"); $material->setLabel("Mateirla")->setAttribute('placeholder', 'Entre com a URL do Material'); $this->add($material); $this->add(array('name' => 'submit', 'type' => 'Zend\\Form\\Element\\Submit', 'attributes' => array('value' => 'Salvar', 'class' => 'btn-success'))); }
/** {@inheritdoc} */ public function init() { parent::init(); $preferences = $this->get('Preferences'); $inputFilter = new \Zend\InputFilter\InputFilter(); $communicationServerUri = new \Zend\Form\Element\Text('communicationServerUri'); $communicationServerUri->setLabel('Communication server URI'); $preferences->add($communicationServerUri); $inputFilter->add(array('name' => 'communicationServerUri', 'validators' => array(array('name' => 'Uri', 'options' => array('uriHandler' => 'Zend\\Uri\\Http', 'allowRelative' => false))))); $lockValidity = new \Zend\Form\Element\Text('lockValidity'); $lockValidity->setLabel('Maximum seconds to lock a computer')->setAttribute('size', 5); $preferences->add($lockValidity); $inputFilter->add($this->_getIntegerFilter('lockValidity')); $sessionValidity = new \Zend\Form\Element\Text('sessionValidity'); $sessionValidity->setLabel('Maximum duration of an agent session in seconds')->setAttribute('size', 5); $preferences->add($sessionValidity); $inputFilter->add($this->_getIntegerFilter('sessionValidity')); $sessionCleanupInterval = new \Zend\Form\Element\Text('sessionCleanupInterval'); $sessionCleanupInterval->setLabel('Interval in seconds to cleanup sessions')->setAttribute('size', 5); $preferences->add($sessionCleanupInterval); $inputFilter->add($this->_getIntegerFilter('sessionCleanupInterval')); $sessionRequired = new \Zend\Form\Element\Checkbox('sessionRequired'); $sessionRequired->setLabel('Session required for inventory'); $preferences->add($sessionRequired); $logLevel = new \Library\Form\Element\SelectSimple('logLevel'); $logLevel->setLabel('Log level')->setValueOptions(array(0, 1, 2)); $preferences->add($logLevel); $autoMergeDuplicates = new \Zend\Form\Element\Checkbox('autoMergeDuplicates'); $autoMergeDuplicates->setLabel('Merge duplicates automatically (not recommended)'); $preferences->add($autoMergeDuplicates); $parentFilter = new \Zend\InputFilter\InputFilter(); $parentFilter->add($inputFilter, 'Preferences'); $this->setInputFilter($parentFilter); }
/** {@inheritdoc} */ public function init() { parent::init(); $preferences = $this->get('Preferences'); $inputFilter = new \Zend\InputFilter\InputFilter(); $scannersPerSubnet = new \Zend\Form\Element\Text('scannersPerSubnet'); $scannersPerSubnet->setLabel('Number of scanning computers per subnet')->setAttribute('size', 5); $preferences->add($scannersPerSubnet); $inputFilter->add($this->_getIntegerFilter('scannersPerSubnet', -1)); $scanSnmp = new \Zend\Form\Element\Checkbox('scanSnmp'); $scanSnmp->setLabel('Use SNMP'); $preferences->add($scanSnmp); $scannerMinDays = new \Zend\Form\Element\Text('scannerMinDays'); $scannerMinDays->setLabel('Minimum days before a scanning computer is replaced')->setAttribute('size', 5); $preferences->add($scannerMinDays); $inputFilter->add($this->_getIntegerFilter('scannerMinDays', 0)); $scannerMaxDays = new \Zend\Form\Element\Text('scannerMaxDays'); $scannerMaxDays->setLabel('Maximum days before a scanning computer is replaced')->setAttribute('size', 5); $preferences->add($scannerMaxDays); $inputFilter->add($this->_getIntegerFilter('scannerMaxDays', 0)); $scanArpDelay = new \Zend\Form\Element\Text('scanArpDelay'); $scanArpDelay->setLabel('Delay (in milliseconds) between ARP requests')->setAttribute('size', 5); $preferences->add($scanArpDelay); $inputFilter->add($this->_getIntegerFilter('scanArpDelay', 9)); $parentFilter = new \Zend\InputFilter\InputFilter(); $parentFilter->add($inputFilter, 'Preferences'); $this->setInputFilter($parentFilter); }
/** {@inheritdoc} */ public function init() { parent::init(); $types = new \Zend\Form\Fieldset('Types'); $this->add($types); $inputFilterTypes = new \Zend\InputFilter\InputFilter(); $this->_definedTypes = $this->getOption('DeviceManager')->getTypeCounts(); foreach ($this->_definedTypes as $name => $count) { $element = new \Zend\Form\Element\Text($name); $element->setValue($name); $types->add($element); $filter = array('name' => $name, 'required' => true, 'filters' => array(array('name' => 'StringTrim')), 'validators' => array(array('name' => 'StringLength', 'options' => array('min' => 1, 'max' => 255)), array('name' => 'Callback', 'options' => array('callback' => array($this, 'validateName'), 'callbackOptions' => $name, 'message' => $this->_('The name already exists'))))); $inputFilterTypes->add($filter); } $add = new \Zend\Form\Element\Text('Add'); $add->setLabel('Add'); $this->add($add); $submit = new \Library\Form\Element\Submit('Submit'); $submit->setLabel('Change'); $this->add($submit); $inputFilter = new \Zend\InputFilter\InputFilter(); $inputFilter->add($inputFilterTypes, 'Types'); $inputFilter->add(array('name' => 'Add', 'required' => false, 'filters' => array(array('name' => 'StringTrim')), 'validators' => array(array('name' => 'StringLength', 'options' => array('max' => 255)), array('name' => 'Callback', 'options' => array('callback' => array($this, 'validateName'), 'message' => $this->_('The name already exists')))))); $this->setInputFilter($inputFilter); }
/** {@inheritdoc} */ public function init() { parent::init(); $translatedTypes = array('text' => $this->_('Text'), 'clob' => $this->_('Long text'), 'integer' => $this->_('Integer'), 'float' => $this->_('Float'), 'date' => $this->_('Date')); $fields = new \Zend\Form\Fieldset('Fields'); $this->add($fields); $inputFilterFields = new \Zend\InputFilter\InputFilter(); foreach ($this->getOption('CustomFieldManager')->getFields() as $name => $type) { if ($name == 'TAG') { // Static field, can not be edited continue; } $this->_definedFields[$name] = $translatedTypes[$type]; $element = new \Zend\Form\Element\Text($name); $element->setValue($name); $fields->add($element); $filter = array('name' => $name, 'required' => true, 'filters' => array(array('name' => 'StringTrim')), 'validators' => array(array('name' => 'StringLength', 'options' => array('min' => 1, 'max' => 255)), array('name' => 'Callback', 'options' => array('callback' => array($this, 'validateName'), 'callbackOptions' => $name, 'message' => $this->_('The name already exists'))))); $inputFilterFields->add($filter); } // Empty text field to create new field. $newName = new \Zend\Form\Element\Text('NewName'); $newName->setLabel('Add'); $this->add($newName); // Datatype of new field $newType = new \Zend\Form\Element\Select('NewType'); $newType->setValueOptions($translatedTypes); $this->add($newType); $submit = new \Library\Form\Element\Submit('Submit'); $submit->setLabel('Change'); $this->add($submit); $inputFilter = new \Zend\InputFilter\InputFilter(); $inputFilter->add($inputFilterFields, 'Fields'); $inputFilter->add(array('name' => 'NewName', 'required' => false, 'filters' => array(array('name' => 'StringTrim')), 'validators' => array(array('name' => 'StringLength', 'options' => array('max' => 255)), array('name' => 'Callback', 'options' => array('callback' => array($this, 'validateName'), 'message' => $this->_('The name already exists')))))); $this->setInputFilter($inputFilter); }
function __construct($name = null, $options = array()) { parent::__construct('produto', $options); $id = new \Zend\Form\Element\Hidden('id'); $this->add($id); $nome = new \Zend\Form\Element\Text('nome'); $nome->setLabel('Nome:')->setAttribute('placeholder', 'Entre com o Nome'); $this->add($nome); $this->add(array('name' => 'Submit', 'type' => '\\Zend\\Form\\Element\\Submit', 'attributes' => array('value' => 'Salvar', 'class' => 'btn-success'))); }
public function __construct($name = null) { parent::__construct('resources'); $this->setAttribute('method', 'post'); $id = new \Zend\Form\Element\Hidden('id'); $this->add($id); $nome = new \Zend\Form\Element\Text("nome"); $nome->setLabel("Nome: ")->setAttribute('placeholder', "Entre com o nome"); $this->add($nome); $this->add(array('name' => 'submit', 'type' => 'Zend\\Form\\Element\\Submit', 'attributes' => array('value' => 'Salvar', 'class' => 'btn-success'))); }
public function __construct($name = null, $options = array()) { parent::__construct('Login', $options); $this->setAttribute('method', 'post'); $email = new \Zend\Form\Element\Text("email"); $email->setLabel("Email: ")->setAttribute('placeholder', 'Entre com o Email')->setAttribute('autofocus', 'autofocus'); $this->add($email); $password = new \Zend\Form\Element\Password("password"); $password->setLabel("Password: ")->setAttribute('placeholder', 'Entre com a senha'); $this->add($password); $this->add(array('name' => 'submit', 'type' => 'Zend\\Form\\Element\\Submit', 'attributes' => array('value' => 'Autenticar', 'class' => 'btn btn-success'))); }
/** {@inheritdoc} */ public function init() { parent::init(); $name = new \Zend\Form\Element\Text('Name'); $name->setLabel('Name'); $this->add($name); $submit = new \Library\Form\Element\Submit('Submit'); $submit->setLabel('OK'); $this->add($submit); $inputFilter = new \Zend\InputFilter\InputFilter(); $inputFilter->add(array('name' => 'Name', 'required' => false, 'filters' => array(array('name' => 'StringTrim')), 'validators' => array(array('name' => 'StringLength', 'options' => array('max' => 255))))); $this->setInputFilter($inputFilter); }
/** {@inheritdoc} */ public function init() { parent::init(); $key = new \Zend\Form\Element\Text('Key'); $key->setLabel('Product key (if different)'); $this->add($key); $submit = new \Library\Form\Element\Submit('Submit'); $submit->setLabel('OK'); $this->add($submit); $inputFilter = new \Zend\InputFilter\InputFilter(); $inputFilter->add(array('name' => 'Key', 'required' => false, 'filters' => array(array('name' => 'StringTrim'), array('name' => 'StringToUpper')), 'validators' => array(array('name' => 'Library\\Validator\\ProductKey')))); $this->setInputFilter($inputFilter); }
public function __construct($name = null, $options = array()) { parent::__construct($name, $options); $this->setAttribute('method', 'post'); $email = new \Zend\Form\Element\Text("email"); $email->setLabel("Email: ")->setAttribute('placeholder', 'Email')->setAttribute('class', 'form-control'); $this->add($email); $password = new \Zend\Form\Element\Password("password"); $password->setLabel("Password: "******"submit"); $submit->setAttribute('value', 'Entrar')->setAttribute('class', 'btn btn-primary btn-block btn-flat'); $this->add($submit); }
public function __construct($name = null, $options = array()) { parent::__construct('professor', $options); $this->setInputFilter(new ProfessorFilter()); $this->setAttribute('method', 'post'); $id = new \Zend\Form\Element\Hidden('id'); $this->add($id); $nome = new \Zend\Form\Element\Text("nome"); $nome->setLabel("Nome: ")->setAttribute('placeholder', 'Entre com o nome'); $this->add($nome); $cpf = new \Zend\Form\Element\Text("cpf"); $cpf->setLabel("CPF: ")->setAttribute('placeholder', 'Entre com o CPF'); $this->add($cpf); $this->add(array('name' => 'submit', 'type' => 'Zend\\Form\\Element\\Submit', 'attributes' => array('value' => 'Salvar', 'class' => 'btn-success'))); }
public function __construct($name = null, $options = array()) { parent::__construct('curso', $options); $this->setInputFilter(new CursoFilter()); $this->setAttribute('method', 'post'); $id = new \Zend\Form\Element\Hidden('id'); $this->add($id); $descricao = new \Zend\Form\Element\Text("descricao"); $descricao->setLabel("Descrição: ")->setAttribute('placeholder', 'Entre com a Descrição do Curso'); $this->add($descricao); $duracao = new \Zend\Form\Element\Text("duracao"); $duracao->setLabel("Duração: ")->setAttribute('placeholder', 'Entre com a duração do curso'); $this->add($duracao); $this->add(array('name' => 'submit', 'type' => 'Zend\\Form\\Element\\Submit', 'attributes' => array('value' => 'Salvar', 'class' => 'btn-success'))); }
/** {@inheritdoc} */ public function init() { parent::init(); $type = new \Library\Form\Element\SelectSimple('Type'); $type->setLabel('Type')->setValueOptions($this->getOption('DeviceManager')->getTypes()); $this->add($type); $description = new \Zend\Form\Element\Text('Description'); $description->setLabel('Description'); $this->add($description); $submit = new \Library\Form\Element\Submit('Submit'); $submit->setLabel('OK'); $this->add($submit); $inputFilter = new \Zend\InputFilter\InputFilter(); $inputFilter->add(array('name' => 'Description', 'required' => false, 'filters' => array(array('name' => 'StringTrim')), 'validators' => array(array('name' => 'StringLength', 'options' => array('max' => 255))))); $this->setInputFilter($inputFilter); }
public function __construct($name = null, array $aulas = null) { parent::__construct('aula'); $this->aulas = $aulas; $this->setInputFilter(new QuestaoFilter()); $this->setAttribute('method', 'post'); $id = new \Zend\Form\Element\Hidden('id'); $this->add($id); $descricao = new \Zend\Form\Element\Text("descricao"); $descricao->setLabel("Descrição: ")->setAttribute('placeholder', 'Entre com a Descrição do Modulo'); $this->add($descricao); $aula = new Select(); $aula->setLabel("Aula: ")->setName("aula")->setOptions(array('value_options' => $this->aulas)); $this->add($aula); $this->add(array('name' => 'submit', 'type' => 'Zend\\Form\\Element\\Submit', 'attributes' => array('value' => 'Salvar', 'class' => 'btn-success'))); }
/** {@inheritdoc} */ public function init() { parent::init(); $user = new \Zend\Form\Element\Text('User'); $user->setLabel('Username'); $this->add($user); $password = new \Zend\Form\Element\Password('Password'); $password->setLabel('Password'); $this->add($password); $submit = new \Library\Form\Element\Submit('Submit'); $submit->setLabel('Login'); $this->add($submit); $inputFilter = $this->getInputFilter(); $inputFilter->get('User')->setAllowEmpty(true); $inputFilter->get('Password')->setAllowEmpty(true); }
public function __construct($name = null, array $parent = null) { parent::__construct('roles'); $this->parent = $parent; $this->setAttribute('method', 'post'); $id = new \Zend\Form\Element\Hidden('id'); $this->add($id); $nome = new \Zend\Form\Element\Text("nome"); $nome->setLabel("Nome: ")->setAttribute('placeholder', "Entre com o nome"); $this->add($nome); $allParent = array_merge(array(0 => 'Nenhum'), $this->parent); $parent = new Select(); $parent->setLabel("Herda: ")->setName("parent")->setOptions(array('value_options' => $allParent)); $this->add($parent); $isAdmin = new \Zend\Form\Element\Checkbox("isAdmin"); $isAdmin->setLabel("Admin?: "); $this->add($isAdmin); $this->add(array('name' => 'submit', 'type' => 'Zend\\Form\\Element\\Submit', 'attributes' => array('value' => 'Salvar', 'class' => 'btn-success'))); }
public function __construct($name = null, array $roles = null, array $resources = null) { parent::__construct($name); $this->roles = $roles; $this->resources = $resources; $this->setAttribute('method', 'post'); $id = new \Zend\Form\Element\Hidden('id'); $this->add($id); $nome = new \Zend\Form\Element\Text("nome"); $nome->setLabel("Nome: ")->setAttribute('placeholder', "Entre com o nome"); $this->add($nome); $role = new Select(); $role->setLabel("Role: ")->setName("role")->setOptions(array('value_options' => $roles)); $this->add($role); $resource = new Select(); $resource->setLabel("Resource: ")->setName("resource")->setOptions(array('value_options' => $resources)); $this->add($resource); $this->add(array('name' => 'submit', 'type' => 'Zend\\Form\\Element\\Submit', 'attributes' => array('value' => 'Salvar', 'class' => 'btn-success'))); }
/** {@inheritdoc} */ public function init() { parent::init(); $preferences = $this->get('Preferences'); $inputFilter = new \Zend\InputFilter\InputFilter(); $packageDeployment = new \Zend\Form\Element\Checkbox('packageDeployment'); $packageDeployment->setLabel('Enable package download'); $preferences->add($packageDeployment); $packagePath = new \Zend\Form\Element\Text('packagePath'); $packagePath->setLabel('Package storage directory'); $preferences->add($packagePath); $inputFilter->add(array('name' => 'packagePath', 'validators' => array(array('name' => 'Library\\Validator\\DirectoryWritable')))); $packageBaseUriHttp = new \Zend\Form\Element\Text('packageBaseUriHttp'); $packageBaseUriHttp->setLabel('HTTP package base URL'); $preferences->add($packageBaseUriHttp); $inputFilter->add(array('name' => 'packageBaseUriHttp', 'filters' => array(array('name' => 'StringTrim'), array('name' => 'PregReplace', 'options' => array('pattern' => '#(.*://|/$)#', 'replacement' => ''))), 'validators' => array(array('name' => 'Callback', 'options' => array('callback' => array($this, 'validateUri')))))); $packageBaseUriHttps = new \Zend\Form\Element\Text('packageBaseUriHttps'); $packageBaseUriHttps->setLabel('HTTPS package base URL'); $preferences->add($packageBaseUriHttps); $inputFilter->add(array('name' => 'packageBaseUriHttps', 'filters' => array(array('name' => 'StringTrim'), array('name' => 'PregReplace', 'options' => array('pattern' => '#(.*://|/$)#', 'replacement' => ''))), 'validators' => array(array('name' => 'Callback', 'options' => array('callback' => array($this, 'validateUri')))))); $downloadPeriodDelay = new \Zend\Form\Element\Text('downloadPeriodDelay'); $downloadPeriodDelay->setLabel('Delay (in seconds) between periods')->setAttribute('size', 5); $preferences->add($downloadPeriodDelay); $inputFilter->add($this->_getIntegerFilter('downloadPeriodDelay')); $downloadCycleDelay = new \Zend\Form\Element\Text('downloadCycleDelay'); $downloadCycleDelay->setLabel('Delay (in seconds) between cycles')->setAttribute('size', 5); $preferences->add($downloadCycleDelay); $inputFilter->add($this->_getIntegerFilter('downloadCycleDelay')); $downloadFragmentDelay = new \Zend\Form\Element\Text('downloadFragmentDelay'); $downloadFragmentDelay->setLabel('Delay (in seconds) between fragments')->setAttribute('size', 5); $preferences->add($downloadFragmentDelay); $inputFilter->add($this->_getIntegerFilter('downloadFragmentDelay')); $downloadMaxPriority = new \Library\Form\Element\SelectSimple('downloadMaxPriority'); $downloadMaxPriority->setLabel('Maximum package priority (packages with higher value will not be downloaded)')->setValueOptions(range(0, 10)); $preferences->add($downloadMaxPriority); $downloadTimeout = new \Zend\Form\Element\Text('downloadTimeout'); $downloadTimeout->setLabel('Timeout (in days)')->setAttribute('size', 5); $preferences->add($downloadTimeout); $inputFilter->add($this->_getIntegerFilter('downloadTimeout')); $parentFilter = new \Zend\InputFilter\InputFilter(); $parentFilter->add($inputFilter, 'Preferences'); $this->setInputFilter($parentFilter); }
public function __construct($name = null, array $cursos = null, array $professores = null) { parent::__construct('modulo'); $this->cursos = $cursos; $this->professores = $professores; $this->setInputFilter(new ModuloFilter()); $this->setAttribute('method', 'post'); $id = new \Zend\Form\Element\Hidden('id'); $this->add($id); $descricao = new \Zend\Form\Element\Text("descricao"); $descricao->setLabel("Descrição: ")->setAttribute('placeholder', 'Entre com a Descrição do Modulo'); $this->add($descricao); $curso = new Select(); $curso->setLabel("Cusro: ")->setName("curso")->setOptions(array('value_options' => $this->cursos)); $this->add($curso); $professor = new Select(); $professor->setLabel("Professor: ")->setName("professor")->setOptions(array('value_options' => $this->professores)); $this->add($professor); $this->add(array('name' => 'submit', 'type' => 'Zend\\Form\\Element\\Submit', 'attributes' => array('value' => 'Salvar', 'class' => 'btn-success'))); }
public function __construct($em) { parent::__construct('contact'); $element = new \Zend\Form\Element\Text('prenom'); $element->setLabel('Prénom'); $this->add($element); $element = new \Zend\Form\Element\Text('nom'); $element->setLabel('Nom'); $this->add($element); $element = new \Zend\Form\Element\Email('email'); $element->setLabel('Email'); $this->add($element); $element = new \Zend\Form\Element\Text('telephone'); $element->setLabel('Téléphone'); $this->add($element); $this->add(array('type' => 'DoctrineModule\\Form\\Element\\ObjectSelect', 'name' => 'societe', 'options' => array('label' => 'Société', 'object_manager' => $em, 'target_class' => \AddressBook\Entity\Societe::class, 'property' => 'nom', 'display_empty_item' => true, 'empty_item_label' => '-- Pas de société --'))); // $element = new \Zend\Form\Element\Submit('submit'); // $element->setValue('Ajouter'); // $this->add($element); }
/** {@inheritdoc} */ public function init() { parent::init(); $preferences = $this->get('Preferences'); $inputFilter = new \Zend\InputFilter\InputFilter(); $trustedNetworksOnly = new \Zend\Form\Element\Checkbox('trustedNetworksOnly'); $trustedNetworksOnly->setLabel('Limit agent connections to trusted networks'); $preferences->add($trustedNetworksOnly); $inventoryFilter = new \Zend\Form\Element\Checkbox('inventoryFilter'); $inventoryFilter->setLabel('Limit inventory frequency'); $preferences->add($inventoryFilter); $limitInventoryInterval = new \Zend\Form\Element\Text('limitInventoryInterval'); $limitInventoryInterval->setLabel('Seconds between inventory processing')->setAttribute('size', 5); $preferences->add($limitInventoryInterval); $validatorChain = new \Zend\Validator\ValidatorChain(); $validatorChain->attachByName('Callback', array('callback' => array($this, 'validateType'), 'callbackOptions' => 'integer'), true); $validatorChain->attachByName('GreaterThan', array('min' => 0)); $inputFilter->add(array('name' => 'limitInventoryInterval', 'required' => false, 'filters' => array(array('name' => 'Callback', 'options' => array('callback' => array($this, 'normalize'), 'callback_params' => 'integer'))), 'validators' => $validatorChain)); $parentFilter = new \Zend\InputFilter\InputFilter(); $parentFilter->add($inputFilter, 'Preferences'); $this->setInputFilter($parentFilter); }
/** {@inheritdoc} */ public function init() { parent::init(); $preferences = $this->get('Preferences'); $inputFilter = new \Zend\InputFilter\InputFilter(); $saveRawData = new \Zend\Form\Element\Checkbox('saveRawData'); $saveRawData->setLabel('Save incoming raw inventory data'); $preferences->add($saveRawData); $saveDir = new \Zend\Form\Element\Text('saveDir'); $saveDir->setLabel('Target directory'); $preferences->add($saveDir); $saveFormat = new \Zend\Form\Element\Select('saveFormat'); $saveFormat->setLabel('File format')->setValueOptions(array('XML' => $this->_('uncompressed XML'), 'OCS' => $this->_('zlib compressed XML'))); $preferences->add($saveFormat); $inputFilter->add(array('name' => 'saveDir', 'validators' => array(array('name' => 'Library\\Validator\\DirectoryWritable')))); $saveOverwrite = new \Zend\Form\Element\Checkbox('saveOverwrite'); $saveOverwrite->setLabel('Overwrite existing files'); $preferences->add($saveOverwrite); $parentFilter = new \Zend\InputFilter\InputFilter(); $parentFilter->add($inputFilter, 'Preferences'); $this->setInputFilter($parentFilter); }
public function __construct($name = null, $options = array()) { parent::__construct('user', $options); $this->setInputFilter(new UserFilter()); $this->setAttribute('methos', 'post'); $id = new \Zend\Form\Element\Hidden('id'); $this->add($id); $nome = new \Zend\Form\Element\Text('nome'); $nome->setLabel('Nome:')->setAttribute('placeholder', 'Entre com o Nome'); $this->add($nome); $email = new \Zend\Form\Element\Text('email'); $email->setLabel('Email:')->setAttribute('placeholder', 'Entre com o Email'); $this->add($email); $password = new \Zend\Form\Element\Password('password'); $password->setLabel('Password:'******'placeholder', 'Entre com o Password'); $this->add($password); $confirmation = new \Zend\Form\Element\Password('confirmation '); $confirmation->setLabel('Password:'******'placeholder', 'Regidite a Senha '); $this->add($confirmation); $csrf = new \Zend\Form\Element\Csrf('security'); $this->add($csrf); $this->add(array('name' => 'Submit', 'type' => '\\Zend\\Form\\Element\\Submit', 'attributes' => array('value' => 'Salvar', 'class' => 'btn-sucess'))); }
/** {@inheritdoc} */ public function init() { parent::init(); $preferences = $this->get('Preferences'); $inputFilter = new \Zend\InputFilter\InputFilter(); $integerFilter = array('name' => 'Callback', 'options' => array('callback' => array($this, 'normalize'), 'callback_params' => 'integer')); $validatorChain = new \Zend\Validator\ValidatorChain(); $validatorChain->attachByName('Callback', array('callback' => array($this, 'validateType'), 'callbackOptions' => 'integer'), true); $validatorChain->attachByName('GreaterThan', array('min' => 0)); $groupCacheExpirationInterval = new \Zend\Form\Element\Text('groupCacheExpirationInterval'); $groupCacheExpirationInterval->setLabel('Minimum seconds between group cache rebuilds')->setAttribute('size', 5); $preferences->add($groupCacheExpirationInterval); $inputFilter->add(array('name' => 'groupCacheExpirationInterval', 'filters' => array($integerFilter), 'validators' => $validatorChain)); $groupCacheExpirationFuzz = new \Zend\Form\Element\Text('groupCacheExpirationFuzz'); $groupCacheExpirationFuzz->setLabel('Maximum seconds added to above value')->setAttribute('size', 5); $preferences->add($groupCacheExpirationFuzz); $inputFilter->add(array('name' => 'groupCacheExpirationFuzz', 'filters' => array($integerFilter), 'validators' => $validatorChain)); $setGroupPackageStatus = new \Zend\Form\Element\Checkbox('setGroupPackageStatus'); $setGroupPackageStatus->setLabel('Set package status on clients for group-assigned packages'); $preferences->add($setGroupPackageStatus); $parentFilter = new \Zend\InputFilter\InputFilter(); $parentFilter->add($inputFilter, 'Preferences'); $this->setInputFilter($parentFilter); }
public function __construct($name = null, array $questoes = null) { parent::__construct('questao'); $this->questoes = $questoes; $this->setInputFilter(new RespostaFilter()); $this->setAttribute('method', 'post'); $id = new \Zend\Form\Element\Hidden('id'); $this->add($id); $descricao = new \Zend\Form\Element\Text("descricao"); $descricao->setLabel("Descrição: ")->setAttribute('placeholder', 'Entre com a Descrição do Modulo'); $this->add($descricao); $questao = new Select(); $questao->setLabel("Questao: ")->setName("questao")->setOptions(array('value_options' => $this->questoes)); $this->add($questao); $allCorreta = array_merge(array(0 => 'SIM', 1 => 'NÃO')); $correta = new Select(); $correta->setLabel("Correta: ")->setName("correta")->setOptions(array('value_options' => $allCorreta)); $this->add($correta); $allHabilitada = array_merge(array(0 => 'SIM', 1 => 'NÃO')); $habilitada = new Select(); $habilitada->setLabel("Habilitada: ")->setName("habilitada")->setOptions(array('value_options' => $allHabilitada)); $this->add($habilitada); $this->add(array('name' => 'submit', 'type' => 'Zend\\Form\\Element\\Submit', 'attributes' => array('value' => 'Salvar', 'class' => 'btn-success'))); }