Example #1
0
 public function __construct($name = 'register-form', CaptchaOptions $options, $role = 'recruiter')
 {
     parent::__construct($name, []);
     $this->setAttribute('data-handle-by', 'native');
     $this->setAttribute('class', 'form-horizontal');
     $fieldset = new Fieldset('register');
     $fieldset->setOptions(array('renderFieldset' => true));
     $fieldset->add(array('type' => 'text', 'name' => 'name', 'options' => array('label' => 'Name')));
     $fieldset->add(array('type' => 'email', 'name' => 'email', 'options' => array('label' => 'Email'), 'attributes' => ['required' => true]));
     $fieldset->add(array('name' => 'role', 'type' => 'hidden', 'attributes' => array('value' => $role)));
     $this->add($fieldset);
     $mode = $options->getMode();
     if (in_array($mode, [CaptchaOptions::RE_CAPTCHA, CaptchaOptions::IMAGE])) {
         if ($mode == CaptchaOptions::IMAGE) {
             $captcha = new Image($options->getImage());
         } elseif ($mode == CaptchaOptions::RE_CAPTCHA) {
             $captcha = new ReCaptcha($options->getReCaptcha());
         }
         if (!empty($captcha)) {
             $this->add(array('name' => 'captcha', 'options' => array('label' => 'Are you human?', 'captcha' => $captcha), 'type' => 'Zend\\Form\\Element\\Captcha'));
         }
     }
     $buttons = new ButtonsFieldset('buttons');
     $buttons->add(array('type' => 'submit', 'name' => 'button', 'attributes' => array('type' => 'submit', 'value' => 'Register', 'class' => 'btn btn-primary')));
     $this->add(array('name' => 'csrf', 'type' => 'csrf', 'options' => array('csrf_options' => array('salt' => str_replace('\\', '_', __CLASS__), 'timeout' => 3600))));
     $this->add($buttons);
 }
Example #2
0
 public function __construct($name = 'register-form', $options = array())
 {
     parent::__construct($name, $options);
     $this->setAttribute('data-handle-by', 'native');
     $this->setAttribute('class', 'form-horizontal');
     $fieldset = new Fieldset('register');
     $fieldset->setOptions(array('renderFieldset' => true));
     $fieldset->add(array('type' => 'text', 'name' => 'name', 'options' => array('label' => 'Name')));
     $fieldset->add(array('type' => 'email', 'name' => 'email', 'options' => array('label' => 'Email')));
     $fieldset->add(array('name' => 'role', 'type' => 'hidden', 'attributes' => array('value' => User::ROLE_RECRUITER)));
     $this->add($fieldset);
     if (($captchaOptions = $this->getOption('captcha')) && !empty($captchaOptions['use'])) {
         if ($captchaOptions['use'] === 'image' && !empty($captchaOptions['image'])) {
             $captcha = new Image($captchaOptions['image']);
         } elseif ($captchaOptions['use'] === 'reCaptcha' && !empty($captchaOptions['reCaptcha'])) {
             $captcha = new ReCaptcha($captchaOptions['reCaptcha']);
         }
         if (!empty($captcha)) {
             $this->add(array('name' => 'captcha', 'options' => array('label' => 'Are you human?', 'captcha' => $captcha), 'type' => 'Zend\\Form\\Element\\Captcha'));
         }
     }
     $buttons = new ButtonsFieldset('buttons');
     $buttons->add(array('type' => 'submit', 'name' => 'button', 'attributes' => array('type' => 'submit', 'value' => 'Register', 'class' => 'btn btn-primary')));
     $this->add(array('name' => 'csrf', 'type' => 'csrf', 'options' => array('csrf_options' => array('salt' => str_replace('\\', '_', __CLASS__), 'timeout' => 3600))));
     $this->add($buttons);
 }
Example #3
0
 public function __construct($name = 'forgot-password', $options = array())
 {
     parent::__construct($name, $options);
     $this->setAttribute('data-handle-by', 'native');
     $this->setAttribute('class', 'form-horizontal');
     $this->add(array('type' => 'text', 'name' => 'identity', 'options' => array('label' => 'Username or email', 'is_disable_capable' => false)));
     $buttons = new ButtonsFieldset('buttons');
     $buttons->add(array('type' => 'submit', 'name' => 'button', 'attributes' => array('id' => 'submit', 'type' => 'submit', 'value' => 'Reset your password', 'class' => 'btn btn-primary')));
     $this->add(array('name' => 'csrf', 'type' => 'csrf'));
     $this->add($buttons);
 }
Example #4
0
 public function __construct($name = 'login-form', $options = array())
 {
     parent::__construct($name, $options);
     $this->setAttribute('data-handle-by', 'native');
     $this->setAttribute('class', 'form-inline');
     $fieldset = new Fieldset('credentials');
     $fieldset->setOptions(array('renderFieldset' => true));
     $fieldset->add(array('name' => 'login', 'options' => array('id' => 'login', 'label' => 'Login name')));
     $fieldset->add(array('type' => 'password', 'name' => 'credential', 'options' => array('id' => 'credential', 'label' => 'Password')));
     $this->add($fieldset);
     $buttons = new \Core\Form\ButtonsFieldset('buttons');
     $buttons->add(array('type' => 'submit', 'name' => 'button', 'attributes' => array('id' => 'submit', 'type' => 'submit', 'value' => 'login', 'class' => 'btn btn-primary')));
     $this->add($buttons);
 }
Example #5
0
 public function __construct($id)
 {
     parent::__construct($id);
 }
Example #6
0
 public function __construct($useAcl = false)
 {
     $this->isExtended = (bool) $useAcl;
     parent::__construct();
 }
Example #7
0
 /**
  * @param int|null|string $name
  * @param array           $options
  *
  * fieldset: string service name of the Fieldset class
  */
 public function __construct($name = null, array $options = [])
 {
     $this->fieldset = array_key_exists('fieldset', $options) ? $options['fieldset'] : self::BASE_FIELDSET;
     parent::__construct();
 }
 public function __construct($extended = false)
 {
     $this->isExtended = (bool) $extended;
     parent::__construct();
 }
 /**
  * @param ServiceLocatorInterface $formManager
  */
 public function __construct(ServiceLocatorInterface $formManager)
 {
     parent::__construct();
     $this->formManager = $formManager;
 }