53 lines
1.1 KiB
PHP
53 lines
1.1 KiB
PHP
<?php
|
|
|
|
namespace KimaiPlugin\KimaiHeatmapBundle\Widget;
|
|
|
|
use App\Widget\Type\AbstractWidget;
|
|
use App\Widget\WidgetInterface;
|
|
use KimaiPlugin\KimaiHeatmapBundle\Service\HeatmapService;
|
|
|
|
class HeatmapWidget extends AbstractWidget
|
|
{
|
|
public function __construct(private readonly HeatmapService $service)
|
|
{
|
|
}
|
|
|
|
public function getId(): string
|
|
{
|
|
return 'HeatmapWidget';
|
|
}
|
|
|
|
public function getTitle(): string
|
|
{
|
|
return 'Activity Heatmap';
|
|
}
|
|
|
|
public function getWidth(): int
|
|
{
|
|
return WidgetInterface::WIDTH_FULL;
|
|
}
|
|
|
|
public function getHeight(): int
|
|
{
|
|
return WidgetInterface::HEIGHT_LARGE;
|
|
}
|
|
|
|
public function getPermissions(): array
|
|
{
|
|
return ['view_own_timesheet'];
|
|
}
|
|
|
|
public function getData(array $options = []): mixed
|
|
{
|
|
$user = $this->getUser();
|
|
|
|
return [
|
|
'projects' => $this->service->getUserProjects($user),
|
|
];
|
|
}
|
|
|
|
public function getTemplateName(): string
|
|
{
|
|
return '@KimaiHeatmapBundle/widget/heatmap.html.twig';
|
|
}
|
|
}
|