recent activities via API (#761)

This commit is contained in:
Kevin Papst
2019-05-07 22:24:28 +02:00
committed by GitHub
parent 98f386dad6
commit b1855447b8
40 changed files with 376 additions and 258 deletions

View File

@@ -1,40 +0,0 @@
<?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\Controller;
use App\Repository\ActivityRepository;
use App\Timesheet\UserDateTimeFactory;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Security;
use Symfony\Component\HttpFoundation\Response;
/**
* Controller used to render recent activities and quick-start new recordings in the navigation-bar.
*
* @Security("is_granted('ROLE_USER')")
*/
class NavbarController extends AbstractController
{
/**
* @param ActivityRepository $repository
* @param UserDateTimeFactory $dateTimeFactory
* @return Response
* @throws \Doctrine\ORM\Query\QueryException
*/
public function recentActivitiesAction(ActivityRepository $repository, UserDateTimeFactory $dateTimeFactory)
{
$user = $this->getUser();
$entries = $repository->getRecentActivities($user, $dateTimeFactory->createDateTime('-1 year'));
return $this->render(
'navbar/recent-activities.html.twig',
['entries' => $entries]
);
}
}

View File

@@ -109,7 +109,9 @@ class SystemConfigurationController extends AbstractController
*/
protected function handleConfigUpdate(Request $request, string $section)
{
$configModel = null;
$configSettings = $this->getInitializedConfigurations();
foreach ($configSettings as $configModel) {
if ($configModel->getSection() === $section) {
break;