diff options
author | matt <matt@59fd770c-687e-43c8-a1e3-f5a4ff64c105> | 2009-05-06 05:26:30 +0400 |
---|---|---|
committer | matt <matt@59fd770c-687e-43c8-a1e3-f5a4ff64c105> | 2009-05-06 05:26:30 +0400 |
commit | c400856758ef69d2bd9d9bdd12ea888bcd6918ea (patch) | |
tree | 28d2cf49b5deaa3d2e13b3837fd5197f1dcb9b5d /core | |
parent | 6eed0fc3f958240b36728b679db379a19f8c04a9 (diff) |
now displaying prettier date (better usability) as well as showing a calendar icon. it looks ugly but it's more usable
Diffstat (limited to 'core')
-rw-r--r-- | core/Controller.php | 7 | ||||
-rw-r--r-- | core/Period.php | 1 | ||||
-rw-r--r-- | core/Period/Day.php | 9 | ||||
-rw-r--r-- | core/Period/Month.php | 8 | ||||
-rw-r--r-- | core/Period/Range.php | 5 | ||||
-rw-r--r-- | core/Period/Week.php | 8 | ||||
-rw-r--r-- | core/Period/Year.php | 6 |
7 files changed, 35 insertions, 9 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'); |