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
pull/393/head
Alexandre Alapetite 11 years ago
parent a46ee26e35
commit bd6a7606c0
  1. 11
      app/Controllers/indexController.php
  2. 10
      app/i18n/en.php
  3. 10
      app/i18n/fr.php
  4. 15
      app/views/index/stats.phtml

@ -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 () {

@ -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)',

@ -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)',

@ -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>
}
initStats();
</script>

Loading…
Cancel
Save