本文整理汇总了PHP中CRM_Contact_Form_Task::buildQuickForm方法的典型用法代码示例。如果您正苦于以下问题:PHP CRM_Contact_Form_Task::buildQuickForm方法的具体用法?PHP CRM_Contact_Form_Task::buildQuickForm怎么用?PHP CRM_Contact_Form_Task::buildQuickForm使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CRM_Contact_Form_Task
的用法示例。
在下文中一共展示了CRM_Contact_Form_Task::buildQuickForm方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: buildQuickForm
function buildQuickForm()
{
// first: sort out the contacts
$contacts = array();
$households = array();
$organisations = array();
foreach ($this->_contactIds as $contact_id) {
$contact = civicrm_api3('Contact', 'getsingle', array('id' => $contact_id));
if ($contact['contact_type'] == 'Individual') {
$contacts[$contact_id] = $contact;
} elseif ($contact['contact_type'] == 'Household') {
$households[$contact_id] = $contact;
} else {
$organisations[$contact_id] = $contact;
}
}
$this->assign('contacts', $contacts);
$this->assign('households', $households);
$this->assign('ignored', $organisations);
$patterns = $this->calculatePatterns($contacts);
$patterns['custom'] = ts("Custom Name", array('domain' => 'de.systopia.householdmerge'));
// adjust title
CRM_Utils_System::setTitle(ts("Merge %1 contacts into a Household", array(1 => count($contacts), 'domain' => 'de.systopia.householdmerge')));
// Add switch and ID list
$this->add('hidden', 'hh_option');
$this->add('hidden', 'hh_contacts', implode(',', array_keys($contacts)));
// Add "CREATE NEW" elements
$this->add('text', 'household_name', ts('Household Name', array('domain' => 'de.systopia.householdmerge')), array('size' => 32, 'placeholder' => ts("Enter household name", array('domain' => 'de.systopia.householdmerge'))), FALSE);
$pattern_select = $this->add('select', 'household_name_pattern', ts('Household Name', array('domain' => 'de.systopia.householdmerge')), $patterns, TRUE);
$pattern_select->setSelected('custom');
// Add "MERGE INTO" elements
$this->add('text', 'existing_household', ts('Enter Household ID', array('domain' => 'de.systopia.householdmerge')), array('size' => 5), false);
$this->addButtons(array(array('type' => 'submit', 'name' => ts('Merge', array('domain' => 'de.systopia.householdmerge')), 'isDefault' => TRUE), array('type' => 'cancel', 'name' => ts('Abort', array('domain' => 'de.systopia.householdmerge')), 'isDefault' => FALSE)));
parent::buildQuickForm();
}
示例2: buildQuickForm
function buildQuickForm()
{
$mysql = 'SELECT id FROM veda_civicrm_wordmailmerge';
$tableCount = CRM_Core_DAO::executeQuery($mysql);
$noofRows = array();
while ($tableCount->fetch()) {
$noofRows = $tableCount->id;
}
$rowCount = count($noofRows);
if ($rowCount == 0) {
$this->add('select', 'message_template', ts('Message Template'), array('' => '- select -'), TRUE);
CRM_Core_Session::setStatus(ts("No attachement in the template."));
} else {
$sql = " SELECT cmt.id, cmt.msg_title FROM civicrm_msg_template cmt\n RIGHT JOIN veda_civicrm_wordmailmerge vcw ON ( vcw.msg_template_id = cmt.id)";
$dao = CRM_Core_DAO::executeQuery($sql);
while ($dao->fetch()) {
$msgTemplatesResult[$dao->id] = $dao->msg_title;
}
// add form elements
$this->add('select', 'message_template', ts('Message Template'), array('' => '- select -') + $msgTemplatesResult, TRUE);
// if mergeSameAddress method exists
if (method_exists('CRM_Core_BAO_Address', 'mergeSameAddress')) {
//add checkbox for merge contacts with same address
$this->add('checkbox', 'merge_letter_for_same_address', ts('Merge letter for same address'), NULL);
}
$this->addButtons(array(array('type' => 'submit', 'name' => ts('Merge'), 'isDefault' => TRUE)));
}
// export form elements
$this->assign('elementNames', $this->getRenderableElementNames());
parent::buildQuickForm();
}