Skip to content

Commit

Permalink
add previous/next to all dropdowns
Browse files Browse the repository at this point in the history
  • Loading branch information
nilmerg committed Apr 12, 2024
1 parent dc05aaa commit 4018874
Showing 1 changed file with 127 additions and 32 deletions.
159 changes: 127 additions & 32 deletions library/Notifications/Widget/Calendar/Controls.php
Original file line number Diff line number Diff line change
Expand Up @@ -164,19 +164,6 @@ protected function assembleWeekSelectors(): void
'disabled' => true
]);

$previousWeek = (clone $chosenWeek)->sub(new DateInterval('P1W'));
/** @var ButtonElement $previousBtn */
$previousBtn = $this->createElement('button', 'week', [
'value' => $previousWeek->format(self::WEEK_FORMAT),
'class' => 'control-button',
'type' => 'submit',
'title' => sprintf(
$this->translate('Show %s to %s'),
...$this->getLocalizedWeek($previousWeek)
)
]);
$this->addHtml($previousBtn->addHtml(new Icon('angle-left')));

// Let's be pragmatic and offer the user only a limited set of years.
$years = [];
$start = (new DateTime())->sub(new DateInterval('P5Y'));
Expand Down Expand Up @@ -217,6 +204,19 @@ protected function assembleWeekSelectors(): void
&& (int) $firstWeekDayOfMonth->format('o') === $chosenYear
);

$previousYear = (clone $chosenWeek)->sub(new DateInterval('P1Y'));
/** @var ButtonElement $previousYearBtn */
$previousYearBtn = $this->createElement('button', 'week', [

Check failure on line 209 in library/Notifications/Widget/Calendar/Controls.php

View workflow job for this annotation

GitHub Actions / phpstan / Static analysis with phpstan and php 7.2 on ubuntu-latest

Call to an undefined method ipl\Html\Contract\FormElement::addHtml().

Check failure on line 209 in library/Notifications/Widget/Calendar/Controls.php

View workflow job for this annotation

GitHub Actions / phpstan / Static analysis with phpstan and php 8.0 on ubuntu-latest

Call to an undefined method ipl\Html\Contract\FormElement::addHtml().

Check failure on line 209 in library/Notifications/Widget/Calendar/Controls.php

View workflow job for this annotation

GitHub Actions / phpstan / Static analysis with phpstan and php 7.3 on ubuntu-latest

Call to an undefined method ipl\Html\Contract\FormElement::addHtml().

Check failure on line 209 in library/Notifications/Widget/Calendar/Controls.php

View workflow job for this annotation

GitHub Actions / phpstan / Static analysis with phpstan and php 8.2 on ubuntu-latest

Call to an undefined method ipl\Html\Contract\FormElement::addHtml().

Check failure on line 209 in library/Notifications/Widget/Calendar/Controls.php

View workflow job for this annotation

GitHub Actions / phpstan / Static analysis with phpstan and php 7.4 on ubuntu-latest

Call to an undefined method ipl\Html\Contract\FormElement::addHtml().

Check failure on line 209 in library/Notifications/Widget/Calendar/Controls.php

View workflow job for this annotation

GitHub Actions / phpstan / Static analysis with phpstan and php 8.1 on ubuntu-latest

Call to an undefined method ipl\Html\Contract\FormElement::addHtml().

Check failure on line 209 in library/Notifications/Widget/Calendar/Controls.php

View workflow job for this annotation

GitHub Actions / phpstan / Static analysis with phpstan and php 8.3 on ubuntu-latest

Call to an undefined method ipl\Html\Contract\FormElement::addHtml().
'value' => $previousYear->format(self::WEEK_FORMAT),
'class' => 'control-button',
'type' => 'submit',
'title' => sprintf(
$this->translate('Show %s to %s'),
...$this->getLocalizedWeek($previousYear)
)
])->addHtml(new Icon('angle-left'));
$this->addHtml($previousYearBtn);

$this->addHtml(new HtmlElement(
'div',
Attributes::create(['class' => 'icinga-controls']),
Expand All @@ -229,7 +229,38 @@ protected function assembleWeekSelectors(): void
$this->translate('Show the first week in %s of a different year'),
$this->getLocalizedMonth($chosenWeek)
)
]),
])
));

$nextYear = (clone $chosenWeek)->add(new DateInterval('P1Y'));
/** @var ButtonElement $nextWeekBtn */
$nextYearBtn = $this->createElement('button', 'week', [

Check failure on line 237 in library/Notifications/Widget/Calendar/Controls.php

View workflow job for this annotation

GitHub Actions / phpstan / Static analysis with phpstan and php 7.2 on ubuntu-latest

Call to an undefined method ipl\Html\Contract\FormElement::addHtml().

Check failure on line 237 in library/Notifications/Widget/Calendar/Controls.php

View workflow job for this annotation

GitHub Actions / phpstan / Static analysis with phpstan and php 7.2 on ubuntu-latest

Variable $nextWeekBtn in PHPDoc tag @var does not match assigned variable $nextYearBtn.

Check failure on line 237 in library/Notifications/Widget/Calendar/Controls.php

View workflow job for this annotation

GitHub Actions / phpstan / Static analysis with phpstan and php 8.0 on ubuntu-latest

Call to an undefined method ipl\Html\Contract\FormElement::addHtml().

Check failure on line 237 in library/Notifications/Widget/Calendar/Controls.php

View workflow job for this annotation

GitHub Actions / phpstan / Static analysis with phpstan and php 8.0 on ubuntu-latest

Variable $nextWeekBtn in PHPDoc tag @var does not match assigned variable $nextYearBtn.

Check failure on line 237 in library/Notifications/Widget/Calendar/Controls.php

View workflow job for this annotation

GitHub Actions / phpstan / Static analysis with phpstan and php 7.3 on ubuntu-latest

Call to an undefined method ipl\Html\Contract\FormElement::addHtml().

Check failure on line 237 in library/Notifications/Widget/Calendar/Controls.php

View workflow job for this annotation

GitHub Actions / phpstan / Static analysis with phpstan and php 7.3 on ubuntu-latest

Variable $nextWeekBtn in PHPDoc tag @var does not match assigned variable $nextYearBtn.

Check failure on line 237 in library/Notifications/Widget/Calendar/Controls.php

View workflow job for this annotation

GitHub Actions / phpstan / Static analysis with phpstan and php 8.2 on ubuntu-latest

Call to an undefined method ipl\Html\Contract\FormElement::addHtml().

Check failure on line 237 in library/Notifications/Widget/Calendar/Controls.php

View workflow job for this annotation

GitHub Actions / phpstan / Static analysis with phpstan and php 8.2 on ubuntu-latest

Variable $nextWeekBtn in PHPDoc tag @var does not match assigned variable $nextYearBtn.

Check failure on line 237 in library/Notifications/Widget/Calendar/Controls.php

View workflow job for this annotation

GitHub Actions / phpstan / Static analysis with phpstan and php 7.4 on ubuntu-latest

Call to an undefined method ipl\Html\Contract\FormElement::addHtml().

Check failure on line 237 in library/Notifications/Widget/Calendar/Controls.php

View workflow job for this annotation

GitHub Actions / phpstan / Static analysis with phpstan and php 7.4 on ubuntu-latest

Variable $nextWeekBtn in PHPDoc tag @var does not match assigned variable $nextYearBtn.

Check failure on line 237 in library/Notifications/Widget/Calendar/Controls.php

View workflow job for this annotation

GitHub Actions / phpstan / Static analysis with phpstan and php 8.1 on ubuntu-latest

Call to an undefined method ipl\Html\Contract\FormElement::addHtml().

Check failure on line 237 in library/Notifications/Widget/Calendar/Controls.php

View workflow job for this annotation

GitHub Actions / phpstan / Static analysis with phpstan and php 8.1 on ubuntu-latest

Variable $nextWeekBtn in PHPDoc tag @var does not match assigned variable $nextYearBtn.

Check failure on line 237 in library/Notifications/Widget/Calendar/Controls.php

View workflow job for this annotation

GitHub Actions / phpstan / Static analysis with phpstan and php 8.3 on ubuntu-latest

Call to an undefined method ipl\Html\Contract\FormElement::addHtml().

Check failure on line 237 in library/Notifications/Widget/Calendar/Controls.php

View workflow job for this annotation

GitHub Actions / phpstan / Static analysis with phpstan and php 8.3 on ubuntu-latest

Variable $nextWeekBtn in PHPDoc tag @var does not match assigned variable $nextYearBtn.
'value' => $nextYear->format(self::WEEK_FORMAT),
'class' => 'control-button',
'type' => 'submit',
'title' => sprintf(
$this->translate('Show %s to %s'),
...$this->getLocalizedWeek($nextYear)
)
])->addHtml(new Icon('angle-right'));
$this->addHtml($nextYearBtn);

$previousMonth = (clone $chosenWeek)->sub(new DateInterval('P1M'));
/** @var ButtonElement $previousMonthBtn */
$previousMonthBtn = $this->createElement('button', 'week', [

Check failure on line 250 in library/Notifications/Widget/Calendar/Controls.php

View workflow job for this annotation

GitHub Actions / phpstan / Static analysis with phpstan and php 7.2 on ubuntu-latest

Call to an undefined method ipl\Html\Contract\FormElement::addHtml().

Check failure on line 250 in library/Notifications/Widget/Calendar/Controls.php

View workflow job for this annotation

GitHub Actions / phpstan / Static analysis with phpstan and php 8.0 on ubuntu-latest

Call to an undefined method ipl\Html\Contract\FormElement::addHtml().

Check failure on line 250 in library/Notifications/Widget/Calendar/Controls.php

View workflow job for this annotation

GitHub Actions / phpstan / Static analysis with phpstan and php 7.3 on ubuntu-latest

Call to an undefined method ipl\Html\Contract\FormElement::addHtml().

Check failure on line 250 in library/Notifications/Widget/Calendar/Controls.php

View workflow job for this annotation

GitHub Actions / phpstan / Static analysis with phpstan and php 8.2 on ubuntu-latest

Call to an undefined method ipl\Html\Contract\FormElement::addHtml().

Check failure on line 250 in library/Notifications/Widget/Calendar/Controls.php

View workflow job for this annotation

GitHub Actions / phpstan / Static analysis with phpstan and php 7.4 on ubuntu-latest

Call to an undefined method ipl\Html\Contract\FormElement::addHtml().

Check failure on line 250 in library/Notifications/Widget/Calendar/Controls.php

View workflow job for this annotation

GitHub Actions / phpstan / Static analysis with phpstan and php 8.1 on ubuntu-latest

Call to an undefined method ipl\Html\Contract\FormElement::addHtml().

Check failure on line 250 in library/Notifications/Widget/Calendar/Controls.php

View workflow job for this annotation

GitHub Actions / phpstan / Static analysis with phpstan and php 8.3 on ubuntu-latest

Call to an undefined method ipl\Html\Contract\FormElement::addHtml().
'value' => $previousMonth->format(self::WEEK_FORMAT),
'class' => 'control-button',
'type' => 'submit',
'title' => sprintf(
$this->translate('Show %s to %s'),
...$this->getLocalizedWeek($previousMonth)
)
])->addHtml(new Icon('angle-left'));
$this->addHtml($previousMonthBtn);

$this->addHtml(new HtmlElement(
'div',
Attributes::create(['class' => 'icinga-controls']),
$this->createElement('select', 'week', [
'class' => 'autosubmit',
'value' => $chosenWeekFormatted,
Expand All @@ -239,7 +270,38 @@ protected function assembleWeekSelectors(): void
$this->translate('Show a different month in %d'),
$chosenYear
)
]),
])
));

$nextMonth = (clone $chosenWeek)->add(new DateInterval('P1M'));
/** @var ButtonElement $nextWeekBtn */
$nextMonthBtn = $this->createElement('button', 'week', [

Check failure on line 278 in library/Notifications/Widget/Calendar/Controls.php

View workflow job for this annotation

GitHub Actions / phpstan / Static analysis with phpstan and php 7.2 on ubuntu-latest

Call to an undefined method ipl\Html\Contract\FormElement::addHtml().

Check failure on line 278 in library/Notifications/Widget/Calendar/Controls.php

View workflow job for this annotation

GitHub Actions / phpstan / Static analysis with phpstan and php 7.2 on ubuntu-latest

Variable $nextWeekBtn in PHPDoc tag @var does not match assigned variable $nextMonthBtn.

Check failure on line 278 in library/Notifications/Widget/Calendar/Controls.php

View workflow job for this annotation

GitHub Actions / phpstan / Static analysis with phpstan and php 8.0 on ubuntu-latest

Call to an undefined method ipl\Html\Contract\FormElement::addHtml().

Check failure on line 278 in library/Notifications/Widget/Calendar/Controls.php

View workflow job for this annotation

GitHub Actions / phpstan / Static analysis with phpstan and php 8.0 on ubuntu-latest

Variable $nextWeekBtn in PHPDoc tag @var does not match assigned variable $nextMonthBtn.

Check failure on line 278 in library/Notifications/Widget/Calendar/Controls.php

View workflow job for this annotation

GitHub Actions / phpstan / Static analysis with phpstan and php 7.3 on ubuntu-latest

Call to an undefined method ipl\Html\Contract\FormElement::addHtml().

Check failure on line 278 in library/Notifications/Widget/Calendar/Controls.php

View workflow job for this annotation

GitHub Actions / phpstan / Static analysis with phpstan and php 7.3 on ubuntu-latest

Variable $nextWeekBtn in PHPDoc tag @var does not match assigned variable $nextMonthBtn.

Check failure on line 278 in library/Notifications/Widget/Calendar/Controls.php

View workflow job for this annotation

GitHub Actions / phpstan / Static analysis with phpstan and php 8.2 on ubuntu-latest

Call to an undefined method ipl\Html\Contract\FormElement::addHtml().

Check failure on line 278 in library/Notifications/Widget/Calendar/Controls.php

View workflow job for this annotation

GitHub Actions / phpstan / Static analysis with phpstan and php 8.2 on ubuntu-latest

Variable $nextWeekBtn in PHPDoc tag @var does not match assigned variable $nextMonthBtn.

Check failure on line 278 in library/Notifications/Widget/Calendar/Controls.php

View workflow job for this annotation

GitHub Actions / phpstan / Static analysis with phpstan and php 7.4 on ubuntu-latest

Call to an undefined method ipl\Html\Contract\FormElement::addHtml().

Check failure on line 278 in library/Notifications/Widget/Calendar/Controls.php

View workflow job for this annotation

GitHub Actions / phpstan / Static analysis with phpstan and php 7.4 on ubuntu-latest

Variable $nextWeekBtn in PHPDoc tag @var does not match assigned variable $nextMonthBtn.

Check failure on line 278 in library/Notifications/Widget/Calendar/Controls.php

View workflow job for this annotation

GitHub Actions / phpstan / Static analysis with phpstan and php 8.1 on ubuntu-latest

Call to an undefined method ipl\Html\Contract\FormElement::addHtml().

Check failure on line 278 in library/Notifications/Widget/Calendar/Controls.php

View workflow job for this annotation

GitHub Actions / phpstan / Static analysis with phpstan and php 8.1 on ubuntu-latest

Variable $nextWeekBtn in PHPDoc tag @var does not match assigned variable $nextMonthBtn.

Check failure on line 278 in library/Notifications/Widget/Calendar/Controls.php

View workflow job for this annotation

GitHub Actions / phpstan / Static analysis with phpstan and php 8.3 on ubuntu-latest

Call to an undefined method ipl\Html\Contract\FormElement::addHtml().

Check failure on line 278 in library/Notifications/Widget/Calendar/Controls.php

View workflow job for this annotation

GitHub Actions / phpstan / Static analysis with phpstan and php 8.3 on ubuntu-latest

Variable $nextWeekBtn in PHPDoc tag @var does not match assigned variable $nextMonthBtn.
'value' => $nextMonth->format(self::WEEK_FORMAT),
'class' => 'control-button',
'type' => 'submit',
'title' => sprintf(
$this->translate('Show %s to %s'),
...$this->getLocalizedWeek($nextMonth)
)
])->addHtml(new Icon('angle-right'));
$this->addHtml($nextMonthBtn);

$previousWeek = (clone $chosenWeek)->sub(new DateInterval('P1W'));
/** @var ButtonElement $previousWeekBtn */
$previousWeekBtn = $this->createElement('button', 'week', [

Check failure on line 291 in library/Notifications/Widget/Calendar/Controls.php

View workflow job for this annotation

GitHub Actions / phpstan / Static analysis with phpstan and php 7.2 on ubuntu-latest

Call to an undefined method ipl\Html\Contract\FormElement::addHtml().

Check failure on line 291 in library/Notifications/Widget/Calendar/Controls.php

View workflow job for this annotation

GitHub Actions / phpstan / Static analysis with phpstan and php 8.0 on ubuntu-latest

Call to an undefined method ipl\Html\Contract\FormElement::addHtml().

Check failure on line 291 in library/Notifications/Widget/Calendar/Controls.php

View workflow job for this annotation

GitHub Actions / phpstan / Static analysis with phpstan and php 7.3 on ubuntu-latest

Call to an undefined method ipl\Html\Contract\FormElement::addHtml().

Check failure on line 291 in library/Notifications/Widget/Calendar/Controls.php

View workflow job for this annotation

GitHub Actions / phpstan / Static analysis with phpstan and php 8.2 on ubuntu-latest

Call to an undefined method ipl\Html\Contract\FormElement::addHtml().

Check failure on line 291 in library/Notifications/Widget/Calendar/Controls.php

View workflow job for this annotation

GitHub Actions / phpstan / Static analysis with phpstan and php 7.4 on ubuntu-latest

Call to an undefined method ipl\Html\Contract\FormElement::addHtml().

Check failure on line 291 in library/Notifications/Widget/Calendar/Controls.php

View workflow job for this annotation

GitHub Actions / phpstan / Static analysis with phpstan and php 8.1 on ubuntu-latest

Call to an undefined method ipl\Html\Contract\FormElement::addHtml().

Check failure on line 291 in library/Notifications/Widget/Calendar/Controls.php

View workflow job for this annotation

GitHub Actions / phpstan / Static analysis with phpstan and php 8.3 on ubuntu-latest

Call to an undefined method ipl\Html\Contract\FormElement::addHtml().
'value' => $previousWeek->format(self::WEEK_FORMAT),
'class' => 'control-button',
'type' => 'submit',
'title' => sprintf(
$this->translate('Show %s to %s'),
...$this->getLocalizedWeek($previousWeek)
)
])->addHtml(new Icon('angle-left'));
$this->addHtml($previousWeekBtn);

$this->addHtml(new HtmlElement(
'div',
Attributes::create(['class' => 'icinga-controls']),
$this->createElement('select', 'week', [
'class' => 'autosubmit',
'value' => $chosenWeekFormatted,
Expand All @@ -254,17 +316,17 @@ protected function assembleWeekSelectors(): void
));

$nextWeek = (clone $chosenWeek)->add(new DateInterval('P1W'));
/** @var ButtonElement $nextBtn */
$nextBtn = $this->createElement('button', 'week', [
/** @var ButtonElement $nextWeekBtn */
$nextWeekBtn = $this->createElement('button', 'week', [

Check failure on line 320 in library/Notifications/Widget/Calendar/Controls.php

View workflow job for this annotation

GitHub Actions / phpstan / Static analysis with phpstan and php 7.2 on ubuntu-latest

Call to an undefined method ipl\Html\Contract\FormElement::addHtml().

Check failure on line 320 in library/Notifications/Widget/Calendar/Controls.php

View workflow job for this annotation

GitHub Actions / phpstan / Static analysis with phpstan and php 8.0 on ubuntu-latest

Call to an undefined method ipl\Html\Contract\FormElement::addHtml().

Check failure on line 320 in library/Notifications/Widget/Calendar/Controls.php

View workflow job for this annotation

GitHub Actions / phpstan / Static analysis with phpstan and php 7.3 on ubuntu-latest

Call to an undefined method ipl\Html\Contract\FormElement::addHtml().

Check failure on line 320 in library/Notifications/Widget/Calendar/Controls.php

View workflow job for this annotation

GitHub Actions / phpstan / Static analysis with phpstan and php 8.2 on ubuntu-latest

Call to an undefined method ipl\Html\Contract\FormElement::addHtml().

Check failure on line 320 in library/Notifications/Widget/Calendar/Controls.php

View workflow job for this annotation

GitHub Actions / phpstan / Static analysis with phpstan and php 7.4 on ubuntu-latest

Call to an undefined method ipl\Html\Contract\FormElement::addHtml().

Check failure on line 320 in library/Notifications/Widget/Calendar/Controls.php

View workflow job for this annotation

GitHub Actions / phpstan / Static analysis with phpstan and php 8.1 on ubuntu-latest

Call to an undefined method ipl\Html\Contract\FormElement::addHtml().

Check failure on line 320 in library/Notifications/Widget/Calendar/Controls.php

View workflow job for this annotation

GitHub Actions / phpstan / Static analysis with phpstan and php 8.3 on ubuntu-latest

Call to an undefined method ipl\Html\Contract\FormElement::addHtml().
'value' => $nextWeek->format(self::WEEK_FORMAT),
'class' => 'control-button',
'type' => 'submit',
'title' => sprintf(
$this->translate('Show %s to %s'),
...$this->getLocalizedWeek($nextWeek)
)
]);
$this->addHtml($nextBtn->addHtml(new Icon('angle-right')));
])->addHtml(new Icon('angle-right'));
$this->addHtml($nextWeekBtn);
}

protected function assembleMonthSelectors(): void
Expand All @@ -286,19 +348,19 @@ protected function assembleMonthSelectors(): void
'disabled' => true
]);

$previousMonth = (clone $chosenMonth)->sub(new DateInterval('P1M'));
/** @var ButtonElement $previousBtn */
$previousBtn = $this->createElement('button', 'month', [
'value' => $previousMonth->format(self::MONTH_FORMAT),
$previousYear = (clone $chosenMonth)->sub(new DateInterval('P1Y'));
/** @var ButtonElement $previousYearBtn */
$previousYearBtn = $this->createElement('button', 'month', [

Check failure on line 353 in library/Notifications/Widget/Calendar/Controls.php

View workflow job for this annotation

GitHub Actions / phpstan / Static analysis with phpstan and php 7.2 on ubuntu-latest

Call to an undefined method ipl\Html\Contract\FormElement::addHtml().

Check failure on line 353 in library/Notifications/Widget/Calendar/Controls.php

View workflow job for this annotation

GitHub Actions / phpstan / Static analysis with phpstan and php 8.0 on ubuntu-latest

Call to an undefined method ipl\Html\Contract\FormElement::addHtml().

Check failure on line 353 in library/Notifications/Widget/Calendar/Controls.php

View workflow job for this annotation

GitHub Actions / phpstan / Static analysis with phpstan and php 7.3 on ubuntu-latest

Call to an undefined method ipl\Html\Contract\FormElement::addHtml().

Check failure on line 353 in library/Notifications/Widget/Calendar/Controls.php

View workflow job for this annotation

GitHub Actions / phpstan / Static analysis with phpstan and php 8.2 on ubuntu-latest

Call to an undefined method ipl\Html\Contract\FormElement::addHtml().

Check failure on line 353 in library/Notifications/Widget/Calendar/Controls.php

View workflow job for this annotation

GitHub Actions / phpstan / Static analysis with phpstan and php 7.4 on ubuntu-latest

Call to an undefined method ipl\Html\Contract\FormElement::addHtml().

Check failure on line 353 in library/Notifications/Widget/Calendar/Controls.php

View workflow job for this annotation

GitHub Actions / phpstan / Static analysis with phpstan and php 8.1 on ubuntu-latest

Call to an undefined method ipl\Html\Contract\FormElement::addHtml().

Check failure on line 353 in library/Notifications/Widget/Calendar/Controls.php

View workflow job for this annotation

GitHub Actions / phpstan / Static analysis with phpstan and php 8.3 on ubuntu-latest

Call to an undefined method ipl\Html\Contract\FormElement::addHtml().
'value' => $previousYear->format(self::MONTH_FORMAT),
'class' => 'control-button',
'type' => 'submit',
'title' => sprintf(
$this->translate('Show %s %d'),
$this->getLocalizedMonth($previousMonth),
$previousMonth->format('Y')
$this->getLocalizedMonth($previousYear),
$previousYear->format('Y')
)
]);
$this->addHtml($previousBtn->addHtml(new Icon('angle-left')));
])->addHtml(new Icon('angle-left'));
$this->addHtml($previousYearBtn);

// Let's be pragmatic and offer the user only a limited set of years.
$years = [];
Expand Down Expand Up @@ -337,7 +399,40 @@ protected function assembleMonthSelectors(): void
$this->translate('Show %s of a different year'),
$this->getLocalizedMonth($chosenMonth)
)
]),
])
));

$nextYear = (clone $chosenMonth)->add(new DateInterval('P1Y'));
/** @var ButtonElement $nextYearBtn */
$nextYearBtn = $this->createElement('button', 'month', [

Check failure on line 407 in library/Notifications/Widget/Calendar/Controls.php

View workflow job for this annotation

GitHub Actions / phpstan / Static analysis with phpstan and php 7.2 on ubuntu-latest

Call to an undefined method ipl\Html\Contract\FormElement::addHtml().

Check failure on line 407 in library/Notifications/Widget/Calendar/Controls.php

View workflow job for this annotation

GitHub Actions / phpstan / Static analysis with phpstan and php 8.0 on ubuntu-latest

Call to an undefined method ipl\Html\Contract\FormElement::addHtml().

Check failure on line 407 in library/Notifications/Widget/Calendar/Controls.php

View workflow job for this annotation

GitHub Actions / phpstan / Static analysis with phpstan and php 7.3 on ubuntu-latest

Call to an undefined method ipl\Html\Contract\FormElement::addHtml().

Check failure on line 407 in library/Notifications/Widget/Calendar/Controls.php

View workflow job for this annotation

GitHub Actions / phpstan / Static analysis with phpstan and php 8.2 on ubuntu-latest

Call to an undefined method ipl\Html\Contract\FormElement::addHtml().

Check failure on line 407 in library/Notifications/Widget/Calendar/Controls.php

View workflow job for this annotation

GitHub Actions / phpstan / Static analysis with phpstan and php 7.4 on ubuntu-latest

Call to an undefined method ipl\Html\Contract\FormElement::addHtml().

Check failure on line 407 in library/Notifications/Widget/Calendar/Controls.php

View workflow job for this annotation

GitHub Actions / phpstan / Static analysis with phpstan and php 8.1 on ubuntu-latest

Call to an undefined method ipl\Html\Contract\FormElement::addHtml().

Check failure on line 407 in library/Notifications/Widget/Calendar/Controls.php

View workflow job for this annotation

GitHub Actions / phpstan / Static analysis with phpstan and php 8.3 on ubuntu-latest

Call to an undefined method ipl\Html\Contract\FormElement::addHtml().
'value' => $nextYear->format(self::MONTH_FORMAT),
'class' => 'control-button',
'type' => 'submit',
'title' => sprintf(
$this->translate('Show %s %d'),
$this->getLocalizedMonth($nextYear),
$nextYear->format('Y')
)
])->addHtml(new Icon('angle-right'));
$this->addHtml($nextYearBtn);

$previousMonth = (clone $chosenMonth)->sub(new DateInterval('P1M'));
/** @var ButtonElement $previousMonthBtn */
$previousMonthBtn = $this->createElement('button', 'month', [
'value' => $previousMonth->format(self::MONTH_FORMAT),
'class' => 'control-button',
'type' => 'submit',
'title' => sprintf(
$this->translate('Show %s %d'),
$this->getLocalizedMonth($previousMonth),
$previousMonth->format('Y')
)
])->addHtml(new Icon('angle-left'));
$this->addHtml($previousMonthBtn);

$this->addHtml(new HtmlElement(
'div',
Attributes::create(['class' => 'icinga-controls']),
$this->createElement('select', 'month', [
'class' => 'autosubmit',
'value' => $chosenMonthFormatted,
Expand All @@ -351,8 +446,8 @@ protected function assembleMonthSelectors(): void
));

$nextMonth = $chosenMonth->add(new DateInterval('P1M'));
/** @var ButtonElement $nextBtn */
$nextBtn = $this->createElement('button', 'month', [
/** @var ButtonElement $nextMonthBtn */
$nextMonthBtn = $this->createElement('button', 'month', [
'value' => $nextMonth->format(self::MONTH_FORMAT),
'class' => 'control-button',
'type' => 'submit',
Expand All @@ -361,8 +456,8 @@ protected function assembleMonthSelectors(): void
$this->getLocalizedMonth($nextMonth),
$nextMonth->format('Y')
)
]);
$this->addHtml($nextBtn->addHtml(new Icon('angle-right')));
])->addHtml(new Icon('angle-right'));
$this->addHtml($nextMonthBtn);
}

/**
Expand Down

0 comments on commit 4018874

Please sign in to comment.