summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar Alexis Degrugillier <github@ainw.org> 2014-01-26 08:54:52 -0500
committerGravatar Alexis Degrugillier <github@ainw.org> 2014-01-26 08:54:52 -0500
commitb0641fd0ebcaa02dcbeb2983703bff6516f93487 (patch)
treec709673e8e5622e73c7b06cd2f0c92a103660873
parent5ad19cddc179e3528bd90d4bea8c97518e65bf51 (diff)
Modification des statistiques.
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)
-rwxr-xr-xapp/Controllers/indexController.php1
-rw-r--r--app/Models/StatsDAO.php29
-rw-r--r--app/i18n/en.php4
-rw-r--r--app/i18n/fr.php4
-rw-r--r--app/views/index/stats.phtml37
-rw-r--r--p/themes/Dark/freshrss.css45
-rw-r--r--p/themes/Flat/freshrss.css45
-rw-r--r--p/themes/Origine/freshrss.css5
8 files changed, 160 insertions, 10 deletions
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 = <<<SQL
+SELECT f.id AS id
+, MAX(f.name) AS name
+, MAX(c.name) AS category
+, COUNT(e.id) AS count
+FROM {$this->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 @@
<tbody>
<tr>
<th><?php echo Minz_Translate::t ('status_total')?></th>
- <td><?php echo $this->repartition['main_stream']['total']?></td>
- <td><?php echo $this->repartition['all_feeds']['total']?></td>
+ <td class="numeric"><?php echo $this->repartition['main_stream']['total']?></td>
+ <td class="numeric"><?php echo $this->repartition['all_feeds']['total']?></td>
</tr>
<tr>
<th><?php echo Minz_Translate::t ('status_read')?></th>
- <td><?php echo $this->repartition['main_stream']['read']?></td>
- <td><?php echo $this->repartition['all_feeds']['read']?></td>
+ <td class="numeric"><?php echo $this->repartition['main_stream']['read']?></td>
+ <td class="numeric"><?php echo $this->repartition['all_feeds']['read']?></td>
</tr>
<tr>
<th><?php echo Minz_Translate::t ('status_unread')?></th>
- <td><?php echo $this->repartition['main_stream']['unread']?></td>
- <td><?php echo $this->repartition['all_feeds']['unread']?></td>
+ <td class="numeric"><?php echo $this->repartition['main_stream']['unread']?></td>
+ <td class="numeric"><?php echo $this->repartition['all_feeds']['unread']?></td>
</tr>
<tr>
<th><?php echo Minz_Translate::t ('status_favorites')?></th>
- <td><?php echo $this->repartition['main_stream']['favorite']?></td>
- <td><?php echo $this->repartition['all_feeds']['favorite']?></td>
+ <td class="numeric"><?php echo $this->repartition['main_stream']['favorite']?></td>
+ <td class="numeric"><?php echo $this->repartition['all_feeds']['favorite']?></td>
</tr>
</tbody>
</table>
@@ -55,6 +55,27 @@
<div id="statsEntryPerCategoryLegend"></div>
</div>
+ <div class="stat">
+ <h2><?php echo Minz_Translate::t ('stats_top_feed')?></h2>
+ <table>
+ <thead>
+ <tr>
+ <th><?php echo Minz_Translate::t ('feed')?></th>
+ <th><?php echo Minz_Translate::t ('category')?></th>
+ <th><?php echo Minz_Translate::t ('stats_entry_count')?></th>
+ </tr>
+ </thead>
+ <tbody>
+ <?php foreach ($this->topFeed as $feed):?>
+ <tr>
+ <td><?php echo $feed['name']?></td>
+ <td><?php echo $feed['category']?></td>
+ <td class="numeric"><?php echo $feed['count']?></td>
+ </tr>
+ <?php endforeach;?>
+ </tbody>
+ </table>
+ </div>
</div>
<script>
diff --git a/p/themes/Dark/freshrss.css b/p/themes/Dark/freshrss.css
index 40634e398..98c742c89 100644
--- a/p/themes/Dark/freshrss.css
+++ b/p/themes/Dark/freshrss.css
@@ -875,3 +875,48 @@ input.extend {
text-decoration: underline;
}
}
+
+.stat{
+ border:1px solid #2f2f2f;
+ border-radius:10px;
+ margin: 10px 0;
+}
+.stat h2{
+ border-bottom:1px solid #2f2f2f;
+ margin:0;
+ padding-left:5px;
+}
+.stat h2 + *{
+ margin:5px;
+}
+.stat h2 + div + div{
+ margin:0 5px 5px 5px;
+}
+.stat h2 + table{
+ border-collapse:collapse;
+ width:calc(100% - 10px);
+}
+.stat h2 + table th{
+ padding:5px;
+}
+.stat h2 + table td{
+ padding:5px;
+}
+.stat h2 + table td.numeric{
+ text-align:center;
+}
+.stat h2 + table thead th{
+ border-bottom:2px solid #2f2f2f;
+}
+.stat h2 + table tbody tr *{
+ border-bottom:1px solid #2f2f2f;
+}
+.stat h2 + table tbody tr:last-child *{
+ border-bottom:0;
+}
+.stat h2 + table tr *{
+ border-left:2px solid #2f2f2f;
+}
+.stat h2 + table tr *:first-child{
+ border-left:0;
+} \ No newline at end of file
diff --git a/p/themes/Flat/freshrss.css b/p/themes/Flat/freshrss.css
index 04b3df842..f0ebe2300 100644
--- a/p/themes/Flat/freshrss.css
+++ b/p/themes/Flat/freshrss.css
@@ -842,3 +842,48 @@ input.extend {
text-decoration: underline;
}
}
+
+.stat{
+ border:1px solid #aaa;
+ border-radius:10px;
+ margin: 10px 0;
+}
+.stat h2{
+ border-bottom:1px solid #aaa;
+ margin:0;
+ padding-left:5px;
+}
+.stat h2 + *{
+ margin:5px;
+}
+.stat h2 + div + div{
+ margin:0 5px 5px 5px;
+}
+.stat h2 + table{
+ border-collapse:collapse;
+ width:calc(100% - 10px);
+}
+.stat h2 + table th{
+ padding:5px;
+}
+.stat h2 + table td{
+ padding:5px;
+}
+.stat h2 + table td.numeric{
+ text-align:center;
+}
+.stat h2 + table thead th{
+ border-bottom:2px solid #aaa;
+}
+.stat h2 + table tbody tr *{
+ border-bottom:1px solid #aaa;
+}
+.stat h2 + table tbody tr:last-child *{
+ border-bottom:0;
+}
+.stat h2 + table tr *{
+ border-left:2px solid #aaa;
+}
+.stat h2 + table tr *:first-child{
+ border-left:0;
+} \ No newline at end of file
diff --git a/p/themes/Origine/freshrss.css b/p/themes/Origine/freshrss.css
index 78adbeff0..fb8abb0b6 100644
--- a/p/themes/Origine/freshrss.css
+++ b/p/themes/Origine/freshrss.css
@@ -921,9 +921,12 @@ input.extend {
width:calc(100% - 10px);
}
.stat h2 + table th{
- text-transform:capitalize;
+ padding:5px;
}
.stat h2 + table td{
+ padding:5px;
+}
+.stat h2 + table td.numeric{
text-align:center;
}
.stat h2 + table thead th{