You are here

function yandex_metrics_reports_filter_to_date_range in Yandex.Metrics 8.3

Same name and namespace in other branches
  1. 7.3 yandex_metrics_reports/yandex_metrics_reports.module \yandex_metrics_reports_filter_to_date_range()

Converts filter value to date range array.

Parameters

string $filter: Date range filter: (day, yesterday, week, month).

Return value

array Format: array( 'start_date' => 'YYYYMMDD', 'end_date' => 'YYYYMMDD', 'group' => 'week' // [optional] );

7 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_search_phrases in yandex_metrics_reports/yandex_metrics_reports.reports.inc
The function generates content of search phrases table ordered by popularity.
yandex_metrics_reports_sources_chart in yandex_metrics_reports/yandex_metrics_reports.reports.inc
The function generates pie chart with traffic sources summary.

... See full list

File

yandex_metrics_reports/yandex_metrics_reports.module, line 156
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',
      );
  }
}