Ejemplo n.º 1
0
 public function showAction()
 {
     $statisticMapper = new StatisticMapper();
     $month = $this->getRequest()->getParam('month');
     $year = $this->getRequest()->getParam('year');
     if ($year != '' and $month != '') {
         $date = new \Ilch\Date($year . '-' . $month . '-01');
         $this->getLayout()->getHmenu()->add($this->getTranslator()->trans('menuStatistic'), array('action' => 'index'))->add($date->format('F', true), array('action' => 'show', 'year' => $year, 'month' => $month))->add($date->format('Y', true), array('action' => 'show', 'year' => $year));
     } elseif ($year != '') {
         $date = new \Ilch\Date($year . '-01-01');
         $this->getLayout()->getHmenu()->add($this->getTranslator()->trans('menuStatistic'), array('action' => 'index'))->add($date->format('Y', true), array('action' => 'show', 'year' => $year));
     }
     if ($year != '' and $month != '') {
         $this->getView()->set('visitsTotal', $statisticMapper->getVisitsMonthCount($year, $month));
         $this->getView()->set('statisticHourList', $statisticMapper->getVisitsHour($year, $month));
         $this->getView()->set('statisticDayList', $statisticMapper->getVisitsDay($year, $month));
         $this->getView()->set('statisticYearMonthDayList', $statisticMapper->getVisitsYearMonthDay($year, $month));
         $this->getView()->set('statisticYearList', $statisticMapper->getVisitsYear($year));
         $this->getView()->set('statisticBrowserList', $statisticMapper->getVisitsBrowser($year, $month));
         $this->getView()->set('statisticLanguageList', $statisticMapper->getVisitsLanguage($year, $month));
         $this->getView()->set('statisticOSList', $statisticMapper->getVisitsOS($year, $month));
     } elseif ($month == '' and $year != '') {
         $this->getView()->set('visitsTotal', $statisticMapper->getVisitsCount('', $year));
         $this->getView()->set('statisticHourList', $statisticMapper->getVisitsHour($year));
         $this->getView()->set('statisticDayList', $statisticMapper->getVisitsDay($year));
         $this->getView()->set('statisticYearMonthList', $statisticMapper->getVisitsYearMonth($year));
         $this->getView()->set('statisticYearList', $statisticMapper->getVisitsYear($year));
         $this->getView()->set('statisticBrowserList', $statisticMapper->getVisitsBrowser($year));
         $this->getView()->set('statisticLanguageList', $statisticMapper->getVisitsLanguage($year));
         $this->getView()->set('statisticOSList', $statisticMapper->getVisitsOS($year));
     }
 }