本文整理汇总了PHP中myPartnerUtils::annualActivityGraph方法的典型用法代码示例。如果您正苦于以下问题:PHP myPartnerUtils::annualActivityGraph方法的具体用法?PHP myPartnerUtils::annualActivityGraph怎么用?PHP myPartnerUtils::annualActivityGraph使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类myPartnerUtils
的用法示例。
在下文中一共展示了myPartnerUtils::annualActivityGraph方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getPartnerUsageGraph
/**
* @param int $startDate
* @param int $endDate
* @param Partner $partner
* @param reportInterval $resolution
* @param int $tzOffset
* @return string
*/
public static function getPartnerUsageGraph($startDate, $endDate, Partner $partner, $resolution = reportInterval::DAYS, $tzOffset = null, $reportType = myReportsMgr::REPORT_TYPE_PARTNER_BANDWIDTH_USAGE)
{
$reportFilter = new reportsInputFilter();
$reportFilter->from_date = $startDate;
$reportFilter->to_date = $endDate;
$reportFilter->from_day = date("Ymd", $startDate);
$reportFilter->to_day = date("Ymd", $endDate);
$reportFilter->interval = $resolution;
// if TZ offset provided, add TZ offset to the UTC time created above to reflect the user's timezone
// in myReportsMgr the offset will be later cleaned again to reflect UTC time so that the DWH query will be correct (with the TIME_SHIFT)
if (!is_null($tzOffset)) {
$tzOffsetSec = $tzOffset * 60;
$reportFilter->timeZoneOffset = $tzOffsetSec;
$reportFilter->from_date = $reportFilter->from_date + $tzOffsetSec;
$reportFilter->to_date = $reportFilter->to_date + $tzOffsetSec;
}
$data = myReportsMgr::getGraph($partner->getId(), $reportType, $reportFilter, null, null);
$graphPointsLine = array();
if ($resolution == reportInterval::MONTHS) {
$graphPointsLine = myPartnerUtils::annualActivityGraph($data);
} else {
$graphPointsLine = myPartnerUtils::dailyActivityGraph($data, $startDate);
}
ksort($graphPointsLine);
$graphLine = '';
foreach ($graphPointsLine as $point => $usage) {
$graphLine .= intval($point) . ",{$usage};";
}
return $graphLine;
}