diff --git a/core/Controller.php b/core/Controller.php index 5c7872149e8..4c120b31fa6 100644 --- a/core/Controller.php +++ b/core/Controller.php @@ -844,6 +844,21 @@ public static function getCalendarPrettyDate($period) } } + + + /** + * Returns the pretty date representation + * + * @param $date string + * @param $period string + * @return string Pretty date + */ + public static function getPrettyDate($date, $period) + { + return self::getCalendarPrettyDate( Piwik_Period::factory($period, Piwik_Date::factory($date)) ); + } + + /** * Calculates the evolution from one value to another and returns HTML displaying * the evolution percent. The HTML includes an up/down arrow and is colored red, black or @@ -855,10 +870,9 @@ public static function getCalendarPrettyDate($period) * @param int $currentValue The value to calculate evolution to. * @param string $pastDate The date of past value. * @param int $pastValue The value in the past to calculate evolution from. - * @param bool $isVisits If the value is for visits or some other unit. * @return string|false The HTML or false if the evolution is 0 and the current value is 0. */ - protected function getEvolutionHtml( $date, $currentValue, $pastDate, $pastValue, $isVisits = true ) + protected function getEvolutionHtml( $date, $currentValue, $pastDate, $pastValue) { $evolutionPercent = Piwik_DataTable_Filter_CalculateEvolutionFilter::calculate( $currentValue, $pastValue, $precision = 2); @@ -873,7 +887,7 @@ protected function getEvolutionHtml( $date, $currentValue, $pastDate, $pastValue $titleEvolutionPercent = $evolutionPercent; if ($evolutionPercent < 0) { - $color = "red"; + $color = "#e02a3b"; //red $img = "arrow_down.png"; } else if ($evolutionPercent == 0) @@ -887,11 +901,15 @@ protected function getEvolutionHtml( $date, $currentValue, $pastDate, $pastValue $titleEvolutionPercent = '+'.$titleEvolutionPercent; } - $token = $isVisits ? 'MultiSites_TotalsEvolutionSummary' : 'Referers_EvolutionSummaryGeneric'; - $title = Piwik_Translate($token, - array($currentValue, $date, $pastValue, $titleEvolutionPercent, $pastDate)); + $title = Piwik_Translate('General_EvolutionSummaryGeneric', array( + Piwik_Translate('General_NVisits', $currentValue), + $date, + Piwik_Translate('General_NVisits', $pastValue), + $pastDate, + $titleEvolutionPercent + )); - $result = ' 'Metadata', 'General_OneVisit' => '1 visit', 'General_NVisits' => '%s visits', + 'General_EvolutionSummaryGeneric' => '%1$s in %2$s compared to %3$s in %4$s. Evolution: %5$s', 'General_OneDay' => '1 day', 'General_NDays' => '%s days', 'General_MainMetrics' => 'Main metrics', @@ -360,7 +361,7 @@ 'General_Show_js' => 'show', 'General_Hide_js' => 'hide', 'General_Donate' => 'Donate', - 'General_MoreSparklines' => 'More Sparklines', + 'General_MoreDetails' => 'More Details', 'Actions_PluginDescription' => 'Reports about the page views, the outlinks and downloads. Outlinks and Downloads tracking is automatic! You can also track your internal website\'s Search Engine.', 'Actions_Actions' => 'Actions', 'Actions_SubmenuPages' => 'Pages', @@ -1148,7 +1149,6 @@ 'MultiSites_PluginDescription' => 'Displays multi-site executive summary/statistics. Currently maintained as a core Piwik plugin.', 'MultiSites_Evolution' => 'Evolution', 'MultiSites_TopLinkTooltip' => 'Compare Web Analytics stats for all of your Websites.', - 'MultiSites_TotalsEvolutionSummary' => '%s visits in %s compared to %s visits (%s) in %s', 'Provider_PluginDescription' => 'Reports the Provider of the visitors.', 'Provider_WidgetProviders' => 'Providers', 'Provider_ColumnProvider' => 'Provider', @@ -1207,7 +1207,6 @@ 'Referers_WidgetSearchEngines' => 'Search Engines', 'Referers_WidgetOverview' => 'Overview', 'Referers_SocialFooterMessage' => 'This is a subset of the Websites report to the left. It filters out other websites so you can compare your social network referrers directly.', - 'Referers_EvolutionSummaryGeneric' => '%s in %s compared to %s (%s) in %s', 'Referers_WidgetGetAll' => 'All Referrers', 'SecurityInfo_PluginDescription' => 'Based on PhpSecInfo from the PHP Security Consortium, this plugin provides security information about your PHP environment and offers suggestions for improvement. It is a tool in a multilayered security approach. It does not replace secure development practices nor audit the code/application.', 'SecurityInfo_Security' => 'Security', diff --git a/plugins/MultiSites/Controller.php b/plugins/MultiSites/Controller.php index 05c5481b767..f1ae285990f 100644 --- a/plugins/MultiSites/Controller.php +++ b/plugins/MultiSites/Controller.php @@ -174,7 +174,7 @@ public function getSitesInfo($isWidgetized) echo $view->render(); } - + /** * The Multisites reports displays the first calendar date as the earliest day available for all websites. * Also, today is the later "today" available across all timezones. diff --git a/plugins/MultiSites/images/arrow_desc.gif b/plugins/MultiSites/images/arrow_desc.gif index abe79f07694..e8234178efa 100644 Binary files a/plugins/MultiSites/images/arrow_desc.gif and b/plugins/MultiSites/images/arrow_desc.gif differ diff --git a/plugins/MultiSites/images/arrow_down.png b/plugins/MultiSites/images/arrow_down.png index 48b427ba1fc..5f1a3020cf6 100644 Binary files a/plugins/MultiSites/images/arrow_down.png and b/plugins/MultiSites/images/arrow_down.png differ diff --git a/plugins/MultiSites/images/arrow_down_green.png b/plugins/MultiSites/images/arrow_down_green.png index a8d0f695d0d..d77adb232f9 100644 Binary files a/plugins/MultiSites/images/arrow_down_green.png and b/plugins/MultiSites/images/arrow_down_green.png differ diff --git a/plugins/MultiSites/images/arrow_up.png b/plugins/MultiSites/images/arrow_up.png index 54d48a6cb0e..eaf8672cc74 100644 Binary files a/plugins/MultiSites/images/arrow_up.png and b/plugins/MultiSites/images/arrow_up.png differ diff --git a/plugins/MultiSites/images/arrow_up_red.png b/plugins/MultiSites/images/arrow_up_red.png index 8135545c32c..c03dad9a225 100644 Binary files a/plugins/MultiSites/images/arrow_up_red.png and b/plugins/MultiSites/images/arrow_up_red.png differ diff --git a/plugins/MultiSites/images/stop.png b/plugins/MultiSites/images/stop.png index 84d56a45327..53d958c8076 100644 Binary files a/plugins/MultiSites/images/stop.png and b/plugins/MultiSites/images/stop.png differ diff --git a/plugins/MultiSites/templates/index.tpl b/plugins/MultiSites/templates/index.tpl index 1e1319ef2ab..cac90e2f8cf 100644 --- a/plugins/MultiSites/templates/index.tpl +++ b/plugins/MultiSites/templates/index.tpl @@ -36,8 +36,10 @@
-

{'General_AllWebsitesDashboard'|translate} - +

{'General_AllWebsitesDashboard'|translate} + {capture assign=nVisits}{'General_NVisits'|translate:$totalVisits}{/capture} + {capture assign=nVisitsLast}{'General_NVisits'|translate:$pastTotalVisits}{/capture} + {'General_TotalVisitsPageviewsRevenue'|translate:"$totalVisits":"$totalPageviews":"$totalRevenue"}

diff --git a/plugins/Referers/Controller.php b/plugins/Referers/Controller.php index 3337630f70d..742da7c8689 100644 --- a/plugins/Referers/Controller.php +++ b/plugins/Referers/Controller.php @@ -54,15 +54,18 @@ function index() if ($lastPeriodDate !== false) { $date = Piwik_Common::getRequestVar('date'); - + $period = Piwik_Common::getRequestVar('period'); + + $prettyDate = self::getPrettyDate($date, $period); + $prettyLastPeriodDate = self::getPrettyDate($lastPeriodDate, $period); + // visit metrics $previousValues = $this->getReferersVisitorsByType($lastPeriodDate); - $this->addEvolutionPropertiesToView($view, $date, $nameValues, $lastPeriodDate, $previousValues); + $this->addEvolutionPropertiesToView($view, $prettyDate, $nameValues, $prettyLastPeriodDate, $previousValues); // distinct metrics $previousValues = $this->getDistinctReferrersMetrics($lastPeriodDate); - $this->addEvolutionPropertiesToView( - $view, $date, $distinctMetrics, $lastPeriodDate, $previousValues, $isVisits = false); + $this->addEvolutionPropertiesToView($view, $prettyDate, $distinctMetrics, $prettyLastPeriodDate, $previousValues); } // sparkline for the historical data of the above values @@ -685,16 +688,14 @@ private function getDistinctReferrersMetrics( $date = false ) * in this array should be the same as keys in $currentValues. * @param bool $isVisits Whether the values are counting visits or something else. */ - private function addEvolutionPropertiesToView( $view, $date, $currentValues, $lastPeriodDate, - $previousValues, $isVisits = false ) + private function addEvolutionPropertiesToView( $view, $date, $currentValues, $lastPeriodDate, $previousValues) { foreach ($previousValues as $name => $pastValue) { $currentValue = $currentValues[$name]; $evolutionName = $name.'Evolution'; - - $view->$evolutionName = $this->getEvolutionHtml( - $date, $currentValue, $lastPeriodDate, $pastValue, $isVisits); + + $view->$evolutionName = $this->getEvolutionHtml($date, $currentValue, $lastPeriodDate, $pastValue); } } } diff --git a/plugins/Referers/templates/index.tpl b/plugins/Referers/templates/index.tpl index 04496e37e2a..005f3fab118 100644 --- a/plugins/Referers/templates/index.tpl +++ b/plugins/Referers/templates/index.tpl @@ -7,18 +7,18 @@

{'Referers_Type'|translate}

{sparkline src=$urlSparklineDirectEntry} - {'Referers_TypeDirectEntries'|translate:"$visitorsFromDirectEntry"}{if !empty($visitorsFromDirectEntryPercent)}, {$visitorsFromDirectEntryPercent}% of visits{/if}{if !empty($visitorsFromDirectEntryEvolution)}, {$visitorsFromDirectEntryEvolution}{/if} + {'Referers_TypeDirectEntries'|translate:"$visitorsFromDirectEntry"}{if !empty($visitorsFromDirectEntryPercent)}, {$visitorsFromDirectEntryPercent}% of visits{/if}{if !empty($visitorsFromDirectEntryEvolution)} {$visitorsFromDirectEntryEvolution}{/if}
{sparkline src=$urlSparklineSearchEngines} - {'Referers_TypeSearchEngines'|translate:"$visitorsFromSearchEngines"}{if !empty($visitorsFromSearchEnginesPercent)}, {$visitorsFromSearchEnginesPercent}% of visits{/if}{if !empty($visitorsFromSearchEnginesEvolution)}, {$visitorsFromSearchEnginesEvolution}{/if} + {'Referers_TypeSearchEngines'|translate:"$visitorsFromSearchEngines"}{if !empty($visitorsFromSearchEnginesPercent)}, {$visitorsFromSearchEnginesPercent}% of visits{/if}{if !empty($visitorsFromSearchEnginesEvolution)} {$visitorsFromSearchEnginesEvolution}{/if}
{sparkline src=$urlSparklineWebsites} - {'Referers_TypeWebsites'|translate:"$visitorsFromWebsites"}{if !empty($visitorsFromWebsitesPercent)}, {$visitorsFromWebsitesPercent}% of visits{/if}{if !empty($visitorsFromWebsitesEvolution)}, {$visitorsFromWebsitesEvolution}{/if} + {'Referers_TypeWebsites'|translate:"$visitorsFromWebsites"}{if !empty($visitorsFromWebsitesPercent)}, {$visitorsFromWebsitesPercent}% of visits{/if}{if !empty($visitorsFromWebsitesEvolution)} {$visitorsFromWebsitesEvolution}{/if}
{sparkline src=$urlSparklineCampaigns} - {'Referers_TypeCampaigns'|translate:"$visitorsFromCampaigns"}{if !empty($visitorsFromCampaignsPercent)}, {$visitorsFromCampaignsPercent}% of visits{/if}{if !empty($visitorsFromCampaignsEvolution)}, {$visitorsFromCampaignsEvolution}{/if} + {'Referers_TypeCampaigns'|translate:"$visitorsFromCampaigns"}{if !empty($visitorsFromCampaignsPercent)}, {$visitorsFromCampaignsPercent}% of visits{/if}{if !empty($visitorsFromCampaignsEvolution)} {$visitorsFromCampaignsEvolution}{/if}
@@ -26,25 +26,25 @@



- {'General_MoreSparklines'|translate} ({'General_Show_js'|translate}) +

{'General_MoreDetails'|translate} ({'General_Show_js'|translate})

\ No newline at end of file +

diff --git a/themes/default/common.css b/themes/default/common.css index 4cb8042eb13..8c966df8b58 100644 --- a/themes/default/common.css +++ b/themes/default/common.css @@ -772,3 +772,10 @@ table.entityTable tr td a { .section-toggler-link:hover { text-decoration:underline; } + +.metricEvolution { + display:inline-block; + font-size:9pt; + opacity:0.75; +} +