allow to select reports as initial view (#2403)
This commit is contained in:
34
src/Twig/Runtime/ReportingExtension.php
Normal file
34
src/Twig/Runtime/ReportingExtension.php
Normal file
@@ -0,0 +1,34 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of the Kimai time-tracking app.
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace App\Twig\Runtime;
|
||||
|
||||
use App\Entity\User;
|
||||
use App\Reporting\ReportingService;
|
||||
use App\Reporting\ReportInterface;
|
||||
use Twig\Extension\RuntimeExtensionInterface;
|
||||
|
||||
final class ReportingExtension implements RuntimeExtensionInterface
|
||||
{
|
||||
private $service;
|
||||
|
||||
public function __construct(ReportingService $reportingService)
|
||||
{
|
||||
$this->service = $reportingService;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param User $user
|
||||
* @return ReportInterface[]
|
||||
*/
|
||||
public function getAvailableReports(User $user): array
|
||||
{
|
||||
return $this->service->getAvailableReports($user);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user