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:
authormatt <matt@59fd770c-687e-43c8-a1e3-f5a4ff64c105>2009-05-06 05:26:30 +0400
committermatt <matt@59fd770c-687e-43c8-a1e3-f5a4ff64c105>2009-05-06 05:26:30 +0400
commitc400856758ef69d2bd9d9bdd12ea888bcd6918ea (patch)
tree28d2cf49b5deaa3d2e13b3837fd5197f1dcb9b5d
parent6eed0fc3f958240b36728b679db379a19f8c04a9 (diff)
now displaying prettier date (better usability) as well as showing a calendar icon. it looks ugly but it's more usable
-rw-r--r--core/Controller.php7
-rw-r--r--core/Period.php1
-rw-r--r--core/Period/Day.php9
-rw-r--r--core/Period/Month.php8
-rw-r--r--core/Period/Range.php5
-rw-r--r--core/Period/Week.php8
-rw-r--r--core/Period/Year.php6
-rw-r--r--plugins/CoreHome/templates/period_select.tpl2
-rw-r--r--themes/default/images/icon-calendar.gifbin0 -> 1036 bytes
9 files changed, 36 insertions, 10 deletions
diff --git a/core/Controller.php b/core/Controller.php
index 22d40ec131..4cb83552fa 100644
--- a/core/Controller.php
+++ b/core/Controller.php
@@ -233,14 +233,12 @@ abstract class Piwik_Controller
protected function setGeneralVariablesView($view)
{
- $oDate = Piwik_Date::factory($this->strDate);
- //TODO TO FIX
- $localizedDateFormat = Piwik_Translate('CoreHome_DayFormat');
- $view->prettyDate = $oDate->getLocalized($localizedDateFormat);
$view->date = $this->strDate;
try {
$this->setPeriodVariablesView($view);
+ $period = Piwik_Period::factory(Piwik_Common::getRequestVar('period'), Piwik_Date::factory($this->strDate));
+ $view->prettyDate = $period->getLocalizedLongString();
$idSite = Piwik_Common::getRequestVar('idSite');
$view->idSite = $idSite;
$site = new Piwik_Site($idSite);
@@ -281,7 +279,6 @@ abstract class Piwik_Controller
{
unset($availablePeriods[$found]);
}
-
$view->period = $currentPeriod;
$view->otherPeriods = $availablePeriods;
$view->periodsNames = $periodNames;
diff --git a/core/Period.php b/core/Period.php
index 29323e6a45..782cb2cd73 100644
--- a/core/Period.php
+++ b/core/Period.php
@@ -240,6 +240,7 @@ abstract class Piwik_Period
abstract public function getPrettyString();
abstract public function getLocalizedShortString();
+ abstract public function getLocalizedLongString();
}
diff --git a/core/Period/Day.php b/core/Period/Day.php
index 55f158a796..9f790ccd91 100644
--- a/core/Period/Day.php
+++ b/core/Period/Day.php
@@ -13,6 +13,7 @@ class Piwik_Period_Day extends Piwik_Period
$out = $this->getDateStart()->toString() ;
return $out;
}
+
public function getLocalizedShortString()
{
//"Mon 15 Aug"
@@ -21,6 +22,14 @@ class Piwik_Period_Day extends Piwik_Period
$out = $date->getLocalized($template);
return $out;
}
+ public function getLocalizedLongString()
+ {
+ //"Mon 15 Aug"
+ $date = $this->getDateStart();
+ $template = "%longDay% %day% %longMonth% %longYear%";
+ $out = $date->getLocalized($template);
+ return $out;
+ }
public function isFinished()
{
diff --git a/core/Period/Month.php b/core/Period/Month.php
index 3d6e9f9d77..0fc7cad553 100644
--- a/core/Period/Month.php
+++ b/core/Period/Month.php
@@ -13,7 +13,13 @@ class Piwik_Period_Month extends Piwik_Period
$out = $this->getDateStart()->getLocalized("%shortMonth% %shortYear%");
return $out;
}
-
+
+ public function getLocalizedLongString()
+ {
+ //"August 2009"
+ $out = $this->getDateStart()->getLocalized("%longMonth% %longYear%");
+ return $out;
+ }
public function getPrettyString()
{
$out = $this->getDateStart()->toString('Y-m');
diff --git a/core/Period/Range.php b/core/Period/Range.php
index 1d695ba971..96df975c53 100644
--- a/core/Period/Range.php
+++ b/core/Period/Range.php
@@ -23,6 +23,11 @@ class Piwik_Period_Range extends Piwik_Period
$out = "$shortDateStart - $shortDateEnd";
return $out;
}
+
+ public function getLocalizedLongString()
+ {
+ return $this->getLocalizedShortString();
+ }
public function getPrettyString()
{
$out = "From ".$this->getDateStart()->toString() . " to " . $this->getDateEnd()->toString();
diff --git a/core/Period/Week.php b/core/Period/Week.php
index f0c682241a..f309701891 100644
--- a/core/Period/Week.php
+++ b/core/Period/Week.php
@@ -10,7 +10,7 @@ class Piwik_Period_Week extends Piwik_Period
public function getLocalizedShortString()
{
- //"Week 30 Dec - 6 Jan 09"
+ //"30 Dec - 6 Jan 09"
$dateStart = $this->getDateStart();
$dateEnd = $this->getDateEnd();
$shortDateStart = $dateStart->getLocalized("%day% %shortMonth%");
@@ -18,7 +18,11 @@ class Piwik_Period_Week extends Piwik_Period
$out = "$shortDateStart - $shortDateEnd";
return $out;
}
-
+
+ public function getLocalizedLongString()
+ {
+ return Piwik_Translate('CoreHome_PeriodWeek') . " ". $this->getLocalizedShortString();
+ }
public function getPrettyString()
{
$out = $this->getDateStart()->toString() . " to " . $this->getDateEnd()->toString();
diff --git a/core/Period/Year.php b/core/Period/Year.php
index c916e5ca7a..0c994e1847 100644
--- a/core/Period/Year.php
+++ b/core/Period/Year.php
@@ -11,11 +11,15 @@ class Piwik_Period_Year extends Piwik_Period
public function getLocalizedShortString()
{
+ return $this->getLocalizedLongString();
+ }
+
+ public function getLocalizedLongString()
+ {
//"2009"
$out = $this->getDateStart()->getLocalized("%longYear%");
return $out;
}
-
public function getPrettyString()
{
$out = $this->getDateStart()->toString('Y');
diff --git a/plugins/CoreHome/templates/period_select.tpl b/plugins/CoreHome/templates/period_select.tpl
index e46c0a9b63..1db1f1092b 100644
--- a/plugins/CoreHome/templates/period_select.tpl
+++ b/plugins/CoreHome/templates/period_select.tpl
@@ -4,7 +4,7 @@
<script type="text/javascript" src="plugins/CoreHome/templates/date.js"></script>
<span id="periodString">
- <span id="date"><img src='plugins/CoreHome/templates/images/more_date.gif' style="vertical-align:middle" alt="" /> {$prettyDate}</span> -&nbsp;
+ <span id="date"><img src='themes/default/images/icon-calendar.gif' style="vertical-align:middle" alt="" /> {$prettyDate}</span> -&nbsp;
<span id="periods">
<span id="currentPeriod">{$periodsNames.$period.singular}</span>
<span id="otherPeriods">
diff --git a/themes/default/images/icon-calendar.gif b/themes/default/images/icon-calendar.gif
new file mode 100644
index 0000000000..b4b7f5e0e1
--- /dev/null
+++ b/themes/default/images/icon-calendar.gif
Binary files differ