You are here

public function DaysOfMonth::display in Visitors 8.2

Returns a days of month page.

Return value

array A render array representing the days of month page content.

1 string reference to 'DaysOfMonth::display'
visitors.routing.yml in ./visitors.routing.yml
visitors.routing.yml

File

src/Controller/Report/DaysOfMonth.php, line 61
Contains Drupal\visitors\Controller\Report\DaysOfMonth.

Class

DaysOfMonth

Namespace

Drupal\visitors\Controller\Report

Code

public function display() {
  $config = \Drupal::config('visitors.config');
  $form = $this->formBuilder
    ->getForm('Drupal\\visitors\\Form\\DateFilter');
  $header = $this
    ->_getHeader();
  $results = $this
    ->_getData(NULL);
  $tmp_rows = array();
  $y = array();
  for ($i = 1; $i <= 31; $i++) {
    $y[$i] = 0;
  }
  foreach ($results as $data) {
    $y[$data[1]] = $data[2];
  }
  return array(
    'visitors_date_filter_form' => $form,
    'visitors_jqplot' => array(
      '#theme' => 'visitors_jqplot',
      '#path' => drupal_get_path('module', 'visitors'),
      '#x' => implode(', ', range(1, 31)),
      '#y' => implode(', ', $y),
      '#width' => $config
        ->get('chart_width'),
      '#height' => $config
        ->get('chart_height'),
    ),
    'visitors_table' => array(
      '#type' => 'table',
      '#header' => $header,
      '#rows' => $this
        ->_getData($header),
    ),
  );
}