function __construct() { $yearsInPast = 10; $yearsInFuture = 1; $date = CRM_Core_SelectValues::date('custom', NULL, $yearsInPast, $yearsInFuture); $count = $date['maxYear']; while ($date['minYear'] <= $count) { $optionYear[$date['minYear']] = $date['minYear']; $date['minYear']++; } // Check if CiviCampaign is a) enabled and b) has active campaigns $config = CRM_Core_Config::singleton(); $campaignEnabled = in_array("CiviCampaign", $config->enableComponents); if ($campaignEnabled) { $getCampaigns = CRM_Campaign_BAO_Campaign::getPermissionedCampaigns(NULL, NULL, TRUE, FALSE, TRUE); $this->activeCampaigns = $getCampaigns['campaigns']; asort($this->activeCampaigns); } $this->_columns = array('civicrm_contact' => array('dao' => 'CRM_Contact_DAO_Contact', 'grouping' => 'contact-field', 'fields' => array('sort_name' => array('title' => ts('Donor Name'), 'required' => TRUE), 'first_name' => array('title' => ts('First Name')), 'last_name' => array('title' => ts('Last Name')), 'contact_type' => array('title' => ts('Contact Type')), 'contact_sub_type' => array('title' => ts('Contact SubType'))), 'filters' => array('sort_name' => array('title' => ts('Donor Name'), 'operator' => 'like'))), 'civicrm_email' => array('dao' => 'CRM_Core_DAO_Email', 'grouping' => 'contact-field', 'fields' => array('email' => array('title' => ts('Email'), 'default' => TRUE))), 'civicrm_phone' => array('dao' => 'CRM_Core_DAO_Phone', 'grouping' => 'contact-field', 'fields' => array('phone' => array('title' => ts('Phone'), 'default' => TRUE)))) + $this->addAddressFields() + array('civicrm_contribution' => array('dao' => 'CRM_Contribute_DAO_Contribution', 'fields' => array('contact_id' => array('title' => ts('contactId'), 'no_display' => TRUE, 'required' => TRUE, 'no_repeat' => TRUE), 'total_amount' => array('title' => ts('Total Amount'), 'no_display' => TRUE, 'required' => TRUE, 'no_repeat' => TRUE), 'receive_date' => array('title' => ts('Year'), 'no_display' => TRUE, 'required' => TRUE, 'no_repeat' => TRUE)), 'filters' => array('yid' => array('name' => 'receive_date', 'title' => ts('This Year'), 'operatorType' => CRM_Report_Form::OP_SELECT, 'options' => $optionYear, 'default' => date('Y')), 'financial_type_id' => array('title' => ts('Financial Type'), 'operatorType' => CRM_Report_Form::OP_MULTISELECT, 'options' => CRM_Contribute_PseudoConstant::financialType()), 'contribution_status_id' => array('title' => ts('Contribution Status'), 'operatorType' => CRM_Report_Form::OP_MULTISELECT, 'options' => CRM_Contribute_PseudoConstant::contributionStatus(), 'default' => array('1')))), 'civicrm_group' => array('dao' => 'CRM_Contact_DAO_GroupContact', 'alias' => 'cgroup', 'filters' => array('gid' => array('name' => 'group_id', 'title' => ts('Group'), 'operatorType' => CRM_Report_Form::OP_MULTISELECT, 'group' => TRUE, 'options' => CRM_Core_PseudoConstant::group())))); // If we have a campaign, build out the relevant elements if ($campaignEnabled && !empty($this->activeCampaigns)) { $this->_columns['civicrm_contribution']['fields']['campaign_id'] = array('title' => ts('Campaign'), 'default' => 'false'); $this->_columns['civicrm_contribution']['filters']['campaign_id'] = array('title' => ts('Campaign'), 'operatorType' => CRM_Report_Form::OP_MULTISELECT, 'options' => $this->activeCampaigns); } $this->_tagFilter = TRUE; parent::__construct(); }
/** * This function provides the HTML form elements that are specific to the Individual Contact Type * * @access public * @return None */ function buildQuickForm(&$form) { $form->applyFilter('__ALL__', 'trim'); // prefix $form->addElement('select', 'prefix_id', ts('Prefix'), array('' => ts('- prefix -')) + CRM_Core_PseudoConstant::individualPrefix()); $attributes = CRM_Core_DAO::getAttribute('CRM_Contact_DAO_Individual'); // first_name $form->addElement('text', 'first_name', ts('First Name'), $attributes['first_name']); //middle_name $form->addElement('text', 'middle_name', ts('Middle Name'), $attributes['middle_name']); // last_name $form->addElement('text', 'last_name', ts('Last Name'), $attributes['last_name']); // suffix $form->addElement('select', 'suffix_id', ts('Suffix'), array('' => ts('- suffix -')) + CRM_Core_PseudoConstant::individualSuffix()); // nick_name $form->addElement('text', 'nick_name', ts('Nick Name'), CRM_Core_DAO::getAttribute('CRM_Contact_DAO_Contact', 'nick_name')); // greeting type $form->addElement('select', 'greeting_type', ts('Greeting'), CRM_Core_SelectValues::greeting()); // job title $form->addElement('text', 'job_title', ts('Job title'), $attributes['job_title']); // radio button for gender $genderOptions = array(); $gender = CRM_Core_PseudoConstant::gender(); foreach ($gender as $key => $var) { $genderOptions[$key] = HTML_QuickForm::createElement('radio', null, ts('Gender'), $var, $key); } $form->addGroup($genderOptions, 'gender_id', ts('Gender')); $form->addElement('checkbox', 'is_deceased', null, ts('Contact is deceased')); $form->addElement('date', 'birth_date', ts('Date of birth'), CRM_Core_SelectValues::date('birth')); $form->addRule('birth_date', ts('Select a valid date.'), 'qfDate'); $form->addElement('text', 'home_URL', ts('Website'), CRM_Core_DAO::getAttribute('CRM_Contact_DAO_Contact', 'home_URL')); $form->addRule('home_URL', ts('Enter a valid Website.'), 'url'); $config =& CRM_Core_Config::singleton(); CRM_Core_ShowHideBlocks::links($this, 'demographics', '', ''); }
function __construct() { $yearsInPast = 4; $date = CRM_Core_SelectValues::date('custom', NULL, $yearsInPast, 0); $count = $date['maxYear']; $optionYear = array('' => ts('-- select --')); $this->_yearStatisticsFrom = $date['minYear']; $this->_yearStatisticsTo = $date['maxYear']; while ($date['minYear'] <= $count) { $optionYear[$date['minYear']] = $date['minYear']; $date['minYear']++; } $relationTypeOp = array(); $relationshipTypes = CRM_Core_PseudoConstant::relationshipType(); foreach ($relationshipTypes as $rid => $rtype) { if ($rtype['label_a_b'] != $rtype['label_b_a']) { $relationTypeOp[$rid] = "{$rtype['label_a_b']}/{$rtype['label_b_a']}"; } else { $relationTypeOp[$rid] = $rtype['label_a_b']; } } $this->_columns = array('civicrm_contact' => array('dao' => 'CRM_Contact_DAO_Contact', 'fields' => array('sort_name' => array('title' => ts('Contact Name'), 'default' => TRUE, 'required' => TRUE, 'no_repeat' => TRUE), 'id' => array('no_display' => TRUE, 'default' => TRUE, 'required' => TRUE)), 'grouping' => 'contact-fields', 'filters' => array('sort_name' => array('title' => ts('Contact Name')), 'id' => array('title' => ts('Contact ID'), 'no_display' => TRUE))), 'civicrm_email' => array('dao' => 'CRM_Core_DAO_Email', 'fields' => array('email' => array('title' => ts('Email'), 'no_repeat' => TRUE)), 'grouping' => 'contact-fields'), 'civicrm_phone' => array('dao' => 'CRM_Core_DAO_Phone', 'fields' => array('phone' => array('title' => ts('Phone'), 'no_repeat' => TRUE)), 'grouping' => 'contact-fields')) + $this->addAddressFields(FALSE, FALSE, FALSE, array()) + array('civicrm_relationship' => array('dao' => 'CRM_Contact_DAO_Relationship', 'fields' => array('relationship_type_id' => array('title' => ts('Relationship Type'), 'default' => TRUE), 'contact_id_a' => array('no_display' => TRUE), 'contact_id_b' => array('no_display' => TRUE)), 'filters' => array('relationship_type_id' => array('title' => ts('Relationship Type'), 'operatorType' => CRM_Report_Form::OP_MULTISELECT, 'options' => $relationTypeOp, 'type' => CRM_Utils_Type::T_STRING)))) + array('civicrm_contribution' => array('dao' => 'CRM_Contribute_DAO_Contribution', 'fields' => array('total_amount' => array('title' => ts('Amount Statistics'), 'default' => TRUE, 'required' => TRUE, 'no_display' => TRUE, 'statistics' => array('sum' => ts('Aggregate Amount'))), 'receive_date' => array('required' => TRUE, 'default' => TRUE, 'no_display' => TRUE)), 'grouping' => 'contri-fields', 'filters' => array('this_year' => array('title' => ts('This Year'), 'operatorType' => CRM_Report_Form::OP_SELECT, 'options' => $optionYear, 'default' => ''), 'other_year' => array('title' => ts('Other Years'), 'operatorType' => CRM_Report_Form::OP_SELECT, 'options' => $optionYear, 'default' => ''), 'receive_date' => array('operatorType' => CRM_Report_Form::OP_DATE), 'contribution_status_id' => array('title' => ts('Donation Status'), 'operatorType' => CRM_Report_Form::OP_MULTISELECT, 'options' => CRM_Contribute_PseudoConstant::contributionStatus(), 'default' => array(1)), 'contribution_type_id' => array('title' => ts('Contribution Type'), 'operatorType' => CRM_Report_Form::OP_MULTISELECT, 'options' => CRM_Contribute_PseudoConstant::contributionType()), 'total_amount' => array('title' => ts('Donation Amount')), 'total_sum' => array('title' => ts('Aggregate Amount'), 'type' => CRM_Report_Form::OP_INT, 'dbAlias' => 'civicrm_contribution_total_amount_sum', 'having' => TRUE)))) + array('civicrm_group' => array('dao' => 'CRM_Contact_DAO_GroupContact', 'alias' => 'cgroup', 'filters' => array('gid' => array('name' => 'group_id', 'title' => ts('Group'), 'operatorType' => CRM_Report_Form::OP_MULTISELECT, 'group' => TRUE, 'options' => CRM_Core_PseudoConstant::group())))); $this->_columns['civicrm_contribution']['fields']['civicrm_upto_' . $this->_yearStatisticsFrom] = array('title' => ts('Up To %1 Donation', array(1 => $this->_yearStatisticsFrom)), 'default' => TRUE, 'type' => CRM_Utils_Type::T_MONEY, 'is_statistics' => TRUE); $yearConter = $this->_yearStatisticsFrom; $yearConter++; while ($yearConter <= $this->_yearStatisticsTo) { $this->_columns['civicrm_contribution']['fields'][$yearConter] = array('title' => ts('%1 Donation', array(1 => $yearConter)), 'default' => TRUE, 'type' => CRM_Utils_Type::T_MONEY, 'is_statistics' => TRUE); $yearConter++; } $this->_columns['civicrm_contribution']['fields']['aggregate_amount'] = array('title' => ts('Aggregate Amount'), 'type' => CRM_Utils_Type::T_MONEY, 'is_statistics' => TRUE); $this->_tagFilter = TRUE; parent::__construct(); }
/** * Build the form for the last step of the mailing wizard * * @param * @return void * @access public */ function buildQuickform() { $this->addElement('date', 'start_date', ts('Start Date'), CRM_Core_SelectValues::date('mailing')); $this->addElement('checkbox', 'now', ts('Send Immediately')); $this->addFormRule(array('CRM_Mailing_Form_Schedule', 'formRule')); $this->addButtons(array(array('type' => 'back', 'name' => ts('<< Previous')), array('type' => 'next', 'name' => ts('Done'), 'isDefault' => true), array('type' => 'Cancel', 'name' => ts('Cancel')))); }
/** */ public function __construct() { $this->_rollup = 'WITH ROLLUP'; $this->_autoIncludeIndexedFieldsAsOrderBys = 1; $yearsInPast = 10; $yearsInFuture = 1; $date = CRM_Core_SelectValues::date('custom', NULL, $yearsInPast, $yearsInFuture); $count = $date['maxYear']; while ($date['minYear'] <= $count) { $optionYear[$date['minYear']] = $date['minYear']; $date['minYear']++; } // Check if CiviCampaign is a) enabled and b) has active campaigns $config = CRM_Core_Config::singleton(); $campaignEnabled = in_array("CiviCampaign", $config->enableComponents); if ($campaignEnabled) { $getCampaigns = CRM_Campaign_BAO_Campaign::getPermissionedCampaigns(NULL, NULL, TRUE, FALSE, TRUE); $this->activeCampaigns = $getCampaigns['campaigns']; asort($this->activeCampaigns); } $this->_columns = array('civicrm_contact' => array('dao' => 'CRM_Contact_DAO_Contact', 'grouping' => 'contact-field', 'fields' => array('sort_name' => array('title' => ts('Donor Name'), 'required' => TRUE), 'first_name' => array('title' => ts('First Name')), 'middle_name' => array('title' => ts('Middle Name')), 'last_name' => array('title' => ts('Last Name')), 'id' => array('no_display' => TRUE, 'required' => TRUE), 'gender_id' => array('title' => ts('Gender')), 'birth_date' => array('title' => ts('Birth Date')), 'age' => array('title' => ts('Age'), 'dbAlias' => 'TIMESTAMPDIFF(YEAR, contact_civireport.birth_date, CURDATE())'), 'contact_type' => array('title' => ts('Contact Type')), 'contact_sub_type' => array('title' => ts('Contact Subtype'))), 'grouping' => 'contact-fields', 'order_bys' => array('sort_name' => array('title' => ts('Last Name, First Name'), 'default' => '1', 'default_weight' => '0', 'default_order' => 'ASC'), 'first_name' => array('name' => 'first_name', 'title' => ts('First Name')), 'gender_id' => array('name' => 'gender_id', 'title' => ts('Gender')), 'birth_date' => array('name' => 'birth_date', 'title' => ts('Birth Date')), 'age_at_event' => array('name' => 'age_at_event', 'title' => ts('Age at Event')), 'contact_type' => array('title' => ts('Contact Type')), 'contact_sub_type' => array('title' => ts('Contact Subtype'))), 'filters' => array('sort_name' => array('title' => ts('Donor Name'), 'operator' => 'like'), 'id' => array('title' => ts('Contact ID'), 'no_display' => TRUE), 'gender_id' => array('title' => ts('Gender'), 'operatorType' => CRM_Report_Form::OP_MULTISELECT, 'options' => CRM_Core_PseudoConstant::get('CRM_Contact_DAO_Contact', 'gender_id')), 'birth_date' => array('title' => ts('Birth Date'), 'operatorType' => CRM_Report_Form::OP_DATE), 'contact_type' => array('title' => ts('Contact Type')), 'contact_sub_type' => array('title' => ts('Contact Subtype')))), 'civicrm_line_item' => array('dao' => 'CRM_Price_DAO_LineItem'), 'civicrm_email' => array('dao' => 'CRM_Core_DAO_Email', 'grouping' => 'contact-field', 'fields' => array('email' => array('title' => ts('Email'), 'default' => TRUE))), 'civicrm_phone' => array('dao' => 'CRM_Core_DAO_Phone', 'grouping' => 'contact-field', 'fields' => array('phone' => array('title' => ts('Phone'), 'default' => TRUE)))); $this->_columns += $this->addAddressFields(); $this->_columns += array('civicrm_contribution' => array('dao' => 'CRM_Contribute_DAO_Contribution', 'fields' => array('contact_id' => array('title' => ts('contactId'), 'no_display' => TRUE, 'required' => TRUE, 'no_repeat' => TRUE), 'total_amount' => array('title' => ts('Total Amount'), 'no_display' => TRUE, 'required' => TRUE, 'no_repeat' => TRUE), 'receive_date' => array('title' => ts('Year'), 'no_display' => TRUE, 'required' => TRUE, 'no_repeat' => TRUE)), 'filters' => array('yid' => array('name' => 'receive_date', 'title' => ts('This Year'), 'operatorType' => CRM_Report_Form::OP_SELECT, 'options' => $optionYear, 'default' => date('Y'), 'type' => CRM_Utils_Type::T_INT), 'financial_type_id' => array('title' => ts('Financial Type'), 'type' => CRM_Utils_Type::T_INT, 'operatorType' => CRM_Report_Form::OP_MULTISELECT, 'options' => CRM_Financial_BAO_FinancialType::getAvailableFinancialTypes()), 'contribution_status_id' => array('title' => ts('Contribution Status'), 'operatorType' => CRM_Report_Form::OP_MULTISELECT, 'options' => CRM_Contribute_PseudoConstant::contributionStatus(), 'default' => array('1'))))); // If we have a campaign, build out the relevant elements if ($campaignEnabled && !empty($this->activeCampaigns)) { $this->_columns['civicrm_contribution']['fields']['campaign_id'] = array('title' => ts('Campaign'), 'default' => 'false'); $this->_columns['civicrm_contribution']['filters']['campaign_id'] = array('title' => ts('Campaign'), 'operatorType' => CRM_Report_Form::OP_MULTISELECT, 'options' => $this->activeCampaigns, 'type' => CRM_Utils_Type::T_INT); } $this->_groupFilter = TRUE; $this->_tagFilter = TRUE; parent::__construct(); }
/** * Build the form object. */ public function buildQuickForm() { $htmlFields = array(); foreach ($this->_settings as $setting => $group) { $settingMetaData = civicrm_api3('setting', 'getfields', array('name' => $setting)); $props = $settingMetaData['values'][$setting]; if (isset($props['quick_form_type'])) { $add = 'add' . $props['quick_form_type']; if ($add == 'addElement') { if (in_array($props['html_type'], array('checkbox', 'textarea'))) { $this->add($props['html_type'], $setting, $props['title']); } else { if ($props['html_type'] == 'select') { $functionName = CRM_Utils_Array::value('name', CRM_Utils_Array::value('pseudoconstant', $props)); if ($functionName) { $props['option_values'] = array('' => ts('- select -')) + CRM_Contribute_PseudoConstant::$functionName(); } } $this->{$add}($props['html_type'], $setting, ts($props['title']), CRM_Utils_Array::value($props['html_type'] == 'select' ? 'option_values' : 'html_attributes', $props, array()), $props['html_type'] == 'select' ? CRM_Utils_Array::value('html_attributes', $props) : NULL); } } elseif ($add == 'addMonthDay') { $this->add('date', $setting, ts($props['title']), CRM_Core_SelectValues::date(NULL, 'M d')); } elseif ($add == 'addDate') { $this->addDate($setting, ts($props['title']), FALSE, array('formatType' => $props['type'])); } else { $this->{$add}($setting, ts($props['title'])); } } $htmlFields[$setting] = ts($props['description']); } $this->assign('htmlFields', $htmlFields); parent::buildQuickForm(); $this->addFormRule(array('CRM_Admin_Form_Preferences_Contribute', 'formRule'), $this); }
/** * Function to build the form * * @return None * @access public */ function buildQuickForm() { parent::buildQuickForm(); if ($this->_action & CRM_CORE_ACTION_DELETE) { return; } $activityType = CRM_Core_PseudoConstant::activityType(false); $this->applyFilter('__ALL__', 'trim'); $this->add('select', 'activity_type_id', ts('Activity Type'), array('' => ts('- select activity type -')) + $activityType, array('onChange' => 'activity_get_description( )'), true); $this->addRule('activity_type_id', ts('Select a valid activity.'), 'required'); $this->add('text', 'description', ts('Description'), CRM_Core_DAO::getAttribute('CRM_Core_DAO_ActivityType', 'description'), false); $this->add('text', 'subject', ts('Subject'), CRM_Core_DAO::getAttribute('CRM_Core_DAO_Activity', 'subject'), true); $this->add('date', 'scheduled_date_time', ts('Date and Time'), CRM_Core_SelectValues::date('datetime'), true); $this->addRule('scheduled_date_time', ts('Select a valid date.'), 'qfDate'); $this->add('select', 'duration_hours', ts('Duration'), CRM_Core_SelectValues::getHours()); $this->add('select', 'duration_minutes', null, CRM_Core_SelectValues::getMinutes()); $this->add('text', 'location', ts('Location'), CRM_Core_DAO::getAttribute('CRM_Core_DAO_Activity', 'location')); $this->add('textarea', 'details', ts('Details'), CRM_Core_DAO::getAttribute('CRM_Core_DAO_Activity', 'details')); $this->add('select', 'status', ts('Status'), CRM_Core_SelectValues::activityStatus(), true); $this->_groupTree =& CRM_Core_BAO_CustomGroup::getTree('Activity', $this->_id, 0); if ($this->_action & CRM_CORE_ACTION_VIEW) { CRM_Core_BAO_CustomGroup::buildViewHTML($this, $this->_groupTree); } else { CRM_Core_BAO_CustomGroup::buildQuickForm($this, $this->_groupTree, 'showBlocks1', 'hideBlocks1'); } }
/** */ public function __construct() { $this->_autoIncludeIndexedFieldsAsOrderBys = 1; $yearsInPast = 4; $date = CRM_Core_SelectValues::date('custom', NULL, $yearsInPast, 0); $count = $date['maxYear']; $optionYear = array('' => ts('- select -')); $this->_yearStatisticsFrom = $date['minYear']; $this->_yearStatisticsTo = $date['maxYear']; while ($date['minYear'] <= $count) { $optionYear[$date['minYear']] = $date['minYear']; $date['minYear']++; } $relationTypeOp = array(); $relationshipTypes = CRM_Core_PseudoConstant::relationshipType(); foreach ($relationshipTypes as $rid => $rtype) { if ($rtype['label_a_b'] != $rtype['label_b_a']) { $relationTypeOp[$rid] = "{$rtype['label_a_b']}/{$rtype['label_b_a']}"; } else { $relationTypeOp[$rid] = $rtype['label_a_b']; } } $this->_columns = array('civicrm_contact' => array('dao' => 'CRM_Contact_DAO_Contact', 'fields' => array('sort_name' => array('title' => ts('Contact Name'), 'default' => TRUE, 'required' => TRUE, 'no_repeat' => TRUE), 'first_name' => array('title' => ts('First Name')), 'middle_name' => array('title' => ts('Middle Name')), 'last_name' => array('title' => ts('Last Name')), 'id' => array('no_display' => TRUE, 'default' => TRUE, 'required' => TRUE), 'gender_id' => array('title' => ts('Gender')), 'birth_date' => array('title' => ts('Birth Date')), 'age' => array('title' => ts('Age'), 'dbAlias' => 'TIMESTAMPDIFF(YEAR, contact_civireport.birth_date, CURDATE())'), 'contact_type' => array('title' => ts('Contact Type')), 'contact_sub_type' => array('title' => ts('Contact Subtype'))), 'grouping' => 'contact-fields', 'order_bys' => array('sort_name' => array('title' => ts('Last Name, First Name'), 'default' => '1', 'default_weight' => '0', 'default_order' => 'ASC'), 'first_name' => array('name' => 'first_name', 'title' => ts('First Name')), 'gender_id' => array('name' => 'gender_id', 'title' => ts('Gender')), 'birth_date' => array('name' => 'birth_date', 'title' => ts('Birth Date')), 'contact_type' => array('title' => ts('Contact Type')), 'contact_sub_type' => array('title' => ts('Contact Subtype'))), 'filters' => array('sort_name' => array('title' => ts('Contact Name')), 'id' => array('title' => ts('Contact ID'), 'no_display' => TRUE), 'gender_id' => array('title' => ts('Gender'), 'operatorType' => CRM_Report_Form::OP_MULTISELECT, 'options' => CRM_Core_PseudoConstant::get('CRM_Contact_DAO_Contact', 'gender_id')), 'birth_date' => array('title' => ts('Birth Date'), 'operatorType' => CRM_Report_Form::OP_DATE), 'contact_type' => array('title' => ts('Contact Type')), 'contact_sub_type' => array('title' => ts('Contact Subtype')))), 'civicrm_email' => array('dao' => 'CRM_Core_DAO_Email', 'fields' => array('email' => array('title' => ts('Email'), 'no_repeat' => TRUE)), 'grouping' => 'contact-fields'), 'civicrm_phone' => array('dao' => 'CRM_Core_DAO_Phone', 'fields' => array('phone' => array('title' => ts('Phone'), 'no_repeat' => TRUE)), 'grouping' => 'contact-fields')) + $this->addAddressFields(FALSE, FALSE, FALSE, array()) + array('civicrm_relationship' => array('dao' => 'CRM_Contact_DAO_Relationship', 'fields' => array('relationship_type_id' => array('title' => ts('Relationship Type'), 'default' => TRUE), 'contact_id_a' => array('no_display' => TRUE), 'contact_id_b' => array('no_display' => TRUE)), 'filters' => array('relationship_type_id' => array('title' => ts('Relationship Type'), 'operatorType' => CRM_Report_Form::OP_MULTISELECT, 'options' => $relationTypeOp, 'type' => CRM_Utils_Type::T_STRING)))) + array('civicrm_contribution' => array('dao' => 'CRM_Contribute_DAO_Contribution', 'fields' => array('total_amount' => array('title' => ts('Amount Statistics'), 'default' => TRUE, 'required' => TRUE, 'no_display' => TRUE, 'statistics' => array('sum' => ts('Aggregate Amount'))), 'receive_date' => array('required' => TRUE, 'default' => TRUE, 'no_display' => TRUE)), 'grouping' => 'contri-fields', 'filters' => array('this_year' => array('title' => ts('This Year'), 'operatorType' => CRM_Report_Form::OP_SELECT, 'options' => $optionYear, 'default' => ''), 'other_year' => array('title' => ts('Other Years'), 'operatorType' => CRM_Report_Form::OP_SELECT, 'options' => $optionYear, 'default' => ''), 'receive_date' => array('operatorType' => CRM_Report_Form::OP_DATE), 'contribution_status_id' => array('title' => ts('Contribution Status'), 'operatorType' => CRM_Report_Form::OP_MULTISELECT, 'options' => CRM_Contribute_PseudoConstant::contributionStatus(), 'default' => array(1)), 'financial_type_id' => array('title' => ts('Financial Type'), 'operatorType' => CRM_Report_Form::OP_MULTISELECT, 'options' => CRM_Contribute_PseudoConstant::financialType()), 'total_amount' => array('title' => ts('Contribution Amount')), 'total_sum' => array('title' => ts('Aggregate Amount'), 'type' => CRM_Report_Form::OP_INT, 'dbAlias' => 'civicrm_contribution_total_amount_sum', 'having' => TRUE)))); $this->_columns['civicrm_contribution']['fields']['civicrm_upto_' . $this->_yearStatisticsFrom] = array('title' => ts('Up To %1 Donation', array(1 => $this->_yearStatisticsFrom)), 'default' => TRUE, 'type' => CRM_Utils_Type::T_MONEY, 'is_statistics' => TRUE); $yearConter = $this->_yearStatisticsFrom; $yearConter++; while ($yearConter <= $this->_yearStatisticsTo) { $this->_columns['civicrm_contribution']['fields'][$yearConter] = array('title' => ts('%1 Donation', array(1 => $yearConter)), 'default' => TRUE, 'type' => CRM_Utils_Type::T_MONEY, 'is_statistics' => TRUE); $yearConter++; } $this->_columns['civicrm_contribution']['fields']['aggregate_amount'] = array('title' => ts('Aggregate Amount'), 'type' => CRM_Utils_Type::T_MONEY, 'is_statistics' => TRUE); $this->_groupFilter = TRUE; $this->_tagFilter = TRUE; parent::__construct(); }
/** * Function to build the form * * @return None * @access public */ function buildQuickForm() { $this->addElement('date', 'start_date', ts('Retry Date'), CRM_Core_SelectValues::date('mailing')); $this->addElement('checkbox', 'now', ts('Send Immediately')); require_once 'CRM/Mailing/Form/Schedule.php'; $this->addFormRule(array('CRM_Mailing_Form_Schedule', 'formRule')); $this->addButtons(array(array('type' => 'next', 'name' => ts('Retry'), 'isDefault' => true), array('type' => 'cancel', 'name' => ts('Cancel')))); }
/** * Build the form * * @access public * * @return void */ public function buildQuickForm() { $this->add('text', 'title', ts('Find'), array(CRM_Core_DAO::getAttribute('CRM_Auction_DAO_Auction', 'title'))); $this->add('date', 'start_date', ts('From'), CRM_Core_SelectValues::date('relative')); $this->addRule('start_date', ts('Select a valid Auction FROM date.'), 'qfDate'); $this->add('date', 'end_date', ts('To'), CRM_Core_SelectValues::date('relative')); $this->addRule('end_date', ts('Select a valid Auction TO date.'), 'qfDate'); $this->addButtons(array(array('type' => 'refresh', 'name' => ts('Search'), 'isDefault' => TRUE))); }
/** * create all fields needed for a credit card transaction * * @return void * @access public */ function setCreditCardFields(&$form) { CRM_Core_Payment_Form::_setPaymentFields($form); $form->_paymentFields['credit_card_number'] = array('htmlType' => 'text', 'name' => 'credit_card_number', 'title' => ts('Card Number'), 'cc_field' => TRUE, 'attributes' => array('size' => 20, 'maxlength' => 20, 'autocomplete' => 'off'), 'is_required' => TRUE); $form->_paymentFields['cvv2'] = array('htmlType' => 'text', 'name' => 'cvv2', 'title' => ts('Security Code'), 'cc_field' => TRUE, 'attributes' => array('size' => 5, 'maxlength' => 10, 'autocomplete' => 'off'), 'is_required' => CRM_Core_BAO_Setting::getItem(CRM_Core_BAO_Setting::CONTRIBUTE_PREFERENCES_NAME, 'cvv_backoffice_required', CRM_Core_Component::getComponentID('CiviContribute'), 1)); $form->_paymentFields['credit_card_exp_date'] = array('htmlType' => 'date', 'name' => 'credit_card_exp_date', 'title' => ts('Expiration Date'), 'cc_field' => TRUE, 'attributes' => CRM_Core_SelectValues::date('creditCard'), 'is_required' => TRUE); $creditCardType = array('' => ts('- select -')) + CRM_Contribute_PseudoConstant::creditCard(); $form->_paymentFields['credit_card_type'] = array('htmlType' => 'select', 'name' => 'credit_card_type', 'title' => ts('Card Type'), 'cc_field' => TRUE, 'attributes' => $creditCardType, 'is_required' => TRUE); }
/** * create all fields needed for a credit card transaction * * @return void * @access public */ function setCreditCardFields(&$form) { CRM_Core_Payment_Form::_setPaymentFields($form); $form->_fields['credit_card_number'] = array('htmlType' => 'text', 'name' => 'credit_card_number', 'title' => ts('Card Number'), 'cc_field' => true, 'attributes' => array('size' => 20, 'maxlength' => 20, 'autocomplete' => 'off'), 'is_required' => true); $form->_fields['cvv2'] = array('htmlType' => 'text', 'name' => 'cvv2', 'title' => ts('Security Code'), 'cc_field' => true, 'attributes' => array('size' => 5, 'maxlength' => 10, 'autocomplete' => 'off'), 'is_required' => true); $form->_fields['credit_card_exp_date'] = array('htmlType' => 'date', 'name' => 'credit_card_exp_date', 'title' => ts('Expiration Date'), 'cc_field' => true, 'attributes' => CRM_Core_SelectValues::date('creditCard'), 'is_required' => true); require_once 'CRM/Contribute/PseudoConstant.php'; $creditCardType = array('' => ts('- select -')) + CRM_Contribute_PseudoConstant::creditCard(); $form->_fields['credit_card_type'] = array('htmlType' => 'select', 'name' => 'credit_card_type', 'title' => ts('Card Type'), 'cc_field' => true, 'attributes' => $creditCardType, 'is_required' => true); }
static function buildQuickForm(&$form) { require_once 'CRM/Core/OptionGroup.php'; $caseType = CRM_Core_OptionGroup::values('case_type'); $form->add('select', 'case_type_id', ts('New Case Type'), $caseType, true); // timeline $form->addYesNo('is_reset_timeline', ts('Reset Case Timeline?'), null, true, array('onclick' => "return showHideByValue('is_reset_timeline','','resetTimeline','table-row','radio',false);")); $form->add('date', 'reset_date_time', ts('Reset Start Date'), CRM_Core_SelectValues::date('activityDatetime'), false); $form->addRule('reset_date_time', ts('Select a valid date.'), 'qfDate'); }
/** * Build the form * * @access public * @return void */ public function buildQuickForm() { $this->add('text', 'title', ts('Find'), array(CRM_Core_DAO::getAttribute('CRM_Auction_DAO_Auction', 'title'))); $auctionsByDates = array(); $searchOption = array(ts('Show Current and Upcoming Auctions'), ts('Search All or by Date Range')); $this->addRadio('auctionsByDates', ts('Auctions by Dates'), $searchOption, array('onclick' => "return showHideByValue('auctionsByDates','1','id_fromToDates','block','radio',true);"), "<br />"); $this->add('date', 'start_date', ts('From'), CRM_Core_SelectValues::date('relative')); $this->addRule('start_date', ts('Select a valid Auction FROM date.'), 'qfDate'); $this->add('date', 'end_date', ts('To'), CRM_Core_SelectValues::date('relative')); $this->addRule('end_date', ts('Select a valid Auction TO date.'), 'qfDate'); $this->addButtons(array(array('type' => 'refresh', 'name' => ts('Search'), 'isDefault' => true))); }
/** * Function to build the form * * @return None * @access public */ public function buildQuickForm() { CRM_Utils_System::setTitle(ts('Settings - Date')); $this->addElement('text', 'dateformatDatetime', ts('Complete Date and Time')); $this->addElement('text', 'dateformatFull', ts('Complete Date')); $this->addElement('text', 'dateformatPartial', ts('Month and Year')); $this->addElement('text', 'dateformatYear', ts('Year Only')); $this->addElement('text', 'dateformatTime', ts('Time Only')); $this->add('select', 'dateInputFormat', ts('Complete Date'), CRM_Core_SelectValues::getDatePluginInputFormats()); $this->add('select', 'timeInputFormat', ts('Time'), CRM_Core_SelectValues::getTimeFormats()); $this->add('date', 'fiscalYearStart', ts('Fiscal Year Start'), CRM_Core_SelectValues::date(null, 'M d')); parent::buildQuickForm(); }
function __construct() { $yearsInPast = 8; $yearsInFuture = 2; $date = CRM_Core_SelectValues::date('custom', null, $yearsInPast, $yearsInFuture); $count = $date['maxYear']; while ($date['minYear'] <= $count) { $optionYear[$date['minYear']] = $date['minYear']; $date['minYear']++; } $this->_columns = array('civicrm_contact' => array('dao' => 'CRM_Contact_DAO_Contact', 'grouping' => 'contact-field', 'fields' => array('display_name' => array('title' => ts('Donor Name'), 'default' => true, 'required' => true)), 'filters' => array('sort_name' => array('title' => ts('Donor Name'), 'operator' => 'like'))), 'civicrm_email' => array('dao' => 'CRM_Core_DAO_Email', 'grouping' => 'contact-field', 'fields' => array('email' => array('title' => ts('Email'), 'default' => true))), 'civicrm_phone' => array('dao' => 'CRM_Core_DAO_Phone', 'grouping' => 'contact-field', 'fields' => array('phone' => array('title' => ts('Phone No'), 'default' => true))), 'civicrm_contribution' => array('dao' => 'CRM_Contribute_DAO_Contribution', 'fields' => array('contact_id' => array('title' => ts('contactId'), 'no_display' => true, 'required' => true, 'no_repeat' => true), 'total_amount' => array('title' => ts('Total Amount'), 'no_display' => true, 'required' => true, 'no_repeat' => true), 'receive_date' => array('title' => ts('Year'), 'no_display' => true, 'required' => true, 'no_repeat' => true)), 'filters' => array('yid' => array('name' => 'receive_date', 'title' => ts('This Year'), 'operatorType' => CRM_Report_Form::OP_SELECT, 'options' => $optionYear, 'default' => date('Y'), 'clause' => "contribution_civireport.contact_id NOT IN\n((SELECT distinct contri.contact_id FROM civicrm_contribution contri \n WHERE YEAR(contri.receive_date) = \$value AND contri.is_test = 0) ) AND contribution_civireport.contact_id IN ((SELECT distinct contri.contact_id FROM civicrm_contribution contri \n WHERE YEAR(contri.receive_date) = (\$value-1) AND contri.is_test = 0) ) "), 'contribution_status_id' => array('operatorType' => CRM_Report_Form::OP_MULTISELECT, 'options' => CRM_Contribute_PseudoConstant::contributionStatus(), 'default' => array('1')))), 'civicrm_group' => array('dao' => 'CRM_Contact_DAO_GroupContact', 'alias' => 'cgroup', 'filters' => array('gid' => array('name' => 'group_id', 'title' => ts('Group'), 'operatorType' => CRM_Report_Form::OP_MULTISELECT, 'group' => true, 'options' => CRM_Core_PseudoConstant::group())))); parent::__construct(); }
function __construct() { $yearsInPast = 10; $yearsInFuture = 1; $date = CRM_Core_SelectValues::date('custom', NULL, $yearsInPast, $yearsInFuture); $count = $date['maxYear']; while ($date['minYear'] <= $count) { $optionYear[$date['minYear']] = $date['minYear']; $date['minYear']++; } $this->_columns = array('civicrm_contact' => array('dao' => 'CRM_Contact_DAO_Contact', 'grouping' => 'contact-field', 'fields' => array('sort_name' => array('title' => ts('Donor Name'), 'required' => TRUE)), 'filters' => array('sort_name' => array('title' => ts('Donor Name'), 'operator' => 'like'))), 'civicrm_email' => array('dao' => 'CRM_Core_DAO_Email', 'grouping' => 'contact-field', 'fields' => array('email' => array('title' => ts('Email'), 'default' => TRUE))), 'civicrm_phone' => array('dao' => 'CRM_Core_DAO_Phone', 'grouping' => 'contact-field', 'fields' => array('phone' => array('title' => ts('Phone No'), 'default' => TRUE))), 'civicrm_contribution' => array('dao' => 'CRM_Contribute_DAO_Contribution', 'fields' => array('contact_id' => array('title' => ts('contactId'), 'no_display' => TRUE, 'required' => TRUE, 'no_repeat' => TRUE), 'total_amount' => array('title' => ts('Total Amount'), 'no_display' => TRUE, 'required' => TRUE, 'no_repeat' => TRUE), 'receive_date' => array('title' => ts('Year'), 'no_display' => TRUE, 'required' => TRUE, 'no_repeat' => TRUE)), 'filters' => array('yid' => array('name' => 'receive_date', 'title' => ts('This Year'), 'operatorType' => CRM_Report_Form::OP_SELECT, 'options' => $optionYear, 'default' => date('Y')), 'contribution_type_id' => array('title' => ts('Contribution Type'), 'operatorType' => CRM_Report_Form::OP_MULTISELECT, 'options' => CRM_Contribute_PseudoConstant::contributionType()), 'contribution_status_id' => array('title' => ts('Contribution Status'), 'operatorType' => CRM_Report_Form::OP_MULTISELECT, 'options' => CRM_Contribute_PseudoConstant::contributionStatus(), 'default' => array('1')))), 'civicrm_group' => array('dao' => 'CRM_Contact_DAO_GroupContact', 'alias' => 'cgroup', 'filters' => array('gid' => array('name' => 'group_id', 'title' => ts('Group'), 'operatorType' => CRM_Report_Form::OP_MULTISELECT, 'group' => TRUE, 'options' => CRM_Core_PseudoConstant::group())))); $this->_tagFilter = TRUE; parent::__construct(); }
/** * Function to actually build the form * * @return None * @access public */ function buildQuickForm() { $this->add('text', 'sort_name', ts('Name or email'), CRM_Core_DAO::getAttribute('CRM_Contact_DAO_Contact', 'sort_name')); // select for state province $stateProvince = array('' => ts('- any state/province -')) + CRM_Core_PseudoConstant::stateProvince(); $this->addElement('select', 'state_province', ts('State/Province'), $stateProvince); // select for country $country = array('' => ts('- any country -')) + CRM_Core_PseudoConstant::country(); $this->addElement('select', 'country', ts('Country'), $country); $this->addElement('date', 'birth_date', ts('Date of birth'), CRM_Core_SelectValues::date('birth')); $this->addElement('date', 'scheduled_date_time', ts('Date and Time'), CRM_Core_SelectValues::date('datetime')); $group = array('' => ts('- any group -')) + CRM_Core_PseudoConstant::group(); $this->addElement('select', 'group', ts('Groups'), $group); $this->addButtons(array(array('type' => 'refresh', 'name' => ts('Search'), 'isDefault' => true))); }
/** * Function to build the form * * @return None * @access public */ function buildQuickForm() { parent::buildQuickForm(); if ($this->_action & CRM_CORE_ACTION_DELETE) { return; } $this->applyFilter('__ALL__', 'trim'); $this->add('text', 'subject', ts('Subject'), CRM_Core_DAO::getAttribute('CRM_Core_DAO_Meeting', 'subject')); $this->addRule('subject', ts('Please enter a valid subject.'), 'required'); $this->addElement('date', 'scheduled_date_time', ts('Date and Time'), CRM_Core_SelectValues::date('datetime')); $this->addRule('scheduled_date_time', ts('Select a valid date.'), 'qfDate'); $this->addRule('scheduled_date_time', ts('Please select Scheduled Date.'), 'required'); $this->add('select', 'duration_hours', ts('Duration'), CRM_Core_SelectValues::getHours()); $this->add('select', 'duration_minutes', null, CRM_Core_SelectValues::getMinutes()); $this->add('text', 'location', ts('Location'), CRM_Core_DAO::getAttribute('CRM_Core_DAO_Meeting', 'location')); $this->add('textarea', 'details', ts('Details'), CRM_Core_DAO::getAttribute('CRM_Core_DAO_Meeting', 'details')); $status =& $this->add('select', 'status', ts('Status'), CRM_Core_SelectValues::activityStatus()); $this->addRule('status', ts('Please select status.'), 'required'); $this->_groupTree =& CRM_Core_BAO_CustomGroup::getTree('Meeting', $this->_id, 0); CRM_Core_BAO_CustomGroup::buildQuickForm($this, $this->_groupTree, 'showBlocks1', 'hideBlocks1'); }
/** * Function to build the form * * @return None * @access public */ public function buildQuickForm() { $this->applyFilter('__ALL__', 'trim'); $attributes = CRM_Core_DAO::getAttribute('CRM_Auction_DAO_Auction'); $this->add('text', 'title', ts('Auction Title'), $attributes['auction_title'], TRUE); $this->addWysiwyg('description', ts('Complete Description'), $attributes['description']); $this->_dates = array('start_date' => ts('Auction Start Date'), 'end_date' => ts('Auction End Date'), 'item_start_date' => ts('Upload Item Start Date'), 'item_end_date' => ts('Upload Item End Date')); foreach ($this->_dates as $name => $title) { $this->add('date', $name, $title, CRM_Core_SelectValues::date('datetime')); $this->addRule($name, ts('Please select a valid date.'), 'qfDate'); } $this->_checkboxes = array('is_active' => ts('Is Active?'), 'is_approval_needed' => ts('Do items need to be approved?'), 'is_item_groups' => ts('Can items be grouped?')); foreach ($this->_checkboxes as $name => $title) { $this->addElement('checkbox', $name, $title); } $this->_numbers = array('max_items_user' => ts('Maximum number of items per user'), 'max_items' => ts('Maximum number of items for the auction')); foreach ($this->_numbers as $name => $title) { $this->addElement('text', $name, $title, $attributes[$name]); $this->addRule($name, ts('%1 should be a postive number', array(1 => $title)), 'positiveInteger'); } if ($this->_action & CRM_Core_Action::VIEW) { $buttons = array(array('type' => 'upload', 'name' => ts('Done'), 'spacing' => ' ', 'isDefault' => TRUE)); $this->freeze(); } elseif ($this->_action & CRM_Core_Action::DELETE) { $this->freeze(); $buttons = array(array('type' => 'upload', 'name' => ts('Delete'), 'spacing' => ' ', 'isDefault' => TRUE), array('type' => 'cancel', 'name' => ts('Cancel'))); } else { $buttons = array(array('type' => 'upload', 'name' => ts('Save'), 'spacing' => ' ', 'isDefault' => TRUE), array('type' => 'cancel', 'name' => ts('Cancel'))); } $this->addButtons($buttons); $this->addFormRule(array('CRM_Auction_Form_Auction', 'formRule'), $this); }
/** * Add an element for inputting a month+day (partial date). * * @param string $name * @param string $label * @return HTML_QuickForm_Element */ public function addMonthDay($name, $label) { return $this->add('date', $name, $label, CRM_Core_SelectValues::date(NULL, 'M d')); }
/** * Build the form object. */ public function buildQuickForm() { $this->add('date', 'closing_date', ts('Accounting Period to Close'), CRM_Core_SelectValues::date(NULL, 'M d'), TRUE); $confirmClose = ts('Are you sure you want to close accounting period?'); $this->addButtons(array(array('type' => 'cancel', 'name' => ts('Cancel')), array('type' => 'upload', 'name' => ts('Close Accounting Period'), 'js' => array('onclick' => 'return confirm(\'' . $confirmClose . '\');')))); }
/** * Function to build the form * * @return None * @access public */ function buildQuickForm() { if ($this->_action & CRM_CORE_ACTION_DELETE) { $this->addButtons(array(array('type' => 'next', 'name' => ts('Delete'), 'isDefault' => true), array('type' => 'cancel', 'name' => ts('Cancel')))); return; } $this->addElement('select', 'relationship_type_id', ts('Relationship Type'), array('' => ts('- select -')) + CRM_Contact_BAO_Relationship::getContactRelationshipType($this->_contactId, $this->_rtype, $this->_relationshipId)); $this->addElement('text', 'name', ts('Find Target Contact')); $this->addElement('date', 'start_date', ts('Start Date'), CRM_Core_SelectValues::date('relative')); $this->addElement('date', 'end_date', ts('End Date'), CRM_Core_SelectValues::date('relative')); $searchRows = $this->get('searchRows'); $searchCount = $this->get('searchCount'); $duplicateRelationship = $this->get('duplicateRelationship'); if ($searchRows) { $checkBoxes = array(); foreach ($searchRows as $id => $row) { $checkBoxes[$id] = $this->createElement('checkbox', $id, null, ''); } $this->addGroup($checkBoxes, 'contact_check'); $this->assign('searchRows', $searchRows); } $this->assign('duplicateRelationship', $duplicateRelationship); $this->assign('searchCount', $searchCount); $this->assign('searchDone', $this->get('searchDone')); if ($this->get('contact_type')) { $this->assign('contact_type', $this->get('contact_type')); $this->assign('contact_type_display', CRM_Contact_DAO_Contact::tsEnum('contact_type', $this->get('contact_type'))); } $this->addElement('submit', $this->getButtonName('refresh'), ts('Search'), array('class' => 'form-submit')); $this->addElement('submit', $this->getButtonName('cancel'), ts('Cancel'), array('class' => 'form-submit')); $this->addButtons(array(array('type' => 'next', 'name' => ts('Save Relationship'), 'isDefault' => true), array('type' => 'cancel', 'name' => ts('Cancel')))); }
/** * Function to build the form for Premium * * @access public * @return None */ function buldPremiumForm($form) { require_once 'CRM/Contribute/DAO/Product.php'; $sel1 = $sel2 = array(); $dao =& new CRM_Contribute_DAO_Product(); $dao->is_active = 1; $dao->find(); $min_amount = array(); $sel1[0] = '-select product-'; while ($dao->fetch()) { $sel1[$dao->id] = $dao->name . " ( " . $dao->sku . " )"; $min_amount[$dao->id] = $dao->min_contribution; $options = explode(',', $dao->options); foreach ($options as $k => $v) { $options[$k] = trim($v); } if ($options[0] != '') { $sel2[$dao->id] = $options; } $form->assign('premiums', true); } $form->_options = $sel2; $form->assign('mincontribution', $min_amount); $sel =& $this->addElement('hierselect', "product_name", ts('Premium'), 'onclick="showMinContrib();"'); $js = "<script type='text/javascript'>\n"; $formName = 'document.forms.' . $form->_name; for ($k = 1; $k < 2; $k++) { if (!$defaults['product_name'][$k]) { $js .= "{$formName}['product_name[{$k}]'].style.display = 'none';\n"; } } $sel->setOptions(array($sel1, $sel2)); $js .= "</script>\n"; $form->assign('initHideBoxes', $js); $form->addElement('date', 'fulfilled_date', ts('Fulfilled'), CRM_Core_SelectValues::date('manual', 3, 1)); $form->addElement('text', 'min_amount', ts('Minimum Contribution Amount')); }
/** * Function to build the form * * @return None * @access public */ public function buildQuickForm() { parent::buildQuickForm(); if ($this->_action & CRM_Core_Action::DELETE) { return; } $this->applyFilter('__ALL__', 'trim'); $this->add('text', 'name', ts('Name'), CRM_Core_DAO::getAttribute('CRM_Member_DAO_MembershipType', 'name'), TRUE); $this->addRule('name', ts('A membership type with this name already exists. Please select another name.'), 'objectExists', array('CRM_Member_DAO_MembershipType', $this->_id)); $this->add('text', 'description', ts('Description'), CRM_Core_DAO::getAttribute('CRM_Member_DAO_MembershipType', 'description')); $this->add('text', 'minimum_fee', ts('Minimum Fee'), CRM_Core_DAO::getAttribute('CRM_Member_DAO_MembershipType', 'minimum_fee')); $this->addRule('minimum_fee', ts('Please enter a monetary value for the Minimum Fee.'), 'money'); $this->addElement('select', 'duration_unit', ts('Duration') . ' ', CRM_Core_SelectValues::unitList('duration'), array('onchange' => 'showHidePeriodSettings()')); //period type $this->addElement('select', 'period_type', ts('Period Type'), CRM_Core_SelectValues::periodType(), array('onchange' => 'showHidePeriodSettings()')); $this->add('text', 'duration_interval', ts('Duration Interval'), CRM_Core_DAO::getAttribute('CRM_Member_DAO_MembershipType', 'duration_interval')); $memberOrg =& $this->add('text', 'member_org', ts('Membership Organization'), 'size=30 maxlength=120'); //start day $this->add('date', 'fixed_period_start_day', ts('Fixed Period Start Day'), CRM_Core_SelectValues::date(NULL, 'M d'), FALSE); $msgTemplates = CRM_Core_BAO_MessageTemplates::getMessageTemplates(FALSE); $hasMsgTemplates = FALSE; if (!empty($msgTemplates)) { $hasMsgTemplates = TRUE; } //Auto-renew Option $paymentProcessor = CRM_Core_PseudoConstant::paymentProcessor(FALSE, FALSE, 'is_recur = 1'); $isAuthorize = FALSE; $options = array(); $allowAutoRenewMsg = FALSE; if (is_array($paymentProcessor) && !empty($paymentProcessor)) { $isAuthorize = TRUE; $options = array(ts('No auto-renew option'), ts('Give option, but not required'), ts('Auto-renew required ')); if ($hasMsgTemplates) { $allowAutoRenewMsg = TRUE; $autoRenewReminderMsg = $this->add('select', 'autorenewal_msg_id', ts('Auto-renew Reminder Message'), array('' => ts('- select -')) + $msgTemplates); } } $this->addRadio('auto_renew', ts('Auto-renew Option'), $options, array('onclick' => "setReminder(this.value);")); $this->assign('authorize', $isAuthorize); $this->assign('allowAutoRenewMsg', $allowAutoRenewMsg); //rollover day $this->add('date', 'fixed_period_rollover_day', ts('Fixed Period Rollover Day'), CRM_Core_SelectValues::date(NULL, 'M d'), FALSE); // required in form rule $this->add('hidden', 'action', $this->_action); $this->add('select', 'contribution_type_id', ts('Contribution Type'), array('' => ts('- select -')) + CRM_Contribute_PseudoConstant::contributionType()); $relTypeInd = CRM_Contact_BAO_Relationship::getContactRelationshipType(NULL, NULL, NULL, NULL, TRUE); if (is_array($relTypeInd)) { asort($relTypeInd); } $memberRel =& $this->add('select', 'relationship_type_id', ts('Relationship Type'), array('' => ts('- select -')) + $relTypeInd); $memberRel->setMultiple(TRUE); $this->add('select', 'visibility', ts('Visibility'), CRM_Core_SelectValues::memberVisibility()); $this->add('text', 'weight', ts('Order'), CRM_Core_DAO::getAttribute('CRM_Member_DAO_MembershipType', 'weight')); $this->add('checkbox', 'is_active', ts('Enabled?')); if ($hasMsgTemplates) { $reminderMsg = $this->add('select', 'renewal_msg_id', ts('Renewal Reminder Message'), array('' => ts('- select -')) + $msgTemplates); } $this->assign('hasMsgTemplates', $hasMsgTemplates); $reminderDay =& $this->add('text', 'renewal_reminder_day', ts('Renewal Reminder Day'), CRM_Core_DAO::getAttribute('CRM_Member_DAO_MembershipType', 'renewal_reminder_day')); $searchRows = $this->get('searchRows'); $searchCount = $this->get('searchCount'); $searchDone = $this->get('searchDone'); if ($searchRows) { $checkBoxes = array(); $chekFlag = 0; foreach ($searchRows as $id => $row) { $checked = ''; if (!$chekFlag) { $checked = array('checked' => NULL); $chekFlag++; } $checkBoxes[$id] = $this->createElement('radio', NULL, NULL, NULL, $id, $checked); } $this->addGroup($checkBoxes, 'contact_check'); $this->assign('searchRows', $searchRows); } $this->assign('searchCount', $searchCount); $this->assign('searchDone', $searchDone); if ($searchDone) { $searchBtn = ts('Search Again'); } elseif ($this->_action & CRM_Core_Action::UPDATE) { $searchBtn = ts('Change'); } else { $searchBtn = ts('Search'); } $membershipRecords = FALSE; if ($this->_action & CRM_Core_Action::UPDATE) { $membershipType = new CRM_Member_BAO_Membership(); $membershipType->membership_type_id = $this->_id; if ($membershipType->find(TRUE)) { $membershipRecords = TRUE; $memberRel->freeze(); } $memberOrg->freeze(); if ($searchDone) { $memberOrg->unfreeze(); } } $this->assign('membershipRecordsExists', $membershipRecords); if ($this->_action & CRM_Core_Action::UPDATE && $reminderDay) { $renewMessage = array(); $returnProperties = array('renewal_msg_id', 'renewal_reminder_day'); CRM_Core_DAO::commonRetrieveAll('CRM_Member_DAO_MembershipType', 'id', $this->_id, $renewMessage, $returnProperties); if (CRM_Utils_Array::value('renewal_msg_id', $renewMessage[$this->_id]) && CRM_Utils_Array::value('renewal_reminder_day', $renewMessage[$this->_id]) && $membershipRecords) { $reminderMsg = $this->add('select', 'renewal_msg_id', ts('Renewal Reminder Message'), array('' => ts('- select -')) + $msgTemplates); $reminderDay->freeze(); } } $this->addElement('submit', $this->getButtonName('refresh'), $searchBtn, array('class' => 'form-submit')); $this->addFormRule(array('CRM_Member_Form_MembershipType', 'formRule')); $this->assign('membershipTypeId', $this->_id); }
/** * Build the form object. */ public function buildQuickForm() { $session = CRM_Core_Session::singleton(); $session->pushUserContext(CRM_Utils_System::url('civicrm/admin', 'reset=1')); $args = func_get_args(); $check = reset($args); $this->addButtons(array(array('type' => 'next', 'name' => ts('Save'), 'isDefault' => TRUE), array('type' => 'cancel', 'name' => ts('Cancel')))); $descriptions = array(); foreach ($this->_settings as $setting => $group) { $settingMetaData = civicrm_api('setting', 'getfields', array('version' => 3, 'name' => $setting)); $props = $settingMetaData['values'][$setting]; if (isset($props['quick_form_type'])) { if (isset($props['pseudoconstant'])) { $options = civicrm_api3('Setting', 'getoptions', array('field' => $setting)); } else { $options = NULL; } $add = 'add' . $props['quick_form_type']; if ($add == 'addElement') { $this->{$add}($props['html_type'], $setting, ts($props['title']), $options !== NULL ? $options['values'] : CRM_Utils_Array::value('html_attributes', $props, array()), $options !== NULL ? CRM_Utils_Array::value('html_attributes', $props, array()) : NULL); } elseif ($add == 'addSelect') { $this->addElement('select', $setting, ts($props['title']), $options['values'], CRM_Utils_Array::value('html_attributes', $props)); } elseif ($add == 'addCheckBox') { $this->addCheckBox($setting, ts($props['title']), $options['values'], NULL, CRM_Utils_Array::value('html_attributes', $props), NULL, NULL, array(' ')); } elseif ($add == 'addChainSelect') { $this->addChainSelect($setting, array('label' => ts($props['title']))); } elseif ($add == 'addMonthDay') { $this->add('date', $setting, ts($props['title']), CRM_Core_SelectValues::date(NULL, 'M d')); } else { $this->{$add}($setting, ts($props['title'])); } // Migrate to using an array as easier in smart... $descriptions[$setting] = ts($props['description']); $this->assign("{$setting}_description", ts($props['description'])); if ($setting == 'max_attachments') { //temp hack @todo fix to get from metadata $this->addRule('max_attachments', ts('Value should be a positive number'), 'positiveInteger'); } if ($setting == 'maxFileSize') { //temp hack $this->addRule('maxFileSize', ts('Value should be a positive number'), 'positiveInteger'); } } } $this->assign('setting_descriptions', $descriptions); }
/** * Function to add all the credit card fields * * @return None * @access public */ function buildCreditCard() { $this->add('text', 'email', ts('Email Address'), array('size' => 30, 'maxlength' => 60), true); $this->add('text', 'first_name', ts('First Name'), array('size' => 30, 'maxlength' => 60)); $this->add('text', 'middle_name', ts('Middle Name'), array('size' => 30, 'maxlength' => 60)); $this->add('text', 'last_name', ts('Last Name'), array('size' => 30, 'maxlength' => 60)); $this->add('text', 'street1', ts('Street Address'), array('size' => 30, 'maxlength' => 60)); $this->add('text', 'city', ts('City'), array('size' => 30, 'maxlength' => 60)); $this->add('text', 'state_province', ts('State / Province'), array('size' => 30, 'maxlength' => 60)); $this->add('text', 'postal_code', ts('Postal Code'), array('size' => 30, 'maxlength' => 60)); $this->addElement('select', 'country_id', ts('Country'), array('' => ts('- select -')) + CRM_Core_PseudoConstant::country()); $this->add('text', 'credit_card_number', ts('Credit Card Number'), array('size' => 20, 'maxlength' => 20)); $this->add('text', 'cvv2', ts('Credit Card Verification Number'), array('size' => 5, 'maxlength' => 10)); $this->add('date', 'credit_card_exp_date', ts('Credit Card Expiration Date'), CRM_Core_SelectValues::date('fixed')); $creditCardType = array('Visa' => 'Visa', 'MasterCard' => 'MasterCard', 'Discover' => 'Discover', 'Amex' => 'Amex'); $this->addElement('select', 'credit_card_type', ts('Credit Card Type'), $creditCardType); $this->_expressButtonName = $this->getButtonName('next', 'express'); $this->add('submit', $this->_expressButtonName, ts('Contribute via PayPal'), array('class' => 'form-submit')); }
/** * Build the form object. * * @return void */ public function buildQuickForm() { parent::buildQuickForm(); if ($this->_action & CRM_Core_Action::DELETE) { return; } $this->applyFilter('__ALL__', 'trim'); $this->add('text', 'name', ts('Name'), CRM_Core_DAO::getAttribute('CRM_Member_DAO_MembershipType', 'name'), TRUE); $this->addRule('name', ts('A membership type with this name already exists. Please select another name.'), 'objectExists', array('CRM_Member_DAO_MembershipType', $this->_id)); $this->add('text', 'description', ts('Description'), CRM_Core_DAO::getAttribute('CRM_Member_DAO_MembershipType', 'description')); $this->add('text', 'minimum_fee', ts('Minimum Fee'), CRM_Core_DAO::getAttribute('CRM_Member_DAO_MembershipType', 'minimum_fee')); $this->addRule('minimum_fee', ts('Please enter a monetary value for the Minimum Fee.'), 'money'); $this->addSelect('duration_unit', array(), TRUE); //period type $this->addSelect('period_type', array(), TRUE); $this->add('text', 'duration_interval', ts('Duration Interval'), CRM_Core_DAO::getAttribute('CRM_Member_DAO_MembershipType', 'duration_interval')); $props = array('api' => array('params' => array('contact_type' => 'Organization'))); $this->addEntityRef('member_of_contact_id', ts('Membership Organization'), $props, TRUE); //start day $this->add('date', 'fixed_period_start_day', ts('Fixed Period Start Day'), CRM_Core_SelectValues::date(NULL, 'M d'), FALSE); //Auto-renew Option $paymentProcessor = CRM_Core_PseudoConstant::paymentProcessor(FALSE, FALSE, 'is_recur = 1'); $isAuthorize = FALSE; $options = array(); if (is_array($paymentProcessor) && !empty($paymentProcessor)) { $isAuthorize = TRUE; $options = CRM_Core_SelectValues::memberAutoRenew(); } $this->addRadio('auto_renew', ts('Auto-renew Option'), $options); $this->assign('authorize', $isAuthorize); //rollover day $this->add('date', 'fixed_period_rollover_day', ts('Fixed Period Rollover Day'), CRM_Core_SelectValues::date(NULL, 'M d'), FALSE); $this->add('date', 'month_fixed_period_rollover_day', ts('Fixed Period Rollover Day'), CRM_Core_SelectValues::date(NULL, 'd'), FALSE); $this->add('select', 'financial_type_id', ts('Financial Type'), array('' => ts('- select -')) + CRM_Financial_BAO_FinancialType::getAvailableFinancialTypes($financialTypes, $this->_action), TRUE, array('class' => 'crm-select2')); $relTypeInd = CRM_Contact_BAO_Relationship::getContactRelationshipType(NULL, NULL, NULL, NULL, TRUE); if (is_array($relTypeInd)) { asort($relTypeInd); } $memberRel = $this->add('select', 'relationship_type_id', ts('Relationship Type'), $relTypeInd, FALSE, array('class' => 'crm-select2 huge', 'multiple' => 1)); $this->addSelect('visibility', array('placeholder' => NULL, 'option_url' => NULL)); $this->add('text', 'weight', ts('Order'), CRM_Core_DAO::getAttribute('CRM_Member_DAO_MembershipType', 'weight')); $this->add('checkbox', 'is_active', ts('Enabled?')); $membershipRecords = FALSE; if ($this->_action & CRM_Core_Action::UPDATE) { $membershipType = new CRM_Member_BAO_Membership(); $membershipType->membership_type_id = $this->_id; if ($membershipType->find(TRUE)) { $membershipRecords = TRUE; $memberRel->freeze(); } } $this->assign('membershipRecordsExists', $membershipRecords); $this->add('text', 'max_related', ts('Max related'), CRM_Core_DAO::getAttribute('CRM_Member_DAO_MembershipType', 'max_related')); $this->addFormRule(array('CRM_Member_Form_MembershipType', 'formRule')); $this->assign('membershipTypeId', $this->_id); }
/** * Return an array of all the details about the fields potentially required for payment fields. * * Only those determined by getPaymentFormFields will actually be assigned to the form * * @return array * field metadata */ public function getPaymentFormFieldsMetadata() { //@todo convert credit card type into an option value $creditCardType = array('' => ts('- select -')) + CRM_Contribute_PseudoConstant::creditCard(); return array('credit_card_number' => array('htmlType' => 'text', 'name' => 'credit_card_number', 'title' => ts('Card Number'), 'cc_field' => TRUE, 'attributes' => array('size' => 20, 'maxlength' => 20, 'autocomplete' => 'off', 'class' => 'creditcard'), 'is_required' => TRUE), 'cvv2' => array('htmlType' => 'text', 'name' => 'cvv2', 'title' => ts('Security Code'), 'cc_field' => TRUE, 'attributes' => array('size' => 5, 'maxlength' => 10, 'autocomplete' => 'off'), 'is_required' => CRM_Core_BAO_Setting::getItem(CRM_Core_BAO_Setting::CONTRIBUTE_PREFERENCES_NAME, 'cvv_backoffice_required', NULL, 1), 'rules' => array(array('rule_message' => ts('Please enter a valid value for your card security code. This is usually the last 3-4 digits on the card\'s signature panel.'), 'rule_name' => 'integer', 'rule_parameters' => NULL))), 'credit_card_exp_date' => array('htmlType' => 'date', 'name' => 'credit_card_exp_date', 'title' => ts('Expiration Date'), 'cc_field' => TRUE, 'attributes' => CRM_Core_SelectValues::date('creditCard'), 'is_required' => TRUE, 'rules' => array(array('rule_message' => ts('Card expiration date cannot be a past date.'), 'rule_name' => 'currentDate', 'rule_parameters' => TRUE))), 'credit_card_type' => array('htmlType' => 'select', 'name' => 'credit_card_type', 'title' => ts('Card Type'), 'cc_field' => TRUE, 'attributes' => $creditCardType, 'is_required' => FALSE), 'account_holder' => array('htmlType' => 'text', 'name' => 'account_holder', 'title' => ts('Account Holder'), 'cc_field' => TRUE, 'attributes' => array('size' => 20, 'maxlength' => 34, 'autocomplete' => 'on'), 'is_required' => TRUE), 'bank_account_number' => array('htmlType' => 'text', 'name' => 'bank_account_number', 'title' => ts('Bank Account Number'), 'cc_field' => TRUE, 'attributes' => array('size' => 20, 'maxlength' => 34, 'autocomplete' => 'off'), 'rules' => array(array('rule_message' => ts('Please enter a valid Bank Identification Number (value must not contain punctuation characters).'), 'rule_name' => 'nopunctuation', 'rule_parameters' => NULL)), 'is_required' => TRUE), 'bank_identification_number' => array('htmlType' => 'text', 'name' => 'bank_identification_number', 'title' => ts('Bank Identification Number'), 'cc_field' => TRUE, 'attributes' => array('size' => 20, 'maxlength' => 11, 'autocomplete' => 'off'), 'is_required' => TRUE, 'rules' => array(array('rule_message' => ts('Please enter a valid Bank Identification Number (value must not contain punctuation characters).'), 'rule_name' => 'nopunctuation', 'rule_parameters' => NULL))), 'bank_name' => array('htmlType' => 'text', 'name' => 'bank_name', 'title' => ts('Bank Name'), 'cc_field' => TRUE, 'attributes' => array('size' => 20, 'maxlength' => 64, 'autocomplete' => 'off'), 'is_required' => TRUE)); }
/** * add all the elements shared between case search and advanaced search * * @access public * @return void * @static */ static function buildSearchForm(&$form) { $config =& CRM_Core_Config::singleton(); require_once 'CRM/Core/OptionGroup.php'; $caseType = CRM_Core_OptionGroup::values('case_type'); $form->addElement('select', 'case_type_id', ts('Case Type'), $caseType, array("size" => "5", "multiple")); $caseStatus = CRM_Core_OptionGroup::values('case_status'); $form->add('select', 'case_status_id', ts('Case Status'), array('' => ts('- select -')) + $caseStatus); $form->addElement('text', 'case_subject', ts('Subject')); if ($config->civiHRD) { $caseSubType = CRM_Core_OptionGroup::values('f1_case_sub_type'); $form->add('select', 'case_casetag2_id', ts('Case Sub Type'), $caseSubType, false, array("size" => "5", "multiple")); $caseViolation = CRM_Core_OptionGroup::values('f1_case_violation'); $form->add('select', 'case_casetag3_id', ts('Violation'), $caseViolation, false, array("size" => "5", "multiple")); } $form->addElement('date', 'case_start_date_low', ts('Start Date - From'), CRM_Core_SelectValues::date('relative')); $form->addRule('case_start_date_low', ts('Select a valid date.'), 'qfDate'); $form->addElement('date', 'case_start_date_high', ts('To'), CRM_Core_SelectValues::date('relative')); $form->addRule('case_start_date_high', ts('Select a valid date.'), 'qfDate'); $form->assign('validCase', true); }