本文整理汇总了PHP中CRM_Core_OptionGroup::getLabel方法的典型用法代码示例。如果您正苦于以下问题:PHP CRM_Core_OptionGroup::getLabel方法的具体用法?PHP CRM_Core_OptionGroup::getLabel怎么用?PHP CRM_Core_OptionGroup::getLabel使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CRM_Core_OptionGroup
的用法示例。
在下文中一共展示了CRM_Core_OptionGroup::getLabel方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: 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);
}
示例2: preProcess
/**
* Function to set variables up before form is built
*
* @return void
* @access public
*/
public function preProcess()
{
$this->_contactID = $this->get('cid');
$this->_caseID = $this->get('id');
$this->assign('caseID', $this->_caseID);
$this->assign('contactID', $this->_contactID);
//retrieve details about case
$params = array('id' => $this->_caseID);
$returnProperties = array('case_type_id', 'subject', 'status_id', 'start_date');
CRM_Core_DAO::commonRetrieve('CRM_Case_BAO_Case', $params, $values, $returnProperties);
$values['case_type_id'] = explode(CRM_Case_BAO_Case::VALUE_SEPERATOR, CRM_Utils_Array::value('case_type_id', $values));
$statuses = CRM_Case_PseudoConstant::caseStatus();
$caseTypeName = CRM_Case_PseudoConstant::caseTypeName($this->_caseID);
$caseType = CRM_Core_OptionGroup::getLabel('case_type', $caseTypeName['id']);
$this->_caseDetails = array('case_type' => $caseType, 'case_status' => $statuses[$values['case_status_id']], 'case_subject' => CRM_Utils_Array::value('subject', $values), 'case_start_date' => $values['case_start_date']);
$this->_caseType = $caseTypeName['name'];
$this->assign('caseDetails', $this->_caseDetails);
$newActivityUrl = CRM_Utils_System::url('civicrm/case/activity', "action=add&reset=1&cid={$this->_contactID}&caseid={$this->_caseID}&atype=", false, null, false);
$this->assign('newActivityUrl', $newActivityUrl);
$reportUrl = CRM_Utils_System::url('civicrm/case/report', "reset=1&cid={$this->_contactID}&caseid={$this->_caseID}&asn=", false, null, false);
$this->assign('reportUrl', $reportUrl);
// add to recently viewed
require_once 'CRM/Utils/Recent.php';
require_once 'CRM/Contact/BAO/Contact.php';
$url = CRM_Utils_System::url('civicrm/contact/view/case', "action=view&reset=1&id={$this->_caseID}&cid={$this->_contactID}&context=home");
$displayName = CRM_Contact_BAO_Contact::displayName($this->_contactID);
$this->assign('displayName', $displayName);
$title = $displayName . ' - ' . $caseType;
// add the recently created case
CRM_Utils_Recent::add($title, $url, $this->_caseID, 'Case', $this->_contactID, null);
}
示例3: details
static function details($csID, $ssID = null, $gID = null)
{
$error = array(null, null, null);
if (!$csID && !$ssID && !$gID) {
return $error;
}
$customSearchID = $csID;
$formValues = array();
if ($ssID || $gID) {
if ($gID) {
$ssID = CRM_Core_DAO::getFieldValue('CRM_Contact_DAO_Group', $gID, 'saved_search_id');
}
$formValues = CRM_Contact_BAO_SavedSearch::getFormValues($ssID);
$customSearchID = CRM_Utils_Array::value('customSearchID', $formValues);
}
if (!$customSearchID) {
return $error;
}
// check that the csid exists in the db along with the right file
// and implements the right interface
require_once 'CRM/Core/OptionGroup.php';
$customSearchClass = CRM_Core_OptionGroup::getLabel('custom_search', $customSearchID);
if (!$customSearchClass) {
return $error;
}
$customSearchFile = str_replace('_', DIRECTORY_SEPARATOR, $customSearchClass) . '.php';
$error = (include_once $customSearchFile);
if ($error == false) {
CRM_Core_Error::fatal('Custom search file: ' . $customSearchFile . ' does not exist. Please verify your custom search settings in CiviCRM administrative panel.');
}
return array($customSearchID, $customSearchClass, $formValues);
}
示例4: civicrm_api3_campaign_expense_get
/**
* Get expenses
*
* function passed on to CRM_Financial_BAO_FinancialItem
*/
function civicrm_api3_campaign_expense_get($params)
{
$params['entity_table'] = 'civicrm_campaign';
$params['entity_id'] = $params['campaign_id'];
$reply = _civicrm_api3_basic_get(CRM_Financial_BAO_FinancialItem, $params);
// extract the encoded expense_type_id from description
if (isset($reply['values'])) {
$values = $reply['values'];
// copy array so we can modify while iterating
foreach ($values as $expense_id => $expense) {
if (!empty($expense['description'])) {
$parts = explode(":", $expense['description'], 2);
if (count($parts) > 1) {
$reply['values'][$expense_id]['expense_type_id'] = $parts[0];
$reply['values'][$expense_id]['description'] = $parts[1];
} else {
$reply['values'][$expense_id]['expense_type_id'] = 1;
// TODO: use default?
$reply['values'][$expense_id]['description'] = $expense['description'];
}
} else {
$reply['values'][$expense_id]['expense_type_id'] = 1;
// TODO: use default?
$reply['values'][$expense_id]['description'] = '';
}
$reply['values'][$expense_id]['expense_type'] = CRM_Core_OptionGroup::getLabel('campaign_expense_types', $reply['values'][$expense_id]['expense_type_id']);
}
}
return $reply;
}
示例5: view
/**
* View details of a recurring contribution.
*/
public function view()
{
$recur = new CRM_Contribute_DAO_ContributionRecur();
$recur->id = $this->_id;
if ($recur->find(TRUE)) {
$values = array();
CRM_Core_DAO::storeValues($recur, $values);
// if there is a payment processor ID, get the name of the payment processor
if (!empty($values['payment_processor_id'])) {
$values['payment_processor'] = CRM_Core_DAO::getFieldValue('CRM_Financial_DAO_PaymentProcessor', $values['payment_processor_id'], 'name');
}
$idFields = array('contribution_status_id', 'campaign_id');
if (CRM_Contribute_BAO_ContributionRecur::supportsFinancialTypeChange($values['id'])) {
$idFields[] = 'financial_type_id';
}
foreach ($idFields as $idField) {
if (!empty($values[$idField])) {
$values[substr($idField, 0, -3)] = CRM_Core_PseudoConstant::getLabel('CRM_Contribute_BAO_ContributionRecur', $idField, $values[$idField]);
}
}
// Get financial type name
if (!empty($values['financial_type_id'])) {
$values['financial_type_name'] = CRM_Core_PseudoConstant::getLabel('CRM_Contribute_BAO_Contribution', 'financial_type_id', $values['financial_type_id']);
}
// Get Paid By label
if (!empty($values['payment_instrument_id'])) {
$values['payment_instrument'] = CRM_Core_OptionGroup::getLabel('payment_instrument', $values['payment_instrument_id']);
}
$this->assign('recur', $values);
$this->assign('customDataType', 'ContributionRecur');
$groupTree = CRM_Core_BAO_CustomGroup::getTree('ContributionRecur', $this, $this->_id);
CRM_Core_BAO_CustomGroup::buildCustomDataView($this, $groupTree);
}
}
开发者ID:Kajakaran,项目名称:uk.co.vedaconsulting.offlinerecurringcontributions,代码行数:37,代码来源:ContributionRecur.php
示例6: buildQuickForm
static function buildQuickForm(&$form)
{
require_once 'CRM/Case/PseudoConstant.php';
$form->_caseStatus = CRM_Case_PseudoConstant::caseStatus();
$form->_defaultCaseStatus = CRM_Core_DAO::getFieldValue('CRM_Case_DAO_Case', $form->_caseId, 'status_id');
if (!array_key_exists($form->_defaultCaseStatus, $form->_caseStatus)) {
$form->_caseStatus[$form->_defaultCaseStatus] = CRM_Core_OptionGroup::getLabel('case_status', $form->_defaultCaseStatus, false);
}
$form->add('select', 'case_status_id', ts('Case Status'), $form->_caseStatus, true);
}
示例7: buildQuickForm
static function buildQuickForm(&$form)
{
$form->removeElement('status_id');
$form->removeElement('priority_id');
$form->_caseStatus = CRM_Case_PseudoConstant::caseStatus();
$form->_defaultCaseStatus = CRM_Core_DAO::getFieldValue('CRM_Case_DAO_Case', $form->_caseId, 'status_id');
if (!array_key_exists($form->_defaultCaseStatus, $form->_caseStatus)) {
$form->_caseStatus[$form->_defaultCaseStatus] = CRM_Core_OptionGroup::getLabel('case_status', $form->_defaultCaseStatus, FALSE);
}
$form->add('select', 'case_status_id', ts('Case Status'), $form->_caseStatus, TRUE);
}
示例8: testGetProjectContactById
/**
* Test simple get via API
*/
function testGetProjectContactById()
{
$relTypeId = CRM_Core_OptionGroup::getValue(CRM_Volunteer_BAO_ProjectContact::RELATIONSHIP_OPTION_GROUP, 'volunteer_owner', 'name');
$relTypeLabel = CRM_Core_OptionGroup::getLabel(CRM_Volunteer_BAO_ProjectContact::RELATIONSHIP_OPTION_GROUP, $relTypeId);
$dao = CRM_Core_DAO::createTestObject('CRM_Volunteer_BAO_ProjectContact', array('relationship_type_id' => $relTypeId));
$this->assertObjectHasAttribute('id', $dao, 'Failed to prepopulate Volunteer Project Contact');
$api = $this->callAPIAndDocument('VolunteerProjectContact', 'get', array('id' => $dao->id), __FUNCTION__, __FILE__);
// make sure the label and machine name are returned
$vpc = $api['values'][1];
$this->assertEquals('volunteer_owner', $vpc['relationship_type_name']);
$this->assertEquals($relTypeLabel, $vpc['relationship_type_label']);
}
示例9: buildQuickForm
static function buildQuickForm(&$form)
{
require_once 'CRM/Case/PseudoConstant.php';
$form->_caseType = CRM_Case_PseudoConstant::caseType();
$caseTypeId = explode(CRM_Case_BAO_Case::VALUE_SEPARATOR, CRM_Core_DAO::getFieldValue('CRM_Case_DAO_Case', $form->_caseId, 'case_type_id'));
$form->_caseTypeId = $caseTypeId[1];
if (!in_array($form->_caseTypeId, $form->_caseType)) {
$form->_caseType[$form->_caseTypeId] = CRM_Core_OptionGroup::getLabel('case_type', $form->_caseTypeId, false);
}
$form->add('select', 'case_type_id', ts('New Case Type'), $form->_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->addDateTime('reset_date_time', ts('Reset Start Date'), false, array('formatType' => 'activityDateTime'));
}
示例10: civicrm_domain_get
/**
* Generic file to retrieve all the constants and
* pseudo constants used in CiviCRM
*
*/
function civicrm_domain_get()
{
require_once 'CRM/Core/BAO/Domain.php';
$dao = CRM_Core_BAO_Domain::getDomain();
$values = array();
$params = array('entity_id' => $dao->id, 'entity_table' => 'civicrm_domain');
require_once 'CRM/Core/BAO/Location.php';
$values['location'] = CRM_Core_BAO_Location::getValues($params, 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');
require_once 'CRM/Core/OptionGroup.php';
$domain[$dao->id] = array('id' => $dao->id, 'domain_name' => $dao->name, 'description' => $dao->description, 'domain_email' => CRM_Utils_Array::value('email', $values['location']['email'][1]), '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])));
foreach ($address_array as $value) {
$domain[$dao->id]['domain_address'][$value] = CRM_Utils_Array::value($value, $values['location']['address'][1]);
}
list($domain[$dao->id]['from_name'], $domain[$dao->id]['from_email']) = CRM_Core_BAO_Domain::getNameAndEmail();
return $domain;
}
示例11: view
/**
* View details of a recurring contribution
*
* @return void
* @access public
*/
function view()
{
$recur = new CRM_Contribute_DAO_ContributionRecur();
$recur->id = $this->_id;
if ($recur->find(TRUE)) {
$values = array();
CRM_Core_DAO::storeValues($recur, $values);
// if there is a payment processor ID, get the name of the payment processor
if (!empty($values['payment_processor_id'])) {
$values['payment_processor'] = CRM_Core_DAO::getFieldValue('CRM_Financial_DAO_PaymentProcessor', $values['payment_processor_id'], 'name');
}
// get contribution status label
if (!empty($values['contribution_status_id'])) {
$values['contribution_status'] = CRM_Core_OptionGroup::getLabel('contribution_status', $values['contribution_status_id']);
}
$this->assign('recur', $values);
}
}
示例12: civicrm_api3_volunteer_need_get
/**
* Returns array of needs matching a set of one or more group properties
*
* @param array $params Array of one or more valid
* property_name=>value pairs. If $params is set
* as null, all needs will be returned
*
* @return array (referance) Array of matching needs
* {@getfields need_get}
* @access public
*/
function civicrm_api3_volunteer_need_get($params)
{
$result = _civicrm_api3_basic_get(_civicrm_api3_get_BAO(__FUNCTION__), $params);
if (!empty($result['values'])) {
foreach ($result['values'] as &$need) {
if (!empty($need['start_time'])) {
$need['display_time'] = CRM_Volunteer_BAO_Need::getTimes($need['start_time'], CRM_Utils_Array::value('duration', $need));
} else {
$need['display_time'] = ts('Flexible', array('domain' => 'org.civicrm.volunteer'));
}
if (isset($need['role_id'])) {
$need['role_label'] = CRM_Core_OptionGroup::getLabel(CRM_Volunteer_Upgrader::customOptionGroupName, $need['role_id']);
} elseif (CRM_Utils_Array::value('is_flexible', $need)) {
$need['role_label'] = CRM_Volunteer_BAO_Need::getFlexibleRoleLabel();
}
}
}
return $result;
}
示例13: userFriendlyConditionParams
/**
* Returns a user friendly text explaining the condition params
* e.g. 'Older than 65'
*
* @return string
* @access public
*/
public function userFriendlyConditionParams()
{
$return = '';
$params = $this->getActionParameters();
$type = CRM_Core_OptionGroup::getLabel('activity_type', $params['activity_type_id']);
$return .= ts("Type: %1", array(1 => $type));
$status = CRM_Core_OptionGroup::getLabel('activity_status', $params['status_id']);
$return .= "<br>";
$return .= ts("Status: %1", array(1 => $status));
$subject = $params['subject'];
if (!empty($subject)) {
$return .= "<br>";
$return .= ts("Subject: %1", array(1 => $subject));
}
if (!empty($params['assignee_contact_id'])) {
$assignee = civicrm_api3('Contact', 'getvalue', array('return' => 'display_name', 'id' => $params['assignee_contact_id']));
$return .= '<br>';
$return .= ts("Assignee: %1", array(1 => $assignee));
}
return $return;
}
示例14: buildQuickForm
/**
* @param CRM_Core_Form $form
*/
public static function buildQuickForm(&$form)
{
$form->removeElement('status_id');
$form->removeElement('priority_id');
$form->_caseStatus = CRM_Case_PseudoConstant::caseStatus();
foreach ($form->_caseId as $key => $val) {
$form->_oldCaseStatus[] = $form->_defaultCaseStatus[] = CRM_Core_DAO::getFieldValue('CRM_Case_DAO_Case', $val, 'status_id');
}
foreach ($form->_defaultCaseStatus as $keydefault => $valdefault) {
if (!array_key_exists($valdefault, $form->_caseStatus)) {
$form->_caseStatus[$valdefault] = CRM_Core_OptionGroup::getLabel('case_status', $valdefault, FALSE);
}
}
$element = $form->add('select', 'case_status_id', ts('Case Status'), $form->_caseStatus, TRUE);
// check if the case status id passed in url is a valid one, set as default and freeze
if (CRM_Utils_Request::retrieve('case_status_id', 'Positive', $form)) {
$caseStatusId = CRM_Utils_Request::retrieve('case_status_id', 'Positive', $form);
$caseStatus = CRM_Case_PseudoConstant::caseStatus();
$form->_defaultCaseStatus = array_key_exists($caseStatusId, $caseStatus) ? $caseStatusId : NULL;
$element->freeze();
}
}
示例15: details
/**
* @param int $csID
* @param int $ssID
* @param int $gID
*
* @return array
* @throws Exception
*/
public static function details($csID, $ssID = NULL, $gID = NULL)
{
$error = array(NULL, NULL, NULL);
if (!$csID && !$ssID && !$gID) {
return $error;
}
$customSearchID = $csID;
$formValues = array();
if ($ssID || $gID) {
if ($gID) {
$ssID = CRM_Core_DAO::getFieldValue('CRM_Contact_DAO_Group', $gID, 'saved_search_id');
}
$formValues = CRM_Contact_BAO_SavedSearch::getFormValues($ssID);
$customSearchID = CRM_Utils_Array::value('customSearchID', $formValues);
}
if (!$customSearchID) {
return $error;
}
// check that the csid exists in the db along with the right file
// and implements the right interface
$customSearchClass = CRM_Core_OptionGroup::getLabel('custom_search', $customSearchID);
if (!$customSearchClass) {
return $error;
}
$ext = CRM_Extension_System::singleton()->getMapper();
if (!$ext->isExtensionKey($customSearchClass)) {
$customSearchFile = str_replace('_', DIRECTORY_SEPARATOR, $customSearchClass) . '.php';
} else {
$customSearchFile = $ext->keyToPath($customSearchClass);
$customSearchClass = $ext->keyToClass($customSearchClass);
}
$error = (include_once $customSearchFile);
if ($error == FALSE) {
CRM_Core_Error::fatal('Custom search file: ' . $customSearchFile . ' does not exist. Please verify your custom search settings in CiviCRM administrative panel.');
}
return array($customSearchID, $customSearchClass, $formValues);
}