本文整理汇总了PHP中CRM_Core_Form_Date::buildDateRange方法的典型用法代码示例。如果您正苦于以下问题:PHP CRM_Core_Form_Date::buildDateRange方法的具体用法?PHP CRM_Core_Form_Date::buildDateRange怎么用?PHP CRM_Core_Form_Date::buildDateRange使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CRM_Core_Form_Date
的用法示例。
在下文中一共展示了CRM_Core_Form_Date::buildDateRange方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: buildQuickForm
public function buildQuickForm()
{
$parent = $this->controller->getParent();
$nameTextLabel = $parent->_sms ? ts('SMS Name') : ts('Mailing Name');
$this->add('text', 'mailing_name', $nameTextLabel, CRM_Core_DAO::getAttribute('CRM_Mailing_DAO_Mailing', 'title'));
CRM_Core_Form_Date::buildDateRange($this, 'mailing', 1, '_from', '_to', ts('From'), FALSE);
$this->add('text', 'sort_name', ts('Created or Sent by'), CRM_Core_DAO::getAttribute('CRM_Contact_DAO_Contact', 'sort_name'));
CRM_Campaign_BAO_Campaign::addCampaignInComponentSearch($this);
// CRM-15434 - Fix mailing search by status in non-English languages
$statusVals = CRM_Core_SelectValues::getMailingJobStatus();
foreach ($statusVals as $statusId => $statusName) {
$this->addElement('checkbox', "mailing_status[{$statusId}]", NULL, $statusName);
}
$this->addElement('checkbox', 'status_unscheduled', NULL, ts('Draft / Unscheduled'));
$this->addYesNo('is_archived', ts('Mailing is Archived'), TRUE);
// Search by language, if multi-lingual
$enabledLanguages = CRM_Core_I18n::languages(TRUE);
if (count($enabledLanguages) > 1) {
$this->addElement('select', 'language', ts('Language'), array('' => ts('- all languages -')) + $enabledLanguages, array('class' => 'crm-select2'));
}
if ($parent->_sms) {
$this->addElement('hidden', 'sms', $parent->_sms);
}
$this->add('hidden', 'hidden_find_mailings', 1);
$this->addButtons(array(array('type' => 'refresh', 'name' => ts('Search'), 'isDefault' => TRUE)));
}
示例2: buildQuickForm
public function buildQuickForm()
{
$parent = $this->controller->getParent();
$nameTextLabel = $parent->_sms ? ts('SMS Name') : ts('Mailing Name');
$this->add('text', 'mailing_name', $nameTextLabel, CRM_Core_DAO::getAttribute('CRM_Mailing_DAO_Mailing', 'title'));
CRM_Core_Form_Date::buildDateRange($this, 'mailing', 1, '_from', '_to', ts('From'), FALSE, FALSE);
$this->add('text', 'sort_name', ts('Created or Sent by'), CRM_Core_DAO::getAttribute('CRM_Contact_DAO_Contact', 'sort_name'));
CRM_Campaign_BAO_Campaign::addCampaignInComponentSearch($this);
foreach (array('Scheduled', 'Complete', 'Running') as $status) {
$this->addElement('checkbox', "mailing_status[{$status}]", NULL, $status);
}
if ($parent->_sms) {
$this->addElement('hidden', 'sms', $parent->_sms);
}
$this->addButtons(array(array('type' => 'refresh', 'name' => ts('Search'), 'isDefault' => TRUE)));
}
示例3: custom
/**
* Generate the custom Data Fields based
* on the is_searchable
*
*
* @param $form
*
* @return void
*/
public static function custom(&$form)
{
$form->add('hidden', 'hidden_custom', 1);
$extends = array_merge(array('Contact', 'Individual', 'Household', 'Organization'), CRM_Contact_BAO_ContactType::subTypes());
$groupDetails = CRM_Core_BAO_CustomGroup::getGroupDetail(NULL, TRUE, $extends);
$form->assign('groupTree', $groupDetails);
foreach ($groupDetails as $key => $group) {
$_groupTitle[$key] = $group['name'];
CRM_Core_ShowHideBlocks::links($form, $group['name'], '', '');
$groupId = $group['id'];
foreach ($group['fields'] as $field) {
$fieldId = $field['id'];
$elementName = 'custom_' . $fieldId;
if ($field['data_type'] == 'Date' && $field['is_search_range']) {
CRM_Core_Form_Date::buildDateRange($form, $elementName, 1, '_from', '_to', ts('From:'), FALSE);
} else {
CRM_Core_BAO_CustomField::addQuickFormElement($form, $elementName, $fieldId, FALSE, FALSE, TRUE);
}
}
}
//TODO: validate for only one state if prox_distance isset
}
示例4: buildSearchForm
/**
* add all the elements shared between Mailing search and advnaced search
*
* @access public
*
* @return void
* @static
*/
static function buildSearchForm(&$form)
{
// mailing selectors
$mailings = CRM_Mailing_BAO_Mailing::getMailingsList();
if (!empty($mailings)) {
$form->add('select', 'mailing_id', ts('Mailing Name(s)'), $mailings, FALSE, array('id' => 'mailing_id', 'multiple' => 'multiple', 'title' => ts('- select -')));
}
CRM_Core_Form_Date::buildDateRange($form, 'mailing_date', 1, '_low', '_high', ts('From'), FALSE, FALSE);
// event filters
$form->addRadio('mailing_delivery_status', ts('Delivery Status'), CRM_Mailing_PseudoConstant::yesNoOptions('delivered'));
$form->addRadio('mailing_open_status', ts('Trackable Opens'), CRM_Mailing_PseudoConstant::yesNoOptions('open'));
$form->addRadio('mailing_click_status', ts('Trackable URLs'), CRM_Mailing_PseudoConstant::yesNoOptions('click'));
$form->addRadio('mailing_reply_status', ts('Trackable Replies'), CRM_Mailing_PseudoConstant::yesNoOptions('reply'));
$form->add('checkbox', 'mailing_unsubscribe', ts('Unsubscribe Requests'));
$form->add('checkbox', 'mailing_optout', ts('Opt-out Requests'));
$form->add('checkbox', 'mailing_forward', ts('Forwards'));
$form->assign('validCiviMailing', TRUE);
$form->addFormRule(array('CRM_Mailing_BAO_Query', 'formRule'), $form);
}
示例5: buildSearchForm
/**
* Build the search form.
*
* @param CRM_Core_Form $form
*/
public static function buildSearchForm(&$form)
{
$membershipStatus = CRM_Member_PseudoConstant::membershipStatus();
$form->add('select', 'membership_status_id', ts('Membership Status(s)'), $membershipStatus, FALSE, array('id' => 'membership_status_id', 'multiple' => 'multiple', 'class' => 'crm-select2'));
$form->addEntityRef('membership_type_id', ts('Membership Type(s)'), array('entity' => 'MembershipType', 'multiple' => TRUE, 'placeholder' => ts('- any -'), 'select' => array('minimumInputLength' => 0)));
$form->addElement('text', 'member_source', ts('Source'));
CRM_Core_Form_Date::buildDateRange($form, 'member_join_date', 1, '_low', '_high', ts('From'), FALSE);
CRM_Core_Form_Date::buildDateRange($form, 'member_start_date', 1, '_low', '_high', ts('From'), FALSE);
CRM_Core_Form_Date::buildDateRange($form, 'member_end_date', 1, '_low', '_high', ts('From'), FALSE);
$form->addYesNo('member_is_primary', ts('Primary Member?'), TRUE);
$form->addYesNo('member_pay_later', ts('Pay Later?'), TRUE);
$form->addYesNo('member_auto_renew', ts('Auto-Renew?'), TRUE);
$form->addYesNo('member_test', ts('Membership is a Test?'), TRUE);
$form->addYesNo('member_is_override', ts('Membership Status Is Override?'), TRUE);
// add all the custom searchable fields
$extends = array('Membership');
$groupDetails = CRM_Core_BAO_CustomGroup::getGroupDetail(NULL, TRUE, $extends);
if ($groupDetails) {
$form->assign('membershipGroupTree', $groupDetails);
foreach ($groupDetails as $group) {
foreach ($group['fields'] as $field) {
$fieldId = $field['id'];
$elementName = 'custom_' . $fieldId;
CRM_Core_BAO_CustomField::addQuickFormElement($form, $elementName, $fieldId, FALSE, FALSE, TRUE);
}
}
}
CRM_Campaign_BAO_Campaign::addCampaignInComponentSearch($form, 'member_campaign_id');
$form->assign('validCiviMember', TRUE);
$form->setDefaults(array('member_test' => 0));
}
示例6: recurringContribution
/**
* @param $form
*/
public static function recurringContribution(&$form)
{
// Recurring contribution fields
foreach (self::getRecurringFields() as $key => $label) {
if ($key == 'contribution_recur_payment_made' && !empty($form->_formValues) && !CRM_Utils_System::isNull(CRM_Utils_Array::value($key, $form->_formValues))) {
$form->assign('contribution_recur_pane_open', TRUE);
break;
}
CRM_Core_Form_Date::buildDateRange($form, $key, 1, '_low', '_high');
// If data has been entered for a recurring field, tell the tpl layer to open the pane
if (!empty($form->_formValues) && !empty($form->_formValues[$key . '_relative']) || !empty($form->_formValues[$key . '_low']) || !empty($form->_formValues[$key . '_high'])) {
$form->assign('contribution_recur_pane_open', TRUE);
break;
}
}
// Add field to check if payment is made for recurring contribution
$recurringPaymentOptions = array(1 => ts('All recurring contributions'), 2 => ts('Recurring contributions with at least one payment'));
$form->addRadio('contribution_recur_payment_made', NULL, $recurringPaymentOptions, array('allowClear' => TRUE));
CRM_Core_Form_Date::buildDateRange($form, 'contribution_recur_start_date', 1, '_low', '_high', ts('From'), FALSE, FALSE, 'birth');
CRM_Core_Form_Date::buildDateRange($form, 'contribution_recur_end_date', 1, '_low', '_high', ts('From'), FALSE, FALSE, 'birth');
CRM_Core_Form_Date::buildDateRange($form, 'contribution_recur_modified_date', 1, '_low', '_high', ts('From'), FALSE, FALSE, 'birth');
CRM_Core_Form_Date::buildDateRange($form, 'contribution_recur_next_sched_contribution_date', 1, '_low', '_high', ts('From'), FALSE, FALSE, 'birth');
CRM_Core_Form_Date::buildDateRange($form, 'contribution_recur_failure_retry_date', 1, '_low', '_high', ts('From'), FALSE, FALSE, 'birth');
CRM_Core_Form_Date::buildDateRange($form, 'contribution_recur_cancel_date', 1, '_low', '_high', ts('From'), FALSE, FALSE, 'birth');
$form->addElement('text', 'contribution_recur_processor_id', ts('Processor ID'), CRM_Core_DAO::getAttribute('CRM_Contribute_DAO_ContributionRecur', 'processor_id'));
$form->addElement('text', 'contribution_recur_trxn_id', ts('Transaction ID'), CRM_Core_DAO::getAttribute('CRM_Contribute_DAO_ContributionRecur', 'trxn_id'));
$contributionRecur = array('ContributionRecur');
$groupDetails = CRM_Core_BAO_CustomGroup::getGroupDetail(NULL, TRUE, $contributionRecur);
if ($groupDetails) {
$form->assign('contributeRecurGroupTree', $groupDetails);
foreach ($groupDetails as $group) {
foreach ($group['fields'] as $field) {
$fieldId = $field['id'];
$elementName = 'custom_' . $fieldId;
CRM_Core_BAO_CustomField::addQuickFormElement($form, $elementName, $fieldId, FALSE, TRUE);
}
}
}
}
示例7: addFilters
/**
* Add filters to report.
*/
public function addFilters()
{
$filters = $filterGroups = array();
$count = 1;
foreach ($this->_filters as $table => $attributes) {
if (isset($this->_columns[$table]['group_title'])) {
// The presence of 'group_title' is secret code for 'is_a_custom_table'
// which magically means to 'display in an accordian'
// here we make this explicit.
$filterGroups[$table] = array('group_title' => $this->_columns[$table]['group_title'], 'use_accordian_for_field_selection' => TRUE);
}
foreach ($attributes as $fieldName => $field) {
// get ready with option value pair
// @ todo being able to specific options for a field (e.g a date field) in the field spec as an array rather than an override
// would be useful
$operations = $this->getOperationPair(CRM_Utils_Array::value('operatorType', $field), $fieldName);
$filters[$table][$fieldName] = $field;
switch (CRM_Utils_Array::value('operatorType', $field)) {
case CRM_Report_Form::OP_MONTH:
if (!array_key_exists('options', $field) || !is_array($field['options']) || empty($field['options'])) {
// If there's no option list for this filter, define one.
$field['options'] = array(1 => ts('January'), 2 => ts('February'), 3 => ts('March'), 4 => ts('April'), 5 => ts('May'), 6 => ts('June'), 7 => ts('July'), 8 => ts('August'), 9 => ts('September'), 10 => ts('October'), 11 => ts('November'), 12 => ts('December'));
// Add this option list to this column _columns. This is
// required so that filter statistics show properly.
$this->_columns[$table]['filters'][$fieldName]['options'] = $field['options'];
}
case CRM_Report_Form::OP_MULTISELECT:
case CRM_Report_Form::OP_MULTISELECT_SEPARATOR:
// assume a multi-select field
if (!empty($field['options']) || $fieldName == 'state_province_id' || $fieldName == 'county_id') {
$element = $this->addElement('select', "{$fieldName}_op", ts('Operator:'), $operations);
if (count($operations) <= 1) {
$element->freeze();
}
if ($fieldName == 'state_province_id' || $fieldName == 'county_id') {
$this->addChainSelect($fieldName . '_value', array('multiple' => TRUE, 'label' => NULL, 'class' => 'huge'));
} else {
$this->addElement('select', "{$fieldName}_value", NULL, $field['options'], array('style' => 'min-width:250px', 'class' => 'crm-select2 huge', 'multiple' => TRUE, 'placeholder' => ts('- select -')));
}
}
break;
case CRM_Report_Form::OP_SELECT:
// assume a select field
$this->addElement('select', "{$fieldName}_op", ts('Operator:'), $operations);
if (!empty($field['options'])) {
$this->addElement('select', "{$fieldName}_value", NULL, $field['options']);
}
break;
case CRM_Report_Form::OP_ENTITYREF:
$this->addElement('select', "{$fieldName}_op", ts('Operator:'), $operations);
$this->setEntityRefDefaults($field, $table);
$this->addEntityRef("{$fieldName}_value", NULL, $field['attributes']);
break;
case CRM_Report_Form::OP_DATE:
// build datetime fields
CRM_Core_Form_Date::buildDateRange($this, $fieldName, $count, '_from', '_to', 'From:', FALSE, $operations);
$count++;
break;
case CRM_Report_Form::OP_DATETIME:
// build datetime fields
CRM_Core_Form_Date::buildDateRange($this, $fieldName, $count, '_from', '_to', 'From:', FALSE, $operations, 'searchDate', TRUE);
$count++;
break;
case CRM_Report_Form::OP_INT:
case CRM_Report_Form::OP_FLOAT:
// and a min value input box
$this->add('text', "{$fieldName}_min", ts('Min'));
// and a max value input box
$this->add('text', "{$fieldName}_max", ts('Max'));
default:
// default type is string
$this->addElement('select', "{$fieldName}_op", ts('Operator:'), $operations, array('onchange' => "return showHideMaxMinVal( '{$fieldName}', this.value );"));
// we need text box for value input
$this->add('text', "{$fieldName}_value", NULL, array('class' => 'huge'));
break;
}
}
}
if (!empty($filters)) {
$this->tabs['Filters'] = array('title' => ts('Filters'), 'tpl' => 'Filters', 'div_label' => 'set-filters');
}
$this->assign('filters', $filters);
$this->assign('filterGroups', $filterGroups);
}
示例8: buildSearchForm
/**
* Add all the elements shared between case search and advanaced search.
*
*
* @param CRM_Core_Form $form
*
* @return void
*/
public static function buildSearchForm(&$form)
{
$config = CRM_Core_Config::singleton();
//validate case configuration.
$configured = CRM_Case_BAO_Case::isCaseConfigured();
$form->assign('notConfigured', !$configured['configured']);
$form->add('select', 'case_type_id', ts('Case Type'), CRM_Case_PseudoConstant::caseType('title', FALSE), FALSE, array('class' => 'crm-select2', 'multiple' => 'multiple'));
$form->add('select', 'case_status_id', ts('Case Status'), CRM_Case_PseudoConstant::caseStatus('label', FALSE), FALSE, array('class' => 'crm-select2', 'multiple' => 'multiple'));
CRM_Core_Form_Date::buildDateRange($form, 'case_from', 1, '_start_date_low', '_start_date_high', ts('From'), FALSE);
CRM_Core_Form_Date::buildDateRange($form, 'case_to', 1, '_end_date_low', '_end_date_high', ts('From'), FALSE);
$form->assign('validCiviCase', TRUE);
//give options when all cases are accessible.
$accessAllCases = FALSE;
if (CRM_Core_Permission::check('access all cases and activities')) {
$accessAllCases = TRUE;
$caseOwner = array(1 => ts('Search All Cases'), 2 => ts('Only My Cases'));
$form->addRadio('case_owner', ts('Cases'), $caseOwner);
}
$form->assign('accessAllCases', $accessAllCases);
$caseTags = CRM_Core_BAO_Tag::getTags('civicrm_case');
if ($caseTags) {
foreach ($caseTags as $tagID => $tagName) {
$form->_tagElement =& $form->addElement('checkbox', "case_tags[{$tagID}]", NULL, $tagName);
}
}
$parentNames = CRM_Core_BAO_Tag::getTagSet('civicrm_case');
CRM_Core_Form_Tag::buildQuickForm($form, $parentNames, 'civicrm_case', NULL, TRUE, FALSE);
if (CRM_Core_Permission::check('administer CiviCRM')) {
$form->addElement('checkbox', 'case_deleted', ts('Deleted Cases'));
}
// add all the custom searchable fields
$extends = array('Case');
$groupDetails = CRM_Core_BAO_CustomGroup::getGroupDetail(NULL, TRUE, $extends);
if ($groupDetails) {
$form->assign('caseGroupTree', $groupDetails);
foreach ($groupDetails as $group) {
foreach ($group['fields'] as $field) {
$fieldId = $field['id'];
$elementName = 'custom_' . $fieldId;
CRM_Core_BAO_CustomField::addQuickFormElement($form, $elementName, $fieldId, FALSE, FALSE, TRUE);
}
}
}
$form->setDefaults(array('case_owner' => 1));
}
示例9: addFilterFieldsToReport
/**
* @param array $field
* @param string $fieldName
* @param array $filters
* @param string $table
* @param int $count
*
* @return array
*/
protected function addFilterFieldsToReport($field, $fieldName, $filters, $table, $count) {
// get ready with option value pair
$operations = CRM_Utils_Array::value('operations', $field);
if (empty($operations)) {
$operations = $this->getOperationPair(
CRM_Utils_Array::value('operatorType', $field),
$fieldName);
}
$filters[$table][$fieldName] = $field;
switch (CRM_Utils_Array::value('operatorType', $field)) {
case CRM_Report_Form::OP_MONTH:
if (!array_key_exists('options', $field) ||
!is_array($field['options']) || empty($field['options'])
) {
// If there's no option list for this filter, define one.
$field['options'] = array(
1 => ts('January'),
2 => ts('February'),
3 => ts('March'),
4 => ts('April'),
5 => ts('May'),
6 => ts('June'),
7 => ts('July'),
8 => ts('August'),
9 => ts('September'),
10 => ts('October'),
11 => ts('November'),
12 => ts('December'),
);
// Add this option list to this column _columns. This is
// required so that filter statistics show properly.
$this->_columns[$table]['filters'][$fieldName]['options'] = $field['options'];
}
case CRM_Report_Form::OP_MULTISELECT:
case CRM_Report_Form::OP_MULTISELECT_SEPARATOR:
// assume a multi-select field
if (!empty($field['options']) ||
$fieldName == 'state_province_id' || $fieldName == 'county_id'
) {
$element = $this->addElement('select', "{$fieldName}_op", ts('Operator:'), $operations);
if (count($operations) <= 1) {
$element->freeze();
}
if ($fieldName == 'state_province_id' ||
$fieldName == 'county_id'
) {
$this->addChainSelect($fieldName . '_value', array(
'multiple' => TRUE,
'label' => NULL,
'class' => 'huge',
));
}
else {
$this->addElement('select', "{$fieldName}_value", NULL, $field['options'], array(
'style' => 'min-width:250px',
'class' => 'crm-select2 huge',
'multiple' => TRUE,
'placeholder' => ts('- select -'),
));
}
}
break;
case CRM_Report_Form::OP_SELECT:
// assume a select field
$this->addElement('select', "{$fieldName}_op", ts('Operator:'), $operations);
if (!empty($field['options'])) {
$this->addElement('select', "{$fieldName}_value", NULL, $field['options']);
}
break;
case 256:
$this->addElement('select', "{$fieldName}_op", ts('Operator:'), $operations);
$this->setEntityRefDefaults($field, $table);
$this->addEntityRef("{$fieldName}_value", NULL, $field['attributes']);
break;
case CRM_Report_Form::OP_DATE:
// build datetime fields
CRM_Core_Form_Date::buildDateRange($this, $fieldName, $count, '_from', '_to', 'From:', FALSE, $operations);
$count++;
break;
case CRM_Report_Form::OP_DATETIME:
// build datetime fields
CRM_Core_Form_Date::buildDateRange($this, $fieldName, $count, '_from', '_to', 'From:', FALSE, $operations, 'searchDate', TRUE);
$count++;
break;
case self::OP_SINGLEDATE:
//.........这里部分代码省略.........
示例10: buildSearchForm
/**
* @param $form
*/
static function buildSearchForm(&$form)
{
foreach (CRM_Member_PseudoConstant::membershipType() as $id => $Name) {
$form->_membershipType =& $form->addElement('checkbox', "member_membership_type_id[{$id}]", NULL, $Name);
}
foreach (CRM_Member_PseudoConstant::membershipStatus(NULL, NULL, 'label') as $sId => $sName) {
$form->_membershipStatus =& $form->addElement('checkbox', "member_status_id[{$sId}]", NULL, $sName);
}
$form->addElement('text', 'member_source', ts('Source'));
CRM_Core_Form_Date::buildDateRange($form, 'member_join_date', 1, '_low', '_high', ts('From'), FALSE);
CRM_Core_Form_Date::buildDateRange($form, 'member_start_date', 1, '_low', '_high', ts('From'), FALSE);
CRM_Core_Form_Date::buildDateRange($form, 'member_end_date', 1, '_low', '_high', ts('From'), FALSE);
$form->addYesNo('member_is_primary', ts('Primary Member?'), TRUE);
$form->addYesNo('member_pay_later', ts('Pay Later?'), TRUE);
$form->addYesNo('member_auto_renew', ts('Auto-Renew?'), TRUE);
$form->addYesNo('member_test', ts('Membership is a Test?'), TRUE);
// add all the custom searchable fields
$extends = array('Membership');
$groupDetails = CRM_Core_BAO_CustomGroup::getGroupDetail(NULL, TRUE, $extends);
if ($groupDetails) {
$form->assign('membershipGroupTree', $groupDetails);
foreach ($groupDetails as $group) {
foreach ($group['fields'] as $field) {
$fieldId = $field['id'];
$elementName = 'custom_' . $fieldId;
CRM_Core_BAO_CustomField::addQuickFormElement($form, $elementName, $fieldId, FALSE, FALSE, TRUE);
}
}
}
CRM_Campaign_BAO_Campaign::addCampaignInComponentSearch($form, 'member_campaign_id');
$form->assign('validCiviMember', TRUE);
$form->setDefaults(array('member_test' => 0));
}
示例11: buildSearchForm
static function buildSearchForm(&$form)
{
foreach (CRM_Member_PseudoConstant::membershipType() as $id => $Name) {
$form->_membershipType =& $form->addElement('checkbox', "member_membership_type_id[{$id}]", NULL, $Name);
}
// Option to include / exclude inherited memberships from search results (e.g. rows where owner_membership_id is NOT NULL)
$primaryValues = array(1 => ts('All Members'), 2 => ts('Primary Members Only'), 3 => ts('Related Members Only'));
$form->addRadio('member_is_primary', '', $primaryValues);
$form->setDefaults(array('member_is_primary' => 1));
foreach (CRM_Member_PseudoConstant::membershipStatus(NULL, NULL, 'label') as $sId => $sName) {
$form->_membershipStatus =& $form->addElement('checkbox', "member_status_id[{$sId}]", NULL, $sName);
}
$form->addElement('text', 'member_source', ts('Source'));
CRM_Core_Form_Date::buildDateRange($form, 'member_join_date', 1, '_low', '_high', ts('From'), FALSE, FALSE);
CRM_Core_Form_Date::buildDateRange($form, 'member_start_date', 1, '_low', '_high', ts('From'), FALSE, FALSE);
CRM_Core_Form_Date::buildDateRange($form, 'member_end_date', 1, '_low', '_high', ts('From'), FALSE, FALSE);
$form->addElement('checkbox', 'member_test', ts('Find Test Memberships?'));
$form->addElement('checkbox', 'member_pay_later', ts('Find Pay Later Memberships?'));
$form->addElement('checkbox', 'member_auto_renew', ts('Find Auto-renew Memberships?'));
// add all the custom searchable fields
$extends = array('Membership');
$groupDetails = CRM_Core_BAO_CustomGroup::getGroupDetail(NULL, TRUE, $extends);
if ($groupDetails) {
$form->assign('membershipGroupTree', $groupDetails);
foreach ($groupDetails as $group) {
foreach ($group['fields'] as $field) {
$fieldId = $field['id'];
$elementName = 'custom_' . $fieldId;
CRM_Core_BAO_CustomField::addQuickFormElement($form, $elementName, $fieldId, FALSE, FALSE, TRUE);
}
}
}
CRM_Campaign_BAO_Campaign::addCampaignInComponentSearch($form, 'member_campaign_id');
$form->assign('validCiviMember', TRUE);
}
示例12: buildSearchForm
/**
* @param CRM_Core_Form $form
*/
static function buildSearchForm(&$form)
{
$dataURLEventFee = CRM_Utils_System::url('civicrm/ajax/eventFee', "reset=1", FALSE, NULL, FALSE);
$form->assign('dataURLEventFee', $dataURLEventFee);
$eventId = $form->addEntityRef('event_id', ts('Event Name'), array('entity' => 'event', 'placeholder' => ts('- any -'), 'select' => array('minimumInputLength' => 0)));
$eventType = $form->addEntityRef('event_type_id', ts('Event Type'), array('entity' => 'option_value', 'placeholder' => ts('- any -'), 'select' => array('minimumInputLength' => 0), 'api' => array('params' => array('option_group_id' => 'event_type'))));
$form->add('text', 'participant_fee_id', ts('Fee Level'), array('class' => 'big crm-ajax-select'));
CRM_Core_Form_Date::buildDateRange($form, 'event', 1, '_start_date_low', '_end_date_high', ts('From'), FALSE);
$status = CRM_Event_PseudoConstant::participantStatus(NULL, NULL, 'label');
foreach ($status as $id => $Name) {
$form->_participantStatus =& $form->addElement('checkbox', "participant_status_id[{$id}]", NULL, $Name);
}
foreach (CRM_Event_PseudoConstant::participantRole() as $rId => $rName) {
$form->_participantRole =& $form->addElement('checkbox', "participant_role_id[{$rId}]", NULL, $rName);
}
$form->addYesNo('participant_test', ts('Participant is a Test?'), TRUE);
$form->addYesNo('participant_pay_later', ts('Participant is Pay Later?'), TRUE);
$form->addElement('text', 'participant_fee_amount_low', ts('From'), array('size' => 8, 'maxlength' => 8));
$form->addElement('text', 'participant_fee_amount_high', ts('To'), array('size' => 8, 'maxlength' => 8));
$form->addRule('participant_fee_amount_low', ts('Please enter a valid money value.'), 'money');
$form->addRule('participant_fee_amount_high', ts('Please enter a valid money value.'), 'money');
// add all the custom searchable fields
$extends = array('Participant', 'Event');
$groupDetails = CRM_Core_BAO_CustomGroup::getGroupDetail(NULL, TRUE, $extends);
if ($groupDetails) {
$form->assign('participantGroupTree', $groupDetails);
foreach ($groupDetails as $group) {
foreach ($group['fields'] as $field) {
$fieldId = $field['id'];
$elementName = 'custom_' . $fieldId;
CRM_Core_BAO_CustomField::addQuickFormElement($form, $elementName, $fieldId, FALSE, FALSE, TRUE);
}
}
}
CRM_Campaign_BAO_Campaign::addCampaignInComponentSearch($form, 'participant_campaign_id');
$form->assign('validCiviEvent', TRUE);
$form->setDefaults(array('participant_test' => 0));
}
示例13: buildSearchForm
static function buildSearchForm(&$form)
{
$form->add('text', 'booking_po_no', ts('Purchase Order Number'));
$resourceTypes = CRM_Booking_BAO_Resource::getResourceTypes();
$resources = array();
foreach ($resourceTypes as $value) {
$resources[$value['id']] = $value['label'];
}
$form->add('select', 'booking_resource_id', ts('Resource Type'), array('' => ts('- select -')) + $resources, FALSE, array());
$form->add('text', 'booking_id', ts('Booking ID'));
$form->add('text', 'booking_title', ts('Booking Title'));
CRM_Core_Form_Date::buildDateRange($form, 'booking_event_date', 1, '_low', '_high', ts('From'), FALSE);
CRM_Core_Form_Date::buildDateRange($form, 'booking_start_date', 1, '_low', '_high', ts('From'), FALSE);
CRM_Core_Form_Date::buildDateRange($form, 'booking_end_date', 1, '_low', '_high', ts('From'), FALSE);
$bookingStatus = CRM_Booking_BAO_Booking::buildOptions('status_id', 'create');
foreach ($bookingStatus as $id => $name) {
$form->_bookingStatus =& $form->addElement('checkbox', "booking_status_id[{$id}]", NULL, $name);
}
$paymentStatus = CRM_Contribute_PseudoConstant::contributionStatus();
foreach ($paymentStatus as $id => $name) {
$form->_paymentStatus = $form->addElement('checkbox', "booking_payment_status_id[{$id}]", NULL, $name);
}
}
示例14: buildAdvancedSearchPaneForm
public function buildAdvancedSearchPaneForm(&$form, $type)
{
if (!CRM_Core_Permission::check('access HRJobs')) {
return;
}
if ($type == 'hrjob') {
$form->add('hidden', 'hidden_hrjob', 1);
$form->addElement('text', 'hrjob_position', ts('Position'), CRM_Core_DAO::getAttribute('CRM_HRJob_DAO_HRJob', 'position'));
$form->addElement('text', 'hrjob_title', ts('Title'), CRM_Core_DAO::getAttribute('CRM_HRJob_DAO_HRJob', 'title'));
$form->add('select', 'hrjob_role_level_type', ts('Level'), CRM_Core_PseudoConstant::get('CRM_HRJob_DAO_HRJobRole', 'level_type'), FALSE, array('id' => 'hrjob_level_type', 'multiple' => 'multiple', 'title' => ts('- select -')));
$form->add('select', 'hrjob_contract_type', ts('Contract Type'), CRM_Core_PseudoConstant::get('CRM_HRJob_DAO_HRJob', 'contract_type'), FALSE, array('id' => 'hrjob_contract_type', 'multiple' => 'multiple', 'title' => ts('- select -')));
CRM_Core_Form_Date::buildDateRange($form, 'hrjob_period_start_date', 1, '_low', '_high', ts('From:'), FALSE, FALSE);
CRM_Core_Form_Date::buildDateRange($form, 'hrjob_period_end_date', 1, '_low', '_high', ts('From:'), FALSE, FALSE);
}
if ($type == 'hrjob_health') {
$form->add('hidden', 'hidden_hrjob_health', 1);
$form->add('checkbox', 'hrjob_is_healthcare', ts('Is healthcare provided?'));
}
if ($type == 'hrjob_hour') {
$form->add('hidden', 'hidden_hrjob_hour', 1);
$hoursType = CRM_Core_PseudoConstant::get('CRM_HRJob_DAO_HRJobHour', 'hours_type');
$form->add('select', 'hrjob_hours_type', ts('Hours Types'), $hoursType, FALSE, array('id' => 'hrjob_hours_type', 'multiple' => 'multiple', 'title' => ts('- select -')));
$form->add('select', 'hrjob_hours_unit', ts('Hours Unit'), array('Day' => ts('Day'), 'Week' => ts('Week'), 'Month' => ts('Month'), 'Year' => ts('Year')), FALSE, array('id' => 'hrjob_hours_unit', 'multiple' => 'multiple', 'title' => ts('- select -')));
$form->add('text', 'hrjob_hours_amount_low', ts('From'), array('size' => 8, 'maxlength' => 8));
$form->addRule('hrjob_hours_amount_low', ts('Please enter a valid money value (e.g. %1).', array(1 => CRM_Utils_Money::format('9.99', ' '))), 'money');
$form->add('text', 'hrjob_hours_amount_high', ts('To'), array('size' => 8, 'maxlength' => 8));
$form->addRule('hrjob_hours_amount_high', ts('Please enter a valid money value (e.g. %1).', array(1 => CRM_Utils_Money::format('99.99', ' '))), 'money');
$form->add('text', 'hrjob_hours_fte_low', ts('From'), array('size' => 8, 'maxlength' => 8));
$form->addRule('hrjob_hours_fte_low', ts('Please enter a valid decimal value (e.g. %1).', array(1 => CRM_Utils_Money::format('9.99', ' '))), 'money');
$form->add('text', 'hrjob_hours_fte_high', ts('To'), array('size' => 8, 'maxlength' => 8));
$form->addRule('hrjob_hours_fte_high', ts('Please enter a valid decimal value (e.g. %1).', array(1 => CRM_Utils_Money::format('99.99', ' '))), 'money');
}
if ($type == 'hrjob_pension') {
$form->add('hidden', 'hidden_hrjob_pension', 1);
$form->addYesNo('hrjob_is_enrolled', ts('Is enrolled?'));
}
if ($type == 'hrjob_pay') {
$form->add('hidden', 'hidden_hrjob_pay', 1);
$form->add('select', 'hrjob_pay_grade', ts('Paid / Unpaid'), CRM_Core_PseudoConstant::get('CRM_HRJob_DAO_HRJobPay', 'is_paid'), FALSE, array('id' => 'hrjob_pay_grade', 'multiple' => 'multiple', 'title' => ts('- select -')));
}
}
示例15: contact_b
/**
* @param CRM_Core_Form $form
*/
public static function contact_b(&$form)
{
$form->addElement('hidden', 'hidden_contact_b', 1);
// add checkboxes for contact type
//@todo FIXME - using the CRM_Core_DAO::VALUE_SEPARATOR creates invalid html - if you can find the form
// this is loaded onto then replace with something like '__' & test
$separator = CRM_Core_DAO::VALUE_SEPARATOR;
$contactTypes = CRM_Contact_BAO_ContactType::getSelectElements(FALSE, TRUE, $separator);
if ($contactTypes) {
$form->add('select', 'contact_b_contact_type', ts('Contact Type(s)'), $contactTypes, FALSE, array('id' => 'contact_b_contact_type', 'multiple' => 'multiple', 'class' => 'crm-select2', 'style' => 'width: 100%;'));
}
// add text box for last name, first name, street name, city
$form->addElement('text', 'contact_b_display_name', ts('Find...'), CRM_Core_DAO::getAttribute('CRM_Contact_DAO_Contact', 'sort_name'));
// add text box for last name, first name, street name, city
$form->add('text', 'contact_b_email', ts('Contact Email'), CRM_Core_DAO::getAttribute('CRM_Contact_DAO_Contact', 'sort_name'));
//added job title
$form->addElement('text', 'contact_b_job_title', ts('Job Title'), CRM_Core_DAO::getAttribute('CRM_Contact_DAO_Contact', 'job_title'));
//added internal ID
$form->addElement('text', 'contact_b_contact_id', ts('Contact ID'), CRM_Core_DAO::getAttribute('CRM_Contact_DAO_Contact', 'id'));
$form->addRule('contact_b_contact_id', ts('Please enter valid Contact ID'), 'positiveInteger');
//added external ID
$form->addElement('text', 'contact_b_external_identifier', ts('External ID'), CRM_Core_DAO::getAttribute('CRM_Contact_DAO_Contact', 'external_identifier'));
// Phone search
$form->addElement('text', 'contact_b_phone_numeric', ts('Phone Number'), CRM_Core_DAO::getAttribute('CRM_Core_DAO_Phone', 'phone'));
$locationType = CRM_Core_PseudoConstant::get('CRM_Core_DAO_Address', 'location_type_id');
$phoneType = CRM_Core_PseudoConstant::get('CRM_Core_DAO_Phone', 'phone_type_id');
$form->add('select', 'contact_b_phone_location_type_id', ts('Phone Location'), array('' => ts('- any -')) + $locationType, FALSE, array('class' => 'crm-select2'));
$form->add('select', 'contact_b_phone_phone_type_id', ts('Phone Type'), array('' => ts('- any -')) + $phoneType, FALSE, array('class' => 'crm-select2'));
// add all the custom searchable fields
$contact = array('Individual', 'Household', 'Organization');
$groupDetails = CRM_Core_BAO_CustomGroup::getGroupDetail(NULL, TRUE, $contact);
if ($groupDetails) {
$form->assign('contactGroupTree', $groupDetails);
foreach ($groupDetails as $group) {
foreach ($group['fields'] as $field) {
$fieldId = $field['id'];
$elementName = 'custom_' . $fieldId;
CRM_Core_BAO_CustomField::addQuickFormElement($form, $elementName, $fieldId, FALSE, FALSE, TRUE);
}
}
}
// Add address fields
$attributes = CRM_Core_DAO::getAttribute('CRM_Core_DAO_Address');
$form->addElement('text', 'contact_b_street_address', ts('Street Address'), $attributes['street_address']);
$form->addElement('text', 'contact_b_city', ts('City'), $attributes['city']);
$form->addElement('text', 'contact_b_postal_code', ts('Zip / Postal Code'), $attributes['postal_code']);
$form->addElement('text', 'contact_b_postal_code_low', NULL, $attributes['postal_code'] + array('placeholder' => ts('From')));
$form->addElement('text', 'contact_b_postal_code_high', NULL, $attributes['postal_code'] + array('placeholder' => ts('To')));
// select for location type
$locationType = CRM_Core_PseudoConstant::get('CRM_Core_DAO_Address', 'location_type_id');
$form->add('select', 'contact_b_location_type', ts('Address Location'), $locationType, FALSE, array('multiple' => TRUE, 'class' => 'crm-select2', 'placeholder' => ts('Primary')));
// Add demographics
// radio button for gender
$genderOptions = array();
$gender = CRM_Core_PseudoConstant::get('CRM_Contact_DAO_Contact', 'gender_id');
foreach ($gender as $key => $var) {
$genderOptions[$key] = $form->createElement('radio', NULL, ts('Gender'), $var, $key, array('id' => "civicrm_gender_{$var}_{$key}"));
}
$form->addGroup($genderOptions, 'contact_b_gender_id', ts('Gender'))->setAttribute('allowClear', TRUE);
CRM_Core_Form_Date::buildDateRange($form, 'contact_b_birth_date', 1, '_low', '_high', ts('From'), FALSE, FALSE, 'birth');
CRM_Core_Form_Date::buildDateRange($form, 'contact_b_deceased_date', 1, '_low', '_high', ts('From'), FALSE, FALSE, 'birth');
// radio button for is_deceased
$form->addYesNo('contact_b_is_deceased', ts('Deceased'), TRUE);
}