function _yandex_metrics_reports_filter_to_date_range in Yandex.Metrics 8.2
Same name and namespace in other branches
- 6.2 yandex_metrics_reports/yandex_metrics_reports.module \_yandex_metrics_reports_filter_to_date_range()
- 7.2 yandex_metrics_reports/yandex_metrics_reports.module \_yandex_metrics_reports_filter_to_date_range()
Converts filter value to date range array: array( 'start_date' => 'YYYYMMDD', 'end_date' => 'YYYYMMDD', 'group' => 'week' // It is optional element. );
Parameters
string $filter - (day, yesterday, week, month):
Return value
array
13 calls to _yandex_metrics_reports_filter_to_date_range()
- Reports::gender_chart in yandex_metrics_reports/
src/ Reports.php - The function generates pie chart with demography information.
- Reports::geo_chart in yandex_metrics_reports/
src/ Reports.php - The function generates pie chart with geographical information on visitors.
- Reports::hourly_chart in yandex_metrics_reports/
src/ Reports.php - The function generates chart with information about hourly traffic.
- Reports::sources_chart in yandex_metrics_reports/
src/ Reports.php - The function generates pie chart with traffic sources summary.
- Reports::visits_chart in yandex_metrics_reports/
src/ Reports.php - The function generates chart with information about page views, visitors and new visitors.
File
- yandex_metrics_reports/
yandex_metrics_reports.module, line 58 - The main code of Yandex.Metrics Reports module.
Code
function _yandex_metrics_reports_filter_to_date_range($filter) {
switch ($filter) {
case 'day':
return array(
'start_date' => date('Ymd'),
'end_date' => date('Ymd'),
);
case 'yesterday':
return array(
'start_date' => date('Ymd', time() - 60 * 60 * 24),
'end_date' => date('Ymd', time() - 60 * 60 * 24),
);
case 'week':
default:
return array(
'start_date' => date('Ymd', time() - 60 * 60 * 24 * 6),
'end_date' => date('Ymd'),
);
case 'month':
return array(
'start_date' => date('Ymd', time() - 60 * 60 * 24 * 31),
'end_date' => date('Ymd'),
'group' => 'week',
);
}
}