public function configure() { unset($this['id'], $this['person_id'], $this['date_added'], $this['date_updated']); $sources = RefSourcePeer::getForSelectParent(); $types = ContactTypePeer::getForSelectParent(); $companies = CompanyPeer::getForSelectParent(); # Fields $this->widgetSchema['ref_source_id'] = new sfWidgetFormChoice(array('choices' => $sources), array('class' => 'text narrow')); $this->widgetSchema['send_app_format'] = new sfWidgetFormInput(array(), array('class' => 'text')); $this->widgetSchema['comment'] = new sfWidgetFormInput(array(), array('class' => 'text')); $this->widgetSchema['letter_sent'] = new widgetFormDate(array('change_year' => true, 'change_month' => true, 'format_date' => array('js' => 'mm/dd/yy', 'php' => 'm/d/Y')), array('class' => 'text narrow')); $this->widgetSchema['contact_type_id'] = new sfWidgetFormChoice(array('choices' => $types), array('class' => 'text narrow')); $this->widgetSchema['company_name'] = new sfWidgetFormChoice(array('choices' => $companies), array('class' => 'text narrow')); $this->widgetSchema->setLabels(array('person_id' => 'Person')); $this->widgetSchema->setLabels(array('ref_source_id' => 'Ref Source')); $this->widgetSchema->setLabels(array('send_app_format' => 'Send Application Format')); $this->widgetSchema->setLabels(array('comment' => 'Comment')); $this->widgetSchema->setLabels(array('letter_sent' => 'Letter Sent')); $this->widgetSchema->setLabels(array('contact_type_id' => 'Contact Type')); $this->widgetSchema->setLabels(array('company_name' => 'Company Name')); $this->validatorSchema['ref_source_id'] = new sfValidatorInteger(array('required' => false)); $this->validatorSchema['send_app_format'] = new sfValidatorString(array('required' => false)); $this->validatorSchema['comment'] = new sfValidatorString(array('required' => false)); $this->validatorSchema['letter_sent'] = new sfValidatorDate(array('max' => time(), 'required' => false), array('invalid' => 'Letter sent is invalid !.')); $this->validatorSchema['contact_type_id'] = new sfValidatorInteger(array('required' => false)); $this->validatorSchema['company_name'] = new sfValidatorInteger(array('required' => false)); $this->widgetSchema->setNameFormat('contact[%s]'); }
public function configure() { unset($this['id'], $this['date_added'], $this['date_updated']); $affiliations = AffiliationPeer::getForSelectParent(); $companies = CompanyPeer::getForSelectParent(); $persons = PersonPeer::getForSelectParent(); # Fields $this->widgetSchema['co_donor_id'] = new sfWidgetFormInput(array(), array('class' => 'text narrow')); $this->widgetSchema['affiliation_id'] = new sfWidgetFormChoice(array('choices' => $affiliations)); $this->widgetSchema['block_mailings'] = new sfWidgetFormInputCheckbox(array(), array('value' => 1)); $this->widgetSchema['prospect_comment'] = new sfWidgetFormTextarea(array(), array('class' => 'text')); $this->widgetSchema['salutation'] = new sfWidgetFormInput(array(), array('class' => 'text')); $this->widgetSchema['company_id'] = new sfWidgetFormChoice(array('choices' => $companies)); $this->widgetSchema['position'] = new sfWidgetFormInput(array(), array('class' => 'text')); $this->widgetSchema['donor_potential'] = new sfWidgetFormInput(array(), array('class' => 'text')); $this->widgetSchema['person_id'] = new sfWidgetFormChoice(array('choices' => $persons)); $this->widgetSchema->setLabels(array('co_donor_id' => 'Co Donor Id')); $this->widgetSchema->setLabels(array('affiliation_id' => 'Affiliation Id')); $this->widgetSchema->setLabels(array('block_mailings' => 'Block mailings')); $this->widgetSchema->setLabels(array('prospect_comment' => 'Prospect comment')); $this->widgetSchema->setLabels(array('salutation' => 'Salutation')); $this->widgetSchema->setLabels(array('company_id' => 'Company')); $this->widgetSchema->setLabels(array('position' => 'Position')); $this->widgetSchema->setLabels(array('donor_potential' => 'Donor potential')); $this->widgetSchema->setLabels(array('person_id' => 'Person')); $this->validatorSchema['co_donor_id'] = new sfValidatorInteger(array('required' => false), array('invalid' => 'Co donor id must be in number format !')); $this->validatorSchema['affiliation_id'] = new sfValidatorInteger(array('required' => false)); $this->validatorSchema['block_mailings'] = new sfValidatorInteger(array('required' => false)); $this->validatorSchema['prospect_comment'] = new sfValidatorString(array('required' => false)); $this->validatorSchema['salutation'] = new sfValidatorString(array('required' => false)); $this->validatorSchema['company_id'] = new sfValidatorInteger(array('required' => false)); $this->validatorSchema['position'] = new sfValidatorString(array('required' => false)); $this->validatorSchema['donor_potential'] = new sfValidatorInteger(array('required' => false), array('invalid' => 'Donor porential must be in number format !')); $this->validatorSchema['person_id'] = new sfValidatorInteger(array('required' => false)); $this->widgetSchema->setNameFormat('donor[%s]'); }