本文整理汇总了PHP中CRM_Contribute_BAO_Contribution::getContributionDates方法的典型用法代码示例。如果您正苦于以下问题:PHP CRM_Contribute_BAO_Contribution::getContributionDates方法的具体用法?PHP CRM_Contribute_BAO_Contribution::getContributionDates怎么用?PHP CRM_Contribute_BAO_Contribution::getContributionDates使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CRM_Contribute_BAO_Contribution
的用法示例。
在下文中一共展示了CRM_Contribute_BAO_Contribution::getContributionDates方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: preProcess
/**
* Heart of the viewing process. The runner gets all the meta data for
* the contact and calls the appropriate type of page to view.
*
* @return void
* @access public
*
*/
function preProcess()
{
CRM_Utils_System::setTitle(ts('CiviContribute'));
$status = array('Valid', 'Cancelled');
$prefixes = array('start', 'month', 'year');
$startDate = NULL;
$startToDate = $monthToDate = $yearToDate = array();
//get contribution dates.
$dates = CRM_Contribute_BAO_Contribution::getContributionDates();
foreach (array('now', 'yearDate', 'monthDate') as $date) {
${$date} = $dates[$date];
}
// fiscal years end date
$yearNow = date('Ymd', strtotime('+1 year -1 day', strtotime($yearDate)));
foreach ($prefixes as $prefix) {
$aName = $prefix . 'ToDate';
$dName = $prefix . 'Date';
if ($prefix == 'year') {
$now = $yearNow;
}
// appending end date i.e $now with time
// to also calculate records of end date till mid-night
$nowWithTime = $now . '235959';
foreach ($status as $s) {
${$aName}[$s] = CRM_Contribute_BAO_Contribution::getTotalAmountAndCount($s, ${$dName}, $nowWithTime);
${$aName}[$s]['url'] = CRM_Utils_System::url('civicrm/contribute/search', "reset=1&force=1&status=1&start={${$dName}}&end={$now}&test=0");
}
$this->assign($aName, ${$aName});
}
//for contribution tabular View
$buildTabularView = CRM_Utils_Array::value('showtable', $_GET, FALSE);
$this->assign('buildTabularView', $buildTabularView);
if ($buildTabularView) {
return;
}
// Check for admin permission to see if we should include the Manage Contribution Pages action link
$isAdmin = 0;
if (CRM_Core_Permission::check('administer CiviCRM')) {
$isAdmin = 1;
}
$this->assign('isAdmin', $isAdmin);
}
示例2: array
/**
* Get the contributions links.
*
* @return array
*/
public function &contributionLinks()
{
if (!isset(self::$_contributionLinks)) {
//get contribution dates.
$dates = CRM_Contribute_BAO_Contribution::getContributionDates();
$now = $dates['now'];
$yearDate = $dates['yearDate'];
$monthDate = $dates['monthDate'];
$yearNow = $yearDate + 10000;
$urlString = 'civicrm/contribute/search';
$urlParams = 'reset=1&pid=%%id%%&force=1&test=0';
self::$_contributionLinks = array(CRM_Core_Action::DETACH => array('name' => ts('Current Month-To-Date'), 'title' => ts('Current Month-To-Date'), 'url' => $urlString, 'qs' => "{$urlParams}&start={$monthDate}&end={$now}", 'uniqueName' => 'current_month_to_date'), CRM_Core_Action::REVERT => array('name' => ts('Fiscal Year-To-Date'), 'title' => ts('Fiscal Year-To-Date'), 'url' => $urlString, 'qs' => "{$urlParams}&start={$yearDate}&end={$yearNow}", 'uniqueName' => 'fiscal_year_to_date'), CRM_Core_Action::BROWSE => array('name' => ts('Cumulative'), 'title' => ts('Cumulative'), 'url' => $urlString, 'qs' => "{$urlParams}&start=&end={$now}", 'uniqueName' => 'cumulative'));
}
return self::$_contributionLinks;
}