本文整理汇总了PHP中CRM_Core_Form::setDefaultValues方法的典型用法代码示例。如果您正苦于以下问题:PHP CRM_Core_Form::setDefaultValues方法的具体用法?PHP CRM_Core_Form::setDefaultValues怎么用?PHP CRM_Core_Form::setDefaultValues使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CRM_Core_Form
的用法示例。
在下文中一共展示了CRM_Core_Form::setDefaultValues方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: setDefaultValues
function setDefaultValues()
{
$defaults = parent::setDefaultValues();
$group = "CiviCRM Mobile";
$defaults['ind_profile_id'] = CRM_Core_BAO_Setting::getItem($group, 'ind_profile_id');
$defaults['org_profile_id'] = CRM_Core_BAO_Setting::getItem($group, 'org_profile_id');
$defaults['house_profile_id'] = CRM_Core_BAO_Setting::getItem($group, 'house_profile_id');
return $defaults;
}
示例2: setDefaultValues
public function setDefaultValues()
{
$defaults = parent::setDefaultValues();
if ($this->id) {
$config = CRM_Chapters_AutomatchConfig::singelton();
$sql = "SELECT id, `" . $config->getMatchTypeField('column_name') . "` AS `type`, `" . $config->getCountryField('column_name') . "` AS `country`, `" . $config->getZipCodeRangeFromField('column_name') . "` AS `zipcode_from`, `" . $config->getZipCodeRangeToField('column_name') . "` AS `zipcode_to` FROM `" . $config->getCustomGroup('table_name') . "` WHERE id = %1";
$params[1] = array($this->id, 'Integer');
$dao = CRM_Core_DAO::executeQuery($sql, $params);
if ($dao->fetch()) {
$defaults['type'] = $dao->type;
$defaults['country'] = $dao->country;
$defaults['zipcode_from'] = $dao->zipcode_from;
$defaults['zipcode_to'] = $dao->zipcode_to;
}
}
return $defaults;
}
示例3: setDefaultValues
function setDefaultValues()
{
$defaults = array();
$defaults = parent::setDefaultValues();
if ($this->_action & CRM_Core_Action::DELETE) {
return $defaults;
}
$params['id'] = $this->_id;
if ($this->_noteId) {
$defaults['note'] = CRM_Core_DAO::getFieldValue('CRM_Core_DAO_Note', $this->_noteId, 'note');
}
if ($this->_id) {
CRM_Grant_BAO_Grant::retrieve($params, $defaults);
// fix the display of the monetary value, CRM-4038
require_once 'CRM/Utils/Money.php';
if (isset($defaults['amount_total'])) {
$defaults['amount_total'] = CRM_Utils_Money::format($defaults['amount_total'], null, '%a');
}
if (isset($defaults['amount_requested'])) {
$defaults['amount_requested'] = CRM_Utils_Money::format($defaults['amount_requested'], null, '%a');
}
if (isset($defaults['amount_granted'])) {
$defaults['amount_granted'] = CRM_Utils_Money::format($defaults['amount_granted'], null, '%a');
}
$dates = array('application_received_date', 'decision_date', 'money_transfer_date', 'grant_due_date');
foreach ($dates as $key) {
if (CRM_Utils_Array::value($key, $defaults)) {
list($defaults[$key]) = CRM_Utils_Date::setDateDefaults($defaults[$key]);
}
}
} else {
require_once 'CRM/Utils/Date.php';
list($defaults['application_received_date']) = CRM_Utils_Date::setDateDefaults();
}
// custom data set defaults
$defaults += CRM_Custom_Form_Customdata::setDefaultValues($this);
return $defaults;
}
示例4: setDefaultValues
function setDefaultValues()
{
$defaults = parent::setDefaultValues();
$custom = sumfields_get_custom_field_definitions();
$active_fields = sumfields_get_setting('active_fields', array());
$active_fundraising_fields = array();
$active_membership_fields = array();
$active_event_standard_fields = array();
$active_event_turnout_fields = array();
while (list($field, $field_info) = each($custom['fields'])) {
if (in_array($field, $active_fields)) {
if ($field_info['display'] == 'fundraising') {
$active_fundraising_fields[] = $field;
} elseif ($field_info['display'] == 'membership') {
$active_membership_fields[] = $field;
} elseif ($field_info['display'] == 'event_standard') {
$active_event_standard_fields[] = $field;
} elseif ($field_info['display'] == 'event_turnout') {
$active_event_turnout_fields[] = $field;
}
}
}
$defaults['active_fundraising_fields'] = $this->array_to_options($active_fundraising_fields);
$defaults['active_membership_fields'] = $this->array_to_options($active_membership_fields);
$defaults['active_event_standard_fields'] = $this->array_to_options($active_event_standard_fields);
$defaults['active_event_turnout_fields'] = $this->array_to_options($active_event_turnout_fields);
$defaults['active_fields'] = $this->array_to_options(sumfields_get_setting('active_fields', array()));
$defaults['financial_type_ids'] = $this->array_to_options(sumfields_get_setting('financial_type_ids', array()));
$defaults['membership_financial_type_ids'] = $this->array_to_options(sumfields_get_setting('membership_financial_type_ids', array()));
$defaults['event_type_ids'] = $this->array_to_options(sumfields_get_setting('event_type_ids', array()));
$defaults['participant_status_ids'] = $this->array_to_options(sumfields_get_setting('participant_status_ids', array()));
$defaults['participant_noshow_status_ids'] = $this->array_to_options(sumfields_get_setting('participant_noshow_status_ids', array()));
$defaults['when_to_apply_change'] = 'via_cron';
return $defaults;
}
示例5: setDefaultValues
/**
* @return array
*/
public function setDefaultValues()
{
if ($this->_cdType) {
return CRM_Custom_Form_CustomData::setDefaultValues($this);
}
$defaults = parent::setDefaultValues();
if ($this->_action & CRM_Core_Action::DELETE) {
return $defaults;
}
$params['id'] = $this->_id;
if ($this->_noteId) {
$defaults['note'] = CRM_Core_DAO::getFieldValue('CRM_Core_DAO_Note', $this->_noteId, 'note');
}
if ($this->_id) {
CRM_Grant_BAO_Grant::retrieve($params, $defaults);
// fix the display of the monetary value, CRM-4038
if (isset($defaults['amount_total'])) {
$defaults['amount_total'] = CRM_Utils_Money::format($defaults['amount_total'], NULL, '%a');
}
if (isset($defaults['amount_requested'])) {
$defaults['amount_requested'] = CRM_Utils_Money::format($defaults['amount_requested'], NULL, '%a');
}
if (isset($defaults['amount_granted'])) {
$defaults['amount_granted'] = CRM_Utils_Money::format($defaults['amount_granted'], NULL, '%a');
}
$dates = array('application_received_date', 'decision_date', 'money_transfer_date', 'grant_due_date');
foreach ($dates as $key) {
if (!empty($defaults[$key])) {
list($defaults[$key]) = CRM_Utils_Date::setDateDefaults($defaults[$key]);
}
}
} else {
list($defaults['application_received_date']) = CRM_Utils_Date::setDateDefaults();
}
return $defaults;
}