'y'); protected function _initElements() { $authAdapter = new App_Admin_AuthAdapter(); $auth = App_Admin_Auth::getInstance(); $table = new Qs_Db_Table('Admin'); $primaryKey = $this->_getData('id'); $this->addElement('text', 'firstName', array('label' => 'First Name', 'required' => true)); $this->addElement('text', 'lastName', array('label' => 'Last Name', 'required' => true)); $this->addElement('text', 'email', array('label' => 'Email', 'required' => false)); $this->getElement('email')->addValidator('EmailAddress'); $emailUniqueValidator = new Qs_Validate_Unique($table, 'email', $primaryKey); $emailUniqueValidator->setMessage('Email must be unique', Qs_Validate_Unique::NOT_UNIQUE); $this->getElement('email')->addValidator($emailUniqueValidator); $this->addElement( 'text', 'login', array('label' => 'Login', 'required' => true, 'attribs' => array('autocomplete' => 'off')) ); $loginValidator = new Qs_Validate_Unique($table, 'login', $primaryKey); $loginValidator->setMessage('Login must be unique', Qs_Validate_Unique::NOT_UNIQUE); $this->getElement('login')->addValidator($loginValidator); $this->addElement( 'password', 'password', array('label' => 'Password', 'attribs' => array('autocomplete' => 'off')) ); $this->addElement( 'password', 'confirmPassword', array('label' => 'Confirm Password', 'attribs' => array('autocomplete' => 'off')) ); if ($authAdapter->isRemoteAuthEnabled() && $auth->getSuMode()) { $this->addElement( 'checkbox', 'remoteAuthEnabled', array( 'label' => 'Support Account (Remote Authorization)', 'decoration' => 'simple', ) ); } if ('y' == $this->_getData('remoteAuthEnabled')) { $this->getElement('password')->setAttrib('disabled', 'disabled'); $this->getElement('password')->setDescription( 'This is support account. You can not change this password.' ); $this->getElement('confirmPassword')->setAttrib('disabled', 'disabled'); } else { $this->getElement('password')->addValidator('ConfirmPassword', false, array('confirmPassword')); } if ($auth->getSuMode()) { $this->addElement( 'checkbox', 'stsLoginEnabled', array( 'label' => 'STS (Remote Authorization)', 'decoration' => 'simple', ) ); } return $this; } public function getDefaults() { return $this->_getDefaults(); } }