-
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
9 changed files
with
259 additions
and
49 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
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,65 @@ | ||
<?php | ||
|
||
namespace Icinga\Module\Notifications\Widget\Calendar; | ||
|
||
use DateTime; | ||
use ipl\I18n\Translation; | ||
use ipl\Web\Widget\Link; | ||
|
||
class ExtraEntryCount extends Link | ||
{ | ||
use Translation; | ||
|
||
protected $defaultAttributes = ['class' => 'extra-count', 'target' => '_self']; | ||
|
||
/** @var BaseGrid */ | ||
protected $grid; | ||
|
||
/** @var DateTime Day for which the extra count is being registered */ | ||
protected $gridStep; | ||
|
||
/** | ||
* Set the grid the tied to this extra count | ||
* | ||
* @param BaseGrid $grid | ||
* | ||
* @return $this | ||
*/ | ||
public function setGrid(BaseGrid $grid): self | ||
{ | ||
$this->grid = $grid; | ||
|
||
return $this; | ||
} | ||
|
||
/** | ||
* Set the day for which the extra count is being registered | ||
* | ||
* @param DateTime $gridStep Grid step | ||
* | ||
* @return $this | ||
*/ | ||
public function setGridStep(DateTime $gridStep): self | ||
{ | ||
$this->gridStep = clone $gridStep; | ||
|
||
return $this; | ||
} | ||
|
||
protected function assemble() | ||
{ | ||
$count = $this->grid->getExtraEntryCount($this->gridStep); | ||
if ($count > 0) { | ||
$this->setContent( | ||
sprintf( | ||
$this->translatePlural( | ||
'+%d entry', | ||
'+%d entries', | ||
$count | ||
), | ||
$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
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.