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


PHP CRM_Contribute_BAO_Contribution_Utils::getFirstLastDetails方法代码示例

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


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

示例1: alterDisplay

 /**
  * @param $rows
  */
 function alterDisplay(&$rows)
 {
     require_once 'CRM/Contribute/BAO/Contribution/Utils.php';
     require_once 'CRM/Utils/Money.php';
     require_once 'CRM/Utils/Date.php';
     $config =& CRM_Core_Config::singleton();
     // custom code to alter rows
     $checkList = array();
     $entryFound = FALSE;
     $display_flag = $prev_cid = $cid = 0;
     $contributionTypes = CRM_Contribute_PseudoConstant::contributionType();
     foreach ($rows as $rowNum => $row) {
         if (!empty($this->_noRepeats) && $this->_outputMode != 'csv') {
             // don't repeat contact details if its same as the previous row
             if (array_key_exists('civicrm_contact_id', $row)) {
                 if ($cid = $row['civicrm_contact_id']) {
                     if ($rowNum == 0) {
                         $prev_cid = $cid;
                     } else {
                         if ($prev_cid == $cid) {
                             $display_flag = 1;
                             $prev_cid = $cid;
                         } else {
                             $display_flag = 0;
                             $prev_cid = $cid;
                         }
                     }
                     if ($display_flag) {
                         foreach ($row as $colName => $colVal) {
                             if (in_array($colName, $this->_noRepeats)) {
                                 unset($rows[$rowNum][$colName]);
                             }
                         }
                     }
                     $entryFound = TRUE;
                 }
             }
         }
         if (array_key_exists('first_contribution', $row) || array_key_exists('last_contribution', $row)) {
             $details = CRM_Contribute_BAO_Contribution_Utils::getFirstLastDetails($row['civicrm_contact_id']);
             if ($details['first']) {
                 $rows[$rowNum]['first_contribution'] = CRM_Utils_Money::format($details['first']['total_amount']) . ' - ' . CRM_Utils_Date::customFormat($details['first']['receive_date'], $config->dateformatFull);
             }
             if ($details['last']) {
                 $rows[$rowNum]['last_contribution'] = CRM_Utils_Money::format($details['last']['total_amount']) . ' - ' . CRM_Utils_Date::customFormat($details['last']['receive_date'], $config->dateformatFull);
             }
         }
         // handle state province
         if (array_key_exists('civicrm_address_state_province_id', $row)) {
             if ($value = $row['civicrm_address_state_province_id']) {
                 $rows[$rowNum]['civicrm_address_state_province_id'] = CRM_Core_PseudoConstant::stateProvince($value, FALSE);
                 $url = CRM_Report_Utils_Report::getNextUrl('contribute/detail', "reset=1&force=1&" . "state_province_id_op=in&state_province_id_value={$value}", $this->_absoluteUrl, $this->_id);
                 $rows[$rowNum]['civicrm_address_state_province_id_link'] = $url;
                 $rows[$rowNum]['civicrm_address_state_province_id_hover'] = ts("List all contribution(s) for this State.");
             }
             $entryFound = TRUE;
         }
         // handle country
         if (array_key_exists('civicrm_address_country_id', $row)) {
             if ($value = $row['civicrm_address_country_id']) {
                 $rows[$rowNum]['civicrm_address_country_id'] = CRM_Core_PseudoConstant::country($value, FALSE);
                 $url = CRM_Report_Utils_Report::getNextUrl('contribute/detail', "reset=1&force=1&" . "country_id_op=in&country_id_value={$value}", $this->_absoluteUrl, $this->_id);
                 $rows[$rowNum]['civicrm_address_country_id_link'] = $url;
                 $rows[$rowNum]['civicrm_address_country_id_hover'] = ts("List all contribution(s) for this Country.");
             }
             $entryFound = TRUE;
         }
         // convert display name to links
         if (array_key_exists('civicrm_contact_display_name', $row) && !empty($rows[$rowNum]['civicrm_contact_display_name']) && array_key_exists('civicrm_contact_id', $row)) {
             $url = CRM_Utils_System::url("civicrm/contact/view", 'reset=1&cid=' . $row['civicrm_contact_id'], $this->_absoluteUrl);
             $rows[$rowNum]['civicrm_contact_display_name_link'] = $url;
             $rows[$rowNum]['civicrm_contact_display_name_hover'] = ts("View Contact Summary for this Contact.");
         }
         // convert soft credit id to link
         if (array_key_exists('soft_credit_display_name', $row) && !empty($rows[$rowNum]['soft_credit_display_name']) && array_key_exists('id', $row)) {
             $url = CRM_Utils_System::url("civicrm/contact/view", 'reset=1&cid=' . $row['id'], $this->_absoluteUrl);
             $rows[$rowNum]['soft_credit_display_name_creditor_link'] = $url;
             $rows[$rowNum]['soft_credit_display_name_creditor_hover'] = ts("View Contact Summary for this Soft Credit.");
         }
         // convert hon/mem contact to link
         if (array_key_exists('civicrm_contact_hon_mem_display_name', $row) && !empty($rows[$rowNum]['civicrm_contribution_honor_contact_id']) && array_key_exists('civicrm_contribution_honor_contact_id', $row)) {
             $url = CRM_Utils_System::url("civicrm/contact/view", 'reset=1&cid=' . $row['civicrm_contribution_honor_contact_id'], $this->_absoluteUrl);
             $rows[$rowNum]['civicrm_contact_hon_mem_display_name_link'] = $url;
             $rows[$rowNum]['civicrm_contact_hon_mem_display_name_hover'] = ts("View Contact Summary for this Honor/Memory Contribution.");
         }
         // honor of/memory of type
         if ($value = CRM_Utils_Array::value('civicrm_contribution_honor_type_id', $row) && !empty($rows[$rowNum]['civicrm_contribution_honor_type_id'])) {
             // rather than do a join, just change the output here, since there these values are pretty static
             if ($rows[$rowNum]['civicrm_contribution_honor_type_id'] == 1) {
                 $rows[$rowNum]['civicrm_contribution_honor_type_id'] = "In Honor Of";
             } elseif ($rows[$rowNum]['civicrm_contribution_honor_type_id'] == 2) {
                 $rows[$rowNum]['civicrm_contribution_honor_type_id'] = "In Memory Of";
             } else {
                 $rows[$rowNum]['civicrm_contribution_honor_type_id'] = "n/a";
             }
         }
         if ($value = CRM_Utils_Array::value('civicrm_contribution_contribution_type_id', $row)) {
//.........这里部分代码省略.........
开发者ID:prashantgajare,项目名称:civicrm-core,代码行数:101,代码来源:Baykeeper.php


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