private function _populateYearData(&$labelsy, &$datay)
 {
     $stats = new Stats_Model_Stats();
     $firstDayOfMonth = date('Y-' . date('m') . '-01');
     $authorizations = $stats->getNumAuthorizationsYear(strtotime('-11 months', strtotime($firstDayOfMonth)), time());
     for ($i = -11; $i <= 0; $i++) {
         $time = strtotime("{$i} months");
         $monthNumber = date('n', $time);
         $labelsy[] = Stats_Model_Stats::$months[$monthNumber];
         if (isset($authorizations[$monthNumber])) {
             $datay[] = $authorizations[$monthNumber]['entry'];
         } else {
             $datay[] = 0;
         }
     }
 }
Exemple #2
0
 public function setTemplateVars()
 {
     $stats = new Stats_Model_Stats();
     $this->view->sites = $stats->getTopTenSites();
 }
Exemple #3
0
 private function _populateYearData(&$labelsy, &$datay, &$datay2)
 {
     $stats = new Stats_Model_Stats();
     $initialTrustedSites = $stats->getNumTrustedSites(strtotime('-1 week'));
     $initialRegisteredUsers = $stats->getNumRegisteredUsers(strtotime('-1 week'));
     $firstDayOfMonth = date('Y-' . date('m') . '-01');
     $sites = $stats->getNumTrustedSitesYear(strtotime('-11 months', strtotime($firstDayOfMonth)), time());
     $numUsers = $stats->getNumRegisteredUsersYear(strtotime('-1 week'), time());
     for ($i = -11; $i <= 0; $i++) {
         $time = strtotime("{$i} months");
         $monthNumber = date('n', $time);
         $labelsy[] = Stats_Model_Stats::$months[$monthNumber];
         if (isset($sites[$monthNumber])) {
             $sitesPeriod = $sites[$monthNumber]['site'];
         } else {
             $sitesPeriod = 0;
         }
         if (isset($numUsers[$monthNumber])) {
             $usersPeriod = $numUsers[$monthNumber]['users'];
         } else {
             $usersPeriod = 0;
         }
         if ($i > -11) {
             $datay[] = $datay[$i + 10] + $sitesPeriod;
             $datay2[] = $datay2[$i + 10] + $usersPeriod;
         } else {
             $datay[] = $initialTrustedSites + $sitesPeriod;
             $datay2[] = $initialRegisteredUsers + $usersPeriod;
         }
     }
     for ($i = 0; $i < count($datay2); $i++) {
         if ($datay2[$i] > 0) {
             $datay2[$i] = round($datay[$i] / $datay2[$i], 2);
         }
     }
 }