本文整理汇总了PHP中CRM_Core_OptionGroup类的典型用法代码示例。如果您正苦于以下问题:PHP CRM_Core_OptionGroup类的具体用法?PHP CRM_Core_OptionGroup怎么用?PHP CRM_Core_OptionGroup使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了CRM_Core_OptionGroup类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: hrvisa_civicrm_install
/**
* Implementation of hook_civicrm_install
*/
function hrvisa_civicrm_install()
{
if (!CRM_Core_OptionGroup::getValue('activity_type', 'Visa Expiration', 'name')) {
// create activity_type 'Visa Expiration'
$params = array('weight' => 1, 'label' => 'Visa Expiration', 'filter' => 0, 'is_active' => 1, 'is_default' => 0);
$result = civicrm_api3('activity_type', 'create', $params);
if (CRM_Utils_Array::value('is_error', $result, FALSE)) {
CRM_Core_Error::debug_var("Failed to create activity type 'Visa Expiration'", $result);
throw new CRM_Core_Exception('Failed to create activity type \'Visa Expiration\'');
}
$activityTypeId = $result['values'][$result['id']]['value'];
} else {
$activityTypeId = CRM_Core_OptionGroup::getValue('activity_type', 'Visa Expiration', 'name');
}
// set weekly reminder for Visa Expiration activities (not active)
// will be active when extension is enabled
if (!empty($activityTypeId)) {
$activityContacts = CRM_Core_OptionGroup::values('activity_contacts', FALSE, FALSE, FALSE, NULL, 'name');
$targetID = CRM_Utils_Array::key('Activity Targets', $activityContacts);
// schedule reminder for Visa Expiration Creation
$result = civicrm_api3('action_schedule', 'get', array('name' => 'Visa Expiration Reminder'));
if (empty($result['id'])) {
$params = array('name' => 'Visa Expiration Reminder', 'title' => 'Visa Expiration Reminder', 'recipient' => $targetID, 'limit_to' => 1, 'entity_value' => $activityTypeId, 'entity_status' => CRM_Core_OptionGroup::getValue('activity_status', 'Scheduled', 'name'), 'start_action_offset' => 1, 'start_action_unit' => 'week', 'start_action_condition' => 'before', 'start_action_date' => 'activity_date_time', 'is_repeat' => 0, 'is_active' => 0, 'body_html' => '<p>Your latest visa expiries on {activity.activity_date_time}</p>', 'subject' => 'Reminder for Visa Expiration', 'record_activity' => 1, 'mapping_id' => CRM_Core_DAO::getFieldValue('CRM_Core_DAO_ActionMapping', 'activity_type', 'id', 'entity_value'));
$result = civicrm_api3('action_schedule', 'create', $params);
}
}
return _hrvisa_civix_civicrm_install();
}
示例2: __construct
function __construct()
{
$this->_columns = array('civicrm_contact' => array('dao' => 'CRM_Contact_DAO_Contact', 'fields' => array('sort_name' => array('title' => ts('Contact Name'), 'no_repeat' => TRUE), 'postal_greeting_display' => array('title' => ts('Postal Greeting')), 'id' => array('no_display' => TRUE, 'required' => TRUE)), 'grouping' => 'contact-fields', 'group_bys' => array('id' => array('title' => ts('Contact ID')), 'sort_name' => array('title' => ts('Contact Name')))), 'civicrm_email' => array('dao' => 'CRM_Core_DAO_Email', 'fields' => array('email' => array('no_repeat' => TRUE, 'title' => ts('email'))), 'grouping' => 'contact-fields'), 'civicrm_pledge' => array('dao' => 'CRM_Pledge_DAO_Pledge', 'fields' => array('id' => array('no_display' => TRUE, 'required' => FALSE), 'currency' => array('required' => TRUE, 'no_display' => TRUE), 'amount' => array('title' => ts('Pledge Amount'), 'required' => TRUE, 'type' => CRM_Utils_Type::T_MONEY, 'statistics' => array('sum' => ts('Aggregate Amount Pledged'), 'count' => ts('Pledges'), 'avg' => ts('Average'))), 'frequency_unit' => array('title' => ts('Frequency Unit')), 'installments' => array('title' => ts('Installments')), 'pledge_create_date' => array('title' => ts('Pledge Made Date')), 'start_date' => array('title' => ts('Pledge Start Date'), 'type' => CRM_Utils_Type::T_DATE), 'end_date' => array('title' => ts('Pledge End Date'), 'type' => CRM_Utils_Type::T_DATE), 'status_id' => array('title' => ts('Pledge Status'))), 'filters' => array('pledge_create_date' => array('title' => 'Pledge Made Date', 'operatorType' => CRM_Report_Form::OP_DATE), 'pledge_amount' => array('title' => ts('Pledged Amount'), 'operatorType' => CRM_Report_Form::OP_INT), 'currency' => array('title' => 'Currency', 'operatorType' => CRM_Report_Form::OP_MULTISELECT, 'options' => CRM_Core_OptionGroup::values('currencies_enabled'), 'default' => NULL, 'type' => CRM_Utils_Type::T_STRING), 'sid' => array('name' => 'status_id', 'title' => ts('Pledge Status'), 'operatorType' => CRM_Report_Form::OP_MULTISELECT, 'options' => CRM_Core_OptionGroup::values('contribution_status'))), 'group_bys' => array('pledge_create_date' => array('frequency' => TRUE, 'default' => TRUE, 'chart' => TRUE), 'frequency_unit' => array('title' => ts('Frequency Unit')), 'status_id' => array('title' => ts('Pledge Status')))), 'civicrm_pledge_payment' => array('dao' => 'CRM_Pledge_DAO_PledgePayment', 'fields' => array('total_paid' => array('title' => ts('Total Amount Paid'), 'type' => CRM_Utils_Type::T_STRING, 'dbAlias' => 'sum(pledge_payment_civireport.actual_amount)'))), 'civicrm_group' => array('dao' => 'CRM_Contact_DAO_Group', '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->addAddressFields();
$this->_tagFilter = TRUE;
$this->_currencyColumn = 'civicrm_pledge_currency';
parent::__construct();
}
示例3: __construct
function __construct()
{
$this->_columns = array('civicrm_contact' => array('dao' => 'CRM_Contact_DAO_Contact', 'fields' => array('sort_name' => array('title' => ts('Contact Name'), 'required' => TRUE, 'no_repeat' => TRUE), 'gender_id' => array('title' => ts('Gender'), 'default' => TRUE), 'birth_date' => array('title' => ts('Birthdate'), 'default' => FALSE), 'id' => array('no_display' => TRUE, 'required' => TRUE)), 'filters' => array('sort_name' => array('title' => ts('Contact Name'), 'operatorType' => CRM_Report_Form::OP_STRING), 'contact_type' => array('title' => ts('Contact Type'), 'operatorType' => CRM_Report_Form::OP_SELECT, 'options' => array('' => ts('-select-'), 'Individual' => ts('Individual'), 'Organization' => ts('Organization'), 'Household' => ts('Household')), 'default' => 'Individual'), 'id' => array('title' => ts('Contact ID'), 'no_display' => TRUE)), 'grouping' => 'contact-fields'), 'civicrm_email' => array('dao' => 'CRM_Core_DAO_Email', 'fields' => array('email' => array('title' => ts('Email'), 'no_repeat' => TRUE)), 'grouping' => 'contact-fields'), 'civicrm_address' => array('dao' => 'CRM_Core_DAO_Address', 'grouping' => 'contact-fields', 'fields' => array('street_address' => array('default' => FALSE), 'city' => array('default' => TRUE), 'postal_code' => NULL, 'state_province_id' => array('title' => ts('State/Province')), 'country_id' => array('title' => ts('Country'), 'default' => FALSE))), 'civicrm_phone' => array('dao' => 'CRM_Core_DAO_Phone', 'fields' => array('phone' => NULL), 'grouping' => 'contact-fields'), 'civicrm_activity' => array('dao' => 'CRM_Activity_DAO_Activity', 'fields' => array('id' => array('title' => ts('Activity ID'), 'no_display' => TRUE, 'required' => TRUE))), 'civicrm_case' => array('dao' => 'CRM_Case_DAO_Case', 'fields' => array('id' => array('title' => ts('Case ID'), 'required' => TRUE), 'start_date' => array('title' => ts('Case Start'), 'required' => TRUE), 'end_date' => array('title' => ts('Case End'), 'required' => TRUE)), 'filters' => array('case_id_filter' => array('name' => 'id', 'title' => ts('Cases?'), 'operatorType' => CRM_Report_Form::OP_SELECT, 'options' => array(1 => ts('Exclude non-case'), 2 => ts('Exclude cases'), 3 => ts('Include Both')), 'default' => 3), 'start_date' => array('title' => ts('Case Start'), 'operatorType' => CRM_Report_Form::OP_DATE), 'end_date' => array('title' => ts('Case End'), 'operatorType' => CRM_Report_Form::OP_DATE))), 'civicrm_group' => array('dao' => 'CRM_Contact_DAO_Group', '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;
$open_case_val = CRM_Core_OptionGroup::getValue('activity_type', 'Open Case', 'name');
$crmDAO =& CRM_Core_DAO::executeQuery("SELECT cg.table_name, cg.extends AS ext, cf.label, cf.column_name FROM civicrm_custom_group cg INNER JOIN civicrm_custom_field cf ON cg.id = cf.custom_group_id\nwhere (cg.extends='Contact' OR cg.extends='Individual' OR cg.extends_entity_column_value='{$open_case_val}') AND cg.is_active=1 AND cf.is_active=1 ORDER BY cg.table_name");
$curTable = '';
$curExt = '';
$curFields = array();
while ($crmDAO->fetch()) {
if ($curTable == '') {
$curTable = $crmDAO->table_name;
$curExt = $crmDAO->ext;
} elseif ($curTable != $crmDAO->table_name) {
// dummy DAO
$this->_columns[$curTable] = array('dao' => 'CRM_Contact_DAO_Contact', 'fields' => $curFields, 'ext' => $curExt);
$curTable = $crmDAO->table_name;
$curExt = $crmDAO->ext;
$curFields = array();
}
$curFields[$crmDAO->column_name] = array('title' => $crmDAO->label);
}
if (!empty($curFields)) {
// dummy DAO
$this->_columns[$curTable] = array('dao' => 'CRM_Contact_DAO_Contact', 'fields' => $curFields, 'ext' => $curExt);
}
$this->_genders = CRM_Core_PseudoConstant::get('CRM_Contact_DAO_Contact', 'gender_id');
parent::__construct();
}
示例4: __construct
/**
*/
public function __construct()
{
$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', 'fields' => array('sort_name' => array('title' => ts('Donor Name'), 'required' => TRUE, 'no_repeat' => TRUE), 'first_name' => array('title' => ts('First Name'), 'no_repeat' => TRUE), 'last_name' => array('title' => ts('Last Name'), 'no_repeat' => TRUE), 'contact_type' => array('title' => ts('Contact Type'), 'no_repeat' => TRUE), 'contact_sub_type' => array('title' => ts('Contact Subtype'), 'no_repeat' => TRUE), 'do_not_email' => array('title' => ts('Do Not Email'), 'no_repeat' => TRUE), 'is_opt_out' => array('title' => ts('No Bulk Email(Is Opt Out)'), 'no_repeat' => TRUE), 'id' => array('no_display' => TRUE, 'required' => TRUE, 'csv_display' => TRUE, 'title' => ts('Contact ID'))), 'filters' => array('sort_name' => array('title' => ts('Donor Name'), 'operator' => 'like'), 'id' => array('title' => ts('Contact ID'), 'no_display' => TRUE)), 'grouping' => 'contact-fields'), 'civicrm_email' => array('dao' => 'CRM_Core_DAO_Email', 'fields' => array('email' => array('title' => ts('Donor Email'), 'default' => TRUE, 'no_repeat' => TRUE)), 'grouping' => 'contact-fields'), 'civicrm_phone' => array('dao' => 'CRM_Core_DAO_Phone', 'fields' => array('phone' => array('title' => ts('Donor Phone'), 'default' => TRUE, 'no_repeat' => TRUE)), 'grouping' => 'contact-fields'), 'first_donation' => array('dao' => 'CRM_Contribute_DAO_Contribution', 'fields' => array('first_donation_date' => array('title' => ts('First Contribution Date'), 'base_field' => 'receive_date', 'no_repeat' => TRUE), 'first_donation_amount' => array('title' => ts('First Contribution Amount'), 'base_field' => 'total_amount', 'no_repeat' => TRUE))), 'civicrm_contribution' => array('dao' => 'CRM_Contribute_DAO_Contribution', 'fields' => array('contribution_id' => array('name' => 'id', 'no_display' => TRUE, 'required' => TRUE, 'csv_display' => TRUE, 'title' => ts('Contribution ID')), 'financial_type_id' => array('title' => ts('Financial Type'), 'default' => TRUE), 'contribution_recur_id' => array('title' => ts('Recurring Contribution Id'), 'name' => 'contribution_recur_id', 'required' => TRUE, 'no_display' => TRUE, 'csv_display' => TRUE), 'contribution_status_id' => array('title' => ts('Contribution Status')), 'payment_instrument_id' => array('title' => ts('Payment Type')), 'contribution_source' => array('name' => 'source', 'title' => ts('Contribution Source')), 'currency' => array('required' => TRUE, 'no_display' => TRUE), 'trxn_id' => NULL, 'receive_date' => array('default' => TRUE), 'receipt_date' => NULL, 'fee_amount' => NULL, 'net_amount' => NULL, 'total_amount' => array('title' => ts('Amount'), 'required' => TRUE)), 'filters' => array('receive_date' => array('operatorType' => CRM_Report_Form::OP_DATE), 'financial_type_id' => array('title' => ts('Financial Type'), 'operatorType' => CRM_Report_Form::OP_MULTISELECT, 'options' => CRM_Contribute_PseudoConstant::financialType()), 'currency' => array('title' => 'Currency', 'operatorType' => CRM_Report_Form::OP_MULTISELECT, 'options' => CRM_Core_OptionGroup::values('currencies_enabled'), 'default' => NULL, 'type' => CRM_Utils_Type::T_STRING), 'payment_instrument_id' => array('title' => ts('Payment Type'), 'operatorType' => CRM_Report_Form::OP_MULTISELECT, 'options' => CRM_Contribute_PseudoConstant::paymentInstrument()), 'contribution_status_id' => array('title' => ts('Contribution Status'), 'operatorType' => CRM_Report_Form::OP_MULTISELECT, 'options' => CRM_Contribute_PseudoConstant::contributionStatus(), 'default' => array(1)), 'total_amount' => array('title' => ts('Contribution Amount'))), 'grouping' => 'contri-fields'), 'civicrm_product' => array('dao' => 'CRM_Contribute_DAO_Product', 'fields' => array('product_name' => array('name' => 'name', 'title' => ts('Premium')))), 'civicrm_contribution_product' => array('dao' => 'CRM_Contribute_DAO_ContributionProduct', 'fields' => array('product_id' => array('no_display' => TRUE), 'product_option' => array('title' => ts('Premium Option')), 'fulfilled_date' => array('title' => ts('Premium Fulfilled Date')), 'contribution_id' => array('no_display' => TRUE))), 'civicrm_contribution_ordinality' => array('dao' => 'CRM_Contribute_DAO_Contribution', 'alias' => 'cordinality', 'filters' => array('ordinality' => array('title' => ts('Contribution Ordinality'), 'operatorType' => CRM_Report_Form::OP_MULTISELECT, 'options' => array(0 => 'First by Contributor', 1 => 'Second or Later by Contributor')))), 'civicrm_membership' => array('dao' => 'CRM_Member_DAO_Membership', 'fields' => array('membership_type_id' => array('title' => ts('Membership Type'), 'required' => TRUE, 'no_repeat' => TRUE), 'membership_start_date' => array('title' => ts('Start Date'), 'default' => TRUE), 'membership_end_date' => array('title' => ts('End Date'), 'default' => TRUE), 'join_date' => array('title' => ts('Join Date'), 'default' => TRUE), 'source' => array('title' => ts('Membership Source'))), 'filters' => array('join_date' => array('operatorType' => CRM_Report_Form::OP_DATE), 'membership_start_date' => array('operatorType' => CRM_Report_Form::OP_DATE), 'membership_end_date' => array('operatorType' => CRM_Report_Form::OP_DATE), 'owner_membership_id' => array('title' => ts('Membership Owner ID'), 'operatorType' => CRM_Report_Form::OP_INT), 'tid' => array('name' => 'membership_type_id', 'title' => ts('Membership Types'), 'type' => CRM_Utils_Type::T_INT, 'operatorType' => CRM_Report_Form::OP_MULTISELECT, 'options' => CRM_Member_PseudoConstant::membershipType())), 'grouping' => 'member-fields'), 'civicrm_membership_status' => array('dao' => 'CRM_Member_DAO_MembershipStatus', 'alias' => 'mem_status', 'fields' => array('membership_status_name' => array('name' => 'name', 'title' => ts('Membership Status'), 'default' => TRUE)), 'filters' => array('sid' => array('name' => 'id', 'title' => ts('Membership Status'), 'type' => CRM_Utils_Type::T_INT, 'operatorType' => CRM_Report_Form::OP_MULTISELECT, 'options' => CRM_Member_PseudoConstant::membershipStatus(NULL, NULL, 'label'))), 'grouping' => 'member-fields'), 'civicrm_note' => array('dao' => 'CRM_Core_DAO_Note', 'fields' => array('contribution_note' => array('name' => 'note', 'title' => ts('Contribution Note'))), 'filters' => array('note' => array('name' => 'note', 'title' => ts('Contribution Note'), 'operator' => 'like', 'type' => CRM_Utils_Type::T_STRING)))) + $this->addAddressFields(FALSE);
$this->_groupFilter = TRUE;
$this->_tagFilter = TRUE;
// Don't show Batch display column and filter unless batches are being used
$this->_allBatches = CRM_Batch_BAO_Batch::getBatches();
if (!empty($this->_allBatches)) {
$this->_columns['civicrm_batch']['dao'] = 'CRM_Batch_DAO_Batch';
$this->_columns['civicrm_batch']['fields']['batch_id'] = array('name' => 'id', 'title' => ts('Batch Name'));
$this->_columns['civicrm_batch']['filters']['bid'] = array('name' => 'id', 'title' => ts('Batch Name'), 'type' => CRM_Utils_Type::T_INT, 'operatorType' => CRM_Report_Form::OP_MULTISELECT, 'options' => $this->_allBatches);
$this->_columns['civicrm_entity_batch']['dao'] = 'CRM_Batch_DAO_EntityBatch';
$this->_columns['civicrm_entity_batch']['fields']['entity_batch_id'] = array('name' => 'batch_id', 'default' => TRUE, 'no_display' => TRUE);
}
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->_columns['civicrm_contribution']['order_bys']['campaign_id'] = array('title' => ts('Campaign'));
}
$this->_currencyColumn = 'civicrm_contribution_currency';
parent::__construct();
}
示例5: buildQuickForm
/**
* Build the form object.
*/
public function buildQuickForm()
{
CRM_Utils_System::setTitle(ts('Settings - Search Preferences'));
// @todo remove the following adds in favour of setting via the settings array (above).
$this->addYesNo('includeWildCardInName', ts('Automatic Wildcard'));
$this->addYesNo('includeEmailInName', ts('Include Email'));
$this->addYesNo('includeNickNameInName', ts('Include Nickname'));
$this->addYesNo('includeAlphabeticalPager', ts('Include Alphabetical Pager'));
$this->addYesNo('includeOrderByClause', ts('Include Order By Clause'));
$this->addElement('text', 'smartGroupCacheTimeout', ts('Smart group cache timeout'), array('size' => 3, 'maxlength' => 5));
$types = array('Contact', 'Individual', 'Organization', 'Household');
$profiles = CRM_Core_BAO_UFGroup::getProfiles($types);
$this->add('select', 'defaultSearchProfileID', ts('Default Contact Search Profile'), array('' => ts('- none -')) + $profiles, FALSE, array('class' => 'crm-select2 huge'));
// Autocomplete for Contact Search (quick search etc.)
$options = array(ts('Contact Name') => 1) + array_flip(CRM_Core_OptionGroup::values('contact_autocomplete_options', FALSE, FALSE, TRUE));
$this->addCheckBox('autocompleteContactSearch', ts('Autocomplete Contact Search'), $options, NULL, NULL, NULL, NULL, array(' '));
$element = $this->getElement('autocompleteContactSearch');
$element->_elements[0]->_flagFrozen = TRUE;
// Autocomplete for Contact Reference (custom fields)
$optionsCR = array(ts('Contact Name') => 1) + array_flip(CRM_Core_OptionGroup::values('contact_reference_options', FALSE, FALSE, TRUE));
$this->addCheckBox('autocompleteContactReference', ts('Contact Reference Options'), $optionsCR, NULL, NULL, NULL, NULL, array(' '));
$element = $this->getElement('autocompleteContactReference');
$element->_elements[0]->_flagFrozen = TRUE;
parent::buildQuickForm();
}
示例6: buildForm
/**
* @param CRM_Core_Form $form
*/
public function buildForm(&$form)
{
/**
* You can define a custom title for the search form
*/
$this->setTitle('Find Totals for Events');
/**
* Define the search form fields here
*/
$form->addElement('checkbox', 'paid_online', ts('Only show Credit Card Payments'));
$form->addElement('checkbox', 'show_payees', ts('Show payees'));
$event_type = CRM_Core_OptionGroup::values('event_type', FALSE);
foreach ($event_type as $eventId => $eventName) {
$form->addElement('checkbox', "event_type_id[{$eventId}]", 'Event Type', $eventName);
}
$events = CRM_Event_BAO_Event::getEvents(1);
$form->add('select', 'event_id', ts('Event Name'), array('' => ts('- select -')) + $events);
$form->addDate('start_date', ts('Payments Date From'), FALSE, array('formatType' => 'custom'));
$form->addDate('end_date', ts('...through'), FALSE, array('formatType' => 'custom'));
/**
* If you are using the sample template, this array tells the template fields to render
* for the search form.
*/
$form->assign('elements', array('paid_online', 'start_date', 'end_date', 'show_payees', 'event_type_id', 'event_id'));
}
示例7: getBatchList
/**
* Retrieve records.
*/
public static function getBatchList()
{
$sortMapper = array(0 => 'batch.title', 1 => 'batch.type_id', 2 => '', 3 => 'batch.total', 4 => 'batch.status_id', 5 => '');
$sEcho = CRM_Utils_Type::escape($_REQUEST['sEcho'], 'Integer');
$offset = isset($_REQUEST['iDisplayStart']) ? CRM_Utils_Type::escape($_REQUEST['iDisplayStart'], 'Integer') : 0;
$rowCount = isset($_REQUEST['iDisplayLength']) ? CRM_Utils_Type::escape($_REQUEST['iDisplayLength'], 'Integer') : 25;
$sort = isset($_REQUEST['iSortCol_0']) ? CRM_Utils_Array::value(CRM_Utils_Type::escape($_REQUEST['iSortCol_0'], 'Integer'), $sortMapper) : NULL;
$sortOrder = isset($_REQUEST['sSortDir_0']) ? CRM_Utils_Type::escape($_REQUEST['sSortDir_0'], 'String') : 'asc';
$context = isset($_REQUEST['context']) ? CRM_Utils_Type::escape($_REQUEST['context'], 'String') : NULL;
$params = $_REQUEST;
if ($sort && $sortOrder) {
$params['sortBy'] = $sort . ' ' . $sortOrder;
}
$params['page'] = $offset / $rowCount + 1;
$params['rp'] = $rowCount;
if ($context != 'financialBatch') {
// data entry status batches
$params['status_id'] = CRM_Core_OptionGroup::getValue('batch_status', 'Data Entry', 'name');
}
$params['context'] = $context;
// get batch list
$batches = CRM_Batch_BAO_Batch::getBatchListSelector($params);
$iFilteredTotal = $iTotal = $params['total'];
if ($context == 'financialBatch') {
$selectorElements = array('check', 'batch_name', 'payment_instrument', 'item_count', 'total', 'status', 'created_by', 'links');
} else {
$selectorElements = array('batch_name', 'type', 'item_count', 'total', 'status', 'created_by', 'links');
}
CRM_Utils_System::setHttpHeader('Content-Type', 'application/json');
echo CRM_Utils_JSON::encodeDataTableSelector($batches, $sEcho, $iTotal, $iFilteredTotal, $selectorElements);
CRM_Utils_System::civiExit();
}
示例8: buildQuickForm
/**
* Overridden parent method to build the form
*
* @access public
*/
public function buildQuickForm()
{
$this->add('hidden', 'rule_action_id');
$this->add('select', 'activity_type_id', ts('Activity type'), array('' => ts('-- please select --')) + CRM_Core_OptionGroup::values('activity_type'), true);
$this->add('select', 'status_id', ts('Status'), array('' => ts('-- please select --')) + CRM_Core_OptionGroup::values('activity_status'), true);
$this->add('text', 'subject', ts('Subject'));
$this->assign('use_old_contact_ref_fields', $this->use_old_contact_ref_fields);
if ($this->use_old_contact_ref_fields) {
$data = unserialize($this->ruleAction->action_params);
$assignees = array();
if (!empty($data['assignee_contact_id'])) {
if (is_array($data['assignee_contact_id'])) {
$assignees = $data['assignee_contact_id'];
} else {
$assignees[] = $data['assignee_contact_id'];
}
}
$this->assign('selectedContacts', implode(",", $assignees));
CRM_Contact_Form_NewContact::buildQuickForm($this);
} else {
$attributes = array('multiple' => TRUE, 'create' => TRUE, 'api' => array('params' => array('is_deceased' => 0)));
$this->addEntityRef('assignee_contact_id', ts('Assigned to'), $attributes, false);
}
$this->addButtons(array(array('type' => 'next', 'name' => ts('Save'), 'isDefault' => TRUE), array('type' => 'cancel', 'name' => ts('Cancel'))));
}
示例9: setDefaultValues
/**
* Set default values for the form.
*
*
* @return void
*/
public function setDefaultValues()
{
$defaults = array();
$defaults = array();
if (isset($this->_id)) {
$title = CRM_Core_DAO::getFieldValue('CRM_Event_DAO_Event', $this->_id, 'title');
CRM_Utils_System::setTitle(ts('Personal Campaign Page Settings (%1)', array(1 => $title)));
$params = array('entity_id' => $this->_id, 'entity_table' => 'civicrm_event');
CRM_Core_DAO::commonRetrieve('CRM_PCP_DAO_PCPBlock', $params, $defaults);
$defaults['pcp_active'] = CRM_Utils_Array::value('is_active', $defaults);
// Assign contribution page ID to pageId for referencing in PCP.hlp - since $id is overwritten there. dgg
$this->assign('pageId', $this->_id);
}
if (empty($defaults['id'])) {
$defaults['target_entity_type'] = 'event';
$defaults['is_approval_needed'] = 1;
$defaults['is_tellfriend_enabled'] = 1;
$defaults['tellfriend_limit'] = 5;
$defaults['link_text'] = ts('Promote this event with a personal campaign page');
$defaults['owner_notify_id'] = CRM_Core_OptionGroup::getDefaultValue('pcp_owner_notify');
if ($this->_id && ($ccReceipt = CRM_Core_DAO::getFieldValue('CRM_Contribute_DAO_ContributionPage', $this->_id, 'cc_receipt'))) {
$defaults['notify_email'] = $ccReceipt;
}
}
return $defaults;
}
示例10: setDefaultValues
/**
* This function sets the default values for the form.
* default values are retrieved from the database
*
* @access public
* @return None
*/
function setDefaultValues()
{
if (!$this->_defaults) {
$this->_defaults = array();
$formArray = array('Component', 'Localization');
$formMode = false;
if (in_array($this->_name, $formArray)) {
$formMode = true;
}
require_once "CRM/Core/BAO/Setting.php";
CRM_Core_BAO_Setting::retrieve($this->_defaults);
require_once "CRM/Core/Config/Defaults.php";
CRM_Core_Config_Defaults::setValues($this->_defaults, $formMode);
require_once "CRM/Core/OptionGroup.php";
$list = array_flip(CRM_Core_OptionGroup::values('contact_autocomplete_options', false, false, true, null, 'name'));
require_once "CRM/Core/BAO/Preferences.php";
$listEnabled = CRM_Core_BAO_Preferences::valueOptions('contact_autocomplete_options');
$autoSearchFields = array();
if (!empty($list) && !empty($listEnabled)) {
$autoSearchFields = array_combine($list, $listEnabled);
}
//Set sort_name for default
$this->_defaults['autocompleteContactSearch'] = array('1' => 1) + $autoSearchFields;
}
return $this->_defaults;
}
示例11: civicrm_api3_domain_get
/**
* Get CiviCRM domain details
* {@getfields domain_create}
* @example DomainGet.php
*/
function civicrm_api3_domain_get($params)
{
$params['version'] = CRM_Utils_Array::value('domain_version', $params);
unset($params['version']);
$bao = new CRM_Core_BAO_Domain();
if (CRM_Utils_Array::value('current_domain', $params)) {
$domainBAO = CRM_Core_Config::domainID();
$params['id'] = $domainBAO;
}
_civicrm_api3_dao_set_filter($bao, $params, true, 'domain');
$domains = _civicrm_api3_dao_to_array($bao, $params, true, 'domain');
foreach ($domains as $domain) {
if (!empty($domain['contact_id'])) {
$values = array();
$locparams = array('contact_id' => $domain['contact_id']);
$values['location'] = CRM_Core_BAO_Location::getValues($locparams, TRUE);
$address_array = array('street_address', 'supplemental_address_1', 'supplemental_address_2', 'city', 'state_province_id', 'postal_code', 'country_id', 'geo_code_1', 'geo_code_2');
if (!empty($values['location']['email'])) {
$domain['domain_email'] = CRM_Utils_Array::value('email', $values['location']['email'][1]);
}
if (!empty($values['location']['phone'])) {
$domain['domain_phone'] = array('phone_type' => CRM_Core_OptionGroup::getLabel('phone_type', CRM_Utils_Array::value('phone_type_id', $values['location']['phone'][1])), 'phone' => CRM_Utils_Array::value('phone', $values['location']['phone'][1]));
}
if (!empty($values['location']['address'])) {
foreach ($address_array as $value) {
$domain['domain_address'][$value] = CRM_Utils_Array::value($value, $values['location']['address'][1]);
}
}
list($domain['from_name'], $domain['from_email']) = CRM_Core_BAO_Domain::getNameAndEmail(TRUE);
$domains[$domain['id']] = array_merge($domains[$domain['id']], $domain);
}
}
return civicrm_api3_create_success($domains, $params, 'domain', 'get', $bao);
}
示例12: buildQuickForm
/**
*
* @return void
*/
public function buildQuickForm()
{
$slots = CRM_Core_OptionGroup::values('conference_slot');
$this->add('select', 'slot_label_id', ts('Conference Slot'), array('' => ts('- select -')) + $slots, FALSE);
$this->addEntityRef('parent_event_id', ts('Parent Event'), array('entity' => 'event', 'placeholder' => ts('- any -'), 'select' => array('minimumInputLength' => 0)));
parent::buildQuickForm();
}
示例13: browse
/**
* This function is called when action is browse
*
* return null
* @access public
*/
function browse()
{
$links =& self::links();
$action = array_sum(array_keys($links));
$caseStatus = CRM_Core_OptionGroup::values('case_status');
$caseType = CRM_Core_OptionGroup::values('case_type');
require_once 'CRM/Case/BAO/Case.php';
$queryParams = array();
$query = "SELECT civicrm_case.id, civicrm_case.case_type_id, civicrm_case.status_id,\n civicrm_case.start_date, civicrm_case.subject \n FROM civicrm_case\n LEFT JOIN civicrm_case_contact ON civicrm_case_contact.case_id = civicrm_case.id\n WHERE civicrm_case_contact.contact_id = {$this->_contactId}";
$case = CRM_Core_DAO::executeQuery($query, $queryParams);
$values = array();
while ($case->fetch()) {
$values[$case->id]['action'] = CRM_Core_Action::formLink($links, $action, array('id' => $case->id, 'cid' => $this->_contactId));
$names = array();
$caseTypeIds = explode(CRM_Case_BAO_Case::VALUE_SEPERATOR, $case->case_type_id);
foreach ($caseTypeIds as $id => $val) {
if ($val) {
$names[] = $caseType[$val];
}
}
$values[$case->id]['case_type_id'] = implode(':::', $names);
$values[$case->id]['status_id'] = $caseStatus[$case->status_id];
$values[$case->id]['start_date'] = $case->start_date;
$values[$case->id]['subject'] = $case->subject;
$values[$case->id]['id'] = $case->id;
}
$this->assign('cases', $values);
}
示例14: __construct
function __construct()
{
$this->fetchActivityTypes();
$this->fetchCaseStatusses();
$rels = CRM_Core_PseudoConstant::relationshipType();
$coach_rel_type_id = false;
foreach ($rels as $relid => $v) {
$this->rel_types[$relid] = $v['label_b_a'];
if ($v['label_b_a'] == 'Coach') {
$coach_rel_type_id = $relid;
}
}
$coaches = array();
if ($coach_rel_type_id) {
$coaches = $this->coaches($coach_rel_type_id);
}
$this->_groupFilter = FALSE;
$this->_tagFilter = FALSE;
$this->_columns = array('civicrm_activity`' => array('dao' => 'CRM_Activity_DAO_Activity', 'fields' => array(), 'filters' => array('activity_type_id' => array('title' => ts('Activity type'), 'operatorType' => CRM_Report_Form::OP_MULTISELECT, 'options' => CRM_Core_OptionGroup::values('activity_type'), 'pseudofield' => true, 'default' => $this->_activityTypes), 'case_status' => array('title' => ts('Status'), 'operatorType' => CRM_Report_Form::OP_MULTISELECT, 'options' => CRM_Core_OptionGroup::values('case_status'), 'pseudofield' => true, 'default' => $this->_openedCaseStatusses), 'case_role' => array('title' => ts('Role on case'), 'operatorType' => CRM_Report_Form::OP_MULTISELECT, 'options' => $this->rel_types), 'coach' => array('title' => ts('Coach'), 'type' => CRM_Utils_Type::T_INT, 'operatorType' => CRM_Report_Form::OP_MULTISELECT, 'options' => $coaches, 'pseudofield' => true), 'my_cases' => array('title' => ts('My cases'), 'type' => CRM_Utils_Type::T_BOOLEAN, 'operatorType' => CRM_Report_Form::OP_SELECT, 'options' => array('0' => ts('No'), '1' => ts('Yes')), 'default' => '1', 'pseudofield' => TRUE))));
parent::__construct();
$this->fetchCaseType();
$this->fetchChequenummer();
$this->fetchStatusGroup();
$this->fetchCoachIdentifier();
}
示例15: buildQuickForm
/**
* Build the form object.
*
* @return void
*/
public function buildQuickForm()
{
//Setting Upload File Size
$config = CRM_Core_Config::singleton();
$uploadFileSize = CRM_Core_Config_Defaults::formatUnitSize($config->maxFileSize . 'm', TRUE);
$uploadSize = round($uploadFileSize / (1024 * 1024), 2);
$this->assign('uploadSize', $uploadSize);
$this->setMaxFileSize($uploadFileSize);
$this->add('File', 'uploadFile', ts('Import Data File'), 'size=30 maxlength=255', TRUE);
$this->addRule('uploadFile', ts('File size should be less than %1 MBytes (%2 bytes)', array(1 => $uploadSize, 2 => $uploadFileSize)), 'maxfilesize', $uploadFileSize);
$this->addRule('uploadFile', ts('A valid file must be uploaded.'), 'uploadedfile');
$this->addRule('uploadFile', ts('Input file must be in CSV format'), 'utf8File');
$this->addElement('checkbox', 'skipColumnHeader', ts('First row contains column headers'));
$duplicateOptions = array();
$duplicateOptions[] = $this->createElement('radio', NULL, NULL, ts('Skip'), CRM_Import_Parser::DUPLICATE_SKIP);
$duplicateOptions[] = $this->createElement('radio', NULL, NULL, ts('Update'), CRM_Import_Parser::DUPLICATE_UPDATE);
$duplicateOptions[] = $this->createElement('radio', NULL, NULL, ts('Fill'), CRM_Import_Parser::DUPLICATE_FILL);
$this->addGroup($duplicateOptions, 'onDuplicate', ts('On duplicate entries'));
//get the saved mapping details
$mappingArray = CRM_Core_BAO_Mapping::getMappings(CRM_Core_OptionGroup::getValue('mapping_type', 'Import Activity', 'name'));
$this->assign('savedMapping', $mappingArray);
$this->add('select', 'savedMapping', ts('Mapping Option'), array('' => ts('- select -')) + $mappingArray);
if ($loadeMapping = $this->get('loadedMapping')) {
$this->assign('loadedMapping', $loadeMapping);
$this->setDefaults(array('savedMapping' => $loadeMapping));
}
$this->setDefaults(array('onDuplicate' => CRM_Import_Parser::DUPLICATE_SKIP));
//build date formats
CRM_Core_Form_Date::buildAllowedDateFormats($this);
$this->addButtons(array(array('type' => 'upload', 'name' => ts('Continue'), 'spacing' => ' ', 'isDefault' => TRUE), array('type' => 'cancel', 'name' => ts('Cancel'))));
}