/** * Set those values needed for editing * * @return \Gems_Model_RespondentModel */ public function applyEditSettings() { $this->applyDetailSettings(); $this->copyKeys(); // The user can edit the keys. $translated = $this->util->getTranslated(); $ucfirst = new \Zend_Filter_Callback('ucfirst'); if ($this->hashSsn !== \Gems_Model_RespondentModel::SSN_HIDE) { $onblur = new \MUtil_Html_JavascriptArrayAttribute('onblur'); $onblur->addSubmitOnChange('this.value'); $this->set('grs_ssn', 'onblur', $onblur->render($this->view), 'validator[]', $this->createUniqueValidator('grs_ssn')); } $this->setIfExists('gr2o_patient_nr', 'size', 15, 'minlength', 4, 'validator', $this->createUniqueValidator(array('gr2o_patient_nr', 'gr2o_id_organization'), array('gr2o_id_user' => 'grs_id_user', 'gr2o_id_organization'))); $this->set('grs_id_user'); $this->set('grs_email', 'required', true, 'autoInsertNotEmptyValidator', false, 'size', 30, 'validator', 'SimpleEmail'); $this->addColumn('CASE WHEN grs_email IS NULL OR LENGTH(TRIM(grs_email)) = 0 THEN 1 ELSE 0 END', 'calc_email'); $this->set('calc_email', 'label', $this->_('Respondent has no e-mail'), 'elementClass', 'Checkbox', 'required', true, 'order', $this->getOrder('grs_email') + 1, 'validator', new \Gems_Validate_OneOf($this->_('Respondent has no e-mail'), 'grs_email', $this->get('grs_email', 'label'))); $this->set('gr2o_mailable', 'label', $this->_('May be mailed'), 'elementClass', 'radio', 'separator', ' ', 'multiOptions', array('1' => $this->_('Yes'), '0' => $this->_('No'))); $this->setIfExists('grs_first_name', 'filter', $ucfirst); $this->setIfExists('grs_last_name', 'filter', $ucfirst, 'required', true); $this->setIfExists('grs_partner_last_name', 'filter', new \Zend_Filter_Callback('ucfirst')); $this->setIfExists('grs_gender', 'elementClass', 'Radio', 'separator', '', 'multiOptions', $translated->getGenders(), 'tab', $this->_('Medical data')); $this->setIfExists('grs_birthday', 'jQueryParams', array('defaultDate' => '-30y', 'maxDate' => 0, 'yearRange' => 'c-130:c0'), 'elementClass', 'Date', 'validator', new \MUtil_Validate_Date_DateBefore()); $this->setIfExists('gr2o_treatment', 'size', 30); $this->setIfExists('gr2o_comments', 'elementClass', 'Textarea', 'rows', 4, 'cols', 60); $this->setIfExists('grs_address_1', 'size', 40, 'description', $this->_('With housenumber'), 'filter', $ucfirst); $this->setIfExists('grs_address_2', 'size', 40); $this->setIfExists('grs_city', 'filter', $ucfirst); $this->setIfExists('grs_phone_1', 'size', 15); $this->setIfExists('grs_phone_2', 'size', 15); $this->setIfExists('grs_phone_3', 'size', 15); $this->setIfExists('grs_phone_4', 'size', 15); $this->setIfExists('gr2o_opened', 'elementClass', 'hidden'); // Has little use to show: is usually editor $this->setIfExists('gr2o_changed', 'elementClass', 'Exhibitor'); $this->setIfExists('gr2o_changed_by', 'elementClass', 'Exhibitor'); $this->setIfExists('gr2o_consent', 'default', $this->util->getDefaultConsent(), 'elementClass', 'Radio', 'separator', '', 'required', true); $this->setIfExists('name', 'elementClass', 'hidden'); return $this; }