Exemplo n.º 1
0
 public function __construct($name = 'mailchimp-sub-form', $options = array())
 {
     parent::__construct($name, $options);
     $firstName = new Element\Text('firstName');
     $firstName->setLabel('First Name');
     $lastName = new Element\Text('lastName');
     $lastName->setLabel('Last Name');
     $email = new Element\Email('email');
     $email->setLabel('Email Address');
     $emailValidator = new Validator\EmailAddress(array('allow' => Validator\Hostname::ALLOW_DNS, 'domain' => true));
     $email->setValidator($emailValidator);
     $privacyPolicy = new Element\Checkbox('privacyPolicy');
     $privacyPolicy->setLabel('I accept the privacy policy and the terms of use');
     $csrf = new Element\Csrf('mcSubCSRF');
     $submit = new Element\Submit('submit');
     $submit->setValue('Subscribe');
     $this->add($firstName);
     $this->add($lastName);
     $this->add($email);
     $this->add($privacyPolicy);
     $this->add($csrf);
     $this->add($submit);
     $inputFilter = $this->getInputFilter();
     $inputFilter->get($firstName->getName())->setAllowEmpty(false)->setRequired(true);
     $inputFilter->get($lastName->getName())->setAllowEmpty(false)->setRequired(true);
 }
Exemplo n.º 2
0
 /**
  * Init Module form
  *
  * @return void
  */
 public function init()
 {
     $showEmail = new Element\Checkbox('show_email');
     $showEmail->setLabel('Show email');
     $showEmail->setAttribute('required', 'required')->setAttribute('id', 'show-email');
     $username = new Element\Text('username');
     $username->setLabel('Username');
     $username->setAttribute('required', 'required')->setAttribute('id', 'username');
     $email = new Element\Text('email');
     $email->setLabel('Email');
     $email->setAttribute('required', 'required')->setAttribute('id', 'email');
     $message = new Element\Textarea('message');
     $message->setLabel('Message');
     $message->setAttribute('required', 'required')->setAttribute('id', 'message');
     $captchaImage = new CaptchaImage(array('font' => GC_PUBLIC_PATH . '/backend/fonts/arial.ttf', 'width' => 250, 'height' => 50, 'dotNoiseLevel' => 40, 'lineNoiseLevel' => 3));
     $captchaImage->setImgDir(GC_PUBLIC_PATH . '/frontend/tmp');
     $captchaImage->setImgUrl('/frontend/tmp');
     $captcha = new Element\Captcha('captcha');
     $captcha->setLabel('Please verify you are human')->setCaptcha($captchaImage)->setAttribute('required', 'required')->setAttribute('id', 'captcha');
     $this->add($showEmail);
     $this->add($username);
     $this->add($email);
     $this->add($message);
     $this->add($captcha);
     $inputFilterFactory = new InputFilterFactory();
     $inputFilter = $inputFilterFactory->createInputFilter(array('show_email' => array('name' => 'show_email', 'required' => false), 'username' => array('name' => 'username', 'required' => true), 'email' => array('name' => 'email', 'required' => true, 'validators' => array(array('name' => 'email_address'))), 'message' => array('name' => 'message', 'required' => true), 'captcha' => $captcha->getInputSpecification()));
     $this->setInputFilter($inputFilter);
 }
Exemplo n.º 3
0
 public function getForm(array $urlType)
 {
     if ($this->form) {
         return $this->form;
     }
     $form = new Form();
     $form->setAttribute('class', 'form-horizontal');
     $form->setAttribute('role', 'form');
     $form->add(array('name' => 'menuId', 'type' => 'Hidden'));
     $form->add(array('name' => 'title', 'type' => 'text', 'options' => array('label' => 'Title'), 'attributes' => array('class' => 'form-control')));
     $form->add(array('name' => 'description', 'type' => 'Textarea', 'options' => array('label' => 'Description'), 'attributes' => array('class' => 'form-control', 'placeholder' => 'description')));
     $form->add(array('name' => 'icon', 'type' => 'text', 'options' => array('label' => 'Icon'), 'attributes' => array('class' => 'form-control', 'placeholder' => 'Icon Class')));
     $form->add(array('name' => 'url', 'type' => 'text', 'options' => array('label' => 'Url'), 'attributes' => array('class' => 'form-control', 'placeholder' => 'Url')));
     $url_type = new Select('url_type');
     $url_type->setLabel('Type')->setAttribute('class', 'form-control')->setValueOptions($urlType)->setEmptyOption('-- Choose URL Type --');
     $form->add($url_type);
     $hasDivider = new Checkbox('hasDivider');
     $hasDivider->setLabel('Has divider?');
     $form->add($hasDivider);
     $form->add(array('name' => 'parentId', 'type' => 'hidden'));
     $form->add(array('name' => 'priority', 'type' => 'number', 'options' => array('label' => 'Priority'), 'attributes' => array('class' => 'form-control')));
     $form->setInputFilter($this->getInputFilter());
     $this->form = $form;
     return $this->form;
 }
Exemplo n.º 4
0
 public function __construct($name = null)
 {
     parent::__construct($name);
     //id+
     $this->add(array('name' => 'id', 'attributes' => array('type' => 'hidden')));
     //categoria+
     $this->add(array('name' => 'categoria', 'attributes' => array('type' => 'hidden')));
     //xyz+
     $this->add(array('name' => 'xyz', 'attributes' => array('type' => 'hidden')));
     //nome+
     $this->add(array('name' => 'nome', 'attributes' => array('type' => 'hidden')));
     //sessione+
     $this->add(array('name' => 'sessione', 'attributes' => array('type' => 'hidden')));
     //data+
     $this->add(array('name' => 'data', 'attributes' => array('type' => 'hidden')));
     //messaggio+
     $this->add(array('name' => 'messaggio', 'options' => array('label' => 'Messaggio'), 'attributes' => array('type' => 'text', 'class' => 'form-control')));
     // Color+
     $this->add(array('type' => 'Zend\\Form\\Element\\Select', 'name' => 'color', 'options' => array('label' => 'Colore', 'empty_option' => 'Scegli un colore =>'), 'attributes' => array('class' => 'form-control')));
     // Posterlab+
     $this->add(array('type' => 'Zend\\Form\\Element\\Select', 'name' => 'posterlab', 'options' => array('label' => 'Posterlab', 'empty_option' => 'Scegli un posterlab =>'), 'attributes' => array('class' => 'form-control')));
     // tipo+
     $this->add(array('type' => 'Zend\\Form\\Element\\Select', 'name' => 'tipo', 'options' => array('label' => 'Tipo', 'empty_option' => 'Scegli tipo =>'), 'attributes' => array('class' => 'form-control')));
     //stato+
     $stato = new Element\Checkbox('stato');
     $stato->setLabel('Stato');
     $stato->setAttribute('class', 'make-switch');
     $this->add($stato);
     $this->add(array('name' => 'send', 'attributes' => array('type' => 'submit', 'value' => 'Salva', 'class' => 'btn green-haze pull-right')));
 }
Exemplo n.º 5
0
 public function __construct($name = null, array $pais = null)
 {
     parent::__construct($name);
     $this->pais = $pais;
     $this->setAttribute('method', 'POST');
     $id = new \Zend\Form\Element\Hidden('id');
     $this->add($id);
     $nome = new Text('nome');
     $nome->setLabel('Nome')->setAttribute('placeholder', 'Entre com a nome')->setAttribute('maxlength', 100)->setAttribute('size', 50)->setAttribute('autofocus', 'autofocus');
     $this->add($nome);
     $email = new Text('email');
     $email->setLabel('E-mail')->setAttribute('placeholder', 'Entre com o email')->setAttribute('maxlength', 255)->setAttribute('size', 50);
     $this->add($email);
     $celular = new Text('celular');
     $celular->setLabel('Telefone')->setAttribute('placeholder', 'Entre com o telefone')->setAttribute('maxlength', 15);
     $this->add($celular);
     $ativo = new Checkbox('ativo');
     $ativo->setLabel('Ativo : ');
     $this->add($ativo);
     $pai = new Select();
     $pai->setLabel("Pai ")->setName("pessoa")->setOptions(array('value_options' => $pais));
     $this->add($pai);
     $button = new Button('submit');
     $button->setLabel('Salvar')->setAttributes(array('type' => 'submit', 'class' => 'btn btn-success'));
     $this->add($button);
 }
Exemplo n.º 6
0
 public function __construct($name = null)
 {
     parent::__construct($name);
     //id
     $this->add(array('name' => 'id', 'attributes' => array('type' => 'hidden')));
     //statosessione
     $this->add(array('name' => 'statosessione', 'attributes' => array('type' => 'hidden')));
     //password visible
     $this->add(array('name' => 'password2', 'attributes' => array('type' => 'hidden')));
     //titolo
     $this->add(array('name' => 'titolo', 'options' => array('label' => 'Titolo'), 'attributes' => array('type' => 'text', 'class' => 'form-control')));
     //password
     $this->add(array('type' => 'Zend\\Form\\Element\\Password', 'name' => 'password', 'options' => array('label' => 'Password'), 'attributes' => array('class' => 'form-control')));
     //confirmapassword
     $this->add(array('type' => 'Zend\\Form\\Element\\Password', 'name' => 'confirmarPassword', 'options' => array('label' => 'Confermare Password'), 'attributes' => array('class' => 'form-control')));
     // Relatori
     $this->add(array('type' => 'Zend\\Form\\Element\\Select', 'name' => 'relatori', 'options' => array('label' => 'Relatori', 'empty_option' => 'Scegli un relatore =>'), 'attributes' => array('class' => 'form-control')));
     // Steps
     $this->add(array('type' => 'Zend\\Form\\Element\\Select', 'name' => 'steps', 'options' => array('label' => 'Steps', 'empty_option' => 'Scegli steps =>'), 'attributes' => array('class' => 'form-control')));
     //testo
     $nota = new Element\Textarea('nota');
     $nota->setLabel('Nota');
     $nota->setAttribute('class', 'ckeditor form-control');
     $this->add($nota);
     //Durata
     $this->add(array('name' => 'durata', 'options' => array('label' => 'Durata Sessione'), 'attributes' => array('type' => 'text', 'class' => 'form-control')));
     //Linkedin
     $this->add(array('name' => 'link', 'options' => array('label' => 'Link Report'), 'attributes' => array('type' => 'text', 'class' => 'form-control')));
     //stato
     $stato = new Element\Checkbox('stato');
     $stato->setLabel('Stato');
     $stato->setAttribute('class', 'make-switch');
     $this->add($stato);
     $this->add(array('name' => 'send', 'attributes' => array('type' => 'submit', 'value' => 'Salva', 'class' => 'btn green-haze pull-right')));
 }
Exemplo n.º 7
0
 public function __construct(ObjectManager $objectManager)
 {
     $this->setObjectManager($objectManager);
     parent::__construct(null);
     $this->setAttribute('method', 'POST');
     $this->setAttribute('class', 'form-horizontal');
     //Input Titulo
     $titulo = new Text('titulo');
     $titulo->setLabel('Titulo')->setAttributes(array('maxlength' => 80));
     $this->add($titulo);
     //Input Descrição
     $descricao = new Textarea('descricao');
     $descricao->setLabel('descriçao')->setAttributes(array('maxlength' => 150));
     $this->add($descricao);
     //Input Titulo
     $texto = new Textarea('texto');
     $texto->setLabel('Texto');
     $this->add($texto);
     $ativo = new Checkbox('ativo');
     $ativo->setLabel('Ativo');
     $this->add($ativo);
     $categoria = new ObjectSelect('category');
     $categoria->setLabel('Categoria')->setOptions(array('object_manager' => $this->getObjectManager(), 'target_class' => '\\Base\\Orm\\Entities\\Category', 'property' => 'nome', 'empty_option' => '--Selecione--', 'is_method' => true, 'find_method' => array('name' => 'findBy', 'params' => array('criteria' => array(), 'orderBy' => array('nome' => 'ASC')))));
     $this->add($categoria);
     //Botao submit
     $button = new Button('submit');
     $button->setLabel('Salvar')->setAttributes(array('type' => 'submit', 'class' => 'btn'));
     $this->add($button);
     $this->setInputFilter(new PostFilter($categoria->getValueOptions()));
 }
Exemplo n.º 8
0
 /** {@inheritdoc} */
 public function init()
 {
     parent::init();
     $config = $this->getOption('config');
     $mergeCustomFields = new Element\Checkbox('mergeCustomFields');
     $mergeCustomFields->setLabel('Merge user supplied information');
     $mergeCustomFields->setChecked($config->defaultMergeCustomFields);
     $this->add($mergeCustomFields);
     $mergeGroups = new Element\Checkbox('mergeGroups');
     $mergeGroups->setLabel('Merge manual group assignments');
     $mergeGroups->setChecked($config->defaultMergeGroups);
     $this->add($mergeGroups);
     $mergePackages = new Element\Checkbox('mergePackages');
     $mergePackages->setLabel('Merge missing package assignments');
     $mergePackages->setChecked($config->defaultMergePackages);
     $this->add($mergePackages);
     $submit = new \Library\Form\Element\Submit('submit');
     $submit->setLabel('Merge selected clients');
     $this->add($submit);
     // Checkboxes for "clients[]" are generated manually, without
     // \Zend\Form\Element. Define an input filter to have them processed.
     $arrayCount = new \Zend\Validator\Callback();
     $arrayCount->setCallback(array($this, 'validateArrayCount'))->setMessage('At least 2 different clients have to be selected', \Zend\Validator\Callback::INVALID_VALUE);
     $inputFilter = new \Zend\InputFilter\InputFilter();
     $inputFilter->add(array('name' => 'clients', 'required' => true, 'continue_if_empty' => true, 'filters' => array(array($this, 'clientsFilter')), 'validators' => array($arrayCount, new \Zend\Validator\Explode(array('validator' => new \Zend\Validator\Digits()))), 'error_message' => $arrayCount->getDefaultTranslator()->translate($arrayCount->getMessageTemplates()[\Zend\Validator\Callback::INVALID_VALUE])));
     $this->setInputFilter($inputFilter);
 }
Exemplo n.º 9
0
 public function __construct(ServiceLocatorInterface $sl)
 {
     parent::__construct('form-produto');
     // instanciando o entity manager do doctrine
     $em = $sl->get('Doctrine\\ORM\\EntityManager');
     // definindo variáveis
     $arrCategorias = array('' => 'Selecione');
     $repoCategorias = $em->getRepository('Admin\\Entity\\Categoria');
     $arrCategorias += $repoCategorias->getCategorias();
     $categoria = new Select('categoria');
     $categoria->setLabel('Categoria do produto')->setAttributes(array('id' => 'categoria', 'class' => 'form-control', 'style' => 'width: 700px', 'options' => $arrCategorias));
     $this->add($categoria);
     $codigo = new Text('codigo');
     $codigo->setLabel('Código do produto')->setAttributes(array('id' => 'codigo', 'style' => 'width: 200px', 'class' => 'form-control'));
     $this->add($codigo);
     $nome = new Text('nome');
     $nome->setLabel('Nome do produto')->setAttributes(array('id' => 'nome', 'style' => 'width: 700px', 'class' => 'form-control'));
     $this->add($nome);
     $slug = new Text('slug');
     $slug->setLabel('Slug do produto')->setAttributes(array('id' => 'slug', 'style' => 'width: 700px', 'class' => 'form-control'));
     $this->add($slug);
     $descricao = new Textarea('descricao');
     $descricao->setLabel('Descrição')->setAttributes(array('id' => 'descricao', 'style' => 'width: 700px; height: 100px', 'class' => 'form-control'));
     $this->add($descricao);
     $peso = new Text('peso');
     $peso->setLabel('Peso')->setAttributes(array('id' => 'peso', 'style' => 'width: 150px', 'class' => 'form-control'));
     $this->add($peso);
     $ativo = new Checkbox('ativo');
     $ativo->setLabel('Ativo')->setAttributes(array('id' => 'ativo', 'style' => 'width: 38px', 'class' => 'form-control'));
     $this->add($ativo);
 }
Exemplo n.º 10
0
 public function __construct($name = null)
 {
     parent::__construct($name);
     //id
     $this->add(array('name' => 'id', 'attributes' => array('type' => 'hidden')));
     //titolo
     $this->add(array('name' => 'titolo', 'options' => array('label' => 'Titolo'), 'attributes' => array('type' => 'text', 'class' => 'form-control')));
     //contenuto
     $nota = new Element\Textarea('contenuto');
     $nota->setLabel('Contenuto');
     $nota->setAttribute('class', 'ckeditor form-control');
     $this->add($nota);
     //Background
     $this->add(array('name' => 'background', 'attributes' => array('type' => 'Zend\\Form\\Element\\File'), 'options' => array('label' => 'Background')));
     // Posterlab
     $this->add(array('type' => 'Zend\\Form\\Element\\Select', 'name' => 'posterlab', 'options' => array('label' => 'Posterlab', 'empty_option' => 'Scegli un posterlab =>'), 'attributes' => array('class' => 'form-control', 'onChange' => 'javascript:caricaPosizioni()', 'id' => 'posterlabs')));
     // Posizione
     $this->add(array('type' => 'Zend\\Form\\Element\\Select', 'name' => 'posizione', 'options' => array('label' => 'posizione', 'empty_option' => 'Scegli una posizione =>', 'disable_inarray_validator' => true), 'attributes' => array('class' => 'form-control', 'id' => 'posizioni')));
     // tipo
     $this->add(array('type' => 'Zend\\Form\\Element\\Select', 'name' => 'tipo', 'options' => array('label' => 'Tipo', 'empty_option' => 'Scegli tipo =>'), 'attributes' => array('class' => 'form-control')));
     //stato
     $stato = new Element\Checkbox('stato');
     $stato->setLabel('Stato');
     $stato->setAttribute('class', 'make-switch');
     $this->add($stato);
     $this->add(array('name' => 'send', 'attributes' => array('type' => 'submit', 'value' => 'Salva', 'class' => 'btn green-haze pull-right')));
 }
Exemplo n.º 11
0
 public function __construct(ObjectManager $objectManager)
 {
     $this->setObjectManager($objectManager);
     parent::__construct(null);
     $this->setAttributes(array('method' => 'POST', 'accept-charset' => 'UTF-8', 'class' => 'form-horizontal'));
     //input Titulo
     $titulo = new Text('titulo');
     $titulo->setLabel('Titulo')->setAttributes(array('id' => 'nome', 'maxlength' => 80, 'class' => 'form-control'));
     $this->add($titulo);
     //input descri��o
     $descricao = new Textarea('descricao');
     $descricao->setLabel("Descricao")->setAttributes(array('id' => 'descricao', 'maxlength' => 150, 'class' => 'form-control'));
     $this->add($descricao);
     //input texto
     $texto = new Textarea('texto');
     $texto->setLabel('Texto')->setAttributes(array('id' => 'texto', 'class' => 'form-control'));
     $this->add($texto);
     //input Ativo
     $ativo = new Checkbox('ativo');
     $ativo->setLabel('Ativo')->setLabelAttributes(array('class' => 'checkbox-inline'))->setOptions(array('use_hidden_element' => true));
     $this->add($ativo);
     //Categoria
     $categoria = new ObjectSelect('category');
     $categoria->setLabel('Categoria')->setOptions(array('object_manager' => $this->getObjectManager(), 'target_class' => 'Categoria\\Entity\\Category', 'property' => 'nome', 'empty_option' => '--Selecione--', 'is_method' => true, 'find_method' => array('name' => 'findBy', 'params' => array('criteria' => array(), 'orderBy' => array('nome' => 'ASC')))))->setAttributes(array('id' => 'category', 'class' => 'form-control'));
     $this->add($categoria);
     //botao submit
     $button = new Button('submit');
     $button->setLabel('Salvar')->setAttributes(array('type' => 'submit', 'class' => 'btn btn-default'));
     $this->add($button);
     $this->setInputFilter(new PostFilter($categoria->getValueOptions()));
 }
Exemplo n.º 12
0
 public function getForm($hasCaptcha, $url = '', $captchaPath = '')
 {
     if (!$this->form) {
         $form = new Form();
         $txtUser = new Element\Text('username');
         $txtUser->setLabel('User Name')->setAttribute('class', 'form-control')->setAttribute('placeholder', 'User name');
         $password = new Element\Password('password');
         $password->setLabel('Password')->setAttribute('class', 'form-control')->setAttribute('placeholder', 'Password');
         $remember = new Element\Checkbox('remember');
         $remember->setLabel('Save authentication?')->setAttribute('class', 'form-control');
         if ($hasCaptcha) {
             $captchaImage = new Image();
             $captchaImage->setFont('./data/font/CAMBRIA.TTC')->setWidth(200)->setHeight(60)->setDotNoiseLevel(40)->setLineNoiseLevel(4)->setExpiration(90);
             $captchaImage->setImgUrl($url);
             $captchaImage->setImgDir($captchaPath);
             $captcha = new Element\Captcha('isHuman');
             $captcha->setCaptcha($captchaImage)->setAttributes(array('class' => 'form-control'));
             $form->add($captcha);
         }
         $form->setAttribute('class', 'form-horizontal');
         $form->add($txtUser);
         $form->add($password);
         $form->add($remember);
         $this->form = $form;
     }
     return $this->form;
 }
Exemplo n.º 13
0
 /**
  * Load Boolean editor
  *
  * @return Element\Checkbox
  */
 public function load()
 {
     $boolean = new Element\Checkbox($this->getName());
     $boolean->setLabel($this->getProperty()->getName());
     $boolean->setAttribute('class', 'input-checkbox');
     $boolean->setAttribute('id', 'boolean' . $this->getProperty()->getId());
     $boolean->setValue($this->getProperty()->getValue());
     return $boolean;
 }
Exemplo n.º 14
0
 public function __construct($name = null, array $classificacoes = null)
 {
     parent::__construct($name);
     $this->classificacoes = $classificacoes;
     $this->setInputFilter(new PessoaFilter());
     $this->setAttribute('method', 'POST');
     $this->setAttribute('enctype', 'multipart/form-data');
     $id = new \Zend\Form\Element\Hidden('id');
     $this->add($id);
     $titulo = new Text('nome');
     $titulo->setLabel('Nome  :  ')->setAttribute('placeholder', 'Entre com o nome')->setAttribute('maxlength', 100)->setAttribute('size', 50)->setAttribute('autofocus', 'autofocus');
     $this->add($titulo);
     $classificacao = new Select();
     $classificacao->setLabel("Classificacao ")->setName("classification")->setOptions(array('value_options' => $classificacoes));
     $this->add($classificacao);
     $dataAdmissao = new Text('data_admissao');
     $dataAdmissao->setLabel('Data Admissão');
     $this->add($dataAdmissao);
     $enderecoResidencial = new Text('endereco_residencial');
     $enderecoResidencial->setLabel('End. Residencial:')->setAttribute('placeholder', 'Entre com o endereço residencial')->setAttribute('maxlength', 255)->setAttribute('size', 50);
     $this->add($enderecoResidencial);
     $telefoneResidencial = new Text('telefone_residencial');
     $telefoneResidencial->setLabel('Tel. Residencial');
     $this->add($telefoneResidencial);
     $celular = new Text('celular');
     $celular->setLabel('Celular');
     $this->add($celular);
     $emailPessoal = new Text('email_pessoal');
     $emailPessoal->setLabel('Email Pessoal');
     $this->add($emailPessoal);
     $enderecoComercial = new Text('endereco_comercial');
     $enderecoComercial->setLabel('End. Comercial:')->setAttribute('placeholder', 'Entre com o endereço comercial')->setAttribute('maxlength', 255)->setAttribute('size', 50);
     $this->add($enderecoComercial);
     $telefoneComercial = new Text('telefone_comercial');
     $telefoneComercial->setLabel('Tel. Comercial');
     $this->add($telefoneComercial);
     $emailComercial = new Text('email_comercial');
     $emailComercial->setLabel('Email Comercial');
     $this->add($emailComercial);
     $conjuge = new Text('conjuge');
     $conjuge->setLabel('Nome do Conjuge')->setAttribute('maxlength', 100)->setAttribute('size', 50);
     $this->add($conjuge);
     $celularConjuge = new Text('celular_conjuge');
     $celularConjuge->setLabel('Celular do Conjuge');
     $this->add($celularConjuge);
     /*===========================================================================================*/
     $fotografia = new File('fotografia');
     $fotografia->setLabel('Fotografia')->setAttribute('id', 'fotografia');
     $this->add($fotografia);
     /*===========================================================================================*/
     $ativo = new Checkbox('ativo');
     $ativo->setLabel('Ativo : ');
     $this->add($ativo);
     $button = new Button('submit');
     $button->setLabel('Salvar')->setAttributes(array('type' => 'submit', 'class' => 'btn btn-success'));
     $this->add($button);
 }
Exemplo n.º 15
0
 public function __construct(LicenseInterface $license)
 {
     parent::__construct('license');
     $agreement = $license->getAgreement() ?: $license->getTitle();
     $checkbox = new Checkbox('agreement');
     $checkbox->setOptions(['use_hidden_element' => false]);
     $checkbox->setLabel($agreement);
     $checkbox->setLabelOptions(['disable_html_escape' => true]);
     $this->add($checkbox);
 }
Exemplo n.º 16
0
 /** {@inheritdoc} */
 public function init()
 {
     parent::init();
     $inputFilter = new \Zend\InputFilter\InputFilter();
     // Create list of values as array because nested iteration does not work with ResultSet objects.
     $this->_definedValues = iterator_to_array($this->getOption('registryManager')->getValueDefinitions());
     // Subform for enabling/disabling registry inspection, in addition to
     // the same setting in preferences.
     $fieldsetInspect = new \Zend\Form\Fieldset('inspect');
     $inspect = new Element\Checkbox('inspect');
     $inspect->setLabel('Inspect registry')->setChecked($this->getOption('config')->inspectRegistry);
     $fieldsetInspect->add($inspect);
     $this->add($fieldsetInspect);
     // Subform for existing values
     $fieldsetExisting = new \Zend\Form\Fieldset('existing');
     $inputFilterExisting = new \Zend\InputFilter\InputFilter();
     // Create text elements for existing values to rename them
     foreach ($this->_definedValues as $value) {
         $name = $value['Name'];
         $elementName = "value_{$value['Id']}_name";
         $element = new Element\Text($elementName);
         $element->setValue($name)->setLabel($value['FullPath']);
         $inputFilterExisting->add(array('name' => $elementName, 'required' => true, 'filters' => array(array('name' => 'StringTrim')), 'validators' => array(array('name' => 'StringLength', 'options' => array('max' => 255)), $this->_createBlacklistValidator($name))));
         $fieldsetExisting->add($element);
     }
     $this->add($fieldsetExisting);
     $inputFilter->add($inputFilterExisting, 'existing');
     // Subform for new value
     $fieldsetNew = new \Zend\Form\Fieldset('new_value');
     $newName = new Element\Text('name');
     $newName->setLabel('Name');
     $fieldsetNew->add($newName);
     $newRootKey = new Element\Select('root_key');
     $newRootKey->setLabel('Root key')->setAttribute('type', 'select_untranslated')->setValueOptions(\Model\Registry\Value::rootKeys())->setValue(\Model\Registry\Value::HKEY_LOCAL_MACHINE);
     $fieldsetNew->add($newRootKey);
     // Additional validation in isValid()
     $newSubKeys = new Element\Text('subkeys');
     $newSubKeys->setLabel('Subkeys');
     $fieldsetNew->add($newSubKeys);
     $newValue = new Element\Text('value');
     $newValue->setLabel('Only this value (optional)');
     $fieldsetNew->add($newValue);
     $submit = new \Library\Form\Element\Submit('submit');
     $submit->setLabel('Change');
     $fieldsetNew->add($submit);
     $this->add($fieldsetNew);
     $inputFilterNew = new \Zend\InputFilter\InputFilter();
     $inputFilterNew->add(array('name' => 'name', 'required' => false, 'filters' => array(array('name' => 'StringTrim')), 'validators' => array(array('name' => 'StringLength', 'options' => array('max' => 255)), $this->_createBlacklistValidator())));
     $inputFilterNew->add(array('name' => 'subkeys', 'continue_if_empty' => true, 'filters' => array(array('name' => 'StringTrim')), 'validators' => array(array('name' => 'Callback', 'options' => array('callback' => array($this, 'validateEmptySubkeys'), 'message' => "Value is required and can't be empty")), array('name' => 'StringLength', 'options' => array('max' => 255)))));
     $inputFilterNew->add(array('name' => 'value', 'required' => false, 'filters' => array(array('name' => 'StringTrim')), 'validators' => array(array('name' => 'StringLength', 'options' => array('max' => 255)))));
     $inputFilter->add($inputFilterNew, 'new_value');
     $this->setInputFilter($inputFilter);
 }
Exemplo n.º 17
0
 public function __construct($name = null)
 {
     parent::__construct('page');
     $id_hidden = new Element\Hidden('id');
     $id_hidden->setName('id');
     $title_text = new Element\Text('title');
     $title_text->setLabel('Title');
     $title_text->setLabelAttributes(array('class' => 'type_text type_text_short'));
     $title_text->setAttributes(array('class' => 'type_text_input', 'placeholder' => 'Type something...', 'required' => 'require'));
     $url_text = new Element\Text('url');
     $url_text->setLabel('Url');
     $url_text->setLabelAttributes(array('class' => 'type_text type_text_short'));
     $url_text->setAttributes(array('class' => 'type_text_input', 'placeholder' => 'Type something...', 'required' => 'require'));
     $text_textarea = new Element\Textarea('text');
     $text_textarea->setLabel('Text');
     $text_textarea->setLabelAttributes(array('class' => 'type_text'));
     $text_textarea->setAttributes(array('placeholder' => 'Type something...'));
     $auto_check = new Element\Checkbox('auto');
     $auto_check->setLabel('Automatically');
     $auto_check->setLabelAttributes(array('class' => 'type_text type_check'));
     $auto_check->setUseHiddenElement(true);
     $auto_check->setCheckedValue("1");
     $auto_check->setUncheckedValue("0");
     $auto_check->setValue('1');
     $meta_text = new Element\Text('meta');
     $meta_text->setLabel('Meta');
     $meta_text->setLabelAttributes(array('class' => 'type_text type_text_mod_darker'));
     $meta_text->setAttributes(array('class' => 'type_text_input'));
     $keywords_text = new Element\Text('keywords');
     $keywords_text->setLabel('Keywords');
     $keywords_text->setLabelAttributes(array('class' => 'type_text type_text_mod_darker'));
     $keywords_text->setAttributes(array('class' => 'type_text_input'));
     $desc_text = new Element\Text('description');
     $desc_text->setLabel('Description');
     $desc_text->setLabelAttributes(array('class' => 'type_text type_text_mod_darker'));
     $desc_text->setAttributes(array('class' => 'type_text_input'));
     $submit_button = new Element\Submit('submit');
     $submit_button->setValue('Submit');
     $submit_button->setAttributes(array('class' => 'btn btn_white'));
     $cancel_button = new Element\Submit('cancel');
     $cancel_button->setValue('Cancel');
     $cancel_button->setAttributes(array('class' => 'btn btn_rozy'));
     $this->add($id_hidden);
     $this->add($title_text);
     $this->add($url_text);
     $this->add($text_textarea);
     $this->add($auto_check);
     $this->add($meta_text);
     $this->add($keywords_text);
     $this->add($desc_text);
     $this->add($submit_button);
     $this->add($cancel_button);
 }
Exemplo n.º 18
0
 public function __construct()
 {
     parent::__construct();
     $this->setAttribute('method', 'post');
     $this->setAttribute('class', 'panel-body');
     $confirm = new Checkbox('confirm');
     $confirm->setLabel('confirm.account.deletion');
     $confirm->setAttribute('class', 'checkbox form-control');
     $this->add($confirm);
     $submit = new Submit('send');
     $submit->setValue('delete.account');
     $submit->setAttribute('class', 'btn btn-danger');
     $this->add($submit);
 }
Exemplo n.º 19
0
 public function __construct()
 {
     parent::__construct('subscription');
     $subscribe = new Element\Checkbox('subscribe');
     $subscribe->setName('subscribe');
     $subscribe->setLabel('Add to watchlist.');
     $subscribe->setChecked(true);
     $mailman = new Element\Checkbox('mailman');
     $mailman->setName('mailman');
     $mailman->setLabel('Receive notifications via email.');
     $mailman->setChecked(true);
     $this->add($subscribe);
     $this->add($mailman);
 }
Exemplo n.º 20
0
 public function __construct()
 {
     parent::__construct('AddRecipeForm');
     $noOfPeopleElement = new Text('NoOfPeople');
     $noOfPeopleElement->setLabel('Anzahl Personen');
     $this->add($noOfPeopleElement);
     // Add Text for kcal.
     //TODO: Rescrict input to integers
     $kcalElement = new Text('Kcal');
     $kcalElement->setLabel('Anzahl Kalorien');
     $this->add($kcalElement);
     // Add Checkbox for publicFlag
     $publicFlagElement = new Checkbox('PublicFlag');
     $publicFlagElement->setLabel('Möchten Sie das Rezept öffentlich speichern?');
     $this->add($publicFlagElement);
     $preparationTimeElement = new Text('PreparationTime');
     $preparationTimeElement->setLabel('Vorbereitungszeit');
     $this->add($preparationTimeElement);
     $cookingTimeElement = new Text('CookingTime');
     $cookingTimeElement->setLabel('Koch- / Backzeit');
     $this->add($cookingTimeElement);
     $restingTimeElement = new Text('RestingTime');
     $restingTimeElement->setLabel('Ruhezeit');
     $this->add($restingTimeElement);
     $types = $this->selectAllFrom('Types', 'Name');
     $typeElement = new MultiCheckbox('TypeId');
     $typeElement->setLabel('Rezept Typ');
     //$possibleValues = array('Sommermenu','Herbstmenu','Wintermenu','Frühlingsmenu');
     $typeElement->setValueOptions($types);
     $this->add($typeElement);
     $levels = $this->selectAllFrom('Levels', 'Shortname');
     $levelElement = new Select('Level');
     $levelElement->setLabel('Schwierigkeit');
     $levelElement->setValueOptions($levels);
     /*array('einfach','schwierig'));*/
     $levelElement->setValue($levels[0]);
     $this->add($levelElement);
     // Add steps
     $this->addSteps($this->getMaxNumberOfSteps());
     // Add select for chosing how many steps should be displayed
     $stepNumbers = range(1, $this->maxNoOfSteps);
     $addStepSelect = new Select('StepNumber');
     $addStepSelect->setLabel('Anzahl Schritte wählen');
     $addStepSelect->setValueOptions($stepNumbers);
     $addStepSelect->setAttribute('id', 'NoOfStepSelect');
     $addStepSelect->setAttribute('onchange', 'show(++this.value)');
     $this->add($addStepSelect);
 }
Exemplo n.º 21
0
 /**
  * Form initialization
  */
 public function init()
 {
     $this->loadDefaultDecorators();
     $this->setLegend('New layout');
     $this->addDecorator('fieldset');
     $this->setMethod('POST');
     $element = new Element\Text('title');
     $element->setLabel('Title:')->setRequired(true);
     $this->addElement($element);
     $themes = $this->themesModel->getThemesPaginator(1, 10000);
     $themesList = array();
     foreach ($themes as $theme) {
         $themesList[$theme->getId()] = $theme->getTitle();
     }
     $element = new Element\Select('theme_id');
     $element->setLabel('Theme:')->addMultiOptions($themesList)->setRequired(true);
     $this->addElement($element);
     $element = new Element\Text('name');
     $element->setLabel('Layout file:')->setRequired(true);
     $this->addElement($element);
     $element = new Element\Checkbox('published');
     $element->setLabel('Published:');
     $this->addElement($element);
     if ($this->locator->instanceManager()->hasAlias('sysmap-service')) {
         $navigator = $this->locator->get('sysmap-service')->getMapFormElement();
         if ($navigator instanceof \Zly\Form\Element\Tree) {
             $navigator->setName('map_id');
             $navigator->setMultiple(true);
             $navigator->setRequired();
             $this->addElement($navigator);
         }
     }
     $element = new Element\Hidden('module');
     $element->removeDecorator('Label')->removeDecorator('HtmlTag')->setValue($this->_defaultValue);
     $this->addElement($element);
     $element = new Element\Hidden('controller');
     $element->removeDecorator('Label')->setValue($this->_defaultValue)->removeDecorator('HtmlTag');
     $this->addElement($element);
     $element = new Element\Hidden('action');
     $element->removeDecorator('Label')->setValue($this->_defaultValue)->removeDecorator('HtmlTag');
     $this->addElement($element);
     $element = new Element\Submit('submit');
     $element->setLabel('Save')->setIgnore(true);
     $this->addElement($element);
 }
 public function __construct($roleName, array $permissions, Acl $acl)
 {
     parent::__construct();
     $this->setAttribute('method', 'post');
     $roles = $acl->getRoles();
     $parentPermissions = [];
     foreach ($roles as $role) {
         if ($acl->inheritsRole($roleName, $role, true)) {
             foreach ($permissions as $permissionId => $permission) {
                 if ($acl->isAllowed($role, $permission)) {
                     $parentPermissions[$permissionId] = $permissionId;
                 }
             }
         }
     }
     $permissionGroups = [];
     foreach ($permissions as $permissionId => $permission) {
         $fragments = explode('/', $permission);
         $groupName = reset($fragments);
         if (!array_key_exists($groupName, $permissionGroups)) {
             $permissionGroups[$groupName] = [];
         }
         $permissionGroups[$groupName][] = $permissionId;
     }
     foreach ($permissionGroups as $groupName => $groupPermissions) {
         foreach ($groupPermissions as $permission) {
             $permissionCheck = new Checkbox($permission);
             $permissionCheck->setLabel($permissions[$permission]);
             if (array_key_exists($permission, $parentPermissions)) {
                 $permissionCheck->setValue(true);
                 $permissionCheck->setAttribute('disabled', true);
             }
             $this->add($permissionCheck);
             if (!array_key_exists($groupName, $this->permissionGroups)) {
                 $this->permissionGroups[$groupName] = [];
             }
             $this->permissionGroups[$groupName][] = $permissionCheck;
         }
     }
     $submit = new Submit('save');
     $submit->setValue('save');
     $submit->setAttribute('class', 'btn btn-primary');
     $this->add($submit);
 }
Exemplo n.º 23
0
 public function __construct()
 {
     parent::__construct();
     $this->setAttribute('method', 'post');
     $this->setAttribute('class', 'panel-body');
     $username = new Text('username');
     $username->setLabel('username');
     $username->setAttribute('class', 'form-control');
     $username->setAttribute('data-urr', '/isusernameinuse');
     $this->add($username);
     $mail = new Email('email');
     $mail->setLabel('email');
     $mail->setAttribute('class', 'form-control');
     $this->add($mail);
     $password = new Password('password');
     $password->setLabel('password');
     $password->setAttribute('class', 'form-control');
     $this->add($password);
     $password2 = new Password('password2');
     $password2->setLabel('repeat.password');
     $password2->setAttribute('class', 'form-control');
     $this->add($password2);
     $captcha = new Captcha('registerCaptcha');
     $imageAdapter = new Image(['font' => __DIR__ . '/../../fonts/arial.ttf']);
     $imageAdapter->setHeight(100);
     $imageAdapter->setWidth(400);
     $imageAdapter->setFontSize(48);
     $imageAdapter->setDotNoiseLevel(400);
     $imageAdapter->setLineNoiseLevel(40);
     $captcha->setCaptcha($imageAdapter);
     $captcha->setLabel('enter.text.from.the.picture');
     $captcha->setAttribute('class', 'form-control');
     $this->add($captcha);
     $agb = new Checkbox('gtcAccept');
     $agb->setLabel('accept.terms.of.gtc');
     $agb->setAttribute('class', 'form-control');
     $agb->setLabelAttributes(['class' => 'checkboxLabel']);
     $this->add($agb);
     $submit = new Submit('register');
     $submit->setValue('register');
     $submit->setAttribute('class', 'btn btn-primary');
     $this->add($submit);
 }
Exemplo n.º 24
0
 public function __construct($name = null, array $parent)
 {
     parent::__construct($name);
     $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 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')));
 }
Exemplo n.º 25
0
 public function prepare()
 {
     $email = new Element('login-email');
     $email->setLabel($this->translate('Email'));
     $email->setAttributes(['id' => 'login-email-standard', 'type' => 'text', 'icon' => 'envelope', 'class' => 'form-control']);
     $password = new Element('login-password');
     $password->setLabel($this->translate('Password'));
     $password->setAttributes(['type' => 'password', 'id' => 'login-password-standard', 'icon' => 'lock', 'class' => 'form-control']);
     $rememberMe = new Checkbox('rememberme');
     $rememberMe->setLabel($this->translate('Remember me'));
     $send = new Element('send');
     $send->setValue('Login');
     $send->setAttributes(['type' => 'submit', 'class' => 'btn btn-default']);
     $this->add($email);
     $this->add($password);
     $this->add($rememberMe);
     $this->add($send);
     parent::prepare();
 }
Exemplo n.º 26
0
 public function __construct()
 {
     $dbAdapter = Zend\Db\TableGateway\Feature\GlobalAdapterFeature::getStaticAdapter();
     $this->setDbAdapter($dbAdapter);
     parent::__construct('recipefieldset');
     $this->add(array('name' => 'noOfPeople', 'type' => 'Text', 'options' => array('label' => 'Anzahl Personen')));
     // Add Text for kcal.
     //TODO: Rescrict input to integers
     $kcalElement = new Text('kcal');
     $kcalElement->setLabel('Anzahl Kalorien');
     $this->add($kcalElement);
     // Add Checkbox for publicFlag
     $publicFlagElement = new Checkbox('publicFlag');
     $publicFlagElement->setLabel('Möchten Sie das Rezept öffentlich speichern?');
     $this->add($publicFlagElement);
     $typeElement = new MultiCheckbox('typeId');
     $typeElement->setLabel('Rezept Typ');
     $possibleValues = array('Sommermenu', 'Herbstmenu', 'Wintermenu', 'Frühlingsmenu');
     $typeElement->setValueOptions($possibleValues);
     $this->add($typeElement);
     $selectString = 'SELECT * FROM Levels';
     //$select->getSqlString();
     $result = $dbAdapter->query($selectString, Adapter::QUERY_MODE_EXECUTE);
     $levels = array();
     foreach ($result as $row) {
         $levels[] = $row['Shortname'];
     }
     $levelElement = new Select('level');
     $levelElement->setLabel('Schwierigkeit');
     $levelElement->setValueOptions($levels);
     /*array('einfach','schwierig'));*/
     $this->add($levelElement);
     // Add steps
     $this->addSteps(4);
     $stepNumbers = range(1, $this->maxNoOfSteps);
     $addStepSelect = new Select('stepNumber');
     $addStepSelect->setLabel('Anzahl Schritte wählen');
     $addStepSelect->setValueOptions($stepNumbers);
     $addStepSelect->setAttribute('id', 'noOfStepSelect');
     $addStepSelect->setAttribute('onchange', 'show()');
     $this->add($addStepSelect);
 }
Exemplo n.º 27
0
 protected function addElements()
 {
     $username = new Element\Text('username');
     $username->setLabel('Username');
     $username->setAttribute('required', 'required');
     $this->add($username);
     $email = new Element\Email('email');
     $email->setLabel("Email");
     $email->setAttribute('required', 'required');
     $this->add($email);
     $password = new Element\Password('password');
     $password->setLabel('password');
     $password->setAttribute('required', 'required');
     $this->add($password);
     $remember = new Element\Checkbox('rememberme');
     $remember->setLabel('remember me');
     $this->add($remember);
     $submit = new Element\Submit('submit');
     $submit->setValue("submit")->setLabel("submit");
     $this->add($submit);
 }
Exemplo n.º 28
0
 public function __construct($name = null)
 {
     parent::__construct('filmes');
     $this->setAttribute('enctype', 'multipart/form-data');
     $id = new Hidden('filmes_id');
     $nome = new Text('filmes_nome');
     $nome->setLabel('Nome: ');
     $nome->setAttributes(array('class' => 'form-control', 'id' => 'filmes_nome'));
     $preco = new Text('filmes_preco');
     $preco->setLabel('Valor Aluguel: ');
     $preco->setAttributes(array('class' => 'form-control', 'id' => 'filmes_preco'));
     $categoria = new Select('categoria_id');
     $categoria->setLabel('Categoria: ');
     $categoria->setAttributes(array('class' => 'form-control', 'id' => 'categoria_id', 'empty_option' => 'Please select an author', 'value_options' => $this->getOptionsForSelect()));
     $foto = new File('filmes_foto');
     $foto->setLabel('Cartaz: ');
     $foto->setAttributes(array('class' => 'form-control'));
     $descricao = new Textarea('filmes_descricao');
     $descricao->setLabel('Dados do Filme: ');
     $descricao->setAttributes(array('style' => 'height: 100px;', 'class' => 'form-control', 'id' => 'filmes_descricao'));
     $status = new Checkbox('filmes_status');
     $status->setLabel("Mostrar?");
     $status->setValue(1);
     $submit = new Button('submit');
     $submit->setLabel('Cadastrar');
     $submit->setAttributes(array('type' => 'submit', 'class' => 'btn btn-success'));
     $cancel = new Button('cancel');
     $cancel->setLabel('Cancelar');
     $cancel->setAttributes(array('type' => 'button', 'class' => 'btn btn-default', 'onclick' => 'javascript:history.go(-1)'));
     $this->add($id);
     $this->add($nome);
     $this->add($preco);
     $this->add($foto);
     $this->add($descricao);
     $this->add($categoria);
     $this->add($status);
     $this->add($submit);
     $this->add($cancel);
 }
Exemplo n.º 29
0
 public function __construct($name = null)
 {
     parent::__construct($name);
     //id
     $this->add(array('name' => 'id', 'attributes' => array('type' => 'hidden')));
     //nombre
     $this->add(array('name' => 'nome', 'options' => array('label' => 'Nome'), 'attributes' => array('type' => 'text', 'class' => 'form-control')));
     //Email
     $this->add(array('type' => 'Zend\\Form\\Element\\Email', 'name' => 'email', 'options' => array('label' => 'Email'), 'attributes' => array('class' => 'form-control')));
     //password
     $this->add(array('type' => 'Zend\\Form\\Element\\Password', 'name' => 'password', 'options' => array('label' => 'Password'), 'attributes' => array('class' => 'form-control')));
     //confirmapassword
     $this->add(array('type' => 'Zend\\Form\\Element\\Password', 'name' => 'confirmarPassword', 'options' => array('label' => 'Confermare Password'), 'attributes' => array('class' => 'form-control')));
     //immagine
     $this->add(array('name' => 'immagine', 'attributes' => array('type' => 'Zend\\Form\\Element\\File'), 'options' => array('label' => 'Immagine')));
     //stato
     $stato = new Element\Checkbox('stato');
     $stato->setLabel('Stato');
     $stato->setAttribute('class', 'make-switch');
     $this->add($stato);
     $this->add(array('name' => 'send', 'attributes' => array('type' => 'submit', 'value' => 'Salva', 'class' => 'btn green-haze pull-right')));
 }
Exemplo n.º 30
0
 public function formAction()
 {
     // Build a name element.
     $name = new Element('name');
     $name->setLabel('Your name');
     $name->setAttributes(array('type' => 'text'));
     // Build a submit button element.
     $send = new Element('send');
     $send->setLabel('Send');
     $send->setAttributes(array('type' => 'submit', 'value' => 'Send'));
     // Build a checkbox element.
     $check = new Checkbox('check');
     $check->setLabel('Checkbox example');
     // Build a multi-checkbox element.
     $multicheck = new MultiCheckbox('multicheck');
     $multicheck->setLabel('Multi checkbox example');
     $multicheck->setOptions(array('value_options' => array('One' => 'one', 'Two' => 'two')));
     // Assemble the form.
     $form = new Form('contact');
     $form->add($name);
     $form->add($check);
     $form->add($multicheck);
     $form->add($send);
     // Get the request if any.
     $request = $this->getRequest();
     $data = $request->getPost();
     $form->setData($data);
     // Validate the form
     if ($form->isValid()) {
         $validatedData = $form->getData();
         $success = 'Form submit was successful';
     } else {
         $success = 'Form submit failed';
         $messages = $form->getMessages();
     }
     // Set the method attribute for the form
     $form->setAttribute('method', 'post');
     return new ViewModel(array('form' => $form, 'success' => $success, 'messages' => $messages, 'data' => $data));
 }