-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Show extra appointments link for week and month views
- Loading branch information
Showing
8 changed files
with
287 additions
and
48 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
<?php | ||
|
||
namespace Icinga\Module\Notifications\Widget\Calendar; | ||
|
||
use ipl\I18n\Translation; | ||
use ipl\Web\Url; | ||
use ipl\Web\Widget\Link; | ||
|
||
class ExtraEntryCount extends Link | ||
{ | ||
use Translation; | ||
|
||
protected $defaultAttributes = ['class' => 'extra-count']; | ||
|
||
/** @var ?Url Url to the day grid*/ | ||
protected $url; | ||
|
||
/** @var BaseGrid */ | ||
protected $grid; | ||
|
||
/** @var string Date in Y-m-d format */ | ||
protected $date; | ||
|
||
/** | ||
* Grid setter | ||
* | ||
* @param BaseGrid $grid | ||
* | ||
* @return $this | ||
*/ | ||
public function setGrid(BaseGrid $grid): self | ||
{ | ||
$this->grid = $grid; | ||
|
||
return $this; | ||
} | ||
|
||
/** | ||
* Setter for Date | ||
* | ||
* @param string $date Date in Y-m-d format | ||
* | ||
* @return $this | ||
*/ | ||
public function setDate(string $date): self | ||
{ | ||
$this->date = $date; | ||
|
||
return $this; | ||
} | ||
|
||
protected function assemble() | ||
{ | ||
$count = $this->grid->getExtraEntryCount($this->date); | ||
if ($count > 0) { | ||
$this->setContent($this->translatePlural( | ||
"+$count entry", | ||
"+$count entries", | ||
$count | ||
)); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.