From e98ac32716dfe9343baa5bce7ad2c1e98c40540c Mon Sep 17 00:00:00 2001 From: Alexis Degrugillier Date: Wed, 22 Jan 2014 19:06:46 -0500 Subject: Ajout de statistiques de l'application Conflicts: app/i18n/en.php app/i18n/fr.php --- app/Controllers/indexController.php | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'app/Controllers/indexController.php') diff --git a/app/Controllers/indexController.php b/app/Controllers/indexController.php index 45ded6fd4..84ed992f9 100755 --- a/app/Controllers/indexController.php +++ b/app/Controllers/indexController.php @@ -6,12 +6,14 @@ 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 () { @@ -198,6 +200,14 @@ class FreshRSS_index_Controller extends Minz_ActionController { return false; } } + + public function statsAction () { + 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(); + } public function aboutAction () { Minz_View::prependTitle (Minz_Translate::t ('about') . ' · '); -- cgit v1.2.3 From bd6a7606c0d2364fd472f7903260a72f37b31f3b Mon Sep 17 00:00:00 2001 From: Alexandre Alapetite Date: Sat, 25 Jan 2014 23:21:01 +0100 Subject: Intégration statistiques MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Quelques corrections https://github.com/marienfressinaud/FreshRSS/pull/390 en particulier correction bug chargement asynchrone JavaScript Pour https://github.com/marienfressinaud/FreshRSS/issues/90 --- app/Controllers/indexController.php | 11 +++++------ app/i18n/en.php | 10 +++++----- app/i18n/fr.php | 10 +++++----- app/views/index/stats.phtml | 15 +++++++++++++-- 4 files changed, 28 insertions(+), 18 deletions(-) (limited to 'app/Controllers/indexController.php') 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 @@ \ No newline at end of file +} +initStats(); + -- cgit v1.2.3 From 3930235b1868a10aeefb88e9e860cec0a4a604d3 Mon Sep 17 00:00:00 2001 From: Alexandre Alapetite Date: Sat, 25 Jan 2014 23:44:36 +0100 Subject: indexController : Charge les DAO uniquement lorsque nécessaire MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Poursuit le raisonnement de https://github.com/marienfressinaud/FreshRSS/commit/bd6a7606c0d2364fd472f7903260a72f37b31f3b Petites corrections https://github.com/marienfressinaud/FreshRSS/issues/90 --- app/Controllers/indexController.php | 28 +++++++++++----------------- app/i18n/en.php | 8 ++++---- app/i18n/fr.php | 4 ++-- app/views/index/stats.phtml | 2 +- 4 files changed, 18 insertions(+), 24 deletions(-) (limited to 'app/Controllers/indexController.php') diff --git a/app/Controllers/indexController.php b/app/Controllers/indexController.php index 898f2577c..74883962d 100755 --- a/app/Controllers/indexController.php +++ b/app/Controllers/indexController.php @@ -1,18 +1,7 @@ entryDAO = new FreshRSS_EntryDAO (); - $this->feedDAO = new FreshRSS_FeedDAO (); - $this->catDAO = new FreshRSS_CategoryDAO (); - } public function indexAction () { $output = Minz_Request::param ('output'); @@ -50,8 +39,11 @@ class FreshRSS_index_Controller extends Minz_ActionController { Minz_View::appendScript (Minz_Url::display ('/scripts/global_view.js?' . @filemtime(PUBLIC_PATH . '/scripts/global_view.js'))); } - $this->view->cat_aside = $this->catDAO->listCategories (); - $this->view->nb_favorites = $this->entryDAO->countUnreadReadFavorites (); + $catDAO = new FreshRSS_CategoryDAO(); + $entryDAO = new FreshRSS_EntryDAO(); + + $this->view->cat_aside = $catDAO->listCategories (); + $this->view->nb_favorites = $entryDAO->countUnreadReadFavorites (); $this->view->currentName = ''; $this->view->get_c = ''; @@ -125,14 +117,14 @@ class FreshRSS_index_Controller extends Minz_ActionController { $keepHistoryDefault = $this->view->conf->keep_history_default; try { - $entries = $this->entryDAO->listWhere($getType, $getId, $state, $order, $nb + 1, $first, $filter, $date_min, $keepHistoryDefault); + $entries = $entryDAO->listWhere($getType, $getId, $state, $order, $nb + 1, $first, $filter, $date_min, $keepHistoryDefault); // Si on a récupéré aucun article "non lus" // on essaye de récupérer tous les articles if ($state === 'not_read' && empty($entries)) { Minz_Log::record ('Conflicting information about nbNotRead!', Minz_Log::DEBUG); $this->view->state = 'all'; - $entries = $this->entryDAO->listWhere($getType, $getId, 'all', $order, $nb, $first, $filter, $date_min, $keepHistoryDefault); + $entries = $entryDAO->listWhere($getType, $getId, 'all', $order, $nb, $first, $filter, $date_min, $keepHistoryDefault); } if (count($entries) <= $nb) { @@ -170,7 +162,8 @@ class FreshRSS_index_Controller extends Minz_ActionController { case 'c': $cat = isset($this->view->cat_aside[$getId]) ? $this->view->cat_aside[$getId] : null; if ($cat === null) { - $cat = $this->catDAO->searchById ($getId); + $catDAO = new FreshRSS_CategoryDAO(); + $cat = $catDAO->searchById($getId); } if ($cat) { $this->view->currentName = $cat->name (); @@ -183,7 +176,8 @@ class FreshRSS_index_Controller extends Minz_ActionController { case 'f': $feed = FreshRSS_CategoryDAO::findFeed($this->view->cat_aside, $getId); if (empty($feed)) { - $feed = $this->feedDAO->searchById ($getId); + $feedDAO = new FreshRSS_FeedDAO(); + $feed = $feedDAO->searchById($getId); } if ($feed) { $this->view->currentName = $feed->name (); diff --git a/app/i18n/en.php b/app/i18n/en.php index 518c14bc8..70fd8a74b 100644 --- a/app/i18n/en.php +++ b/app/i18n/en.php @@ -305,8 +305,8 @@ return array ( 'status_unread' => 'unread', 'status_total' => 'total', - 'stats_entry_repartition' => 'Entry repartition', - 'stats_entry_per_day' => 'Entry per day (last 30 days)', - 'stats_feed_per_category' => 'Feed per category', - 'stats_entry_per_category' => 'Entry per category', + 'stats_entry_repartition' => 'Entries repartition', + 'stats_entry_per_day' => 'Entries per day (last 30 days)', + 'stats_feed_per_category' => 'Feeds per category', + 'stats_entry_per_category' => 'Entries per category', ); diff --git a/app/i18n/fr.php b/app/i18n/fr.php index efe4a08c4..53645477b 100644 --- a/app/i18n/fr.php +++ b/app/i18n/fr.php @@ -307,6 +307,6 @@ return array ( 'stats_entry_repartition' => 'Répartition des articles', 'stats_entry_per_day' => 'Nombre d’articles par jour (30 derniers jours)', - 'stats_feed_per_category' => 'Flux par categorie', - 'stats_entry_per_category' => 'Article par categorie', + 'stats_feed_per_category' => 'Flux par catégorie', + 'stats_entry_per_category' => 'Articles par catégorie', ); diff --git a/app/views/index/stats.phtml b/app/views/index/stats.phtml index b1f0b8eb3..e531a31dc 100644 --- a/app/views/index/stats.phtml +++ b/app/views/index/stats.phtml @@ -8,7 +8,7 @@ - + -- cgit v1.2.3 From b0641fd0ebcaa02dcbeb2983703bff6516f93487 Mon Sep 17 00:00:00 2001 From: Alexis Degrugillier Date: Sun, 26 Jan 2014 08:54:52 -0500 Subject: Modification des statistiques. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Ajout de la liste des 10 plus gros contributeurs Ajout de règles CSS pour les thèmes Flat et Dark Modification de l'affichage des camemberts (tri par nombre qui remplace le tri alphabétique) --- app/Controllers/indexController.php | 1 + app/Models/StatsDAO.php | 29 +++++++++++++++++++++++- app/i18n/en.php | 4 ++++ app/i18n/fr.php | 4 ++++ app/views/index/stats.phtml | 37 +++++++++++++++++++++++------- p/themes/Dark/freshrss.css | 45 +++++++++++++++++++++++++++++++++++++ p/themes/Flat/freshrss.css | 45 +++++++++++++++++++++++++++++++++++++ p/themes/Origine/freshrss.css | 5 ++++- 8 files changed, 160 insertions(+), 10 deletions(-) (limited to 'app/Controllers/indexController.php') diff --git a/app/Controllers/indexController.php b/app/Controllers/indexController.php index 74883962d..cb6be6049 100755 --- a/app/Controllers/indexController.php +++ b/app/Controllers/indexController.php @@ -200,6 +200,7 @@ class FreshRSS_index_Controller extends Minz_ActionController { $this->view->count = ($statsDAO->calculateEntryCount()); $this->view->feedByCategory = $statsDAO->calculateFeedByCategory(); $this->view->entryByCategory = $statsDAO->calculateEntryByCategory(); + $this->view->topFeed = $statsDAO->calculateTopFeed(); } public function aboutAction () { diff --git a/app/Models/StatsDAO.php b/app/Models/StatsDAO.php index a317c8f27..60cec7847 100644 --- a/app/Models/StatsDAO.php +++ b/app/Models/StatsDAO.php @@ -122,6 +122,7 @@ FROM {$this->prefix}category AS c, {$this->prefix}feed AS f WHERE c.id = f.category GROUP BY label +ORDER BY data DESC SQL; $stm = $this->bd->prepare($sql); $stm->execute(); @@ -146,6 +147,7 @@ FROM {$this->prefix}category AS c, WHERE c.id = f.category AND f.id = e.id_feed GROUP BY label +ORDER BY data DESC SQL; $stm = $this->bd->prepare($sql); $stm->execute(); @@ -154,6 +156,31 @@ SQL; return $this->convertToPieSerie($res); } + /** + * Calculates the 10 top feeds based on their number of entries + * + * @return array + */ + public function calculateTopFeed() { + $sql = <<prefix}category AS c, +{$this->prefix}feed AS f, +{$this->prefix}entry AS e +WHERE c.id = f.category +AND f.id = e.id_feed +GROUP BY id +ORDER BY count DESC +LIMIT 10 +SQL; + $stm = $this->bd->prepare($sql); + $stm->execute(); + return $stm->fetchAll(PDO::FETCH_ASSOC); + } + private function convertToSerie($data) { $serie = array(); @@ -168,7 +195,7 @@ SQL; $serie = array(); foreach ($data as $value) { - $value['data'] = array(array(0, (int)$value['data'])); + $value['data'] = array(array(0, (int) $value['data'])); $serie[] = $value; } diff --git a/app/i18n/en.php b/app/i18n/en.php index 70fd8a74b..e5cf623c7 100644 --- a/app/i18n/en.php +++ b/app/i18n/en.php @@ -11,6 +11,8 @@ return array ( 'users' => 'Users', 'categories' => 'Categories', 'category' => 'Category', + 'feed' => 'Feed', + 'feeds' => 'Feeds', 'shortcuts' => 'Shortcuts', 'about' => 'About', 'stats' => 'Statistics', @@ -309,4 +311,6 @@ return array ( 'stats_entry_per_day' => 'Entries per day (last 30 days)', 'stats_feed_per_category' => 'Feeds per category', 'stats_entry_per_category' => 'Entries per category', + 'stats_top_feed' => 'Top ten feeds', + 'stats_entry_count' => 'Entry count', ); diff --git a/app/i18n/fr.php b/app/i18n/fr.php index 53645477b..693dce5d1 100644 --- a/app/i18n/fr.php +++ b/app/i18n/fr.php @@ -11,6 +11,8 @@ return array ( 'users' => 'Utilisateurs', 'categories' => 'Catégories', 'category' => 'Catégorie', + 'feed' => 'Flux', + 'feeds' => 'Flux', 'shortcuts' => 'Raccourcis', 'about' => 'À propos', 'stats' => 'Statistiques', @@ -309,4 +311,6 @@ return array ( 'stats_entry_per_day' => 'Nombre d’articles par jour (30 derniers jours)', 'stats_feed_per_category' => 'Flux par catégorie', 'stats_entry_per_category' => 'Articles par catégorie', + 'stats_top_feed' => 'Les dix plus gros flux', + 'stats_entry_count' => 'Nombre d’articles', ); diff --git a/app/views/index/stats.phtml b/app/views/index/stats.phtml index 487c50a4b..ae9db172b 100644 --- a/app/views/index/stats.phtml +++ b/app/views/index/stats.phtml @@ -16,23 +16,23 @@ - - + + - - + + - - + + - - + +
  
repartition['main_stream']['total']?>repartition['all_feeds']['total']?>repartition['main_stream']['total']?>repartition['all_feeds']['total']?>
repartition['main_stream']['read']?>repartition['all_feeds']['read']?>repartition['main_stream']['read']?>repartition['all_feeds']['read']?>
repartition['main_stream']['unread']?>repartition['all_feeds']['unread']?>repartition['main_stream']['unread']?>repartition['all_feeds']['unread']?>
repartition['main_stream']['favorite']?>repartition['all_feeds']['favorite']?>repartition['main_stream']['favorite']?>repartition['all_feeds']['favorite']?>
@@ -55,6 +55,27 @@
+
+

+ + + + + + + + + + topFeed as $feed):?> + + + + + + + +
+