You are here

protected function DaysOfWeek::_getDaysOfWeek in Visitors 8.2

Create days of week array, using first_day parameter, using keys as day of week.

Return value

array

2 calls to DaysOfWeek::_getDaysOfWeek()
DaysOfWeek::display in src/Controller/Report/DaysOfWeek.php
Returns a days of week page page.
DaysOfWeek::_getData in src/Controller/Report/DaysOfWeek.php
Returns a table content.

File

src/Controller/Report/DaysOfWeek.php, line 174
Contains Drupal\visitors\Controller\Report\DaysOfWeek.

Class

DaysOfWeek

Namespace

Drupal\visitors\Controller\Report

Code

protected function _getDaysOfWeek() {
  $days = array(
    'Sun',
    'Mon',
    'Tue',
    'Wed',
    'Thu',
    'Fri',
    'Sat',
  );
  $date_first_day = \Drupal::config('system.date')
    ->get('first_day', 0);
  $sort_days = array();
  $n = 1;
  for ($i = $date_first_day; $i < 7; $i++) {
    $sort_days[$days[$i]] = $n++;
  }
  for ($i = 0; $i < $date_first_day; $i++) {
    $sort_days[$days[$i]] = $n++;
  }
  return $sort_days;
}