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))); }
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))); }
/** * 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 }
/** * 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); }
/** * 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)); }
/** * @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); } } } }
/** * 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); }
/** * 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)); }
/** * @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: // build single datetime field $this->addElement('select', "{$fieldName}_op", ts('Operator:'), $operations); $this->addDate("{$fieldName}_value", ts(''), FALSE); $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; } return $filters; }
/** * @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)); }
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); }
/** * @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)); }
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); } }
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 -'))); } }
/** * @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); }
/** * add all the elements shared between contribute search and advnaced search * * @access public * * @return void * @static */ static function buildSearchForm(&$form) { //added contribution source $form->addElement('text', 'contribution_source', ts('Contribution Source'), CRM_Core_DAO::getAttribute('CRM_Contribute_DAO_Contribution', 'source')); CRM_Core_Form_Date::buildDateRange($form, 'contribution_date', 1, '_low', '_high', ts('From'), FALSE, FALSE); $form->add('text', 'contribution_amount_low', ts('From'), array('size' => 8, 'maxlength' => 8)); $form->addRule('contribution_amount_low', ts('Please enter a valid money value (e.g. %1).', array(1 => CRM_Utils_Money::format('9.99', ' '))), 'money'); $form->add('text', 'contribution_amount_high', ts('To'), array('size' => 8, 'maxlength' => 8)); $form->addRule('contribution_amount_high', ts('Please enter a valid money value (e.g. %1).', array(1 => CRM_Utils_Money::format('99.99', ' '))), 'money'); //adding select option for curreny type -- CRM-4711 $form->add('select', 'contribution_currency_type', ts('Currency Type'), array('' => ts('- select -')) + CRM_Core_PseudoConstant::currencySymbols('name')); $form->add('select', 'contribution_type_id', ts('Contribution Type'), array('' => ts('- select -')) + CRM_Contribute_PseudoConstant::contributionType()); $form->add('select', 'contribution_page_id', ts('Contribution Page'), array('' => ts('- select -')) + CRM_Contribute_PseudoConstant::contributionPage()); $form->add('select', 'contribution_payment_instrument_id', ts('Payment Instrument'), array('' => ts('- select -')) + CRM_Contribute_PseudoConstant::paymentInstrument()); $form->add('select', 'contribution_pcp_made_through_id', ts('Personal Campaign Page'), array('' => ts('- select -')) + CRM_Contribute_PseudoConstant::pcPage()); $status = array(); $statusValues = CRM_Core_OptionGroup::values("contribution_status"); // Remove status values that are only used for recurring contributions or pledges (In Progress, Overdue). unset($statusValues['5']); unset($statusValues['6']); foreach ($statusValues as $key => $val) { $status[] = $form->createElement('advcheckbox', $key, NULL, $val); } $form->addGroup($status, 'contribution_status_id', ts('Contribution Status')); // add null checkboxes for thank you and receipt $form->addElement('checkbox', 'contribution_thankyou_date_isnull', ts('Thank-you date not set?')); $form->addElement('checkbox', 'contribution_receipt_date_isnull', ts('Receipt not sent?')); //add fields for honor search $form->addElement('text', 'contribution_in_honor_of', ts("In Honor Of")); $form->addElement('checkbox', 'contribution_test', ts('Find Test Contributions?')); $form->addElement('checkbox', 'contribution_pay_later', ts('Find Pay Later Contributions?')); //add field for transaction ID search $form->addElement('text', 'contribution_transaction_id', ts("Transaction ID")); $form->addElement('checkbox', 'contribution_recurring', ts('Find Recurring Contributions?')); $form->addElement('checkbox', 'contribution_recurring_isnull', ts('Find Non Recurring Contributions?')); $form->addElement('text', 'contribution_check_number', ts('Check Number')); //add field for pcp display in roll search $form->addYesNo('contribution_pcp_display_in_roll', ts('Personal Campaign Page Honor Roll?')); // add all the custom searchable fields $contribution = array('Contribution'); $groupDetails = CRM_Core_BAO_CustomGroup::getGroupDetail(NULL, TRUE, $contribution); if ($groupDetails) { $form->assign('contributeGroupTree', $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, 'contribution_campaign_id'); // add batch select $batches = CRM_Core_BAO_Batch::getBatches(); if (!empty($batches)) { $form->add('select', 'contribution_batch_id', ts('Batch Name'), array('' => ts('- select -')) + $batches); } $form->assign('validCiviContribute', TRUE); }
/** * Add all the elements shared between case activity search and advanced search. * * * @param CRM_Core_Form $form * @return void */ public static function buildSearchForm(&$form) { $activityOptions = CRM_Core_PseudoConstant::activityType(TRUE, TRUE, FALSE, 'label', TRUE); $form->addSelect('activity_type_id', array('entity' => 'activity', 'label' => 'Activity Type(s)', 'multiple' => 'multiple', 'option_url' => NULL, 'placeholder' => ts('- any -'))); CRM_Core_Form_Date::buildDateRange($form, 'activity_date', 1, '_low', '_high', ts('From'), FALSE, FALSE); $followUpActivity = array(1 => ts('Yes'), 2 => ts('No')); $form->addRadio('parent_id', NULL, $followUpActivity, array('allowClear' => TRUE)); $form->addRadio('followup_parent_id', NULL, $followUpActivity, array('allowClear' => TRUE)); $activityRoles = array(3 => ts('With'), 2 => ts('Assigned to'), 1 => ts('Added by')); $form->addRadio('activity_role', NULL, $activityRoles, array('allowClear' => TRUE)); $form->setDefaults(array('activity_role' => 3)); $activityStatus = CRM_Core_PseudoConstant::get('CRM_Activity_DAO_Activity', 'status_id', array('flip' => 1, 'labelColumn' => 'name')); $form->addSelect('status_id', array('entity' => 'activity', 'multiple' => 'multiple', 'option_url' => NULL, 'placeholder' => ts('- any -'))); $form->setDefaults(array('status_id' => array($activityStatus['Completed'], $activityStatus['Scheduled']))); $form->addElement('text', 'activity_subject', ts('Subject'), CRM_Core_DAO::getAttribute('CRM_Contact_DAO_Contact', 'sort_name')); $form->addYesNo('activity_test', ts('Activity is a Test?')); $activity_tags = CRM_Core_BAO_Tag::getTags('civicrm_activity'); if ($activity_tags) { foreach ($activity_tags as $tagID => $tagName) { $form->_tagElement =& $form->addElement('checkbox', "activity_tags[{$tagID}]", NULL, $tagName); } } $parentNames = CRM_Core_BAO_Tag::getTagSet('civicrm_activity'); CRM_Core_Form_Tag::buildQuickForm($form, $parentNames, 'civicrm_activity', NULL, TRUE, TRUE); $surveys = CRM_Campaign_BAO_Survey::getSurveys(TRUE, FALSE, FALSE, TRUE); if ($surveys) { $form->add('select', 'activity_survey_id', ts('Survey / Petition'), array('' => ts('- none -')) + $surveys, FALSE, array('class' => 'crm-select2')); } $extends = array('Activity'); $groupDetails = CRM_Core_BAO_CustomGroup::getGroupDetail(NULL, TRUE, $extends); if ($groupDetails) { $form->assign('activityGroupTree', $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, 'activity_campaign_id'); //add engagement level CRM-7775 $buildEngagementLevel = FALSE; $buildSurveyResult = FALSE; if (CRM_Campaign_BAO_Campaign::isCampaignEnable() && CRM_Campaign_BAO_Campaign::accessCampaign()) { $buildEngagementLevel = TRUE; $form->addSelect('activity_engagement_level', array('entity' => 'activity', 'context' => 'search')); // Add survey result field. $optionGroups = CRM_Campaign_BAO_Survey::getResultSets('name'); $resultOptions = array(); foreach ($optionGroups as $gid => $name) { if ($name) { $value = array(); $value = CRM_Core_OptionGroup::values($name); if (!empty($value)) { while (list($k, $v) = each($value)) { $resultOptions[$v] = $v; } } } } // If no survey result options have been created, don't build // the field to avoid clutter. if (count($resultOptions) > 0) { $buildSurveyResult = TRUE; asort($resultOptions); $form->add('select', 'activity_result', ts("Survey Result"), $resultOptions, FALSE, array('id' => 'activity_result', 'multiple' => 'multiple', 'class' => 'crm-select2')); } } $form->assign('buildEngagementLevel', $buildEngagementLevel); $form->assign('buildSurveyResult', $buildSurveyResult); $form->setDefaults(array('activity_test' => 0)); }
static function buildSearchForm(&$form) { $dataURLEvent = CRM_Utils_System::url('civicrm/ajax/event', "reset=1", FALSE, NULL, FALSE); $dataURLEventType = CRM_Utils_System::url('civicrm/ajax/eventType', "reset=1", FALSE, NULL, FALSE); $dataURLEventFee = CRM_Utils_System::url('civicrm/ajax/eventFee', "reset=1", FALSE, NULL, FALSE); $form->assign('dataURLEvent', $dataURLEvent); $form->assign('dataURLEventType', $dataURLEventType); $form->assign('dataURLEventFee', $dataURLEventFee); $eventId =& $form->add('text', 'event_name', ts('Event Name')); $eventType =& $form->add('text', 'event_type', ts('Event Type')); $participantFee =& $form->add('text', 'participant_fee_level', ts('Fee Level')); //elements for assigning value operation $eventNameId =& $form->add('hidden', 'event_id', '', array('id' => 'event_id')); $eventTypeId =& $form->add('hidden', 'event_type_id', '', array('id' => 'event_type_id')); $participantFeeId =& $form->add('hidden', 'participant_fee_id', '', array('id' => 'participant_fee_id')); CRM_Core_Form_Date::buildDateRange($form, 'event', 1, '_start_date_low', '_end_date_high', ts('From'), FALSE, FALSE); $status = CRM_Event_PseudoConstant::participantStatus(NULL, NULL, 'label'); asort($status); 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->addElement('checkbox', 'participant_test', ts('Find Test Participants?')); $form->addElement('checkbox', 'participant_pay_later', ts('Find Pay Later Participants?')); $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'); $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); }
public function buildAdvancedSearchPaneForm(&$form, $type) { //if (!CRM_Core_Permission::check('access HRJobs')) { echo 'not accessible'; return; } if ($type == 'hrjobcontract') { $form->add('hidden', 'hidden_hrjobcontract', 1); $form->addElement('text', 'hrjobcontract_details_position', ts('Position'), CRM_Core_DAO::getAttribute('CRM_Hrjobcontract_DAO_HRJobDetails', 'position')); $form->addElement('text', 'hrjobcontract_details_title', ts('Title'), CRM_Core_DAO::getAttribute('CRM_Hrjobcontract_DAO_HRJobDetails', 'title')); $form->addElement('text', 'hrjobcontract_details_funding_notes', ts('Funding Notes'), CRM_Core_DAO::getAttribute('CRM_Hrjobcontract_DAO_HRJobDetails', 'funding_notes')); $form->addElement('text', 'hrjobcontract_details_notice_amount', ts('Notice Period from Employer (Amount)'), CRM_Core_DAO::getAttribute('CRM_Hrjobcontract_DAO_HRJobDetails', 'notice_amount')); $form->add('select', 'hrjobcontract_details_notice_unit', ts('Notice Period from Employer (Amount)'), CRM_Hrjobcontract_SelectValues::commonUnit(), FALSE, array('id' => 'hrjobcontract_details_notice_unit', 'multiple' => true)); $form->addElement('text', 'hrjobcontract_details_notice_amount_employee', ts('Notice Period from Employee (Amount)'), CRM_Core_DAO::getAttribute('CRM_Hrjobcontract_DAO_HRJobDetails', 'notice_amount_employee')); $form->add('select', 'hrjobcontract_details_notice_unit_employee', ts('Notice Period from Employer (Amount)'), CRM_Hrjobcontract_SelectValues::commonUnit(), FALSE, array('id' => 'hrjobcontract_details_notice_unit_employee', 'multiple' => true)); $hrjcLocation = CRM_Core_PseudoConstant::get('CRM_Hrjobcontract_DAO_HRJobDetails', 'hrjobcontract_details_location'); $form->add('select', 'hrjobcontract_details_location', ts('Normal Place of Work'), $hrjcLocation, FALSE, array('id' => 'hrjobcontract_details_location', 'multiple' => true)); $form->add('select', 'hrjobcontract_role_role_level_type', ts('Level'), CRM_Core_PseudoConstant::get('CRM_Hrjobcontract_DAO_HRJobRole', 'hrjobcontract_role_role_level_type'), FALSE, array('id' => 'hrjobcontract_role_role_level_type', 'multiple' => true)); $form->add('select', 'hrjobcontract_details_contract_type', ts('Contract Type'), CRM_Core_PseudoConstant::get('CRM_Hrjobcontract_DAO_HRJobDetails', 'hrjobcontract_details_contract_type'), FALSE, array('id' => 'hrjobcontract_details_contract_type', 'multiple' => true)); CRM_Core_Form_Date::buildDateRange($form, 'hrjobcontract_details_period_start_date', 1, '_low', '_high', ts('From:'), FALSE, FALSE); CRM_Core_Form_Date::buildDateRange($form, 'hrjobcontract_details_period_end_date', 1, '_low', '_high', ts('From:'), FALSE, FALSE); //$form->addYesNo( 'hrjobcontract_details_is_primary', ts('Is Primary?')); $form->add('select', 'hrjobcontract_details_is_primary', ts('Is Primary'), array('' => '- select -', 0 => 'No', 1 => 'Yes'), FALSE, array('id' => 'hrjobcontract_details_is_primary', 'multiple' => false)); } if ($type == 'hrjobcontract_health') { $form->add('hidden', 'hidden_hrjobcontract_health', 1); //$form->add('checkbox', 'hrjobcontract_health_is_healthcare', ts('Is healthcare provided?')); $form->addElement('text', 'hrjobcontract_health_health_provider', ts('Healthcare Provider (Complete OR Partial Name)'), CRM_Core_DAO::getAttribute('CRM_Hrjobcontract_DAO_HRJobHealth', 'provider')); $form->add('select', 'hrjobcontract_health_health_plan_type', ts('Healthcare Plan Type'), CRM_Hrjobcontract_SelectValues::planType(), FALSE, array('id' => 'hrjobcontract_health_health_plan_type', 'multiple' => true)); $form->addElement('text', 'hrjobcontract_health_description', ts('Description Health Insurance'), CRM_Core_DAO::getAttribute('CRM_Hrjobcontract_DAO_HRJobHealth', 'description')); $form->addElement('text', 'hrjobcontract_health_dependents', ts('Healthcare Dependents'), CRM_Core_DAO::getAttribute('CRM_Hrjobcontract_DAO_HRJobHealth', 'dependents')); $form->addElement('text', 'hrjobcontract_health_health_provider_life_insurance', ts('Life insurance Provider (Complete OR Partial Name)'), CRM_Core_DAO::getAttribute('CRM_Hrjobcontract_DAO_HRJobHealth', 'provider_life_insurance')); $form->add('select', 'hrjobcontract_health_life_insurance_plan_type', ts('Life insurance Plan Type'), CRM_Hrjobcontract_SelectValues::planTypeLifeInsurance(), FALSE, array('id' => 'hrjobcontract_health_life_insurance_plan_type', 'multiple' => true)); $form->addElement('text', 'hrjobcontract_health_description_life_insurance', ts('Description Life Insurance'), CRM_Core_DAO::getAttribute('CRM_Hrjobcontract_DAO_HRJobHealth', 'description_life_insurance')); $form->addElement('text', 'hrjobcontract_health_dependents_life_insurance', ts('Life Insurance Dependents'), CRM_Core_DAO::getAttribute('CRM_Hrjobcontract_DAO_HRJobHealth', 'dependents_life_insurance')); } if ($type == 'hrjobcontract_hour') { $form->add('hidden', 'hidden_hrjobcontract_hour', 1); $hoursLocation = new CRM_Hrjobcontract_BAO_HoursLocation(); $hoursLocation->find(); $hoursLocationOptions = array(); while ($hoursLocation->fetch()) { $hoursLocationOptions[$hoursLocation->id] = $hoursLocation->location; } $form->add('select', 'hrjobcontract_hour_location_standard_hours', ts('Location/Standard hours'), $hoursLocationOptions, FALSE, array('id' => 'hrjobcontract_hour_location_standard_hours', 'multiple' => true)); $hoursType = CRM_Core_PseudoConstant::get('CRM_Hrjobcontract_DAO_HRJobHour', 'hrjobcontract_hour_hours_type'); $form->add('select', 'hrjobcontract_hour_hours_type', ts('Hours Types'), $hoursType, FALSE, array('id' => 'hrjobcontract_hour_hours_type', 'multiple' => true)); $form->add('text', 'hrjobcontract_hour_hours_amount', ts('Actual Hours (Amount)'), array('size' => 8, 'maxlength' => 8)); $form->add('select', 'hrjobcontract_hour_hours_unit', ts('Actual Hours (Unit)'), CRM_Hrjobcontract_SelectValues::commonUnit(), FALSE, array('id' => 'hrjobcontract_hour_hours_unit', 'multiple' => true)); $form->add('text', 'hrjobcontract_hour_hours_fte', ts('Full-Time Equivalence'), array('size' => 8, 'maxlength' => 8)); $form->add('text', 'hrjobcontract_hour_hours_fte_num', ts('Full-Time Numerator Equivalence'), array('size' => 8, 'maxlength' => 8)); $form->add('text', 'hrjobcontract_hour_fte_denom', ts('Full-Time Denominator Equivalence'), array('size' => 8, 'maxlength' => 8)); $form->add('text', 'hrjobcontract_hour_hours_amount_low', ts('From'), array('size' => 8, 'maxlength' => 8)); $form->addRule('hrjobcontract_hour_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', 'hrjobcontract_hour_hours_amount_high', ts('To'), array('size' => 8, 'maxlength' => 8)); $form->addRule('hrjobcontract_hour_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', 'hrjobcontract_hour_hours_fte_low', ts('From'), array('size' => 8, 'maxlength' => 8)); $form->addRule('hrjobcontract_hour_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', 'hrjobcontract_hour_hours_fte_high', ts('To'), array('size' => 8, 'maxlength' => 8)); $form->addRule('hrjobcontract_hour_hours_fte_high', ts('Please enter a valid decimal value (e.g. %1).', array(1 => CRM_Utils_Money::format('99.99', ' '))), 'money'); } if ($type == 'hrjobcontract_leave') { $form->add('hidden', 'hidden_hrjobcontract_leave', 1); $leaveTypeOptions = array(); $absenceType = new CRM_HRAbsence_BAO_HRAbsenceType(); $absenceType->find(); while ($absenceType->fetch()) { $leaveTypeOptions[$absenceType->id] = $absenceType->title; } $form->add('select', 'hrjobcontract_leave_leave_type', ts('Leave Type'), $leaveTypeOptions, FALSE, array('id' => 'hrjobcontract_leave_leave_type', 'multiple' => true)); } if ($type == 'hrjobcontract_pay') { $form->add('hidden', 'hidden_hrjobcontract_pay', 1); $payScaleOptions = array(); $payScale = new CRM_Hrjobcontract_BAO_PayScale(); $payScale->find(); while ($payScale->fetch()) { $payScaleOptions[$payScale->id] = $payScale->pay_scale; if (!empty($payScale->pay_grade)) { $payScaleOptions[$payScale->id] .= ' - ' . $payScale->pay_grade . ' - ' . $payScale->currency . ' ' . $payScale->amount . ' per ' . $payScale->periodicity; } } $form->add('select', 'hrjobcontract_pay_pay_scale', ts('Pay Scale'), $payScaleOptions, FALSE, array('id' => 'hrjobcontract_pay_pay_scale', 'multiple' => true)); $form->add('select', 'hrjobcontract_pay_is_paid', ts('Paid / Unpaid'), CRM_Core_PseudoConstant::get('CRM_Hrjobcontract_DAO_HRJobPay', 'is_paid'), FALSE, array('id' => 'hrjobcontract_pay_is_paid', 'multiple' => 'multiple', 'title' => ts('- select -'))); $form->add('text', 'hrjobcontract_pay_pay_amount', ts('Pay Amount'), array('size' => 8, 'maxlength' => 8)); $form->addRule('hrjobcontract_pay_pay_amount', ts('Please enter a valid money value (e.g. %1).', array(1 => CRM_Utils_Money::format('9.99', ' '))), 'money'); $form->add('text', 'hrjobcontract_pay_pay_amount_low', ts('From'), array('size' => 8, 'maxlength' => 8)); $form->addRule('hrjobcontract_pay_pay_amount_low', ts('Please enter a valid money value (e.g. %1).', array(1 => CRM_Utils_Money::format('9.99', ' '))), 'money'); $form->add('text', 'hrjobcontract_pay_pay_amount_high', ts('To'), array('size' => 8, 'maxlength' => 8)); $form->addRule('hrjobcontract_pay_pay_amount_high', ts('Please enter a valid money value (e.g. %1).', array(1 => CRM_Utils_Money::format('99.99', ' '))), 'money'); $form->add('select', 'hrjobcontract_pay_pay_unit', ts('Pay Unit'), CRM_Hrjobcontract_SelectValues::payUnit(), FALSE, array('id' => 'hrjobcontract_pay_pay_unit', 'multiple' => true)); $form->add('select', 'hrjobcontract_pay_pay_currency', ts('Pay Currency'), array_keys(CRM_Hrjobcontract_Page_JobContractTab::getCurrencyFormats()), FALSE, array('id' => 'hrjobcontract_pay_pay_currency', 'multiple' => true)); $form->add('text', 'hrjobcontract_pay_pay_annualized_est', ts('Estimated Annual Pay'), array('size' => 8, 'maxlength' => 8)); $form->addRule('hrjobcontract_pay_pay_annualized_est', ts('Please enter a valid money value (e.g. %1).', array(1 => CRM_Utils_Money::format('9.99', ' '))), 'money'); $form->add('text', 'hrjobcontract_pay_pay_annualized_est_low', ts('From'), array('size' => 8, 'maxlength' => 8)); $form->addRule('hrjobcontract_pay_pay_annualized_est_low', ts('Please enter a valid money value (e.g. %1).', array(1 => CRM_Utils_Money::format('9.99', ' '))), 'money'); $form->add('text', 'hrjobcontract_pay_pay_annualized_est_high', ts('To'), array('size' => 8, 'maxlength' => 8)); $form->addRule('hrjobcontract_pay_pay_annualized_est_high', ts('Please enter a valid money value (e.g. %1).', array(1 => CRM_Utils_Money::format('99.99', ' '))), 'money'); $form->add('select', 'hrjobcontract_pay_pay_is_auto_est', ts('Estimated Auto Pay'), array('' => '- select -', 0 => 'No', 1 => 'Yes'), FALSE, array('id' => 'hrjobcontract_pay_pay_is_auto_est', 'multiple' => false)); // TODO: Annual Benefits + Annual Deductions $payCycleOptions = array(); $payCycles = array(); CRM_Core_OptionGroup::getAssoc('hrjc_pay_cycle', $payCycles, true); foreach ($payCycles as $payCycle) { $payCycleOptions[$payCycle['value']] = $payCycle['label']; } $form->add('select', 'hrjobcontract_pay_pay_cycle', ts('Pay Cycle'), $payCycleOptions, FALSE, array('id' => 'hrjobcontract_pay_pay_cycle', 'multiple' => true)); $form->add('text', 'hrjobcontract_pay_pay_per_cycle_gross', ts('Pay Per Cycle Gross'), array('size' => 8, 'maxlength' => 8)); $form->addRule('hrjobcontract_pay_pay_per_cycle_gross', ts('Please enter a valid money value (e.g. %1).', array(1 => CRM_Utils_Money::format('9.99', ' '))), 'money'); $form->add('text', 'hrjobcontract_pay_pay_per_cycle_gross_low', ts('From'), array('size' => 8, 'maxlength' => 8)); $form->addRule('hrjobcontract_pay_pay_per_cycle_gross_low', ts('Please enter a valid money value (e.g. %1).', array(1 => CRM_Utils_Money::format('9.99', ' '))), 'money'); $form->add('text', 'hrjobcontract_pay_pay_per_cycle_gross_high', ts('To'), array('size' => 8, 'maxlength' => 8)); $form->addRule('hrjobcontract_pay_pay_per_cycle_gross_high', ts('Please enter a valid money value (e.g. %1).', array(1 => CRM_Utils_Money::format('99.99', ' '))), 'money'); $form->add('text', 'hrjobcontract_pay_pay_per_cycle_net', ts('Pay Per Cycle Net'), array('size' => 8, 'maxlength' => 8)); $form->addRule('hrjobcontract_pay_pay_per_cycle_net', ts('Please enter a valid money value (e.g. %1).', array(1 => CRM_Utils_Money::format('9.99', ' '))), 'money'); $form->add('text', 'hrjobcontract_pay_pay_per_cycle_net_low', ts('From'), array('size' => 8, 'maxlength' => 8)); $form->addRule('hrjobcontract_pay_pay_per_cycle_net_low', ts('Please enter a valid money value (e.g. %1).', array(1 => CRM_Utils_Money::format('9.99', ' '))), 'money'); $form->add('text', 'hrjobcontract_pay_pay_per_cycle_net_high', ts('To'), array('size' => 8, 'maxlength' => 8)); $form->addRule('hrjobcontract_pay_pay_per_cycle_net_high', ts('Please enter a valid money value (e.g. %1).', array(1 => CRM_Utils_Money::format('99.99', ' '))), 'money'); } if ($type == 'hrjobcontract_pension') { $form->add('hidden', 'hidden_hrjobcontract_pension', 1); $form->add('select', 'hrjobcontract_pension_is_enrolled', ts('Is Enrolled'), array(0 => 'No', 1 => 'Yes', 2 => 'Opted out'), FALSE, array('id' => 'hrjobcontract_pension_is_enrolled', 'multiple' => true)); $form->add('text', 'hrjobcontract_pension_ee_contrib_pct_low', ts('From'), array('size' => 8, 'maxlength' => 8)); $form->addRule('hrjobcontract_pension_ee_contrib_pct_low', ts('Please enter a valid money value (e.g. %1).', array(1 => CRM_Utils_Money::format('9.99', ' '))), 'money'); $form->add('text', 'hrjobcontract_pension_ee_contrib_pct_high', ts('To'), array('size' => 8, 'maxlength' => 8)); $form->addRule('hrjobcontract_pension_ee_contrib_pct_high', ts('Please enter a valid money value (e.g. %1).', array(1 => CRM_Utils_Money::format('99.99', ' '))), 'money'); $form->add('text', 'hrjobcontract_pension_er_contrib_pct_low', ts('From'), array('size' => 8, 'maxlength' => 8)); $form->addRule('hrjobcontract_pension_er_contrib_pct_low', ts('Please enter a valid money value (e.g. %1).', array(1 => CRM_Utils_Money::format('9.99', ' '))), 'money'); $form->add('text', 'hrjobcontract_pension_er_contrib_pct_high', ts('To'), array('size' => 8, 'maxlength' => 8)); $form->addRule('hrjobcontract_pension_er_contrib_pct_high', ts('Please enter a valid money value (e.g. %1).', array(1 => CRM_Utils_Money::format('99.99', ' '))), 'money'); $pensionTypes = array(); $pensionTypeOptions = array(); CRM_Core_OptionGroup::getAssoc('hrjc_pension_type', $pensionTypes, true); foreach ($pensionTypes as $pensionType) { $pensionTypeOptions[$pensionType['value']] = $pensionType['label']; } $form->add('select', 'hrjobcontract_pension_pension_type', ts('Pension Provider'), $pensionTypeOptions, FALSE, array('id' => 'hrjobcontract_pension_pension_type', 'multiple' => true)); $form->add('text', 'hrjobcontract_pension_ee_contrib_abs_low', ts('From'), array('size' => 8, 'maxlength' => 8)); $form->addRule('hrjobcontract_pension_ee_contrib_abs_low', ts('Please enter a valid money value (e.g. %1).', array(1 => CRM_Utils_Money::format('9.99', ' '))), 'money'); $form->add('text', 'hrjobcontract_pension_ee_contrib_abs_high', ts('To'), array('size' => 8, 'maxlength' => 8)); $form->addRule('hrjobcontract_pension_ee_contrib_abs_high', ts('Please enter a valid money value (e.g. %1).', array(1 => CRM_Utils_Money::format('99.99', ' '))), 'money'); $form->addElement('text', 'hrjobcontract_pension_ee_evidence_note', ts('Pension Evidence Note'), CRM_Core_DAO::getAttribute('CRM_Hrjobcontract_DAO_HRJobPension', 'ee_evidence_note')); } }
function addFilters() { require_once 'CRM/Utils/Date.php'; require_once 'CRM/Core/Form/Date.php'; $options = $filters = array(); $count = 1; foreach ($this->_filters as $table => $attributes) { foreach ($attributes as $fieldName => $field) { // get ready with option value pair $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_MULTISELECT: case CRM_Report_FORM::OP_MULTISELECT_SEPARATOR: // assume a multi-select field if (!empty($field['options'])) { $element = $this->addElement('select', "{$fieldName}_op", ts('Operator:'), $operations); if (count($operations) <= 1) { $element->freeze(); } $select = $this->addElement('select', "{$fieldName}_value", null, $field['options'], array('size' => 4, 'style' => 'width:200px')); $select->setMultiple(true); } break; case CRM_Report_FORM::OP_SELECT: // assume a select field $this->addElement('select', "{$fieldName}_op", ts('Operator:'), $operations); $this->addElement('select', "{$fieldName}_value", null, $field['options']); break; case CRM_Report_FORM::OP_DATE: // build datetime fields CRM_Core_Form_Date::buildDateRange($this, $fieldName, $count); $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); break; } } } $this->assign('filters', $filters); }
/** * @param CRM_Core_Form $form */ public static function buildSearchForm(&$form) { // pledge related dates CRM_Core_Form_Date::buildDateRange($form, 'pledge_start_date', 1, '_low', '_high', ts('From'), FALSE); CRM_Core_Form_Date::buildDateRange($form, 'pledge_end_date', 1, '_low', '_high', ts('From'), FALSE); CRM_Core_Form_Date::buildDateRange($form, 'pledge_create_date', 1, '_low', '_high', ts('From'), FALSE); // pledge payment related dates CRM_Core_Form_Date::buildDateRange($form, 'pledge_payment_date', 1, '_low', '_high', ts('From'), FALSE); $form->addYesNo('pledge_test', ts('Pledge is a Test?'), TRUE); $form->add('text', 'pledge_amount_low', ts('From'), array('size' => 8, 'maxlength' => 8)); $form->addRule('pledge_amount_low', ts('Please enter a valid money value (e.g. %1).', array(1 => CRM_Utils_Money::format('9.99', ' '))), 'money'); $form->add('text', 'pledge_amount_high', ts('To'), array('size' => 8, 'maxlength' => 8)); $form->addRule('pledge_amount_high', ts('Please enter a valid money value (e.g. %1).', array(1 => CRM_Utils_Money::format('99.99', ' '))), 'money'); $statusValues = CRM_Contribute_PseudoConstant::contributionStatus(); // Remove status values that are only used for recurring contributions for now (Failed and In Progress). unset($statusValues['4']); $form->add('select', 'pledge_status_id', ts('Pledge Status'), $statusValues, FALSE, array('class' => 'crm-select2', 'multiple' => 'multiple')); //unset in progress for payment unset($statusValues['5']); $form->add('select', 'pledge_payment_status_id', ts('Pledge Payment Status'), $statusValues, FALSE, array('class' => 'crm-select2', 'multiple' => 'multiple')); $form->add('select', 'pledge_financial_type_id', ts('Financial Type'), array('' => ts('- select -')) + CRM_Contribute_PseudoConstant::financialType(), FALSE, array('class' => 'crm-select2')); $form->add('select', 'pledge_contribution_page_id', ts('Contribution Page'), array('' => ts('- any -')) + CRM_Contribute_PseudoConstant::contributionPage(), FALSE, array('class' => 'crm-select2')); //add fields for pledge frequency $form->add('text', 'pledge_frequency_interval', ts('Every'), array('size' => 8, 'maxlength' => 8)); $form->addRule('pledge_frequency_interval', ts('Please enter valid Pledge Frequency Interval'), 'integer'); $frequencies = CRM_Core_OptionGroup::values('recur_frequency_units'); foreach ($frequencies as $val => $label) { $freqUnitsDisplay["'{$val}'"] = ts('%1(s)', array(1 => $label)); } $form->add('select', 'pledge_frequency_unit', ts('Pledge Frequency'), array('' => ts('- any -')) + $freqUnitsDisplay); // add all the custom searchable fields $pledge = array('Pledge'); $groupDetails = CRM_Core_BAO_CustomGroup::getGroupDetail(NULL, TRUE, $pledge); if ($groupDetails) { $form->assign('pledgeGroupTree', $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, 'pledge_campaign_id'); $form->assign('validCiviPledge', TRUE); $form->setDefaults(array('pledge_test' => 0)); }
/** * @param $form */ public static function demographics(&$form) { $form->add('hidden', 'hidden_demographics', 1); // 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, 'gender_id', ts('Gender'))->setAttribute('allowClear', TRUE); $form->add('text', 'age_low', ts('Min Age'), array('size' => 6)); $form->addRule('age_low', ts('Please enter a positive integer'), 'positiveInteger'); $form->add('text', 'age_high', ts('Max Age'), array('size' => 6)); $form->addRule('age_high', ts('Please enter a positive integer'), 'positiveInteger'); $form->addDate('age_asof_date', ts('Age as of Date'), FALSE, array('formatType' => 'searchDate')); CRM_Core_Form_Date::buildDateRange($form, 'birth_date', 1, '_low', '_high', ts('From'), FALSE, FALSE, 'birth'); CRM_Core_Form_Date::buildDateRange($form, 'deceased_date', 1, '_low', '_high', ts('From'), FALSE, FALSE, 'birth'); // radio button for is_deceased $form->addYesNo('is_deceased', ts('Deceased'), TRUE); }
/** * Add all the elements shared between contribute search and advnaced search. * * * @param CRM_Core_Form $form * * @return void */ public static function buildSearchForm(&$form) { // Added contribution source $form->addElement('text', 'contribution_source', ts('Contribution Source'), CRM_Core_DAO::getAttribute('CRM_Contribute_DAO_Contribution', 'source')); CRM_Core_Form_Date::buildDateRange($form, 'contribution_date', 1, '_low', '_high', ts('From:'), FALSE); $form->add('text', 'contribution_amount_low', ts('From'), array('size' => 8, 'maxlength' => 8)); $form->addRule('contribution_amount_low', ts('Please enter a valid money value (e.g. %1).', array(1 => CRM_Utils_Money::format('9.99', ' '))), 'money'); $form->add('text', 'contribution_amount_high', ts('To'), array('size' => 8, 'maxlength' => 8)); $form->addRule('contribution_amount_high', ts('Please enter a valid money value (e.g. %1).', array(1 => CRM_Utils_Money::format('99.99', ' '))), 'money'); // Adding select option for curreny type -- CRM-4711 $form->add('select', 'contribution_currency_type', ts('Currency Type'), array('' => ts('- any -')) + CRM_Core_PseudoConstant::get('CRM_Contribute_DAO_Contribution', 'currency', array('labelColumn' => 'name')), FALSE, array('class' => 'crm-select2')); // CRM-13848 $form->addSelect('financial_type_id', array('entity' => 'contribution', 'multiple' => 'multiple', 'context' => 'search')); $form->add('select', 'contribution_page_id', ts('Contribution Page'), array('' => ts('- any -')) + CRM_Contribute_PseudoConstant::contributionPage(), FALSE, array('class' => 'crm-select2')); $form->addSelect('payment_instrument_id', array('entity' => 'contribution', 'label' => ts('Payment Method'), 'option_url' => NULL, 'placeholder' => ts('- any -'))); $form->add('select', 'contribution_pcp_made_through_id', ts('Personal Campaign Page'), array('' => ts('- any -')) + CRM_Contribute_PseudoConstant::pcPage(), FALSE, array('class' => 'crm-select2')); $status = array(); $statusValues = CRM_Core_PseudoConstant::get('CRM_Contribute_DAO_Contribution', 'contribution_status'); // Remove status values that are only used for recurring contributions or pledges (In Progress, Overdue). unset($statusValues['5'], $statusValues['6']); $form->addSelect('contribution_status_id', array('entity' => 'contribution', 'multiple' => 'multiple', 'label' => ts('Contribution Status(s)'), 'option_url' => NULL, 'placeholder' => ts('- any -'))); // Add fields for thank you and receipt $form->addYesNo('contribution_thankyou_date_is_not_null', ts('Thank-you sent?'), TRUE); $form->addYesNo('contribution_receipt_date_is_not_null', ts('Receipt sent?'), TRUE); $form->addYesNo('contribution_pay_later', ts('Contribution is Pay Later?'), TRUE); $form->addYesNo('contribution_recurring', ts('Contribution is Recurring?'), TRUE); // Recurring contribution fields foreach (self::getRecurringFields() as $key => $label) { 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[$key . '_relative']) || !empty($form->_formValues[$key . '_low']) || !empty($form->_formValues[$key . '_high'])) { $form->assign('contribution_recur_pane_open', TRUE); } } $form->addYesNo('contribution_test', ts('Contribution is a Test?'), TRUE); // Add field for transaction ID search $form->addElement('text', 'contribution_trxn_id', ts("Transaction ID")); $form->addElement('text', 'contribution_check_number', ts('Check Number')); // Add field for pcp display in roll search $form->addYesNo('contribution_pcp_display_in_roll', ts('Personal Campaign Page Honor Roll?'), TRUE); // Soft credit related fields $options = array('only_contribs' => ts('Contributions Only'), 'only_scredits' => ts('Soft Credits Only'), 'both_related' => ts('Soft Credits with related Hard Credit'), 'both' => ts('Both')); $form->add('select', 'contribution_or_softcredits', ts('Contributions OR Soft Credits?'), $options, FALSE, array('class' => "crm-select2")); $form->addSelect('contribution_soft_credit_type_id', array('entity' => 'contribution_soft', 'field' => 'soft_credit_type_id', 'multiple' => TRUE, 'context' => 'search')); // Add all the custom searchable fields $contribution = array('Contribution'); $groupDetails = CRM_Core_BAO_CustomGroup::getGroupDetail(NULL, TRUE, $contribution); if ($groupDetails) { $form->assign('contributeGroupTree', $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, 'contribution_campaign_id'); // Add batch select $batches = CRM_Contribute_PseudoConstant::batch(); if (!empty($batches)) { $form->add('select', 'contribution_batch_id', ts('Batch Name'), array('' => ts('- any -')) + $batches, FALSE, array('class' => 'crm-select2')); } $form->assign('validCiviContribute', TRUE); $form->setDefaults(array('contribution_test' => 0)); }
function addFilters() { $options = $filters = array(); $count = 1; foreach ($this->_filters as $table => $attributes) { foreach ($attributes as $fieldName => $field) { // get ready with option value pair $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'])) { $element = $this->addElement('select', "{$fieldName}_op", ts('Operator:'), $operations); if (count($operations) <= 1) { $element->freeze(); } $select = $this->addElement('select', "{$fieldName}_value", NULL, $field['options'], array('size' => 4, 'style' => 'width:250px')); $select->setMultiple(TRUE); } break; case CRM_Report_FORM::OP_SELECT: // assume a select field $this->addElement('select', "{$fieldName}_op", ts('Operator:'), $operations); $this->addElement('select', "{$fieldName}_value", NULL, $field['options']); break; case CRM_Report_FORM::OP_DATE: // build datetime fields CRM_Core_Form_Date::buildDateRange($this, $fieldName, $count); $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); break; } } } $this->assign('filters', $filters); }
/** * Add all the elements shared between Mailing search and advnaced search. * * * @param CRM_Core_Form $form */ public 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', 'class' => 'crm-select2')); } CRM_Core_Form_Date::buildDateRange($form, 'mailing_date', 1, '_low', '_high', ts('From'), FALSE); $form->addElement('hidden', 'mailing_date_range_error'); $form->addFormRule(array('CRM_Mailing_BAO_Query', 'formRule'), $form); $mailingJobStatuses = array('' => ts('- select -'), 'Complete' => 'Complete', 'Scheduled' => 'Scheduled', 'Running' => 'Running', 'Canceled' => 'Canceled'); $form->addElement('select', 'mailing_job_status', ts('Mailing Job Status'), $mailingJobStatuses, FALSE); $mailingBounceTypes = CRM_Core_PseudoConstant::get('CRM_Mailing_Event_DAO_Bounce', 'bounce_type_id', array('keyColumn' => 'id', 'labelColumn' => 'name')); $form->add('select', 'mailing_bounce_types', ts('Bounce Types'), $mailingBounceTypes, FALSE, array('id' => 'mailing_bounce_types', 'multiple' => 'multiple', 'class' => 'crm-select2')); // event filters $form->addRadio('mailing_delivery_status', ts('Delivery Status'), CRM_Mailing_PseudoConstant::yesNoOptions('delivered'), array('allowClear' => TRUE)); $form->addRadio('mailing_open_status', ts('Trackable Opens'), CRM_Mailing_PseudoConstant::yesNoOptions('open'), array('allowClear' => TRUE)); $form->addRadio('mailing_click_status', ts('Trackable URLs'), CRM_Mailing_PseudoConstant::yesNoOptions('click'), array('allowClear' => TRUE)); $form->addRadio('mailing_reply_status', ts('Trackable Replies'), CRM_Mailing_PseudoConstant::yesNoOptions('reply'), array('allowClear' => TRUE)); $form->add('checkbox', 'mailing_unsubscribe', ts('Unsubscribe Requests')); $form->add('checkbox', 'mailing_optout', ts('Opt-out Requests')); $form->add('checkbox', 'mailing_forward', ts('Forwards')); // Campaign select field CRM_Campaign_BAO_Campaign::addCampaignInComponentSearch($form, 'mailing_campaign_id'); $form->assign('validCiviMailing', TRUE); }
/** * @param $form */ static function demographics(&$form) { $form->add('hidden', 'hidden_demographics', 1); // 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, 'gender_id', ts('Gender'))->setAttribute('allowClear', TRUE); CRM_Core_Form_Date::buildDateRange($form, 'birth_date', 1, '_low', '_high', ts('From'), FALSE, FALSE, 'birth'); CRM_Core_Form_Date::buildDateRange($form, 'deceased_date', 1, '_low', '_high', ts('From'), FALSE, FALSE, 'birth'); // radio button for is_deceased $form->addYesNo('is_deceased', ts('Deceased'), TRUE); }
/** * @param CRM_Core_Form $form */ public static function buildSearchForm(&$form) { $dataURLEventFee = CRM_Utils_System::url('civicrm/ajax/eventFee', "reset=1", FALSE, NULL, FALSE); $form->assign('dataURLEventFee', $dataURLEventFee); $form->addEntityRef('event_id', ts('Event Name'), array('entity' => 'event', 'placeholder' => ts('- any -'), 'multiple' => 1, 'select' => array('minimumInputLength' => 0))); $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')))); $obj = new CRM_Report_Form_Event_ParticipantListing(); $form->add('select', 'participant_fee_id', ts('Fee Level'), $obj->getPriceLevels(), FALSE, array('class' => 'crm-select2', 'multiple' => 'multiple', 'placeholder' => ts('- any -'))); CRM_Core_Form_Date::buildDateRange($form, 'event', 1, '_start_date_low', '_end_date_high', ts('From'), FALSE); CRM_Core_Form_Date::buildDateRange($form, 'participant', 1, '_register_date_low', '_register_date_high', ts('From'), FALSE); $form->addElement('checkbox', "event_include_repeating_events", NULL, ts('Include participants from all events in the %1 series', array(1 => '<em>%1</em>'))); $form->addSelect('participant_status_id', array('entity' => 'participant', 'label' => ts('Participant Status'), 'multiple' => 'multiple', 'option_url' => NULL, 'placeholder' => ts('- any -'))); $form->addSelect('participant_role_id', array('entity' => 'participant', 'label' => ts('Participant Role'), 'multiple' => 'multiple', 'option_url' => NULL, 'placeholder' => ts('- any -'))); $form->addYesNo('participant_test', ts('Participant is a Test?'), TRUE); $form->addYesNo('participant_is_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, TRUE); } } } CRM_Campaign_BAO_Campaign::addCampaignInComponentSearch($form, 'participant_campaign_id'); $form->assign('validCiviEvent', TRUE); $form->setDefaults(array('participant_test' => 0)); }
/** * add all the elements shared between case activity search and advanaced search * * @access public * * @return void * @static */ static function buildSearchForm(&$form) { $activityOptions = CRM_Core_PseudoConstant::activityType(TRUE, TRUE, FALSE, 'label', TRUE); asort($activityOptions); foreach ($activityOptions as $activityID => $activity) { $form->_activityElement =& $form->addElement('checkbox', "activity_type_id[{$activityID}]", NULL, $activity, array('onClick' => 'showCustomData( this.id );')); } CRM_Core_Form_Date::buildDateRange($form, 'activity_date', 1, '_low', '_high', ts('From'), FALSE, FALSE); $activityRoles = array(1 => ts('Created by'), 2 => ts('Assigned to')); $form->addRadio('activity_role', NULL, $activityRoles, NULL, '<br />'); $form->addElement('text', 'activity_contact_name', ts('Contact Name'), CRM_Core_DAO::getAttribute('CRM_Contact_DAO_Contact', 'sort_name')); $activityStatus = CRM_Core_PseudoConstant::activityStatus(); foreach ($activityStatus as $activityStatusID => $activityStatusName) { $activity_status[] = $form->createElement('checkbox', $activityStatusID, NULL, $activityStatusName); } $form->addGroup($activity_status, 'activity_status', ts('Activity Status')); $form->setDefaults(array('activity_status[1]' => 1, 'activity_status[2]' => 1)); $form->addElement('text', 'activity_subject', ts('Subject'), CRM_Core_DAO::getAttribute('CRM_Contact_DAO_Contact', 'sort_name')); $form->addElement('checkbox', 'activity_test', ts('Find Test Activities?')); $activity_tags = CRM_Core_BAO_Tag::getTags('civicrm_activity'); if ($activity_tags) { foreach ($activity_tags as $tagID => $tagName) { $form->_tagElement =& $form->addElement('checkbox', "activity_tags[{$tagID}]", NULL, $tagName); } } $parentNames = CRM_Core_BAO_Tag::getTagSet('civicrm_activity'); CRM_Core_Form_Tag::buildQuickForm($form, $parentNames, 'civicrm_activity', NULL, TRUE, FALSE, TRUE); $surveys = CRM_Campaign_BAO_Survey::getSurveys(); if ($surveys) { $form->add('select', 'activity_survey_id', ts('Survey'), array('' => ts('- none -')) + $surveys, FALSE); } $extends = array('Activity'); $groupDetails = CRM_Core_BAO_CustomGroup::getGroupDetail(NULL, TRUE, $extends); if ($groupDetails) { $form->assign('activityGroupTree', $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, 'activity_campaign_id'); //add engagement level CRM-7775 $buildEngagementLevel = FALSE; if (CRM_Campaign_BAO_Campaign::isCampaignEnable() && CRM_Campaign_BAO_Campaign::accessCampaign()) { $buildEngagementLevel = TRUE; $form->add('select', 'activity_engagement_level', ts('Engagement Index'), array('' => ts('- select -')) + CRM_Campaign_PseudoConstant::engagementLevel()); } $form->assign('buildEngagementLevel', $buildEngagementLevel); }