diff options
Diffstat (limited to 'site/app/controllers/statistics_controller.php')
-rw-r--r-- | site/app/controllers/statistics_controller.php | 34 |
1 files changed, 5 insertions, 29 deletions
diff --git a/site/app/controllers/statistics_controller.php b/site/app/controllers/statistics_controller.php index b6a7ffd..7acf45e 100644 --- a/site/app/controllers/statistics_controller.php +++ b/site/app/controllers/statistics_controller.php @@ -41,7 +41,7 @@ class StatisticsController extends AppController var $name = 'Statistics'; var $uses = array('Addon', 'Addontype', 'Application', 'User', 'Version'); var $components = array('Amo', 'Image', 'Stats'); - var $helpers = array('Html', 'Javascript', 'Listing', 'Localization', 'Statistics', 'Time'); + var $helpers = array('Html', 'Javascript', 'Listing', 'Localization', 'Time'); /** * Require login for all actions @@ -56,7 +56,7 @@ class StatisticsController extends AppController // Clean post data $this->Amo->clean($this->data); - $this->layout = 'amo2009'; + $this->layout = 'mozilla'; $this->pageTitle = _('statistics_pagetitle').' :: '.sprintf(_('addons_home_pagetitle'), APP_PRETTYNAME); $this->cssAdd = array('stats/stats'); @@ -78,10 +78,6 @@ class StatisticsController extends AppController * Index */ function index($addon_id = 0) { - - // Get public stats for dashboard. - $this->publish('dailyStats',$this->Stats->getDailyStats()); - // If add-on id was specified, go to its statistics if (!empty($addon_id) || !empty($_GET['data']['Addon']['id'])) { if (!empty($addon_id)) @@ -94,11 +90,7 @@ class StatisticsController extends AppController // If not, figure out what to do else { $session = $this->Session->read('User'); - if ($session) { - $addons = $this->Addon->getAddonsByUser($session['id']); - } else { - $addons = array(); - } + $addons = $this->Addon->getAddonsByUser($session['id']); $this->publish('addons', $addons); // If user can access all add-on stats, pull all @@ -148,6 +140,7 @@ class StatisticsController extends AppController return; } + $this->publish('suppressJQuery', true); $this->jsAdd = array( //'simile/timeplot/timeplot-api.js?local', 'jquery-compressed.js', @@ -218,23 +211,6 @@ class StatisticsController extends AppController $stats['last_downloads'] = $statsQry[0]['download_counts']['count']; $stats['last_downloads_date'] = $statsQry[0]['download_counts']['date']; } - // Grouping by week is not quite what we want, since the current - // week is going to be shorter than (the complete) last week. - // If you know how to get (now, now - 7), (now - 8, now - 14) ranges - // in a group by, feel free to improve this. - $thisWeek = $this->Addon->query("SELECT AVG(count) as `count` FROM update_counts - WHERE addon_id={$addon_id} - AND date >= DATE_SUB(CURDATE(), INTERVAL 7 DAY)"); - $prevWeek = $this->Addon->query("SELECT AVG(count) as `count` FROM update_counts - WHERE addon_id={$addon_id} - AND date <= DATE_SUB(CURDATE(), INTERVAL 7 DAY) - AND date >= DATE_SUB(CURDATE(), INTERVAL 14 DAY)"); - if ($thisWeek && $prevWeek) { - $thisWeek = $thisWeek[0][0]['count']; - $prevWeek = $prevWeek[0][0]['count']; - $stats['weekly_updatepings'] = $thisWeek; - $stats['weekly_updatepings_change'] = $prevWeek > 0 ? (($thisWeek - $prevWeek) / $prevWeek) * 100 : 0; - } } $this->set('stats', $stats); $this->pageTitle = $addon['Translation']['name']['string'].' :: '._('statistics_pagetitle').' :: '.sprintf(_('addons_home_pagetitle'), APP_PRETTYNAME); @@ -276,7 +252,7 @@ class StatisticsController extends AppController 'statistics_js_plotselection_options_csv_tooltip' => _('statistics_js_plotselection_options_csv_tooltip') )); - $this->render('addon', 'amo2009'); + $this->render('addon', 'mozilla'); } else { $this->publish('rss_title', sprintf(_('statistics_title_addon_stats'), $addon['Translation']['name']['string'])); |