function _yandex_metrics_reports_filter_to_date_range in Yandex.Metrics 7.2
Same name and namespace in other branches
- 8.2 yandex_metrics_reports/yandex_metrics_reports.module \_yandex_metrics_reports_filter_to_date_range()
- 6.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
8 calls to _yandex_metrics_reports_filter_to_date_range()
- yandex_metrics_reports_gender_chart in yandex_metrics_reports/
yandex_metrics_reports.reports.inc - The function generates pie chart with demography information.
- yandex_metrics_reports_geo_chart in yandex_metrics_reports/
yandex_metrics_reports.reports.inc - The function generates pie chart with geographical information on visitors.
- yandex_metrics_reports_popular_content in yandex_metrics_reports/
yandex_metrics_reports.reports.inc - The function generates the table of popular content.
- yandex_metrics_reports_save_popular_content in yandex_metrics_reports/
yandex_metrics_reports.module - Fetch Popuplar content from Yandex.metrika and save it to the database.
- yandex_metrics_reports_search_phrases in yandex_metrics_reports/
yandex_metrics_reports.reports.inc - The function generates content of search phrases table ordered by popularity.
File
- yandex_metrics_reports/
yandex_metrics_reports.module, line 172 - 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',
);
}
}