summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar Alexandre Alapetite <alexandre@alapetite.fr> 2014-01-25 23:21:01 +0100
committerGravatar Alexandre Alapetite <alexandre@alapetite.fr> 2014-01-25 23:21:01 +0100
commitbd6a7606c0d2364fd472f7903260a72f37b31f3b (patch)
tree610b18e0ceec3d6b6986594e724f1334dd8cb770
parenta46ee26e3592f8be95df9265e759796f3dc945eb (diff)
Intégration statistiques
Quelques corrections https://github.com/marienfressinaud/FreshRSS/pull/390 en particulier correction bug chargement asynchrone JavaScript Pour https://github.com/marienfressinaud/FreshRSS/issues/90
-rwxr-xr-xapp/Controllers/indexController.php11
-rw-r--r--app/i18n/en.php10
-rw-r--r--app/i18n/fr.php10
-rw-r--r--app/views/index/stats.phtml15
4 files changed, 28 insertions, 18 deletions
diff --git a/app/Controllers/indexController.php b/app/Controllers/indexController.php
index 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.php
index 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.php
index 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.phtml
index 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 day
Flotr.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 category
Flotr.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>