Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/matomo-org/matomo.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTimo Besenreuther <timo.besenreuther@gmail.com>2014-12-23 13:17:42 +0300
committerTimo Besenreuther <timo.besenreuther@gmail.com>2014-12-23 13:17:42 +0300
commitfa3d7effbb72dc40b6db2c46852d97f968daf7d4 (patch)
treea9d8540d6f107b69841d05cc9732c90c24f4d56e /plugins/ImageGraph
parent352204543fb730dbb44e28ec2623d89f179a73de (diff)
fixes #6895 - add a config option that causes the image graphs to show the evolution within the selected period instead of the evolution across the last n periods
Diffstat (limited to 'plugins/ImageGraph')
-rw-r--r--plugins/ImageGraph/ImageGraph.php28
1 files changed, 20 insertions, 8 deletions
diff --git a/plugins/ImageGraph/ImageGraph.php b/plugins/ImageGraph/ImageGraph.php
index 5bd61cc6a9..d38aa8fdde 100644
--- a/plugins/ImageGraph/ImageGraph.php
+++ b/plugins/ImageGraph/ImageGraph.php
@@ -16,6 +16,7 @@ use Piwik\Period\Range;
use Piwik\Site;
use Piwik\TaskScheduler;
use Piwik\Url;
+use Piwik\Period\Factory as PeriodFactory;
class ImageGraph extends \Piwik\Plugin
{
@@ -88,16 +89,27 @@ class ImageGraph extends \Piwik\Plugin
$piwikSite = new Site($idSite);
if ($periodForSinglePeriodGraph == 'range') {
+ // for period=range, show the configured sub-periods
$periodForMultiplePeriodGraph = Config::getInstance()->General['graphs_default_period_to_plot_when_period_range'];
$dateForMultiplePeriodGraph = $dateForSinglePeriodGraph;
- } else {
- $periodForMultiplePeriodGraph = $periodForSinglePeriodGraph;
- $dateForMultiplePeriodGraph = Range::getRelativeToEndDate(
- $periodForSinglePeriodGraph,
- 'last' . self::GRAPH_EVOLUTION_LAST_PERIODS,
- $dateForSinglePeriodGraph,
- $piwikSite
- );
+ } else if ($info['period'] == 'day' || !Config::getInstance()->General['graphs_show_evolution_within_selected_period']) {
+ // for period=day, always show the last n days
+ // if graphs_show_evolution_within_selected_period=false, show the last n periods
+ $periodForMultiplePeriodGraph = $periodForSinglePeriodGraph;
+ $dateForMultiplePeriodGraph = Range::getRelativeToEndDate(
+ $periodForSinglePeriodGraph,
+ 'last' . self::GRAPH_EVOLUTION_LAST_PERIODS,
+ $dateForSinglePeriodGraph,
+ $piwikSite
+ );
+ } else {
+ // if graphs_show_evolution_within_selected_period=true, show the days withing the period
+ // (except if the period is day, see above)
+ $periodForMultiplePeriodGraph = 'day';
+ $period = PeriodFactory::build($info['period'], $info['date']);
+ $start = $period->getDateStart()->toString();
+ $end = $period->getDateEnd()->toString();
+ $dateForMultiplePeriodGraph = $start . ',' . $end;
}
}