'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('email', 'email', array('label' => 'Email', 'required' => false)); $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')) ); $this->getElement('password')->setAllowEmpty(false); $this->getElement('confirmPassword')->setAllowEmpty(false); $this->getElement('password')->addValidator('NotEmptyDependent', true, array('confirmPassword')); $this->getElement('confirmPassword')->addValidator('NotEmptyDependent', true, array('password')); 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', true, array('confirmPassword')); } if ($auth->getSuMode()) { $this->addElement( 'checkbox', 'stsLoginEnabled', array( 'label' => 'STS (Remote Authorization)', 'decoration' => 'simple', ) ); } return $this; } public function getDefaults() { return $this->_getDefaults(); } }