示例#1
0
 /**
  * Gets the statistics data and set it to JS.
  *
  * @return void
  * @since  1.0
  */
 protected function setStatisticsData()
 {
     $data = StatisticsHelper::totalSent();
     JavascriptHelper::addObject('statTotalSent', $data);
     $data = StatisticsHelper::openedActionsCount();
     JavascriptHelper::addObject('statOpenedCount', $data);
     $data = StatisticsHelper::openedNewslettersCount();
     $res = array('newsletters' => empty($data['newsletters']) ? 0 : $data['newsletters'], 'subscribers' => empty($data['subscribers']) ? 0 : $data['subscribers']);
     JavascriptHelper::addObject('statActiveSubscribersCount', $res);
     $now = date('Y-m-d H:i:s');
     $sevenDaysBefore = date('Y-m-d', strtotime('-7 Days', time())) . " 00:00:00";
     $thirtyDaysBefore = date('Y-m-d', strtotime('-30 Days', time())) . " 00:00:00";
     $ninetyDaysBefore = date('Y-m-d', strtotime('-90 Days', time())) . " 00:00:00";
     $this->totalSubs = array(StatisticsHelper::totalSubscribersCount($sevenDaysBefore, $now), StatisticsHelper::totalSubscribersCount($thirtyDaysBefore, $now), StatisticsHelper::totalSubscribersCount($ninetyDaysBefore, $now));
     $this->newSubs = array(StatisticsHelper::newSubscribersCount($sevenDaysBefore, $now), StatisticsHelper::newSubscribersCount($thirtyDaysBefore, $now), StatisticsHelper::newSubscribersCount($ninetyDaysBefore, $now));
     $this->lostSubs = array(StatisticsHelper::lostSubscribersCount($sevenDaysBefore, $now), StatisticsHelper::lostSubscribersCount($thirtyDaysBefore, $now), StatisticsHelper::lostSubscribersCount($ninetyDaysBefore, $now));
     $this->activeSubs = array(StatisticsHelper::activeSubscribersCount($sevenDaysBefore, $now), StatisticsHelper::activeSubscribersCount($thirtyDaysBefore, $now), StatisticsHelper::activeSubscribersCount($ninetyDaysBefore, $now));
 }