Пример #1
0
 public function __construct()
 {
     parent::__construct();
     $this->setAttribute('method', 'post');
     $this->setAttribute('action', '/user/login');
     $this->setAttribute('class', 'form');
     $this->setAttribute('id', 'userLoginForm');
     $this->setAttribute('role', 'form');
     $email = new Email();
     $email->setName('email')->setLabel('Email Address')->setAttribute('required', 'true');
     $password = new Password();
     $password->setName('password')->setLabel('Password')->setAttribute('required', 'true');
     $csrf = new Csrf();
     $csrf->setName('prev');
     $checkbox = new Checkbox();
     $checkbox->setName('remember-me');
     $checkbox->setOptions(['use_hidden_element' => false, 'required' => false]);
     $checkbox->setChecked("checked");
     $submit = new Submit();
     $submit->setName('submit')->setValue('Sign In');
     $this->add($email)->add($password)->add($checkbox)->add($csrf)->add($submit);
     foreach ($this->elements as $element) {
         if ($element instanceof Checkbox) {
             $element->setAttributes(['class' => 'custom-checkbox', 'data-toggle' => 'checkbox']);
         } else {
             if ($element instanceof Submit) {
                 $element->setAttributes(['class' => 'btn-inverse btn-large', 'id' => 'loginSubmit']);
             } else {
                 $element->setAttribute('class', 'form-control');
             }
         }
     }
 }
Пример #2
0
 public function __construct()
 {
     parent::__construct();
     $this->setAttribute('method', 'post')->setAttribute('action', '/user/register')->setAttribute('id', 'user-register-form');
     $email = new Email();
     $email->setName('email')->setLabel('Email Address');
     $userName = new Text();
     $userName->setName('userName')->setLabel('Username');
     $password = new Password();
     $password->setName('password')->setLabel('Password');
     $firstName = new Text();
     $firstName->setName('firstName')->setLabel('First Name');
     $lastName = new Text();
     $lastName->setName('lastName')->setLabel('Last Name');
     $csrf = new Csrf();
     $csrf->setName('prev');
     $submit = new Submit();
     $submit->setName('submit')->setValue('Register');
     $this->add($email)->add($userName)->add($password)->add($firstName)->add($lastName)->add($csrf)->add($submit);
     foreach ($this->elements as $element) {
         if (!$element instanceof Submit) {
             $element->setAttribute('class', 'form-control');
         }
     }
 }
Пример #3
0
 public function __construct($name = null)
 {
     parent::__construct('users');
     $this->setAttribute('class', 'form-small');
     $this->setAttribute('method', 'post');
     $this->setAttribute('novalidate', true);
     $csrf = new Element\Csrf('csrf');
     $csrf_options = array('csrf_options' => array('timeout' => 1000));
     $csrf->setAttribute('id', 'csrf');
     $csrf->setOptions($csrf_options);
     $email = new Element\Email('email');
     $email->setLabel('Email')->setAttribute('id', 'email')->setAttribute('class', 'form-control')->setAttribute('maxlength', '200')->setAttribute('required', true)->setAttribute('placeholder', 'Email address');
     $password = new Element\Password('password');
     $password->setLabel('Password')->setAttribute('id', 'password')->setAttribute('class', 'form-control')->setAttribute('maxlength', '200')->setAttribute('required', true)->setAttribute('placeholder', 'Password');
     //        $rememberme = new Element\Checkbox('rememberme');
     //        $rememberme->setLabel(' Remember me')
     //                ->setAttribute('id', 'rememberme')
     //                ->setAttribute('class', '')
     //                ->setValue('1');
     $submit = new Element\Submit('submit');
     $submit->setValue('Log in')->setAttribute('id', 'submit')->setAttribute('class', 'btn btn-lg btn-primary btn-block');
     $this->add($csrf);
     $this->add($email);
     $this->add($password);
     //        $this->add($rememberme);
     $this->add($submit);
 }
Пример #4
0
 public function testAllowSettingCsrfValidatorOptions()
 {
     $element = new CsrfElement('foo');
     $element->setCsrfValidatorOptions(array('timeout' => 777));
     $validator = $element->getCsrfValidator();
     $this->assertEquals('foo', $validator->getName());
     $this->assertEquals(777, $validator->getTimeout());
 }
Пример #5
0
 public function testAllowSettingCsrfOptions()
 {
     $element = new CsrfElement('foo');
     $element->setOptions(array('csrf_options' => array('timeout' => 777, 'salt' => 'MySalt')));
     $validator = $element->getCsrfValidator();
     $this->assertEquals('foo', $validator->getName());
     $this->assertEquals(777, $validator->getTimeOut());
     $this->assertEquals('MySalt', $validator->getSalt());
 }
Пример #6
0
 public function testProvidesInputSpecificationThatIncludesValidatorsBasedOnAttributes()
 {
     $element = new CsrfElement('foo');
     $inputSpec = $element->getInputSpecification();
     $this->assertArrayHasKey('validators', $inputSpec);
     $this->assertInternalType('array', $inputSpec['validators']);
     $expectedClasses = array('Zend\\Validator\\Csrf');
     foreach ($inputSpec['validators'] as $validator) {
         $class = get_class($validator);
         $this->assertTrue(in_array($class, $expectedClasses), $class);
         switch ($class) {
             case 'Zend\\Validator\\Csrf':
                 $this->assertEquals('foo', $validator->getName());
                 break;
             default:
                 break;
         }
     }
 }
Пример #7
0
 public function __construct($name = null)
 {
     parent::__construct('user_roles');
     $this->setAttribute('class', 'form-horizontal');
     $this->setAttribute('method', 'post');
     $id = new Element\Hidden('id');
     $id->setAttribute('class', 'primarykey');
     $csrf = new Element\Csrf('csrf');
     $csrf_options = array('csrf_options' => array('timeout' => 1000));
     $csrf->setOptions($csrf_options);
     $user_id = new Element\Text('user_id');
     $user_id->setLabel('User Id')->setAttribute('class', 'required form-control')->setAttribute('id', 'user_id')->setAttribute('placeholder', 'User Id');
     $role_id = new Element\Text('role_id');
     $role_id->setLabel('Role Id')->setAttribute('class', 'required form-control')->setAttribute('id', 'role_id')->setAttribute('placeholder', 'Role Id');
     $submit = new Element\Submit('submit');
     $submit->setValue('Submit')->setAttribute('class', 'btn btn-success');
     $this->add($id);
     $this->add($csrf);
     $this->add($user_id);
     $this->add($role_id);
 }
Пример #8
0
 public function __construct()
 {
     parent::__construct();
     $this->setAttribute('method', 'post');
     $this->setAttribute('action', '/user/dashboard/post/create');
     $this->setAttribute('id', 'user-post-form');
     $title = new Text();
     $title->setName('title')->setLabel('Title')->setAttribute('required', 'true');
     $body = new Textarea();
     $body->setName('body')->setAttributes(array('placeholder' => 'Your post content...', 'rows' => 8, 'resizable' => 'false', 'required' => 'true'));
     $csrf = new Csrf();
     $csrf->setName('prev');
     $submit = new Submit();
     $submit->setName('submit')->setValue('Create')->setAttribute('class', 'btn btn-info');
     $this->add($title)->add($body)->add($csrf)->add($submit);
     foreach ($this->elements as $element) {
         if (!$element instanceof Submit) {
             $element->setAttribute('class', 'form-control');
         }
     }
 }
Пример #9
0
 public function __construct($name = null)
 {
     parent::__construct('menus');
     $this->setAttribute('class', 'form-horizontal');
     $this->setAttribute('method', 'post');
     $formValue = $this->formValue();
     $id = new Element\Hidden('id');
     $id->setAttribute('class', 'primarykey');
     $csrf = new Element\Csrf('csrf');
     $csrf_options = array('csrf_options' => array('timeout' => 1000));
     $csrf->setOptions($csrf_options);
     $name = new Element\Text('name');
     $name->setLabel('Name')->setAttribute('class', 'required form-control')->setAttribute('id', 'name')->setAttribute('placeholder', 'Name');
     $icon = new Element\Text('icon');
     $icon->setLabel('Icon')->setAttribute('class', 'form-control')->setAttribute('id', 'icon')->setAttribute('placeholder', 'Fa icon name');
     $type = new Element\Select('type');
     $type->setLabel('Type')->setAttribute('class', 'required form-control')->setValueOptions($formValue['type'])->setDisableInArrayValidator(true)->setAttribute('id', 'type')->setAttribute('placeholder', 'Type');
     $resource_id = new Element\Select('resource_id');
     $resource_id->setLabel('Resource')->setAttribute('class', 'required form-control')->setOptions(array())->setDisableInArrayValidator(true)->setAttribute('id', 'resource_id')->setAttribute('placeholder', 'Resource');
     $url = new Element\Text('url');
     $url->setLabel('Url')->setAttribute('class', 'required form-control')->setAttribute('id', 'url')->setAttribute('placeholder', 'Url');
     $target = new Element\Select('target');
     $target->setLabel('Target')->setAttribute('class', 'required form-control')->setValueOptions($formValue['target'])->setDisableInArrayValidator(true)->setAttribute('id', 'target')->setAttribute('placeholder', 'Target');
     $parent_id = new Element\Select('parent_id');
     $parent_id->setLabel('Parent')->setAttribute('class', 'required form-control')->setOptions(array())->setDisableInArrayValidator(true)->setAttribute('id', 'parent_id')->setAttribute('placeholder', 'Parent Id');
     $status = new Element\Select('status');
     $status->setLabel('Status')->setAttribute('class', 'required form-control')->setValueOptions($formValue['status'])->setDisableInArrayValidator(true)->setAttribute('id', 'status')->setAttribute('placeholder', 'Status');
     $submit = new Element\Submit('submit');
     $submit->setValue('Submit')->setAttribute('class', 'btn btn-primary');
     $this->add($id);
     $this->add($csrf);
     $this->add($name);
     $this->add($icon);
     $this->add($type);
     $this->add($resource_id);
     $this->add($url);
     $this->add($target);
     $this->add($parent_id);
     $this->add($status);
 }
Пример #10
0
 public function __construct($name = null)
 {
     parent::__construct('users');
     $this->setAttribute('class', 'form-horizontal');
     $this->setAttribute('method', 'post');
     $id = new Element\Hidden('id');
     $id->setAttribute('class', 'primarykey');
     $csrf = new Element\Csrf('csrf');
     $csrf_options = array('csrf_options' => array('timeout' => 1000));
     $csrf->setOptions($csrf_options);
     $username = new Element\Text('username');
     $username->setLabel('Username')->setAttribute('class', 'required form-control')->setAttribute('id', 'username')->setAttribute('placeholder', 'Username');
     $email = new Element\Text('email');
     $email->setLabel('Email')->setAttribute('class', 'required form-control')->setAttribute('id', 'email')->setAttribute('placeholder', 'Email');
     $password = new Element\Text('password');
     $password->setLabel('Password')->setAttribute('class', 'required form-control')->setAttribute('id', 'password')->setAttribute('placeholder', 'Password');
     $salt = new Element\Text('salt');
     $salt->setLabel('Salt')->setAttribute('class', 'required form-control')->setAttribute('id', 'salt')->setAttribute('placeholder', 'Salt');
     $email_check_code = new Element\Text('email_check_code');
     $email_check_code->setLabel('Email Check Code')->setAttribute('class', 'required form-control')->setAttribute('id', 'email_check_code')->setAttribute('placeholder', 'Email Check Code');
     $is_disabled = new Element\Text('is_disabled');
     $is_disabled->setLabel('Is Disabled')->setAttribute('class', 'required form-control')->setAttribute('id', 'is_disabled')->setAttribute('placeholder', 'Is Disabled');
     $created = new Element\Text('created');
     $created->setLabel('Created')->setAttribute('class', 'required form-control')->setAttribute('id', 'created')->setAttribute('placeholder', 'Created');
     $modified = new Element\Text('modified');
     $modified->setLabel('Modified')->setAttribute('class', 'required form-control')->setAttribute('id', 'modified')->setAttribute('placeholder', 'Modified');
     $submit = new Element\Submit('submit');
     $submit->setValue('Submit')->setAttribute('class', 'btn btn-success');
     $this->add($id);
     $this->add($csrf);
     $this->add($username);
     $this->add($email);
     $this->add($password);
     $this->add($salt);
     $this->add($email_check_code);
     $this->add($is_disabled);
     $this->add($created);
     $this->add($modified);
 }
Пример #11
0
 /**
  * Get CSRF validator
  *
  * @return  \Zend\Validator\Csrf
  */
 public function getCsrfValidator()
 {
     if (null === $this->csrfValidator) {
         $serviceLocator = $this->getServiceLocator();
         if ($serviceLocator && $serviceLocator->has('Zend\\Session\\ManagerInterface')) {
             $defaultManager = SessionContainer::getDefaultManager();
             $serviceManager = $serviceLocator->get('Zend\\Session\\ManagerInterface');
             if ($defaultManager !== $serviceManager) {
                 SessionContainer::setDefaultManager($serviceManager);
             }
         }
     }
     return parent::getCsrfValidator();
 }
Пример #12
0
 public function __construct()
 {
     parent::__construct();
     $this->setAttribute('method', 'post');
     $this->setAttribute('action', '/user/dashboard/messages/create');
     $this->setAttribute('class', 'form-horizontal');
     $this->setAttribute('id', 'user-message-form');
     $to = new Text();
     $to->setName('recipient')->setLabel('Recipients')->setAttribute('id', 'recipients');
     $subject = new Text();
     $subject->setName('subject')->setLabel('Subject');
     $body = new Textarea();
     $body->setName('body')->setAttributes(array('placeholder' => 'Your message...', 'rows' => 4));
     $csrf = new Csrf();
     $csrf->setName('prev');
     $submit = new Submit();
     $submit->setName('submit')->setValue('Send');
     $this->add($to)->add($subject)->add($body)->add($csrf)->add($submit);
     foreach ($this->elements as $element) {
         if (!$element instanceof Submit) {
             $element->setAttribute('class', 'form-control');
         }
     }
 }
Пример #13
0
    public function testValueAttributeIsSetToValidatorHash()
    {
        $element   = new CsrfElement('foo');
        $validator = $element->getValidator();
        $value     = $element->getAttribute('value');
        $this->assertSame($validator->getHash(), $value);

        $validator = new CsrfValidator(array(
            'salt' => 'foobar',
            'name' => $element->getName(),
        ));
        $validator->setSalt('foobarbaz');
        $element->setValidator($validator);
        $value2    = $element->getAttribute('value');
        $this->assertSame($validator->getHash(), $value2);
        $this->assertNotSame($value, $value2, "$value == $value2");
    }
Пример #14
0
 public function testRendersCsrfAsExpected()
 {
     $element = new Element\Csrf('foo');
     $inputSpec = $element->getInputSpecification();
     $hash = '';
     foreach ($inputSpec['validators'] as $validator) {
         $class = get_class($validator);
         switch ($class) {
             case 'Zend\\Validator\\Csrf':
                 $hash = $validator->getHash();
                 break;
             default:
                 break;
         }
     }
     $markup = $this->helper->render($element);
     $this->assertRegexp('#<input[^>]*(type="hidden")#', $markup);
     $this->assertRegexp('#<input[^>]*(value="' . $hash . '")#', $markup);
 }
Пример #15
0
    public function testRendersCsrfAsExpected()
    {
        $element   = new Element\Csrf('foo');
        $validator = $element->getValidator();
        $hash      = $validator->getHash();
        $markup    = $this->helper->render($element);

        $this->assertRegexp('#<input[^>]*(type="hidden")#', $markup);
        $this->assertRegexp('#<input[^>]*(value="' . $hash . '")#', $markup);
    }
Пример #16
0
 /**
  * Prepara os campos do formulário
  * @param  string    $fieldName
  * @param  array     $fieldParams
  * @param  array     $options
  * @return object
  * @throws Exception
  */
 private function prepareFields($fieldName, array $fieldParams, array $options = array())
 {
     $element = null;
     $extraLabel = " ";
     $this->aOptions = array();
     $this->aAttributes = array();
     /* Define o tooltip do campo */
     $tooltip = (isset($fieldParams['tooltip']) and $fieldParams['tooltip'] == 'true') ? "<a class=\"tooltip-marc\" href=\"#\" data-toggle=\"tooltip\" title=\"{$this->getTranslator($fieldName . '_tooltip')}\">[?]</a>" : null;
     $this->aOptions['tooltip'] = $tooltip;
     /* Define como será mostrado o nome do campo (se é obrigatório ou não) */
     if (strtolower($fieldParams['type']) != 'hidden') {
         if (isset($fieldParams['validation']) and stristr(strtolower($fieldParams['validation']), "required")) {
             $extraLabel = " * ";
         }
     }
     switch (strtolower($fieldParams['type'])) {
         /* Caso hidden */
         case 'primary':
         case 'hidden':
             $element = new ZendFormElement\Hidden($fieldName);
             break;
             /* Caso Csrf */
         /* Caso Csrf */
         case 'csrf':
         case 'sec':
             $element = new ZendFormElement\Csrf($fieldName);
             $element->setCsrfValidatorOptions(array('timeout' => '600'));
             break;
             /* Caso text */
         /* Caso text */
         case 'text':
             $element = new ZendFormElement\Text($fieldName);
             $element->setLabel($this->getTranslator($fieldName) . $extraLabel);
             $this->aAttributes['class'] = 'form-input';
             break;
             /* Caso textarea */
         /* Caso textarea */
         case 'textarea':
             $element = new ZendFormElement\Textarea($fieldName);
             $element->setLabel($this->getTranslator($fieldName) . $extraLabel);
             /* Define os padrões de colunas e linhas do campo */
             $this->aAttributes['rows'] = (isset($fieldParams['rows']) and !empty($fieldParams['rows'])) ? $fieldParams['rows'] : 5;
             $this->aAttributes['cols'] = (isset($fieldParams['cols']) and !empty($fieldParams['cols'])) ? $fieldParams['cols'] : 10;
             $this->aAttributes['class'] = 'form-input';
             $this->aAttributes['data-editor'] = 'false';
             break;
             /* Caso editor */
         /* Caso editor */
         case 'editor':
             $element = new ZendFormElement\Textarea($fieldName);
             $element->setLabel($this->getTranslator($fieldName) . $extraLabel);
             /* Define os padrões de colunas e linhas do campo */
             $this->aAttributes['rows'] = (isset($fieldParams['rows']) and !empty($fieldParams['rows'])) ? $fieldParams['rows'] : 5;
             $this->aAttributes['cols'] = (isset($fieldParams['cols']) and !empty($fieldParams['cols'])) ? $fieldParams['cols'] : 10;
             /* Verifica se utilizará o editor */
             $this->aAttributes['class'] = 'editorw';
             $this->aAttributes['data-editor'] = 'true';
             /* Verifica a pasta de upload */
             if (isset($this->formDefaultConfig['destination']) and !empty($this->formDefaultConfig['destination'])) {
                 /* Caso não exista a pasta cria o mesmo */
                 if (!is_dir(UPLOAD_PATH . $this->formDefaultConfig['destination'])) {
                     mkdir(UPLOAD_PATH . $this->formDefaultConfig['destination'], 0777, true);
                     chmod(UPLOAD_PATH . $this->formDefaultConfig['destination'], 0777);
                 }
                 $_SESSION['KCFINDER'] = array();
                 $_SESSION['KCFINDER']['disabled'] = false;
                 $_SESSION['KCFINDER']['uploadURL'] = URL_UPLOAD . $this->formDefaultConfig['destination'];
                 $_SESSION['KCFINDER']['uploadDir'] = UPLOAD_PATH . $this->formDefaultConfig['destination'];
             } else {
                 throw new \Exception('Defina a pasta de destino de upload das imagens do editor!', 500);
             }
             break;
             /* Caso password */
         /* Caso password */
         case 'password':
             $element = new ZendFormElement\Password($fieldName);
             $element->setLabel($this->getTranslator($fieldName) . $extraLabel);
             $this->aAttributes['renderPassword'] = true;
             $this->aAttributes['class'] = 'form-input';
             break;
             /* Caso radio */
         /* Caso radio */
         case 'radio':
             $element = new ZendFormElement\Radio($fieldName);
             $element->setLabel($this->getTranslator($fieldName) . $extraLabel);
             $this->aAttributes['class'] = 'radio';
             break;
             /* Caso checkbox */
         /* Caso checkbox */
         case 'checkbox':
             $element = new ZendFormElement\Checkbox($fieldName);
             $element->setLabel($this->getTranslator($fieldName) . $extraLabel);
             $element->setUncheckedValue(null);
             $this->aAttributes['class'] = 'checkbox';
             break;
             /* Caso multicheckbox */
         /* Caso multicheckbox */
         case 'multicheckbox':
             $element = new ZendFormElement\MultiCheckbox($fieldName);
             $element->setLabel($this->getTranslator($fieldName) . $extraLabel);
             $element->setUncheckedValue(null);
             break;
             /* Caso select */
         /* Caso select */
         case 'select':
             $element = new ZendFormElement\Select($fieldName, array('disable_inarray_validator' => true));
             $element->setLabel($this->getTranslator($fieldName) . $extraLabel);
             $this->selectOptions = array();
             if (isset($fieldParams['placeholder']) and strtolower($fieldParams['placeholder']) == 'true') {
                 $this->selectOptions[''] = $this->getTranslator($fieldName . '_placeholder');
             } else {
                 $this->selectOptions[''] = "---------";
             }
             $this->aAttributes['class'] = 'form-input-select';
             break;
             /* Caso selectgroup */
         /* Caso selectgroup */
         case 'selectgroup':
             $element = new ZendFormElement\Select($fieldName, array('disable_inarray_validator' => true));
             $element->setLabel($this->getTranslator($fieldName) . $extraLabel);
             $this->selectOptions = array();
             if (isset($fieldParams['placeholder']) and strtolower($fieldParams['placeholder']) == 'true') {
                 $this->selectOptions[''] = $this->getTranslator($fieldName . '_placeholder');
             } else {
                 $this->selectOptions[''] = "---------";
             }
             $this->aAttributes['class'] = 'form-input-select';
             break;
             /* Caso multiselect */
         /* Caso multiselect */
         case 'multiselect':
             $element = new ZendFormElement\Select($fieldName, array('disable_inarray_validator' => true));
             $element->setLabel($this->getTranslator($fieldName) . $extraLabel);
             $this->aAttributes['class'] = 'form-input-select ms';
             $this->aAttributes['multiple'] = 'multiple';
             break;
             /* Caso fileimage */
         /* Caso fileimage */
         case 'fileimage':
             $element = new ZendFormElement\File($fieldName);
             $element->setLabel($this->getTranslator($fieldName) . $extraLabel);
             //$this->aAttributes['multiple'] = true;
             $this->aAttributes['class'] = 'hiddenImageFile';
             /* Verifica a pasta de upload */
             if (isset($this->formDefaultConfig['pathfiles']) and !empty($this->formDefaultConfig['pathfiles'])) {
                 /* Caso não exista a pasta cria o mesmo */
                 if (!is_dir(UPLOAD_PATH . $this->formDefaultConfig['pathfiles'])) {
                     mkdir(UPLOAD_PATH . $this->formDefaultConfig['pathfiles'], 0777, true);
                     chmod(UPLOAD_PATH . $this->formDefaultConfig['pathfiles'], 0777);
                 }
                 $this->aAttributes['data-path'] = LINK_DEFAULT . 'uploads/' . $this->formDefaultConfig['pathfiles'];
             } else {
                 throw new \Exception('Defina a pasta de destino de upload das imagens do editor!', 500);
             }
             break;
             /* Caso file */
         /* Caso file */
         case 'file':
             $element = new ZendFormElement\File($fieldName);
             $element->setLabel($this->getTranslator($fieldName) . $extraLabel);
             break;
         case 'money':
             $element = new ZendFormElement\Text($fieldName);
             $element->setLabel($this->getTranslator($fieldName) . $extraLabel);
             $this->aAttributes['class'] = 'form-input';
             break;
             /* HTML5 Elements */
             /* Caso url */
         /* HTML5 Elements */
         /* Caso url */
         case 'url':
             $element = new ZendFormElement\Url($fieldName);
             $element->setLabel($this->getTranslator($fieldName) . $extraLabel);
             $this->aAttributes['class'] = 'form-input';
             break;
             /* Caso date */
         /* Caso date */
         case 'date':
             $element = new ZendFormElement\Date($fieldName);
             $element->setLabel($this->getTranslator($fieldName) . $extraLabel);
             $this->aAttributes['min'] = date("Y") - 10 . '-01-01';
             $this->aAttributes['max'] = date("Y") + 10 . '-12-31';
             $this->aAttributes['class'] = 'form-input';
             break;
         case 'dateage':
             $element = new ZendFormElement\Date($fieldName);
             $element->setLabel($this->getTranslator($fieldName) . $extraLabel);
             $this->aAttributes['min'] = date("Y") - 100 . '-01-01';
             $this->aAttributes['max'] = date("Y") + 100 . '-12-31';
             $this->aAttributes['class'] = 'form-input';
             break;
             /* Caso time */
         /* Caso time */
         case 'time':
             $element = new ZendFormElement\DateTime($fieldName);
             $element->setLabel($this->getTranslator($fieldName) . $extraLabel);
             $this->aAttributes['class'] = 'form-input';
             $this->aAttributes['min'] = '00:00:00';
             $this->aAttributes['max'] = '23:59:59';
             $this->aOptions['format'] = 'H:i:s';
             break;
             /* Caso date */
         /* Caso date */
         case 'datetime':
             $element = new ZendFormElement\DateTime($fieldName);
             $element->setLabel($this->getTranslator($fieldName) . $extraLabel);
             $this->aAttributes['min'] = date("Y") - 10 . '-01-01 00:00:00';
             $this->aAttributes['max'] = date("Y") + 10 . '-12-31 23:59:59';
             $this->aAttributes['class'] = 'form-input';
             break;
             /* Caso email */
         /* Caso email */
         case 'email':
             $element = new ZendFormElement\Email($fieldName);
             $element->setLabel($this->getTranslator($fieldName) . $extraLabel);
             $this->aAttributes['class'] = 'form-input';
             break;
             /* Caso number */
         /* Caso number */
         case 'number':
             $element = new ZendFormElement\Number($fieldName);
             $element->setLabel($this->getTranslator($fieldName) . $extraLabel);
             $this->aAttributes['step'] = '1';
             $this->aAttributes['class'] = 'form-input';
             break;
         case 'integer':
             $element = new ZendFormElement\Number($fieldName);
             $element->setLabel($this->getTranslator($fieldName) . $extraLabel);
             $this->aAttributes['min'] = '0';
             $this->aAttributes['max'] = '99999999999999999999';
             $this->aAttributes['step'] = '1';
             $this->aAttributes['class'] = 'form-input';
             break;
         case 'float':
             $element = new ZendFormElement\Number($fieldName);
             $element->setLabel($this->getTranslator($fieldName) . $extraLabel);
             $this->aAttributes['step'] = '0.001';
             $this->aAttributes['class'] = 'form-input';
             break;
             /* Plataforma */
             /* Caso select */
         /* Plataforma */
         /* Caso select */
         case 'status':
             $element = new ZendFormElement\Select($fieldName, array('disable_inarray_validator' => true));
             $element->setLabel($this->getTranslator($fieldName) . $extraLabel);
             if (isset($fieldParams['placeholder']) and strtolower($fieldParams['placeholder']) == 'true') {
                 $this->selectOptions[''] = $this->getTranslator($fieldName . '_placeholder');
             } else {
                 $this->selectOptions[''] = "---------";
             }
             $this->aAttributes['class'] = 'form-input-select';
             break;
             /* Caso boolean */
         /* Caso boolean */
         case 'boolean':
             $element = new ZendFormElement\Select($fieldName, array('disable_inarray_validator' => true));
             $element->setLabel($this->getTranslator($fieldName) . $extraLabel);
             if (isset($fieldParams['placeholder']) and strtolower($fieldParams['placeholder']) == 'true') {
                 $this->selectOptions[''] = $this->getTranslator($fieldName . '_placeholder');
             } else {
                 $this->selectOptions[''] = "---------";
             }
             $this->aAttributes['class'] = 'form-input-select';
             break;
     }
     /* Verifica se foi setado classe de estilo e implementa */
     if (isset($fieldParams['class']) and !empty($fieldParams['class'])) {
         if (isset($this->aAttributes['class']) and $this->aAttributes['class'] != "") {
             $this->aAttributes['class'] = $this->aAttributes['class'] . " " . $fieldParams['class'];
         } else {
             $this->aAttributes['class'] = $fieldParams['class'];
         }
     }
     /* Define a descrição abaixo do campo */
     if (isset($fieldParams['description']) and $fieldParams['description'] == 'true') {
         $this->aOptions['help-block'] = $this->getTranslator($fieldName . '_description');
     }
     /* Verifica se foi setado grupo do campo e implementa */
     if (isset($fieldParams['group']) and !empty($fieldParams['group'])) {
         $this->aOptions['group'] = $fieldParams['group'];
     }
     /* Verifica se foi setado placeholder no campo e implementa */
     if (isset($fieldParams['placeholder']) and strtolower($fieldParams['placeholder']) == 'true') {
         $this->aAttributes['placeholder'] = $this->getTranslator($fieldName . '_placeholder');
     }
     /* Verifica se foi setado somente leitura e implementa */
     if (isset($fieldParams['readonly']) and strtolower($fieldParams['readonly']) == 'true') {
         $this->aAttributes['readonly'] = 'readonly';
     }
     /* Verifica se foi setado desabilitado e implementa */
     if (isset($fieldParams['disabled']) and strtolower($fieldParams['disabled']) == 'true') {
         $this->aAttributes['disabled'] = true;
     }
     /* Verifica se utilizará mascara no campo */
     if (isset($fieldParams['mask']) and !empty($fieldParams['mask'])) {
         $this->aAttributes['data-inputmask'] = $fieldParams['mask'];
     }
     /* Verifica se foi setado inputgroup tipo append e implementa */
     if (isset($fieldParams['groupappend']) and !empty($fieldParams['groupappend'])) {
         $this->aOptions['add-on-append'] = $fieldParams['groupappend'];
     }
     /* Verifica se foi setado inputgroup tipo prepend e implementa */
     if (isset($fieldParams['groupprepend']) and !empty($fieldParams['groupprepend'])) {
         $this->aOptions['add-on-prepend'] = $fieldParams['groupprepend'];
     }
     /* Verifica se foi setado como array e implementa */
     if (isset($fieldParams['array']) and strtolower($fieldParams['array']) == 'true') {
         $this->aOptions['disable_inarray_validator'] = false;
     }
     if (strtolower($fieldParams['type']) !== 'checkbox' and strtolower($fieldParams['type']) !== 'button') {
         if (strtolower($fieldParams['type']) !== 'textarea' and strtolower($fieldParams['type']) !== 'editor') {
             //$this->aOptions['column-size'] = 'col4';
         } else {
             //$this->aOptions['column-size'] = 'col6';
         }
         $this->aOptions['labelattributes'] = array('class' => 'form-label');
     } else {
         //$this->aOptions['column-size'] = 'col6 col-sm-offset-2';
         unset($this->aOptions['labelattributes']);
     }
     return array('element' => $element, 'params' => $fieldParams);
 }