当前位置: 首页>>代码示例>>PHP>>正文


PHP CRM_Core_PseudoConstant::getLabel方法代码示例

本文整理汇总了PHP中CRM_Core_PseudoConstant::getLabel方法的典型用法代码示例。如果您正苦于以下问题:PHP CRM_Core_PseudoConstant::getLabel方法的具体用法?PHP CRM_Core_PseudoConstant::getLabel怎么用?PHP CRM_Core_PseudoConstant::getLabel使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在CRM_Core_PseudoConstant的用法示例。


在下文中一共展示了CRM_Core_PseudoConstant::getLabel方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: testGetSoftContributionSelector

 /**
  * Test retrieve Soft Contribution through AJAX
  */
 public function testGetSoftContributionSelector()
 {
     $softTypes = array(3, 2, 5);
     $amounts = array('100', '600', '150');
     // create sample soft contribution for contact
     foreach ($this->_primaryContacts as $seq => $contactId) {
         $this->callAPISuccess('Contribution', 'create', array('contact_id' => $contactId, 'receive_date' => date('Ymd'), 'total_amount' => $amounts[$seq], 'financial_type_id' => 1, 'non_deductible_amount' => '10', 'contribution_status_id' => 1, 'soft_credit' => array('1' => array('contact_id' => $this->_softContactId, 'amount' => $amounts[$seq], 'soft_credit_type_id' => $softTypes[$seq]))));
     }
     $_GET = array_merge($this->_params, array('cid' => $this->_softContactId, 'context' => 'contribution'));
     $softCreditList = CRM_Contribute_Page_AJAX::getSoftContributionRows();
     foreach ($this->_fields as $columnName) {
         $_GET['columns'][] = array('data' => $columnName);
     }
     // get the results in descending order
     $_GET['order'] = array('0' => array('column' => 0, 'dir' => 'desc'));
     $amountSortedList = CRM_Contribute_Page_AJAX::getSoftContributionRows();
     $this->assertEquals(3, $softCreditList['recordsTotal']);
     $this->assertEquals(3, $amountSortedList['recordsTotal']);
     rsort($amounts);
     foreach ($amounts as $key => $amount) {
         $amount = CRM_Utils_Money::format($amount, 'USD');
         $this->assertEquals($amount, $amountSortedList['data'][$key]['amount']);
     }
     // sort with soft credit types
     $_GET['order'][0]['column'] = 1;
     foreach ($softTypes as $id) {
         $softLabels[] = CRM_Core_PseudoConstant::getLabel('CRM_Contribute_BAO_ContributionSoft', 'soft_credit_type_id', $id);
     }
     rsort($softLabels);
     $softTypeSortedList = CRM_Contribute_Page_AJAX::getSoftContributionRows();
     foreach ($softLabels as $key => $labels) {
         $this->assertEquals($labels, $softTypeSortedList['data'][$key]['sct_label']);
     }
 }
开发者ID:nielosz,项目名称:civicrm-core,代码行数:37,代码来源:AjaxTest.php

示例2: 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_PseudoConstant::getLabel('CRM_Core_BAO_Phone', 'phone_type_id', 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);
}
开发者ID:TheCraftyCanvas,项目名称:aegir-platforms,代码行数:39,代码来源:Domain.php

示例3: 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

示例4: view

 /**
  * View details of a note.
  */
 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_PseudoConstant::getLabel('CRM_Core_BAO_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);
 }
开发者ID:FundingWorks,项目名称:civicrm-core,代码行数:21,代码来源:Note.php

示例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');
         }
         // get contribution status label
         if (!empty($values['contribution_status_id'])) {
             $values['contribution_status'] = CRM_Core_PseudoConstant::getLabel('CRM_Contribute_BAO_ContributionRecur', 'contribution_status_id', $values['contribution_status_id']);
         }
         $this->assign('recur', $values);
     }
 }
开发者ID:FundingWorks,项目名称:civicrm-core,代码行数:21,代码来源:ContributionRecur.php

示例6: 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]);
             }
         }
         $this->assign('recur', $values);
     }
 }
开发者ID:konadave,项目名称:civicrm-core,代码行数:26,代码来源:ContributionRecur.php

示例7: array


//.........这里部分代码省略.........
                 $names[] = $field['name'];
             }
         }
     }
     $multipleSelectFields = array('preferred_communication_method' => 1);
     $multiRecordTableId = NULL;
     if ($this->_multiRecordTableName) {
         $multiRecordTableId = "{$this->_multiRecordTableName}_id";
     }
     // we need to determine of overlay profile should be shown
     $showProfileOverlay = CRM_Core_BAO_UFGroup::showOverlayProfile();
     while ($result->fetch()) {
         $this->_query->convertToPseudoNames($result);
         if (isset($result->country)) {
             // the query returns the untranslated country name
             $i18n = CRM_Core_I18n::singleton();
             $result->country = $i18n->translate($result->country);
         }
         $row = array();
         $empty = TRUE;
         $row[] = CRM_Contact_BAO_Contact_Utils::getImage($result->contact_sub_type ? $result->contact_sub_type : $result->contact_type, FALSE, $result->contact_id, $showProfileOverlay);
         if ($result->sort_name) {
             $row[] = $result->sort_name;
             $empty = FALSE;
         } else {
             continue;
         }
         foreach ($names as $name) {
             if ($cfID = CRM_Core_BAO_CustomField::getKeyID($name)) {
                 $row[] = CRM_Core_BAO_CustomField::getDisplayValue($result->{$name}, $cfID, $this->_options, $result->contact_id);
             } elseif (substr($name, -4) == '-url' && !empty($result->{$name})) {
                 $url = CRM_Utils_System::fixURL($result->{$name});
                 $typeId = substr($name, 0, -4) . "-website_type_id";
                 $typeName = CRM_Core_PseudoConstant::getLabel('CRM_Core_DAO_Website', 'website_type_id', $result->{$typeId});
                 if ($typeName) {
                     $row[] = "<a href=\"{$url}\">{$result->{$name}} ({$typeName})</a>";
                 } else {
                     $row[] = "<a href=\"{$url}\">{$result->{$name}}</a>";
                 }
             } elseif ($name == 'preferred_language') {
                 $row[] = CRM_Core_PseudoConstant::getLabel('CRM_Contact_DAO_Contact', 'preferred_language', $result->{$name});
             } elseif ($multipleSelectFields && array_key_exists($name, $multipleSelectFields)) {
                 $paramsNew = array($name => $result->{$name});
                 $name = array($name => array('newName' => $name, 'groupName' => $name));
                 CRM_Core_OptionGroup::lookupValues($paramsNew, $name, FALSE);
                 $row[] = $paramsNew[$key];
             } elseif (strpos($name, '-im')) {
                 if (!empty($result->{$name})) {
                     $providerId = $name . "-provider_id";
                     $providerName = CRM_Core_PseudoConstant::getLabel('CRM_Core_DAO_IM', 'provider_id', $result->{$providerId});
                     $row[] = $result->{$name} . " ({$providerName})";
                 } else {
                     $row[] = '';
                 }
             } elseif (strpos($name, '-phone-')) {
                 $phoneExtField = str_replace('phone', 'phone_ext', $name);
                 if (isset($result->{$phoneExtField})) {
                     $row[] = $result->{$name} . " (" . $result->{$phoneExtField} . ")";
                 } else {
                     $row[] = $result->{$name};
                 }
             } elseif (in_array($name, array('addressee', 'email_greeting', 'postal_greeting'))) {
                 $dname = $name . '_display';
                 $row[] = $result->{$dname};
             } elseif (in_array($name, array('birth_date', 'deceased_date'))) {
                 $row[] = CRM_Utils_Date::customFormat($result->{$name});
开发者ID:archcidburnziso,项目名称:civicrm-core,代码行数:67,代码来源:Listings.php

示例8: getFinancialTransactionsList

 /**
  * Get output of financial transactions.
  *
  * @param bool $return
  *   Return result. This parameter allows the output to be unit tested.
  *
  * @return string
  */
 public static function getFinancialTransactionsList($return = FALSE)
 {
     $sortMapper = array(0 => '', 1 => '', 2 => 'sort_name', 3 => 'amount', 4 => 'trxn_id', 5 => 'transaction_date', 6 => 'payment_method', 7 => 'status', 8 => 'name');
     $sEcho = CRM_Utils_Type::escape($_REQUEST['sEcho'], 'Integer');
     $return = isset($_REQUEST['return']) ? CRM_Utils_Type::escape($_REQUEST['return'], 'Boolean') : FALSE;
     $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;
     $entityID = isset($_REQUEST['entityID']) ? CRM_Utils_Type::escape($_REQUEST['entityID'], 'String') : NULL;
     $notPresent = isset($_REQUEST['notPresent']) ? CRM_Utils_Type::escape($_REQUEST['notPresent'], 'String') : NULL;
     $statusID = isset($_REQUEST['statusID']) ? CRM_Utils_Type::escape($_REQUEST['statusID'], 'String') : NULL;
     $search = isset($_REQUEST['search']) ? TRUE : FALSE;
     $params = $_POST;
     if ($sort && $sortOrder) {
         $params['sortBy'] = $sort . ' ' . $sortOrder;
     }
     $returnvalues = array('civicrm_financial_trxn.payment_instrument_id as payment_method', 'civicrm_contribution.contact_id as contact_id', 'civicrm_contribution.id as contributionID', 'contact_a.sort_name', 'civicrm_financial_trxn.total_amount as amount', 'civicrm_financial_trxn.trxn_id as trxn_id', 'contact_a.contact_type', 'contact_a.contact_sub_type', 'civicrm_financial_trxn.trxn_date as transaction_date', 'name', 'civicrm_contribution.currency as currency', 'civicrm_financial_trxn.status_id as status', 'civicrm_financial_trxn.check_number as check_number');
     $columnHeader = array('contact_type' => '', 'sort_name' => ts('Contact Name'), 'amount' => ts('Amount'), 'trxn_id' => ts('Trxn ID'), 'transaction_date' => ts('Received'), 'payment_method' => ts('Payment Method'), 'status' => ts('Status'), 'name' => ts('Type'));
     if ($sort && $sortOrder) {
         $params['sortBy'] = $sort . ' ' . $sortOrder;
     }
     $params['page'] = $offset / $rowCount + 1;
     $params['rp'] = $rowCount;
     $params['context'] = $context;
     $params['offset'] = ($params['page'] - 1) * $params['rp'];
     $params['rowCount'] = $params['rp'];
     $params['sort'] = CRM_Utils_Array::value('sortBy', $params);
     $params['total'] = 0;
     // get batch list
     if (isset($notPresent)) {
         $financialItem = CRM_Batch_BAO_Batch::getBatchFinancialItems($entityID, $returnvalues, $notPresent, $params);
         if ($search) {
             $unassignedTransactions = CRM_Batch_BAO_Batch::getBatchFinancialItems($entityID, $returnvalues, $notPresent, $params, TRUE);
         } else {
             $unassignedTransactions = CRM_Batch_BAO_Batch::getBatchFinancialItems($entityID, $returnvalues, $notPresent, NULL, TRUE);
         }
         while ($unassignedTransactions->fetch()) {
             $unassignedTransactionsCount[] = $unassignedTransactions->id;
         }
         if (!empty($unassignedTransactionsCount)) {
             $params['total'] = count($unassignedTransactionsCount);
         }
     } else {
         $financialItem = CRM_Batch_BAO_Batch::getBatchFinancialItems($entityID, $returnvalues, NULL, $params);
         $assignedTransactions = CRM_Batch_BAO_Batch::getBatchFinancialItems($entityID, $returnvalues);
         while ($assignedTransactions->fetch()) {
             $assignedTransactionsCount[] = $assignedTransactions->id;
         }
         if (!empty($assignedTransactionsCount)) {
             $params['total'] = count($assignedTransactionsCount);
         }
     }
     $financialitems = array();
     while ($financialItem->fetch()) {
         $row[$financialItem->id] = array();
         foreach ($columnHeader as $columnKey => $columnValue) {
             if ($financialItem->contact_sub_type && $columnKey == 'contact_type') {
                 $row[$financialItem->id][$columnKey] = $financialItem->contact_sub_type;
                 continue;
             }
             $row[$financialItem->id][$columnKey] = $financialItem->{$columnKey};
             if ($columnKey == 'sort_name' && $financialItem->{$columnKey}) {
                 $url = CRM_Utils_System::url('civicrm/contact/view', "reset=1&cid=" . $financialItem->contact_id);
                 $row[$financialItem->id][$columnKey] = '<a href=' . $url . '>' . $financialItem->{$columnKey} . '</a>';
             } elseif ($columnKey == 'payment_method' && $financialItem->{$columnKey}) {
                 $row[$financialItem->id][$columnKey] = CRM_Core_PseudoConstant::getLabel('CRM_Batch_BAO_Batch', 'payment_instrument_id', $financialItem->{$columnKey});
                 if ($row[$financialItem->id][$columnKey] == 'Check') {
                     $checkNumber = $financialItem->check_number ? ' (' . $financialItem->check_number . ')' : '';
                     $row[$financialItem->id][$columnKey] = $row[$financialItem->id][$columnKey] . $checkNumber;
                 }
             } elseif ($columnKey == 'amount' && $financialItem->{$columnKey}) {
                 $row[$financialItem->id][$columnKey] = CRM_Utils_Money::format($financialItem->{$columnKey}, $financialItem->currency);
             } elseif ($columnKey == 'transaction_date' && $financialItem->{$columnKey}) {
                 $row[$financialItem->id][$columnKey] = CRM_Utils_Date::customFormat($financialItem->{$columnKey});
             } elseif ($columnKey == 'status' && $financialItem->{$columnKey}) {
                 $row[$financialItem->id][$columnKey] = CRM_Core_PseudoConstant::getLabel('CRM_Contribute_BAO_Contribution', 'contribution_status_id', $financialItem->{$columnKey});
             }
         }
         if ($statusID == CRM_Core_OptionGroup::getValue('batch_status', 'Open')) {
             if (isset($notPresent)) {
                 $js = "enableActions('x')";
                 $row[$financialItem->id]['check'] = "<input type='checkbox' id='mark_x_" . $financialItem->id . "' name='mark_x_" . $financialItem->id . "' value='1' onclick={$js}></input>";
                 $row[$financialItem->id]['action'] = CRM_Core_Action::formLink(CRM_Financial_Form_BatchTransaction::links(), NULL, array('id' => $financialItem->id, 'contid' => $financialItem->contributionID, 'cid' => $financialItem->contact_id), ts('more'), FALSE, 'financialItem.batch.row', 'FinancialItem', $financialItem->id);
             } else {
                 $js = "enableActions('y')";
                 $row[$financialItem->id]['check'] = "<input type='checkbox' id='mark_y_" . $financialItem->id . "' name='mark_y_" . $financialItem->id . "' value='1' onclick={$js}></input>";
                 $row[$financialItem->id]['action'] = CRM_Core_Action::formLink(CRM_Financial_Page_BatchTransaction::links(), NULL, array('id' => $financialItem->id, 'contid' => $financialItem->contributionID, 'cid' => $financialItem->contact_id), ts('more'), FALSE, 'financialItem.batch.row', 'FinancialItem', $financialItem->id);
             }
         } else {
             $row[$financialItem->id]['check'] = NULL;
//.........这里部分代码省略.........
开发者ID:rollox,项目名称:civicrm-core,代码行数:101,代码来源:AJAX.php

示例9: getOptionLabels

 /**
  * Populate option labels for this object's fields.
  *
  * @throws exception if called directly on the base class
  */
 public function getOptionLabels()
 {
     $fields = $this->fields();
     if ($fields === NULL) {
         throw new Exception('Cannot call getOptionLabels on CRM_Core_DAO');
     }
     foreach ($fields as $field) {
         $name = CRM_Utils_Array::value('name', $field);
         if ($name && isset($this->{$name})) {
             $label = CRM_Core_PseudoConstant::getLabel(get_class($this), $name, $this->{$name});
             if ($label !== FALSE) {
                 // Append 'label' onto the field name
                 $labelName = $name . '_label';
                 $this->{$labelName} = $label;
             }
         }
     }
 }
开发者ID:konadave,项目名称:civicrm-core,代码行数:23,代码来源:DAO.php

示例10: alterDisplay

 /**
  * @param $rows
  */
 function alterDisplay(&$rows)
 {
     // custom code to alter rows
     $entryFound = FALSE;
     foreach ($rows as $rowNum => $row) {
         if (array_key_exists('civicrm_grant_grant_type_id', $row)) {
             if ($value = $row['civicrm_grant_grant_type_id']) {
                 $rows[$rowNum]['civicrm_grant_grant_type_id'] = CRM_Core_PseudoConstant::getLabel('CRM_Grant_DAO_Grant', 'grant_type_id', $value);
             }
             $entryFound = TRUE;
         }
         if (array_key_exists('civicrm_grant_status_id', $row)) {
             if ($value = $row['civicrm_grant_status_id']) {
                 $rows[$rowNum]['civicrm_grant_status_id'] = CRM_Core_PseudoConstant::getLabel('CRM_Grant_DAO_Grant', 'status_id', $value);
             }
             $entryFound = TRUE;
         }
         if (array_key_exists('civicrm_grant_grant_report_received', $row)) {
             if ($value = $row['civicrm_grant_grant_report_received']) {
                 if ($value == 1) {
                     $value = 'Yes';
                 } else {
                     $value = 'No';
                 }
                 $rows[$rowNum]['civicrm_grant_grant_report_received'] = $value;
             }
             $entryFound = TRUE;
         }
         if (!$entryFound) {
             break;
         }
     }
 }
开发者ID:rajeshrhino,项目名称:civicrm-core,代码行数:36,代码来源:Grant.php

示例11: _civicrm_api3_uf_group_getlist_output

/**
 * Format getlist output
 *
 * @see _civicrm_api3_generic_getlist_output
 *
 * @param array $result
 * @param array $request
 * @param string $entity
 * @param array $fields
 *
 * @return array
 */
function _civicrm_api3_uf_group_getlist_output($result, $request, $entity, $fields)
{
    $output = array();
    if (!empty($result['values'])) {
        foreach ($result['values'] as $row) {
            $data = array('id' => $row[$request['id_field']], 'label' => $row[$request['label_field']]);
            if (!empty($request['description_field'])) {
                $data['description'] = array();
                foreach ((array) $request['description_field'] as $field) {
                    if (!empty($row[$field])) {
                        // Special formatting for group_type field
                        if ($field == 'group_type') {
                            $groupTypes = CRM_UF_Page_Group::extractGroupTypes($row[$field]);
                            $data['description'][] = CRM_UF_Page_Group::formatGroupTypes($groupTypes);
                            continue;
                        }
                        if (!isset($fields[$field]['pseudoconstant'])) {
                            $data['description'][] = $row[$field];
                        } else {
                            $data['description'][] = CRM_Core_PseudoConstant::getLabel(_civicrm_api3_get_BAO($entity), $field, $row[$field]);
                        }
                    }
                }
            }
            if (!empty($request['image_field'])) {
                $data['image'] = isset($row[$request['image_field']]) ? $row[$request['image_field']] : '';
            }
            $output[] = $data;
        }
    }
    return $output;
}
开发者ID:FundingWorks,项目名称:civicrm-core,代码行数:44,代码来源:UFGroup.php

示例12: getContactTokenReplacement

 /**
  * @param $token
  * @param $contact
  * @param bool $html
  * @param bool $returnBlankToken
  * @param bool $escapeSmarty
  *
  * @return bool|mixed|null|string
  */
 public static function getContactTokenReplacement($token, &$contact, $html = FALSE, $returnBlankToken = FALSE, $escapeSmarty = FALSE)
 {
     if (self::$_tokens['contact'] == NULL) {
         /* This should come from UF */
         self::$_tokens['contact'] = array_merge(array_keys(CRM_Contact_BAO_Contact::exportableFields('All')), array('checksum', 'contact_id'));
     }
     // Construct value from $token and $contact
     $value = NULL;
     $noReplace = FALSE;
     // Support legacy tokens
     $token = CRM_Utils_Array::value($token, self::legacyContactTokens(), $token);
     // check if the token we were passed is valid
     // we have to do this because this function is
     // called only when we find a token in the string
     if (!in_array($token, self::$_tokens['contact'])) {
         $noReplace = TRUE;
     } elseif ($token == 'checksum') {
         $hash = CRM_Utils_Array::value('hash', $contact);
         $contactID = CRM_Utils_Array::retrieveValueRecursive($contact, 'contact_id');
         $cs = CRM_Contact_BAO_Contact_Utils::generateChecksum($contactID, NULL, NULL, $hash);
         $value = "cs={$cs}";
     } else {
         $value = CRM_Utils_Array::retrieveValueRecursive($contact, $token);
         // FIXME: for some pseudoconstants we get array ( 0 => id, 1 => label )
         if (is_array($value)) {
             $value = $value[1];
         } elseif ($value && is_numeric($value)) {
             $allFields = CRM_Contact_BAO_Contact::exportableFields('All');
             if (!empty($allFields[$token]['pseudoconstant'])) {
                 $value = CRM_Core_PseudoConstant::getLabel('CRM_Contact_BAO_Contact', $token, $value);
             }
         }
     }
     if (!$html) {
         $value = str_replace('&amp;', '&', $value);
     }
     // if null then return actual token
     if ($returnBlankToken && !$value) {
         $noReplace = TRUE;
     }
     if ($noReplace) {
         $value = "{contact.{$token}}";
     }
     if ($escapeSmarty && !($returnBlankToken && $noReplace)) {
         // $returnBlankToken means the caller wants to do further attempts at
         // processing unreplaced tokens -- so don't escape them yet in this case.
         $value = self::tokenEscapeSmarty($value);
     }
     return $value;
 }
开发者ID:rameshrr99,项目名称:civicrm-core,代码行数:59,代码来源:Token.php

示例13: whereClauseSingle


//.........这里部分代码省略.........
             return;
         case 'case_source_contact_id':
             $query->_where[$grouping][] = CRM_Contact_BAO_Query::buildClause("civicrm_case_reporter.sort_name", $op, $value, 'String');
             $query->_qill[$grouping][] = ts("Activity Reporter %1 '%2'", array(1 => $op, 2 => $value));
             $query->_tables['case_activity'] = $query->_whereTables['case_activity'] = 1;
             $query->_tables['civicrm_case_reporter'] = $query->_whereTables['civicrm_case_reporter'] = 1;
             $query->_tables['civicrm_case'] = $query->_whereTables['civicrm_case'] = 1;
             $query->_tables['civicrm_case_contact'] = $query->_whereTables['civicrm_case_contact'] = 1;
             return;
         case 'case_recent_activity_date':
             $date = CRM_Utils_Date::format($value);
             $query->_where[$grouping][] = CRM_Contact_BAO_Query::buildClause("case_activity.activity_date_time", $op, $date, 'Date');
             if ($date) {
                 $date = CRM_Utils_Date::customFormat($date);
                 $query->_qill[$grouping][] = ts("Activity Actual Date %1 %2", array(1 => $op, 2 => $date));
             }
             $query->_tables['case_activity'] = $query->_whereTables['case_activity'] = 1;
             $query->_tables['civicrm_case'] = $query->_whereTables['civicrm_case'] = 1;
             $query->_tables['civicrm_case_contact'] = $query->_whereTables['civicrm_case_contact'] = 1;
             return;
         case 'case_scheduled_activity_date':
             $date = CRM_Utils_Date::format($value);
             $query->_where[$grouping][] = CRM_Contact_BAO_Query::buildClause("case_activity.activity_date_time", $op, $date, 'Date');
             if ($date) {
                 $date = CRM_Utils_Date::customFormat($date);
                 $query->_qill[$grouping][] = ts("Activity Schedule Date %1 %2", array(1 => $op, 2 => $date));
             }
             $query->_tables['case_activity'] = $query->_whereTables['case_activity'] = 1;
             $query->_tables['civicrm_case'] = $query->_whereTables['civicrm_case'] = 1;
             $query->_tables['civicrm_case_contact'] = $query->_whereTables['civicrm_case_contact'] = 1;
             return;
         case 'case_recent_activity_type':
             $names = $value;
             if (($activityType = CRM_Core_PseudoConstant::getLabel('CRM_Activity_BAO_Activity', 'activity_type_id', $value)) != FALSE) {
                 $names = $activityType;
             }
             $query->_where[$grouping][] = CRM_Contact_BAO_Query::buildClause("case_activity.activity_type_id", $op, $value, 'Int');
             $query->_qill[$grouping][] = ts("Activity Type %1 %2", array(1 => $op, 2 => $names));
             $query->_tables['case_activity'] = $query->_whereTables['case_activity'] = 1;
             $query->_tables['civicrm_case'] = $query->_whereTables['civicrm_case'] = 1;
             $query->_tables['case_activity_type'] = 1;
             $query->_tables['civicrm_case_contact'] = $query->_whereTables['civicrm_case_contact'] = 1;
             return;
         case 'case_activity_status_id':
             $names = $value;
             if (($activityStatus = CRM_Core_PseudoConstant::getLabel('CRM_Activity_BAO_Activity', 'status_id', $value)) != FALSE) {
                 $names = $activityStatus;
             }
             $query->_where[$grouping][] = CRM_Contact_BAO_Query::buildClause("case_activity.status_id", $op, $value, 'Int');
             $query->_qill[$grouping][] = ts("Activity Type %1 %2", array(1 => $op, 2 => $names));
             $query->_tables['case_activity'] = $query->_whereTables['case_activity'] = 1;
             $query->_tables['civicrm_case'] = $query->_whereTables['civicrm_case'] = 1;
             $query->_tables['case_activity_status'] = 1;
             $query->_tables['civicrm_case_contact'] = $query->_whereTables['civicrm_case_contact'] = 1;
             return;
         case 'case_activity_duration':
             $query->_where[$grouping][] = CRM_Contact_BAO_Query::buildClause("case_activity.duration", $op, $value, 'Int');
             $query->_qill[$grouping][] = ts("Activity Duration %1 %2", array(1 => $op, 2 => $value));
             $query->_tables['case_activity'] = $query->_whereTables['case_activity'] = 1;
             $query->_tables['civicrm_case'] = $query->_whereTables['civicrm_case'] = 1;
             $query->_tables['civicrm_case_contact'] = $query->_whereTables['civicrm_case_contact'] = 1;
             return;
         case 'case_activity_medium_id':
             $names = $value;
             if (($activityMedium = CRM_Core_PseudoConstant::getLabel('CRM_Activity_BAO_Activity', 'medium_id', $value)) != FALSE) {
                 $names = $activityMedium;
开发者ID:nielosz,项目名称:civicrm-core,代码行数:67,代码来源:Query.php

示例14: alterDisplay

 /**
  * Alter display of rows.
  *
  * Iterate through the rows retrieved via SQL and make changes for display purposes,
  * such as rendering contacts as links.
  *
  * @param array $rows
  *   Rows generated by SQL, with an array for each row.
  */
 public function alterDisplay(&$rows)
 {
     $entryFound = FALSE;
     $dispname_flag = $phone_flag = $email_flag = 0;
     $prev_email = $prev_dispname = $prev_phone = NULL;
     foreach ($rows as $rowNum => $row) {
         // Link constituent (contributor) to contribution detail
         if (array_key_exists('civicrm_contact_display_name_constituent', $row) && array_key_exists('civicrm_contact_id_constituent', $row)) {
             $url = CRM_Report_Utils_Report::getNextUrl('contribute/detail', 'reset=1&force=1&id_op=eq&id_value=' . $row['civicrm_contact_id_constituent'], $this->_absoluteUrl, $this->_id, $this->_drilldownReport);
             $rows[$rowNum]['civicrm_contact_display_name_constituent_link'] = $url;
             $rows[$rowNum]['civicrm_contact_display_name_constituent_hover'] = ts('List all direct contribution(s) from this contact.');
             $entryFound = TRUE;
         }
         // convert soft credit contact name to link
         if (array_key_exists('civicrm_contact_display_name_creditor', $row) && !empty($rows[$rowNum]['civicrm_contact_display_name_creditor']) && array_key_exists('civicrm_contact_id_creditor', $row)) {
             $url = CRM_Utils_System::url("civicrm/contact/view", 'reset=1&cid=' . $row['civicrm_contact_id_creditor'], $this->_absoluteUrl);
             $rows[$rowNum]['civicrm_contact_display_name_creditor_link'] = $url;
             $rows[$rowNum]['civicrm_contact_display_name_creditor_hover'] = ts("view contact summary");
         }
         // make subtotals look nicer
         if (array_key_exists('civicrm_contact_id_constituent', $row) && !$row['civicrm_contact_id_constituent']) {
             $this->fixSubTotalDisplay($rows[$rowNum], $this->_statFields);
             $entryFound = TRUE;
         }
         // convert campaign_id to campaign title
         if (array_key_exists('civicrm_contribution_campaign_id', $row)) {
             if ($value = $row['civicrm_contribution_campaign_id']) {
                 $rows[$rowNum]['civicrm_contribution_campaign_id'] = $this->activeCampaigns[$value];
                 $entryFound = TRUE;
             }
         }
         //convert soft_credit_type_id into label
         if (array_key_exists('civicrm_contribution_soft_soft_credit_type_id', $rows[$rowNum])) {
             $rows[$rowNum]['civicrm_contribution_soft_soft_credit_type_id'] = CRM_Core_PseudoConstant::getLabel('CRM_Contribute_BAO_ContributionSoft', 'soft_credit_type_id', $row['civicrm_contribution_soft_soft_credit_type_id']);
         }
         //handle gender
         if (array_key_exists('civicrm_contact_gender_id', $row)) {
             if ($value = $row['civicrm_contact_gender_id']) {
                 $gender = CRM_Core_PseudoConstant::get('CRM_Contact_DAO_Contact', 'gender_id');
                 $rows[$rowNum]['civicrm_contact_gender_id'] = $gender[$value];
             }
             $entryFound = TRUE;
         }
         // display birthday in the configured custom format
         if (array_key_exists('civicrm_contact_birth_date', $row)) {
             $birthDate = $row['civicrm_contact_birth_date'];
             if ($birthDate) {
                 $rows[$rowNum]['civicrm_contact_birth_date'] = CRM_Utils_Date::customFormat($birthDate, '%Y%m%d');
             }
             $entryFound = TRUE;
         }
         // skip looking further in rows, if first row itself doesn't
         // have the column we need
         if (!$entryFound) {
             break;
         }
     }
     $this->removeDuplicates($rows);
 }
开发者ID:rollox,项目名称:civicrm-core,代码行数:68,代码来源:SoftCredit.php

示例15: getValues

 /**
  * Fetch the object and store the values in the values array.
  *
  * @param array $params
  *   Input parameters to find object.
  * @param array $values
  *   Output values of the object.
  *
  * @return CRM_Contact_BAO_Contact|null
  *   The found object or null
  */
 public static function getValues(&$params, &$values)
 {
     $contact = new CRM_Contact_BAO_Contact();
     $contact->copyValues($params);
     if ($contact->find(TRUE)) {
         CRM_Core_DAO::storeValues($contact, $values);
         $privacy = array();
         foreach (self::$_commPrefs as $name) {
             if (isset($contact->{$name})) {
                 $privacy[$name] = $contact->{$name};
             }
         }
         if (!empty($privacy)) {
             $values['privacy'] = $privacy;
         }
         // communication Prefferance
         $preffComm = $comm = array();
         $comm = explode(CRM_Core_DAO::VALUE_SEPARATOR, $contact->preferred_communication_method);
         foreach ($comm as $value) {
             $preffComm[$value] = 1;
         }
         $temp = array('preferred_communication_method' => $contact->preferred_communication_method);
         $names = array('preferred_communication_method' => array('newName' => 'preferred_communication_method_display', 'groupName' => 'preferred_communication_method'));
         CRM_Core_OptionGroup::lookupValues($temp, $names, FALSE);
         $values['preferred_communication_method'] = $preffComm;
         $values['preferred_communication_method_display'] = CRM_Utils_Array::value('preferred_communication_method_display', $temp);
         $preferredMailingFormat = CRM_Core_SelectValues::pmf();
         $values['preferred_mail_format'] = $preferredMailingFormat[$contact->preferred_mail_format];
         // get preferred languages
         if (!empty($contact->preferred_language)) {
             $values['preferred_language'] = CRM_Core_PseudoConstant::getLabel('CRM_Contact_DAO_Contact', 'preferred_language', $contact->preferred_language);
         }
         // Calculating Year difference
         if ($contact->birth_date) {
             $birthDate = CRM_Utils_Date::customFormat($contact->birth_date, '%Y%m%d');
             if ($birthDate < date('Ymd')) {
                 $age = CRM_Utils_Date::calculateAge($birthDate);
                 $values['age']['y'] = CRM_Utils_Array::value('years', $age);
                 $values['age']['m'] = CRM_Utils_Array::value('months', $age);
             }
             list($values['birth_date']) = CRM_Utils_Date::setDateDefaults($contact->birth_date, 'birth');
             $values['birth_date_display'] = $contact->birth_date;
         }
         if ($contact->deceased_date) {
             list($values['deceased_date']) = CRM_Utils_Date::setDateDefaults($contact->deceased_date, 'birth');
             $values['deceased_date_display'] = $contact->deceased_date;
         }
         $contact->contact_id = $contact->id;
         return $contact;
     }
     return NULL;
 }
开发者ID:JSProffitt,项目名称:civicrm-website-org,代码行数:63,代码来源:Contact.php


注:本文中的CRM_Core_PseudoConstant::getLabel方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。