Ejemplo n.º 1
0
 public function __construct()
 {
     parent::__construct();
     $this->setAttribute('method', 'POST');
     $Controller = new Text('Controller');
     $Controller->setLabel("Controller: ");
     $Controller->setAttributes(array("class" => 'form-control'));
     $this->add($Controller);
     $nome = new Text('nome');
     $nome->setLabel("Nome: ");
     $nome->setAttributes(array("class" => 'form-control'));
     $this->add($nome);
     $label = new Text('label');
     $label->setLabel("Label: ");
     $label->setAttributes(array("class" => 'form-control'));
     $this->add($label);
     $route = new Text('route');
     $route->setLabel("Route: ");
     $route->setAttributes(array("class" => 'form-control'));
     $this->add($route);
     $select = new \Zend\Form\Element\Select('parentView');
     $select->setLabel('Parente View');
     $select->setAttributes(array("class" => 'form-control'));
     $select->setValueOptions(array('0' => 'French', '1' => 'English', '2' => 'Japanese', '3' => 'Chinese'));
     $this->add($select);
     $status = new \Zend\Form\Element\Select('Status');
     $status->setLabel('Status');
     $status->setAttributes(array("class" => 'form-control'));
     $status->setValueOptions(array('0' => '', '1' => 'Ativo', '2' => 'Inativo'));
     $this->add($status);
     $submit = new \Zend\Form\Element\Submit('Salvar');
     $submit->setValue('Salvar')->setAttributes(array("class" => 'btn btn-primary btn-lg btn-block'));
     $this->add($submit);
 }
Ejemplo n.º 2
0
 protected function getOutputSelect($name)
 {
     $select = new \Zend\Form\Element\Select($name);
     $select->setAttributes(array('id' => $name));
     $select->setLabel('Output Type');
     $select->setEmptyOption('-- Select Output Type --');
     $opt = array('binary' => 'Binary', 'base64' => 'Base 64 Encoded');
     $select->setValueOptions($opt);
     $select->setValue('base64');
     return $select;
 }
Ejemplo n.º 3
0
 protected function getKeySizeSelect($name)
 {
     $select = new \Zend\Form\Element\Select($name);
     $select->setAttributes(array('id' => $name));
     $select->setLabel('Key Size');
     $select->setEmptyOption('-- Select Key Size --');
     $opt = array();
     for ($pow = 10; $pow <= 13; $pow++) {
         $v = pow(2, $pow);
         $opt[$v] = number_format($v) . ' Bytes';
     }
     $select->setValueOptions($opt);
     $select->setValue(\Zend\Crypt\PublicKey\Rsa\PrivateKey::DEFAULT_KEY_SIZE);
     return $select;
 }
Ejemplo n.º 4
0
 public function setKeyStorage(KeyStorageInterface $storage)
 {
     parent::setKeyStorage($storage);
     $this->add($this->getKeyListSelect('keyName'));
     $this->add(array('name' => 'keyPassPhrase', 'type' => 'password', 'options' => array('label' => 'Pass Phrase'), 'attributes' => array('id' => 'keyPassPhrase', 'title' => 'Provide the password associated with your private key')));
     $dir = new \Zend\Form\Element\Select('direction');
     $dir->setAttributes(array('id' => 'direction'));
     $opt = array('encrypt' => 'Encrypt', 'decrypt' => 'Decrypt');
     $dir->setValueOptions($opt);
     $dir->setLabel('Encrypt or Decrypt');
     $this->add($dir);
     $out = $this->getOutputSelect('outputType');
     $out->setLabel('Set encrypted output format');
     $this->add($out);
     $this->add(array('name' => 'sourceText', 'type' => 'textarea', 'options' => array('label' => 'Input Text'), 'attributes' => array('id' => 'sourceText')));
     $this->add(array('name' => 'processText', 'type' => 'button', 'attributes' => array('id' => 'processText', 'type' => 'submit'), 'options' => array('label' => 'Encrypt/Decrypt')));
 }
Ejemplo n.º 5
0
 public function __construct($name = null, $sm)
 {
     parent::__construct('MenuForm');
     $this->setAttribute('method', 'post');
     $this->setAttribute('enctype', 'multipart/form-data');
     $menu_id = new \Zend\Form\Element\Hidden('menu_id');
     $this->add($menu_id);
     $menu_name = new \Zend\Form\Element\Text('name', array('label' => 'Menu Name'));
     $menu_name->setAttributes(array('placeholder' => 'Menu Name...', 'required' => 'required', 'class' => 'form-control', 'min' => 3, 'max' => 50));
     $this->add($menu_name);
     $label = new \Zend\Form\Element\Text('label', array('label' => 'Label'));
     $label->setAttributes(array('placeholder' => 'Label...', 'required' => 'required', 'class' => 'form-control', 'min' => 3, 'max' => 50));
     $this->add($label);
     $uri = new \Zend\Form\Element\Text('uri', array('label' => 'Uri'));
     $uri->setAttributes(array('placeholder' => 'Uri...', 'required' => 'required', 'class' => 'form-control', 'min' => 1, 'max' => 50));
     $this->add($uri);
     $route = new \Zend\Form\Element\Text('route', array('label' => 'Route'));
     $route->setAttributes(array('placeholder' => 'Route...', 'class' => 'form-control', 'max' => 50));
     $this->add($route);
     $parent_menu = new \Zend\Form\Element\Select('parent_menu_id', array('label' => 'Parent Menu'));
     $parent_menu->setAttributes(array('class' => 'form-control'));
     $parent_options = array('0' => 'None');
     $parentMenus = $sm->get('MenuModel')->fetchParentMenus();
     if (0 !== count($parentMenus)) {
         foreach ($parentMenus as $key => $menu) {
             $parent_options[$menu->menu_id] = $menu->name;
         }
     }
     unset($parentMenus);
     $parent_menu->setValueOptions($parent_options);
     $this->add($parent_menu);
     $icon = new \Zend\Form\Element\Text('icon', array('label' => 'Icon'));
     $icon->setAttributes(array('placeholder' => 'Icon...', 'class' => 'form-control', 'max' => 50));
     $this->add($icon);
     $this->add(array('name' => 'submit', 'attributes' => array('type' => 'submit', 'value' => 'Create', 'class' => 'btn btn-primary col-xs-12')));
 }