本文整理汇总了PHP中CRM_Core_OptionGroup::optionLabel方法的典型用法代码示例。如果您正苦于以下问题:PHP CRM_Core_OptionGroup::optionLabel方法的具体用法?PHP CRM_Core_OptionGroup::optionLabel怎么用?PHP CRM_Core_OptionGroup::optionLabel使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CRM_Core_OptionGroup
的用法示例。
在下文中一共展示了CRM_Core_OptionGroup::optionLabel方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: view
/**
* View details of a note
*
* @return void
* @access public
*/
function view()
{
$note = new CRM_Core_DAO_Note();
$note->id = $this->_id;
if ($note->find(true)) {
$values = array();
CRM_Core_DAO::storeValues($note, $values);
$values['privacy'] = CRM_Core_OptionGroup::optionLabel('note_privacy', $values['privacy']);
$this->assign('note', $values);
}
$comments = CRM_Core_BAO_Note::getNoteTree($values['id'], 1);
if (!empty($comments)) {
$this->assign('comments', $comments);
}
}
示例2: view
/**
* View details of a note
*
* @return void
* @access public
*/
function view()
{
$note = new CRM_Core_DAO_Note();
$note->id = $this->_id;
if ($note->find(TRUE)) {
$values = array();
CRM_Core_DAO::storeValues($note, $values);
$values['privacy'] = CRM_Core_OptionGroup::optionLabel('note_privacy', $values['privacy']);
$this->assign('note', $values);
}
$comments = CRM_Core_BAO_Note::getNoteTree($values['id'], 1);
if (!empty($comments)) {
$this->assign('comments', $comments);
}
// add attachments part
$currentAttachmentInfo = CRM_Core_BAO_File::getEntityFile('civicrm_note', $this->_id);
$this->assign('currentAttachmentInfo', $currentAttachmentInfo);
}
示例3: preProcess
/**
* Function to set variables up before form is built
*
* @return void
* @access public
*/
public function preProcess()
{
$config =& CRM_Core_Config::singleton();
parent::preProcess();
// lineItem isn't set until Register postProcess
$this->_lineItem = $this->get('lineItem');
if ($this->_contributeMode == 'express') {
// rfp == redirect from paypal
$rfp = CRM_Utils_Request::retrieve('rfp', 'Boolean', CRM_Core_DAO::$_nullObject, false, null, 'GET');
if ($rfp) {
require_once 'CRM/Core/Payment.php';
$payment =& CRM_Core_Payment::singleton($this->_mode, 'Contribute', $this->_paymentProcessor, $this);
$expressParams = $payment->getExpressCheckoutDetails($this->get('token'));
$this->_params['payer'] = $expressParams['payer'];
$this->_params['payer_id'] = $expressParams['payer_id'];
$this->_params['payer_status'] = $expressParams['payer_status'];
require_once 'CRM/Core/Payment/Form.php';
CRM_Core_Payment_Form::mapParams($this->_bltID, $expressParams, $this->_params, false);
// fix state and country id if present
if (!empty($this->_params["billing_state_province_id-{$this->_bltID}"]) && $this->_params["billing_state_province_id-{$this->_bltID}"]) {
$this->_params["billing_state_province-{$this->_bltID}"] = CRM_Core_PseudoConstant::stateProvinceAbbreviation($this->_params["billing_state_province_id-{$this->_bltID}"]);
}
if (!empty($this->_params["billing_country_id-{$this->_bltID}"]) && $this->_params["billing_country_id-{$this->_bltID}"]) {
$this->_params["billing_country-{$this->_bltID}"] = CRM_Core_PseudoConstant::countryIsoCode($this->_params["billing_country_id-{$this->_bltID}"]);
}
// set a few other parameters for PayPal
$this->_params['token'] = $this->get('token');
$this->_params['amount'] = $this->get('amount');
// we use this here to incorporate any changes made by folks in hooks
$this->_params['currencyID'] = $config->defaultCurrency;
$this->_params['payment_action'] = 'Sale';
// also merge all the other values from the profile fields
$values = $this->controller->exportValues('Main');
$skipFields = array('amount', 'amount_other', "billing_street_address-{$this->_bltID}", "billing_city-{$this->_bltID}", "billing_state_province_id-{$this->_bltID}", "billing_postal_code-{$this->_bltID}", "billing_country_id-{$this->_bltID}");
foreach ($values as $name => $value) {
// skip amount field
if (!in_array($name, $skipFields)) {
$this->_params[$name] = $value;
}
}
$this->set('getExpressCheckoutDetails', $this->_params);
} else {
$this->_params = $this->get('getExpressCheckoutDetails');
}
} else {
$this->_params = $this->controller->exportValues('Main');
if (!empty($this->_params["billing_state_province_id-{$this->_bltID}"])) {
$this->_params["billing_state_province-{$this->_bltID}"] = CRM_Core_PseudoConstant::stateProvinceAbbreviation($this->_params["billing_state_province_id-{$this->_bltID}"]);
}
if (!empty($this->_params["billing_country_id-{$this->_bltID}"])) {
$this->_params["billing_country-{$this->_bltID}"] = CRM_Core_PseudoConstant::countryIsoCode($this->_params["billing_country_id-{$this->_bltID}"]);
}
if (isset($this->_params['credit_card_exp_date'])) {
$this->_params['year'] = $this->_params['credit_card_exp_date']['Y'];
$this->_params['month'] = $this->_params['credit_card_exp_date']['M'];
}
$this->_params['ip_address'] = $_SERVER['REMOTE_ADDR'];
// hack for safari
if ($this->_params['ip_address'] == '::1') {
$this->_params['ip_address'] = '127.0.0.1';
}
$this->_params['amount'] = $this->get('amount');
if ($this->_params['amount']) {
require_once 'CRM/Core/OptionGroup.php';
$this->_params['amount_level'] = CRM_Core_OptionGroup::optionLabel("civicrm_contribution_page.amount.{$this->_id}", $this->_params['amount']);
}
$this->_params['currencyID'] = $config->defaultCurrency;
$this->_params['payment_action'] = 'Sale';
}
// if onbehalf-of-organization
if (CRM_Utils_Array::value('is_for_organization', $this->_params)) {
if (CRM_Utils_Array::value('org_option', $this->_params) && CRM_Utils_Array::value('organization_id', $this->_params)) {
if (CRM_Utils_Array::value('onbehalfof_id', $this->_params)) {
$this->_params['organization_id'] = $this->_params['onbehalfof_id'];
}
}
if (!empty($this->_params['address'][1]['country_id'])) {
$this->_params['address'][1]['country'] = CRM_Core_PseudoConstant::countryIsoCode($this->_params['address'][1]['country_id']);
}
if (!empty($this->_params['address'][1]['state_province_id'])) {
$this->_params['address'][1]['state_province'] = CRM_Core_PseudoConstant::stateProvinceAbbreviation($this->_params['address'][1]['state_province_id']);
}
// hardcode blocks for now. We might shift to generalized model in 3.1 which uses profiles
foreach (array('phone', 'email', 'address') as $loc) {
$this->_params['onbehalf_location'][$loc] = $this->_params[$loc];
unset($this->_params[$loc]);
}
} else {
if (CRM_Utils_Array::value('is_for_organization', $this->_values)) {
// no on behalf of an organization, CRM-5519
// so reset loc blocks from main params.
foreach (array('phone', 'email', 'address') as $blk) {
if (isset($this->_params[$blk])) {
unset($this->_params[$blk]);
//.........这里部分代码省略.........
示例4: run
function run()
{
if (empty($_REQUEST['group_id'])) {
$this->assign('status', 'error');
} else {
$group_id = (int) $_REQUEST['group_id'];
$this->assign('txgid', $group_id);
$txgroup = civicrm_api('SepaTransactionGroup', 'getsingle', array('id' => $group_id, 'version' => 3));
if (empty($txgroup['is_error'])) {
$txgroup['status_label'] = CRM_Core_OptionGroup::optionLabel('batch_status', $txgroup['status_id']);
$txgroup['status_name'] = CRM_Core_OptionGroup::getValue('batch_status', $txgroup['status_id'], 'value', 'String', 'name');
$this->assign('txgroup', $txgroup);
} else {
$_REQUEST['confirmed'] = 'error';
// skip the parts below
}
if (empty($_REQUEST['confirmed'])) {
// gather information to display
$PENDING = (int) CRM_Core_OptionGroup::getValue('contribution_status', 'Pending', 'name');
$INPROGRESS = (int) CRM_Core_OptionGroup::getValue('contribution_status', 'In Progress', 'name');
$stats = array('busy' => 0, 'open' => 0, 'other' => 0, 'total' => 0);
$status2contributions = $this->contributionStats($group_id);
foreach ($status2contributions as $contribution_status_id => $contributions) {
foreach ($contributions as $contribution_id) {
$stats['total'] += 1;
if ($contribution_status_id == $PENDING) {
$stats['open'] += 1;
} elseif ($contribution_status_id == $INPROGRESS) {
$stats['busy'] += 1;
} else {
$stats['other'] += 1;
}
}
}
$this->assign('stats', $stats);
$this->assign('status', 'unconfirmed');
$this->assign('submit_url', CRM_Utils_System::url('civicrm/sepa/deletegroup'));
} elseif ($_REQUEST['confirmed'] == 'yes') {
// delete the group
$this->assign('status', 'done');
$delete_contributions_mode = $_REQUEST['delete_contents'];
$deleted_ok = array();
$deleted_error = array();
$result = CRM_Sepa_BAO_SEPATransactionGroup::deleteGroup($group_id, $delete_contributions_mode);
if (is_string($result)) {
// a very basic error happened
$this->assign('error', $result);
} else {
// do some stats on the result
$deleted_total = count($result);
foreach ($result as $contribution_id => $message) {
if ($message == 'ok') {
array_push($deleted_ok, $contribution_id);
} else {
array_push($deleted_error, $contribution_id);
}
}
$this->assign('deleted_result', $result);
$this->assign('deleted_ok', $deleted_ok);
$this->assign('deleted_error', $deleted_error);
}
} elseif ($_REQUEST['confirmed'] == 'error') {
$this->assign('status', 'error');
} else {
CRM_Utils_System::redirect(CRM_Utils_System::url('civicrm/sepa'));
}
}
parent::run();
}