'y'); protected function _bindListColumns(Qs_ViewController_List $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'); return $this; } protected function _bindFormFields(Qs_Form $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'), ) ) ); } return $this; } protected function _initFromForm(Qs_Form $form) { $data = $form->getValues(); if (empty($data['email'])) { $data['email'] = null; } foreach ($this->getFormDefaults() as $field => $value) { if (!array_key_exists($field, $data)) { $data[$field] = $value; } } $this->dataObj->initFromForm($data); return $this; } protected function _getNewForm() { $form = parent::_getNewForm(); $form->password->setRequired(); $form->confirmPassword->setRequired(); return $form; } }