Ejemplo n.º 1
0
 /**
  * @param string|null $name
  * @param RegistrationOptionsInterface $options
  */
 public function __construct($name, RegistrationOptionsInterface $options)
 {
     $this->setRegistrationOptions($options);
     parent::__construct($name);
     $this->remove('userId');
     if (!$this->getRegistrationOptions()->getEnableUsername()) {
         $this->remove('username');
     }
     if (!$this->getRegistrationOptions()->getEnableDisplayName()) {
         $this->remove('display_name');
     }
     // 增加type项
     $this->add(array('name' => 'type', 'type' => 'Zend\\Form\\Element\\Hidden', 'attributes' => array('value' => '2'), 'options' => array('label' => '用户类型')));
     // 增加 用户信息
     $this->add(array('name' => 'realName', 'type' => 'Text', 'options' => array('label' => '公司/个人名称')));
     $this->add(array('name' => 'memberAddress', 'type' => 'Text', 'options' => array('label' => '详细地址')));
     $this->add(array('name' => 'memberTelphone', 'type' => 'Text', 'options' => array('label' => '固定电话')));
     $this->add(array('name' => 'memberPhone', 'type' => 'Text', 'options' => array('label' => '移动电话')));
     $this->add(array('name' => 'memberQq', 'type' => 'Text', 'options' => array('label' => 'QQ')));
     $this->add(array('name' => 'memberMsn', 'type' => 'Text', 'options' => array('label' => 'MSN')));
     $this->add(array('name' => 'memberWebsite', 'type' => 'Url', 'options' => array('label' => '使用域名'), 'attributes' => array('value' => 'http://')));
     if ($this->getRegistrationOptions()->getUseRegistrationFormCaptcha() && $this->captchaElement) {
         $this->add($this->captchaElement, array('name' => 'captcha'));
     }
     $this->get('submit')->setLabel('注册');
     $this->getEventManager()->trigger('init', $this);
 }
Ejemplo n.º 2
0
 /**
  * @param string|null $name
  * @param RegistrationOptionsInterface $options
  */
 public function __construct($name = null, RegistrationOptionsInterface $options)
 {
     $this->setRegistrationOptions($options);
     parent::__construct($name);
     $this->remove('userId');
     if (!$this->getRegistrationOptions()->getEnableUsername()) {
         $this->remove('username');
     }
     if (!$this->getRegistrationOptions()->getEnableDisplayName()) {
         $this->remove('display_name');
     }
     if ($this->getRegistrationOptions()->getUseRegistrationFormCaptcha() && $this->captchaElement) {
         $this->add($this->captchaElement, array('name' => 'captcha'));
     }
     $this->get('submit')->setLabel('Register');
     $this->getEventManager()->trigger('init', $this);
 }
Ejemplo n.º 3
0
 public function initLate()
 {
     parent::initLate();
     $this->removeElement('userId');
     $this->getElement('submit')->setLabel('Register');
 }