Esempio n. 1
0
 /**
  * Get statistics data and set it to JS.
  * 
  * @return void
  * @since  1.0
  */
 protected function setStatisticsData()
 {
     $ids = JRequest::getString('newsletters', '');
     $this->ids = $ids;
     $days = JRequest::getString('days', 30);
     $this->days = $days;
     $ids = !empty($ids) ? explode(',', $ids) : null;
     $data = StatisticsHelper::totalSent($ids);
     JavascriptHelper::addObject('statTotalSent', $data);
     $data = StatisticsHelper::openedActionsCount($ids);
     JavascriptHelper::addObject('statOpenedCount', $data);
     $data = StatisticsHelper::openedNewslettersCount($ids);
     $res = array('newsletters' => empty($data['newsletters']) ? 0 : $data['newsletters'], 'subscribers' => empty($data['subscribers']) ? 0 : $data['subscribers']);
     JavascriptHelper::addObject('statActiveCount', $res);
     $data = StatisticsHelper::totalClicks($ids);
     JavascriptHelper::addObject('statTotalClicks', $data);
     $previousDay = date('Y-m-d 00:00:00', strtotime("-1 day", time()));
     $thisDay = date('Y-m-d 00:00:00');
     $daysIdentifier = $days == 1 ? "-1 day" : "-" . $days . " Days";
     $fiewDaysBefore = date('Y-m-d 00:00:00', strtotime($daysIdentifier, time()));
     $previousHour = date('Y-m-d H:00:00', strtotime("-1 hour", time()));
     $thisHour = date('Y-m-d H:00:00');
     $oneDayBefore = date('Y-m-d H:00:00', strtotime("-1 day", time()));
     JavascriptHelper::addObject('clicksPerDay', StatisticsHelper::activityPerDay($fiewDaysBefore, $thisDay, $ids, NewsletterTableHistory::ACTION_CLICKED));
     JavascriptHelper::addObject('viewsPerDay', StatisticsHelper::activityPerDay($fiewDaysBefore, $thisDay, $ids, NewsletterTableHistory::ACTION_OPENED));
     JavascriptHelper::addObject('clicksPerHour', StatisticsHelper::activityPerHour($oneDayBefore, $thisHour, $ids, NewsletterTableHistory::ACTION_CLICKED));
     JavascriptHelper::addObject('viewsPerHour', StatisticsHelper::activityPerHour($oneDayBefore, $thisHour, $ids, NewsletterTableHistory::ACTION_OPENED));
 }
Esempio n. 2
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));
 }
Esempio n. 3
0
 /**
  * Calculate the statistics data and add it to the JS
  *
  * @return void
  * @since  1.0
  */
 protected function setStatisticsData()
 {
     $data = StatisticsHelper::totalSent();
     $res = array('no' => empty($data['no']) ? 0 : $data['no'], 'soft' => empty($data['soft']) ? 0 : $data['soft'], 'hard' => empty($data['hard']) ? 0 : $data['hard'], 'total' => empty($data['total']) ? 0 : $data['total']);
     JavascriptHelper::addObject('statTotalSent', $res);
     $data = StatisticsHelper::openedActionsCount();
     $res = array('other' => empty($data['other']) ? 0 : $data['other'], 'opened' => empty($data['opened']) ? 0 : $data['opened'], 'total' => empty($data['total']) ? 0 : $data['total']);
     JavascriptHelper::addObject('statOpenedCount', $res);
     $data = StatisticsHelper::openedNewslettersCount();
     $res = array('newsletters' => empty($data['newsletters']) ? 0 : $data['newsletters'], 'subscribers' => empty($data['subscribers']) ? 0 : $data['subscribers']);
     JavascriptHelper::addObject('statActiveSubscribersCount', $res);
     $theHour = 3600;
     $theDay = $theHour * 24;
     $days = 30;
     $previousDay = date('Y-m-d 00:00:00', time() - $theDay);
     $fiewDaysBefore = date('Y-m-d 00:00:00', time() - $theDay * $days);
     JavascriptHelper::addObject('newSubsPerDay', StatisticsHelper::newSubscribersPerDay($fiewDaysBefore, $previousDay));
 }