public function DaysOfWeek::display in Visitors 8.2
Returns a days of week page page.
Return value
array A render array representing the days of week page content.
1 string reference to 'DaysOfWeek::display'
File
- src/
Controller/ Report/ DaysOfWeek.php, line 62 - Contains Drupal\visitors\Controller\Report\DaysOfWeek.
Class
Namespace
Drupal\visitors\Controller\ReportCode
public function display() {
$config = \Drupal::config('visitors.config');
$form = $this->formBuilder
->getForm('Drupal\\visitors\\Form\\DateFilter');
$header = $this
->_getHeader();
$results = $this
->_getData(NULL);
$sort_days = array_keys($this
->_getDaysOfWeek());
$results = $this
->_getData(NULL);
$days = array(
'Sun',
'Mon',
'Tue',
'Wed',
'Thu',
'Fri',
'Sat',
);
$x = array();
$y = array();
foreach ($days as $day) {
$x[] = '"' . $day . '"';
$y[$day] = 0;
}
foreach ($results as $data) {
$y[$data[1]
->getUntranslatedString()] = $data[2];
}
return array(
'visitors_date_filter_form' => $form,
'visitors_jqplot' => array(
'#theme' => 'visitors_jqplot',
'#path' => drupal_get_path('module', 'visitors'),
'#x' => implode(', ', $x),
'#y' => implode(', ', $y),
'#width' => $config
->get('chart_width'),
'#height' => $config
->get('chart_height'),
),
'visitors_table' => array(
'#type' => 'table',
'#header' => $header,
'#rows' => $this
->_getData($header),
),
);
}