You are here

function _yandex_metrics_reports_filter_to_date_range in Yandex.Metrics 6.2

Same name and namespace in other branches
  1. 8.2 yandex_metrics_reports/yandex_metrics_reports.module \_yandex_metrics_reports_filter_to_date_range()
  2. 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

6 calls to _yandex_metrics_reports_filter_to_date_range()
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_geo_chart in yandex_metrics_reports/yandex_metrics_reports.module
The function generates pie chart with geographical information on visitors.
_yandex_metrics_reports_popular_content in yandex_metrics_reports/yandex_metrics_reports.module
The function generates the table of popular content.
_yandex_metrics_reports_search_phrases in yandex_metrics_reports/yandex_metrics_reports.module
The function generates content of search phrases table ordered by popularity.
_yandex_metrics_reports_sources_chart in yandex_metrics_reports/yandex_metrics_reports.module
The function generates pie chart with traffic sources summary.

... See full list

File

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