public function __construct(RegistrationOptionsInterface $registrationOptions)
 {
     $this->setRegistrationOptions($registrationOptions);
     parent::__construct(null, $registrationOptions);
     if (!$this->has('userId')) {
         $this->add(array('name' => 'userId', 'type' => 'Zend\\Form\\Element\\Hidden', 'attributes' => array('type' => 'hidden')));
     }
 }
示例#2
0
 public function __construct($name = null, UserCreateOptionsInterface $createOptions, RegistrationOptionsInterface $registerOptions, $serviceManager)
 {
     $this->setCreateOptions($createOptions);
     $this->setServiceManager($serviceManager);
     parent::__construct($name, $registerOptions);
     if ($createOptions->getCreateUserAutoPassword()) {
         $this->remove('password');
         $this->remove('passwordVerify');
     }
     foreach ($this->getCreateOptions()->getCreateFormElements() as $name => $element) {
         // avoid adding fields twice (e.g. email)
         // if ($this->get($element)) continue;
         $this->add(array('name' => $element, 'options' => array('label' => $name), 'attributes' => array('type' => 'text')));
     }
     $this->get('submit')->setAttribute('label', 'Create');
 }
示例#3
0
 public function __construct(EntityManager $em, $name = null, RegistrationOptionsInterface $options)
 {
     $this->setUseInputFilterDefaults(false);
     // remove zf2 default validators
     parent::__construct($name, $options);
     $this->em = $em;
     //        $this->get('userId')
     //                ->setName('user_id');
     $this->add(array('name' => 'id', 'attributes' => array('type' => 'hidden')));
     $this->get('email')->setLabel('Email Address')->setAttributes(array('placeholder' => 'We will be sending your login details here', 'class' => 'form-control', 'id' => 'email'));
     $this->get('username')->setAttributes(array('placeholder' => 'Username (this can be changed later)', 'class' => 'form-control', 'id' => 'username'));
     $this->get('password')->setAttributes(array('placeholder' => 'Minimum of 6 characters', 'class' => 'form-control', 'id' => 'password'));
     $this->get('passwordVerify')->setAttributes(array('placeholder' => 'Must match the password', 'class' => 'form-control', 'id' => 'passwordVerify'));
     $this->get('submit')->setName('install')->setLabel('Install')->setAttributes(array('class' => 'btn btn-primary btn-block', 'id' => 'install'));
     $this->add(array('name' => 'firstname', 'options' => array('label' => 'First Name'), 'attributes' => array('type' => 'text', 'placeholder' => 'John', 'class' => 'form-control', 'id' => 'firstname', 'autofocus' => 'autofocus')))->add(array('name' => 'lastname', 'options' => array('label' => 'Last Name'), 'attributes' => array('type' => 'text', 'placeholder' => 'Doe', 'class' => 'form-control', 'id' => 'lastname')))->add(array('type' => 'DoctrineModule\\Form\\Element\\ObjectSelect', 'name' => 'role', 'options' => array('label' => 'Role', 'object_manager' => $this->em, 'target_class' => 'ZfMuscle\\Entity\\Role', 'property' => 'roleId', 'empty_option' => 'please select...', 'is_method' => true, 'find_method' => array('name' => 'getRoles')), 'attributes' => array('class' => 'full-width', 'data-placeholder' => 'Select User Role', 'data-init-plugin' => 'select2', 'id' => 'role')));
 }
示例#4
0
 public function __construct($name = null, UserEditOptionsInterface $options, RegistrationOptionsInterface $registerOptions, $serviceManager)
 {
     $this->setUserEditOptions($options);
     $this->setServiceManager($serviceManager);
     parent::__construct($name, $registerOptions);
     $this->remove('captcha');
     if ($this->userEditOptions->getAllowPasswordChange()) {
         $this->add(array('name' => 'reset_password', 'type' => 'Zend\\Form\\Element\\Checkbox', 'options' => array('label' => 'Reset password to random')));
         $password = $this->get('password');
         $password->setAttribute('required', false);
         $password->setOptions(array('label' => 'Password (only if want to change)'));
         $this->remove('passwordVerify');
     } else {
         $this->remove('password')->remove('passwordVerify');
     }
     foreach ($this->getUserEditOptions()->getEditFormElements() as $name => $element) {
         // avoid adding fields twice (e.g. email)
         // if ($this->get($element)) continue;
         $this->add(array('name' => $element, 'options' => array('label' => $name), 'attributes' => array('type' => 'text')));
     }
     $this->get('submit')->setLabel('Save')->setValue('Save');
     $this->add(array('name' => 'userId', 'attributes' => array('type' => 'hidden')));
 }