A free, self-hostable news aggregator…
Intégration statistiques
Alexandre Alapetitebd6a7606c0d2
diff --git a/app/Controllers/indexController.php b/app/Controllers/indexController.phpindex 84ed992f9..898f2577c 100755--- a/app/Controllers/indexController.php+++ b/app/Controllers/indexController.php@@ -6,14 +6,12 @@ class FreshRSS_index_Controller extends Minz_ActionController {private $entryDAO;private $feedDAO;private $catDAO;- private $statsDAO;function __construct($router) {parent::__construct($router);$this->entryDAO = new FreshRSS_EntryDAO ();$this->feedDAO = new FreshRSS_FeedDAO ();$this->catDAO = new FreshRSS_CategoryDAO ();- $this->statsDAO = new FreshRSS_StatsDAO ();}public function indexAction () {@@ -202,11 +200,12 @@ class FreshRSS_index_Controller extends Minz_ActionController {}public function statsAction () {+ $statsDAO = new FreshRSS_StatsDAO ();Minz_View::appendScript (Minz_Url::display ('/scripts/flotr2.min.js?' . @filemtime(PUBLIC_PATH . '/scripts/flotr2.min.js')));- $this->view->repartition = $this->statsDAO->calculateEntryRepartition();- $this->view->count = ($this->statsDAO->calculateEntryCount());- $this->view->feedByCategory = $this->statsDAO->calculateFeedByCategory();- $this->view->entryByCategory = $this->statsDAO->calculateEntryByCategory();+ $this->view->repartition = $statsDAO->calculateEntryRepartition();+ $this->view->count = ($statsDAO->calculateEntryCount());+ $this->view->feedByCategory = $statsDAO->calculateFeedByCategory();+ $this->view->entryByCategory = $statsDAO->calculateEntryByCategory();}public function aboutAction () {diff --git a/app/i18n/en.php b/app/i18n/en.phpindex 963105f35..518c14bc8 100644--- a/app/i18n/en.php+++ b/app/i18n/en.php@@ -22,7 +22,7 @@ return array ('subscription_management' => 'Subscriptions management','main_stream' => 'Main stream',- 'all_feeds' => 'All feeds',+ 'all_feeds' => 'All feeds','favorite_feeds' => 'Favourites (%d)','not_read' => '%d unread','not_reads' => '%d unread',@@ -300,10 +300,10 @@ return array ('format_date' => '%s j\<\s\u\p\>S\<\/\s\u\p\> Y','format_date_hour' => '%s j\<\s\u\p\>S\<\/\s\u\p\> Y \a\t H\:i',- 'status_favorites' => 'favourites',- 'status_read' => 'read',- 'status_unread' => 'unread',- 'status_total' => 'total',+ 'status_favorites' => 'favourites',+ 'status_read' => 'read',+ 'status_unread' => 'unread',+ 'status_total' => 'total','stats_entry_repartition' => 'Entry repartition','stats_entry_per_day' => 'Entry per day (last 30 days)',diff --git a/app/i18n/fr.php b/app/i18n/fr.phpindex c8b03ef8b..efe4a08c4 100644--- a/app/i18n/fr.php+++ b/app/i18n/fr.php@@ -22,7 +22,7 @@ return array ('subscription_management' => 'Gestion des abonnements','main_stream' => 'Flux principal',- 'all_feeds' => 'Tous les flux',+ 'all_feeds' => 'Tous les flux','favorite_feeds' => 'Favoris (%d)','not_read' => '%d non lu','not_reads' => '%d non lus',@@ -300,10 +300,10 @@ return array ('format_date' => 'j %s Y','format_date_hour' => 'j %s Y \à H\:i',- 'status_favorites' => 'favoris',- 'status_read' => 'lus',- 'status_unread' => 'non lus',- 'status_total' => 'total',+ 'status_favorites' => 'favoris',+ 'status_read' => 'lus',+ 'status_unread' => 'non lus',+ 'status_total' => 'total','stats_entry_repartition' => 'Répartition des articles','stats_entry_per_day' => 'Nombre d’articles par jour (30 derniers jours)',diff --git a/app/views/index/stats.phtml b/app/views/index/stats.phtmlindex ab9d0a881..b1f0b8eb3 100644--- a/app/views/index/stats.phtml+++ b/app/views/index/stats.phtml@@ -58,6 +58,15 @@</div><script>+"use strict";+function initStats() {+ if (!window.Flotr) {+ if (window.console) {+ console.log('FreshRSS waiting for Flotr…');+ }+ window.setTimeout(initStats, 50);+ return;+ }// Entry per dayFlotr.draw(document.getElementById('statsEntryPerDay'),[<?php echo $this->count ?>],@@ -65,7 +74,7 @@bars: {horizontal: false, show: true},xaxis: {noTicks: 6, showLabels: false, tickDecimals: 0},yaxis: {showLabels: false},- mouse: {relative: true, track: true, trackDecimals: 0,trackFormatter: function(obj) {return obj.y;}}+ mouse: {relative: true, track: true, trackDecimals: 0, trackFormatter: function(obj) {return obj.y;}}});// Feed per categoryFlotr.draw(document.getElementById('statsFeedPerCategory'),@@ -89,4 +98,6 @@mouse: {relative: true, track: true, trackDecimals: 0, trackFormatter: function(obj) {return obj.y;}},legend: {container: document.getElementById('statsEntryPerCategoryLegend')}});-</script>\ No newline at end of file+}+initStats();+</script>