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:
authorThomas Steur <thomas.steur@gmail.com>2013-11-20 07:40:08 +0400
committerThomas Steur <thomas.steur@gmail.com>2013-11-20 07:40:08 +0400
commit4793bc774656c59df6a48eed239f72718570ac35 (patch)
tree5d4e08a01b3b6fa8a3adc1e48fb51a6320a76f88 /core/Twig.php
parent4cec24f6b8db0a8d65952cb837ea8632ec5cc3a4 (diff)
refs #1816 do not create metrics for ratio, instead add total values to tableMetadata and generate ratio in view
Diffstat (limited to 'core/Twig.php')
-rw-r--r--core/Twig.php9
1 files changed, 9 insertions, 0 deletions
diff --git a/core/Twig.php b/core/Twig.php
index 01282ef35d..69a6501d90 100644
--- a/core/Twig.php
+++ b/core/Twig.php
@@ -65,6 +65,7 @@ class Twig
$this->addFilter_money();
$this->addFilter_truncate();
$this->addFilter_notificiation();
+ $this->addFilter_percentage();
$this->twig->addFilter(new Twig_SimpleFilter('implode', 'implode'));
$this->twig->addFilter(new Twig_SimpleFilter('ucwords', 'ucwords'));
@@ -187,6 +188,14 @@ class Twig
$this->twig->addFilter($notificationFunction);
}
+ protected function addFilter_percentage()
+ {
+ $percentage = new Twig_SimpleFilter('percentage', function ($string, $totalValue, $precision = 1) {
+ return Piwik::getPercentageSafe($string, $totalValue, $precision) . '%';
+ });
+ $this->twig->addFilter($percentage);
+ }
+
protected function addFilter_truncate()
{
$truncateFilter = new Twig_SimpleFilter('truncate', function ($string, $size) {