'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', ['label' => 'First Name', 'required' => true]); $this->addElement('text', 'lastName', ['label' => 'Last Name', 'required' => true]); $this->addElement('email', 'email', ['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', ['label' => 'Login', 'required' => true, 'attribs' => ['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', ['label' => 'Password', 'attribs' => ['autocomplete' => 'off']] ); $this->addElement( 'password', 'confirmPassword', ['label' => 'Confirm Password', 'attribs' => ['autocomplete' => 'off']] ); $this->getElement('password')->setAllowEmpty(false); $this->getElement('confirmPassword')->setAllowEmpty(false); $this->getElement('password')->addValidator('NotEmptyDependent', true, ['confirmPassword']); $this->getElement('confirmPassword')->addValidator('NotEmptyDependent', true, ['password']); if ($authAdapter->isRemoteAuthEnabled() && $auth->getSuMode()) { $this->addElement( 'checkbox', 'remoteAuthEnabled', [ '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, ['confirmPassword']); } if ($auth->getSuMode()) { $this->addElement( 'checkbox', 'stsLoginEnabled', [ 'label' => 'STS (Remote Authorization)', 'decoration' => 'simple', ] ); } return $this; } public function getDefaults() { return $this->_getDefaults(); } }