本文整理汇总了PHP中myPartnerUtils::getPartnerBandwidthUsageFromDWH方法的典型用法代码示例。如果您正苦于以下问题:PHP myPartnerUtils::getPartnerBandwidthUsageFromDWH方法的具体用法?PHP myPartnerUtils::getPartnerBandwidthUsageFromDWH怎么用?PHP myPartnerUtils::getPartnerBandwidthUsageFromDWH使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类myPartnerUtils
的用法示例。
在下文中一共展示了myPartnerUtils::getPartnerBandwidthUsageFromDWH方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getPartnerUsageGraph
public static function getPartnerUsageGraph($year, $month, $partner, $resolution = 'days', $tzOffset = null)
{
if (!$resolution) {
$resolution = 'days';
}
$start_date = $year . '-' . ($month ? $month : '01') . '-01';
switch ($resolution) {
case 'weeks':
case 'days':
$end_date = $year . '-' . $month . '-' . date('t', strtotime($year . '-' . $month . '-01'));
break;
case 'months':
$start_date = $year . '-' . '01-01';
if ((int) date('Y') == $year) {
$end_date = date('Y-m-d');
} else {
$end_date = (int) $year . '-12-31';
}
break;
}
$data = myPartnerUtils::getPartnerBandwidthUsageFromDWH($partner->getId(), $start_date, $end_date, $resolution, $tzOffset);
if ($resolution != 'months') {
$graph_points['line'] = myPartnerUtils::daily_activity_to_graph($data, $resolution, $start_date);
} else {
//$activity = myPartnerUtils::collectPartnerUsageFromDWH($partner, 1, $end_date, true );
$graph_points['line'] = myPartnerUtils::year_activity_to_graph($data, $year);
}
$strGraphLine = '';
// sort array by keys
ksort($graph_points['line']);
foreach ($graph_points['line'] as $point => $usage) {
$strGraphLine .= (int) $point . ',' . $usage . ';';
}
$graph_points['line'] = $strGraphLine;
return $graph_points;
}