dataObj->setPrimaryKey($this->doc->getAuth()->getData('id')); parent::exec(); } protected function _bindListColumns($list) { $list->addColumn('no', 'no') ->addColumn('text', 'firstName', array('orderBy' => 'firstName', 'attribs' => array('width' => 120))) ->addColumn('text', 'lastName', array('orderBy' => 'lastName', 'attribs' => array('width' => 200))) ->addColumn('text', 'login', array('orderBy' => 'login', 'attribs' => array('width' => 100))) ->addColumn('email', 'email', array('orderBy' => 'email', 'attribs' => array('width' => 200))) ->addColumn('options', 'options'); } protected function _bindFormFields($form) { $form->addElement('text', 'firstName', array('label' => 'First Name', 'required' => true)); $form->addElement('text', 'lastName', array('label' => 'Last Name', 'required' => true)); $form->addElement('text', 'email', array('label' => 'Email', 'required' => false)); $form->email->addValidator('EmailAddress'); $emailUniqueValidator = new Qs_Validate_Unique($this->dataObj->table, 'email', $this->dataObj->getPrimaryKey()); $emailUniqueValidator->setMessage('Email must be unique', Qs_Validate_Unique::NOT_UNIQUE); $form->email->addValidator($emailUniqueValidator); $form->addElement('text', 'login', array('label' => 'Login', 'required' => true)); $loginValidator = new Qs_Validate_Unique($this->dataObj->table, 'login', $this->dataObj->getPrimaryKey()); $loginValidator->setMessage('Login must be unique', Qs_Validate_Unique::NOT_UNIQUE); $form->login->addValidator($loginValidator); $form->addElement('password', 'password', array('label' => 'Password')); $form->addElement('password', 'confirmPassword', array('label' => 'Confirm Password')); if ($this->doc->getAuthAdapter()->isRemoteAuthEnabled()) { if ($this->doc->getAuth()->getSuMode()) { $form->addElement( 'checkbox', 'remoteAuthEnabled', array( 'label' => 'Support Account (remote authorization)', 'checkedValue' => 'y', 'uncheckedValue' => 'n', 'decorators' => array( 'ViewHelper', array('Label', array('placement' => 'APPEND')), 'Errors', array('Description', array('tag' => 'p', 'class' => 'description')), array('DtDdWrapper'), ) ) ); } if ('y' == $this->_getData('remoteAuthEnabled')) { $form->password->setAttrib('disabled', 'disabled'); $form->password->setDescription('This is support account. You can not change this password.'); $form->confirmPassword->setAttrib('disabled', 'disabled'); } } else { $form->password->addValidator('ConfirmPassword', false, array('confirmPassword')); } if ($this->doc->getAuth()->getSuMode()) { $form->addElement( 'checkbox', 'stsLoginEnabled', array( 'label' => 'STS (remote authorization)', 'checkedValue' => 'y', 'uncheckedValue' => 'n', 'decorators' => array( 'ViewHelper', array('Label', array('placement' => 'APPEND')), 'Errors', array('Description', array('tag' => 'p', 'class' => 'description')), array('DtDdWrapper'), ) ) ); } } protected function _initFromForm($form) { $data = $form->getValues(); if (empty($data['email'])) { $data['email'] = null; } if ($this->action == 'update') { unset($data['login']); } $this->dataObj->initFromForm($data); } protected function _getNewForm() { $form = parent::_getNewForm(); $form->password->setRequired(); $form->confirmPassword->setRequired(); return $form; } protected function _getEditForm() { $form = parent::_getEditForm(); $form->login->setRequired(false); $form->login->setOptions(array('disabled' => 'disabled')); return $form; } }