diff options
Diffstat (limited to 'app/views/stats')
| -rw-r--r-- | app/views/stats/idle.phtml | 6 | ||||
| -rw-r--r-- | app/views/stats/index.phtml | 74 | ||||
| -rw-r--r-- | app/views/stats/repartition.phtml | 113 |
3 files changed, 42 insertions, 151 deletions
diff --git a/app/views/stats/idle.phtml b/app/views/stats/idle.phtml index 22117792d..ba88b679f 100644 --- a/app/views/stats/idle.phtml +++ b/app/views/stats/idle.phtml @@ -6,10 +6,10 @@ <h1><?php echo _t('admin.stats.idle'); ?></h1> <?php - $current_url = urlencode(Minz_Url::display( + $current_url = Minz_Url::display( array('c' => 'stats', 'a' => 'idle'), 'php', true - )); + ); $nothing = true; foreach ($this->idleFeeds as $period => $feeds) { if (!empty($feeds)) { @@ -18,7 +18,7 @@ <div class="stat"> <h2><?php echo _t('gen.date.' . $period); ?></h2> - <form id="form-delete" method="post" style="display: none"></form> + <form id="form-delete" method="post" aria-hidden="true"></form> <?php foreach ($feeds as $feed) { ?> <ul class="horizontal-list"> diff --git a/app/views/stats/index.phtml b/app/views/stats/index.phtml index 18bcd4d99..0a2fbdb10 100644 --- a/app/views/stats/index.phtml +++ b/app/views/stats/index.phtml @@ -66,74 +66,28 @@ <div class="stat"> <h2><?php echo _t('admin.stats.entry_per_day'); ?></h2> - <div id="statsEntryPerDay" style="height: 300px"></div> + <div id="statsEntryPerDay" class="statGraph"></div> </div> <div class="stat half"> <h2><?php echo _t('admin.stats.feed_per_category'); ?></h2> - <div id="statsFeedPerCategory" style="height: 300px"></div> + <div id="statsFeedPerCategory" class="statGraph"></div> <div id="statsFeedPerCategoryLegend"></div> - </div><!-- + </div> - --><div class="stat half"> + <div class="stat half"> <h2><?php echo _t('admin.stats.entry_per_category'); ?></h2> - <div id="statsEntryPerCategory" style="height: 300px"></div> + <div id="statsEntryPerCategory" class="statGraph"></div> <div id="statsEntryPerCategoryLegend"></div> </div> </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 - var avg = []; - for (var i = -31; i <= 0; i++) { - avg.push([i, <?php echo $this->average?>]); - } - Flotr.draw(document.getElementById('statsEntryPerDay'), - [{ - data: <?php echo $this->count ?>, - bars: {horizontal: false, show: true} - },{ - data: avg, - lines: {show: true}, - label: "<?php echo $this->average?>" - }], - { - grid: {verticalLines: false}, - xaxis: {noTicks: 6, showLabels: false, tickDecimals: 0, min: -30.75, max: -0.25}, - yaxis: {min: 0}, - mouse: {relative: true, track: true, trackDecimals: 0, trackFormatter: function(obj) {return numberFormat(obj.y);}} - }); - // Feed per category - Flotr.draw(document.getElementById('statsFeedPerCategory'), - <?php echo $this->feedByCategory ?>, - { - grid: {verticalLines: false, horizontalLines: false}, - pie: {explode: 10, show: true, labelFormatter: function(){return '';}}, - xaxis: {showLabels: false}, - yaxis: {showLabels: false}, - mouse: {relative: true, track: true, trackDecimals: 0, trackFormatter: function(obj) {return obj.series.label + ' - '+ numberFormat(obj.y) + ' ('+ (obj.fraction * 100).toFixed(1) + '%)';}}, - legend: {container: document.getElementById('statsFeedPerCategoryLegend'), noColumns: 3} - }); - // Entry per category - Flotr.draw(document.getElementById('statsEntryPerCategory'), - <?php echo $this->entryByCategory ?>, - { - grid: {verticalLines: false, horizontalLines: false}, - pie: {explode: 10, show: true, labelFormatter: function(){return '';}}, - xaxis: {showLabels: false}, - yaxis: {showLabels: false}, - mouse: {relative: true, track: true, trackDecimals: 0, trackFormatter: function(obj) {return obj.series.label + ' - '+ numberFormat(obj.y) + ' ('+ (obj.fraction * 100).toFixed(1) + '%)';}}, - legend: {container: document.getElementById('statsEntryPerCategoryLegend'), noColumns: 3} - }); -} -initStats(); -</script> +<script id="jsonStats" type="application/json"><?php +echo htmlspecialchars(json_encode(array( + 'average' => $this->average, + 'dataCount' => $this->count, + 'feedByCategory' => $this->feedByCategory, + 'entryByCategory' => $this->entryByCategory, +), JSON_UNESCAPED_UNICODE), ENT_NOQUOTES); +?></script> +<script src="../scripts/stats.js?<?php echo @filemtime(PUBLIC_PATH . '/scripts/stats.js'); ?>"></script> diff --git a/app/views/stats/repartition.phtml b/app/views/stats/repartition.phtml index b20d9bbd0..ffb2c361e 100644 --- a/app/views/stats/repartition.phtml +++ b/app/views/stats/repartition.phtml @@ -30,108 +30,45 @@ <?php }?> <div class="stat"> - <table> + <table> <tr> - <th><?php echo _t('admin.stats.status_total'); ?></th> - <th><?php echo _t('admin.stats.status_read'); ?></th> - <th><?php echo _t('admin.stats.status_unread'); ?></th> - <th><?php echo _t('admin.stats.status_favorites'); ?></th> + <th><?php echo _t('admin.stats.status_total'); ?></th> + <th><?php echo _t('admin.stats.status_read'); ?></th> + <th><?php echo _t('admin.stats.status_unread'); ?></th> + <th><?php echo _t('admin.stats.status_favorites'); ?></th> </tr> <tr> - <td class="numeric"><?php echo $this->repartition['total']; ?></td> - <td class="numeric"><?php echo $this->repartition['read']; ?></td> - <td class="numeric"><?php echo $this->repartition['unread']; ?></td> - <td class="numeric"><?php echo $this->repartition['favorite']; ?></td> + <td class="numeric"><?php echo $this->repartition['total']; ?></td> + <td class="numeric"><?php echo $this->repartition['read']; ?></td> + <td class="numeric"><?php echo $this->repartition['unread']; ?></td> + <td class="numeric"><?php echo $this->repartition['favorite']; ?></td> </tr> - </table> + </table> </div> <div class="stat"> <h2><?php echo _t('admin.stats.entry_per_hour', $this->averageHour); ?></h2> - <div id="statsEntryPerHour" style="height: 300px"></div> + <div id="statsEntryPerHour" class="statGraph"></div> </div> <div class="stat half"> <h2><?php echo _t('admin.stats.entry_per_day_of_week', $this->averageDayOfWeek); ?></h2> - <div id="statsEntryPerDayOfWeek" style="height: 300px"></div> - </div><!-- + <div id="statsEntryPerDayOfWeek" class="statGraph"></div> + </div> - --><div class="stat half"> + <div class="stat half"> <h2><?php echo _t('admin.stats.entry_per_month', $this->averageMonth); ?></h2> - <div id="statsEntryPerMonth" style="height: 300px"></div> + <div id="statsEntryPerMonth" class="statGraph"></div> </div> </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 hour - Flotr.draw(document.getElementById('statsEntryPerHour'), - [{ - data: <?php echo $this->repartitionHour ?>, - bars: {horizontal: false, show: true} - }], - { - grid: {verticalLines: false}, - xaxis: {noTicks: 23, - tickFormatter: function(x) { - var x = parseInt(x); - return x + 1; - }, - min: -0.9, - max: 23.9, - tickDecimals: 0}, - yaxis: {min: 0}, - mouse: {relative: true, track: true, trackDecimals: 0, trackFormatter: function(obj) {return numberFormat(obj.y);}} - }); - // Entry per day of week - Flotr.draw(document.getElementById('statsEntryPerDayOfWeek'), - [{ - data: <?php echo $this->repartitionDayOfWeek ?>, - bars: {horizontal: false, show: true} - }], - { - grid: {verticalLines: false}, - xaxis: {noTicks: 6, - tickFormatter: function(x) { - var x = parseInt(x), - days = <?php echo $this->days?>; - return days[x]; - }, - min: -0.9, - max: 6.9, - tickDecimals: 0}, - yaxis: {min: 0}, - mouse: {relative: true, track: true, trackDecimals: 0, trackFormatter: function(obj) {return numberFormat(obj.y);}} - }); - // Entry per month - Flotr.draw(document.getElementById('statsEntryPerMonth'), - [{ - data: <?php echo $this->repartitionMonth ?>, - bars: {horizontal: false, show: true} - }], - { - grid: {verticalLines: false}, - xaxis: {noTicks: 12, - tickFormatter: function(x) { - var x = parseInt(x), - months = <?php echo $this->months?>; - return months[(x - 1)]; - }, - min: 0.1, - max: 12.9, - tickDecimals: 0}, - yaxis: {min: 0}, - mouse: {relative: true, track: true, trackDecimals: 0, trackFormatter: function(obj) {return numberFormat(obj.y);}} - }); - -} -initStats(); -</script> +<script id="jsonRepartition" type="application/json"><?php +echo htmlspecialchars(json_encode(array( + 'repartitionHour' => $this->repartitionHour, + 'repartitionDayOfWeek' => $this->repartitionDayOfWeek, + 'days' => $this->days, + 'repartitionMonth' => $this->repartitionMonth, + 'months' => $this->months, +), JSON_UNESCAPED_UNICODE), ENT_NOQUOTES); +?></script> +<script src="../scripts/repartition.js?<?php echo @filemtime(PUBLIC_PATH . '/scripts/repartition.js'); ?>"></script> |
