| <?php |
|
|
| |
| |
| |
| |
| |
| |
|
|
| namespace Piwik\Period; |
|
|
| use Piwik\Date; |
| use Piwik\Period; |
|
|
| class Year extends Period |
| { |
| public const PERIOD_ID = 4; |
|
|
| protected $label = 'year'; |
|
|
| |
| |
| |
| |
| |
| public function getLocalizedShortString() |
| { |
| return $this->getLocalizedLongString(); |
| } |
|
|
| |
| |
| |
| |
| |
| public function getLocalizedLongString() |
| { |
| |
| $out = $this->getDateStart()->getLocalized(Date::DATE_FORMAT_YEAR); |
| return $out; |
| } |
|
|
| |
| |
| |
| |
| |
| public function getPrettyString() |
| { |
| $out = $this->getDateStart()->toString('Y'); |
| return $out; |
| } |
|
|
| |
| |
| |
| protected function generate() |
| { |
| if ($this->subperiodsProcessed) { |
| return; |
| } |
|
|
| parent::generate(); |
|
|
| $year = $this->date->toString("Y"); |
| for ($i = 1; $i <= 12; $i++) { |
| $this->addSubperiod(new Month( |
| Date::factory("$year-$i-01") |
| )); |
| } |
| } |
|
|
| |
| |
| |
| |
| |
| |
| public function toString($format = 'ignored') |
| { |
| $this->generate(); |
|
|
| $stringMonth = array(); |
| foreach ($this->subperiods as $month) { |
| $stringMonth[] = $month->getDateStart()->toString("Y") . "-" . $month->getDateStart()->toString("m") . "-01"; |
| } |
|
|
| return $stringMonth; |
| } |
|
|
| public function getImmediateChildPeriodLabel() |
| { |
| return 'month'; |
| } |
|
|
| public function getParentPeriodLabel() |
| { |
| return null; |
| } |
| } |
|
|