protected function parse() { parent::parse(); // if we don't have a token anymore, redirect to the settings page if ($this->get('fork.settings')->get($this->getModule(), 'certificate') === null || $this->get('fork.settings')->get($this->getModule(), 'account') === null || $this->get('fork.settings')->get($this->getModule(), 'web_property_id') === null || $this->get('fork.settings')->get($this->getModule(), 'profile') === null) { $this->redirect(Model::createURLForAction('Settings')); } $this->header->addJS('highcharts.js', 'Core', false); $analytics = $this->get('analytics.connector'); $analyticsTemplateToFunctionMap = ['page_views' => 'getPageViews', 'visitors' => 'getVisitors', 'pages_per_visit' => 'getPagesPerVisit', 'time_on_site' => 'getTimeOnSite', 'new_sessions_percentage' => 'getNewSessionsPercentage', 'bounce_rate' => 'getBounceRate', 'visitors_graph_data' => 'getVisitorsGraphData', 'source_graph_data' => 'getSourceGraphData']; foreach ($analyticsTemplateToFunctionMap as $templateVariableName => $functionName) { $this->tpl->assign($templateVariableName, $analytics->{$functionName}($this->dateRange->getStartDate(), $this->dateRange->getEndDate())); } $dataGrid = new DataGridArray($analytics->getMostVisitedPagesData($this->dateRange->getStartDate(), $this->dateRange->getEndDate())); $this->tpl->assign('dataGridMostViewedPages', (string) $dataGrid->getContent()); }
/** * Build up the form */ private function build() { $this->form->addDate('start_date', $this->dateRange->getStartDate(), 'range', mktime(0, 0, 0, 1, 1, 2005), time()); $this->form->addDate('end_date', $this->dateRange->getEndDate(), 'range', mktime(0, 0, 0, 1, 1, 2005), time()); }