Exemplo n.º 1
0
 /**
  * Function to actually build the form
  *
  * @return None
  * @access public
  */
 public function buildQuickForm()
 {
     //load form for child blocks
     if ($this->_addBlockName) {
         require_once str_replace('_', DIRECTORY_SEPARATOR, "CRM_Contact_Form_Edit_" . $this->_addBlockName) . ".php";
         return eval('CRM_Contact_Form_Edit_' . $this->_addBlockName . '::buildQuickForm( $this );');
     }
     //build contact type specific fields
     require_once str_replace('_', DIRECTORY_SEPARATOR, "CRM_Contact_Form_Edit_" . $this->_contactType) . ".php";
     eval('CRM_Contact_Form_Edit_' . $this->_contactType . '::buildQuickForm( $this, $this->_action );');
     // subtype is a common field. lets keep it here
     require_once 'CRM/Contact/BAO/ContactType.php';
     $subtypes = CRM_Contact_BAO_ContactType::subTypePairs($this->_contactType);
     if (!empty($subtypes)) {
         $subtypeElem =& $this->addElement('select', 'contact_sub_type', ts('Subtype'), array('' => '') + $subtypes);
     }
     $allowEditSubType = true;
     if ($this->_contactId) {
         $allowEditSubType = CRM_Contact_BAO_Contact::allowEditSubtype($this->_contactId, $this->_contactSubType, $this->_groupTree);
     }
     $this->assign('allowEditSubType', $allowEditSubType);
     // build edit blocks ( custom data, demographics, communication preference, notes, tags and groups )
     foreach ($this->_editOptions as $name => $label) {
         if ($name == 'Address') {
             $this->_blocks['Address'] = $this->_editOptions['Address'];
             continue;
         }
         require_once str_replace('_', DIRECTORY_SEPARATOR, "CRM_Contact_Form_Edit_" . $name) . ".php";
         eval('CRM_Contact_Form_Edit_' . $name . '::buildQuickForm( $this );');
     }
     // build location blocks.
     CRM_Contact_Form_Location::buildQuickForm($this);
     // add the dedupe button
     $this->addElement('submit', $this->_dedupeButtonName, ts('Check for Matching Contact(s)'));
     $this->addElement('submit', $this->_duplicateButtonName, ts('Save Matching Contact'));
     $this->addElement('submit', $this->getButtonName('next', 'sharedHouseholdDuplicate'), ts('Save With Duplicate Household'));
     $this->addButtons(array(array('type' => 'upload', 'name' => ts('Save'), 'subName' => 'view', 'isDefault' => true), array('type' => 'upload', 'name' => ts('Save and New'), 'subName' => 'new'), array('type' => 'cancel', 'name' => ts('Cancel'))));
 }