| @@ 37-50 (lines=14) @@ | ||
| 34 | } |
|
| 35 | ||
| 36 | /** {@inheritdoc} */ |
|
| 37 | public function getQuantityOptions() |
|
| 38 | { |
|
| 39 | $result = []; |
|
| 40 | foreach ([1, 3, 6, 12] as $n) { |
|
| 41 | $date = (new DateTime())->add(new \DateInterval("P{$n}M")); |
|
| 42 | ||
| 43 | $result[$n] = Yii::t('hipanel/server', '{n, plural, one{# month} other{# months}} till {date}', [ |
|
| 44 | 'n' => $n, |
|
| 45 | 'date' => Yii::$app->formatter->asDate($date), |
|
| 46 | ]); |
|
| 47 | } |
|
| 48 | ||
| 49 | return $result; |
|
| 50 | } |
|
| 51 | } |
|
| 52 | ||
| @@ 73-86 (lines=14) @@ | ||
| 70 | } |
|
| 71 | ||
| 72 | /** {@inheritdoc} */ |
|
| 73 | public function getQuantityOptions() |
|
| 74 | { |
|
| 75 | $result = []; |
|
| 76 | foreach ([1, 3, 6, 12] as $n) { |
|
| 77 | $date = (new DateTime($this->_model->expires))->add(new \DateInterval("P{$n}M")); |
|
| 78 | ||
| 79 | $result[$n] = Yii::t('hipanel/server', '{n, plural, one{# month} other{# months}} till {date}', [ |
|
| 80 | 'n' => $n, |
|
| 81 | 'date' => Yii::$app->formatter->asDate($date), |
|
| 82 | ]); |
|
| 83 | } |
|
| 84 | ||
| 85 | return $result; |
|
| 86 | } |
|
| 87 | ||
| 88 | /** {@inheritdoc} */ |
|
| 89 | public function getPurchaseModel($options = []) |
|