* improved dev fixtures with more diversity, more data, better testcases, user avatars #42 * added customer stats to dashboard, fixed column length for 3 widgets #42 * fixed empty alias - display empty message for new user #42 * unified-ui for "new" toolbar icon #42 * use kimai2_ as database prefix #42 * added customer stats to dashboard, fixed column length for 3 widgets #42 * fix long project/customer names in "currently active" navbar flyout" #42 * added services config for dev environment #42 * added command to run unit tests #42 * added command to run integration tests #42 * added command to run code sniffer #42 * added phpcs and phpunit to composer #42 * created tests directory #42 * fixed code sniffer warnings #42 * added function to switch result type from Pagerfanta to QueryBuilder #42 * dramatically reduced database calls by using custom joined query #42 * added command to install kimai dependencies #42 * added dev:reset command #42
56 lines
1.5 KiB
PHP
56 lines
1.5 KiB
PHP
<?php
|
|
|
|
/*
|
|
* This file is part of the Kimai package.
|
|
*
|
|
* (c) Kevin Papst <kevin@kevinpapst.de>
|
|
*
|
|
* For the full copyright and license information, please view the LICENSE
|
|
* file that was distributed with this source code.
|
|
*/
|
|
|
|
namespace TimesheetBundle\Controller;
|
|
|
|
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
|
|
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route;
|
|
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Security;
|
|
use TimesheetBundle\Entity\Activity;
|
|
use TimesheetBundle\Repository\ActivityRepository;
|
|
|
|
/**
|
|
* Controller used to manage activity contents in the public part of the site.
|
|
*
|
|
* @Route("/activity")
|
|
* @Security("has_role('ROLE_USER')")
|
|
*
|
|
* @author Kevin Papst <kevin@kevinpapst.de>
|
|
*/
|
|
class ActivityController extends Controller
|
|
{
|
|
|
|
/**
|
|
* @return ActivityRepository
|
|
*/
|
|
protected function getRepository()
|
|
{
|
|
return $this->getDoctrine()->getRepository(Activity::class);
|
|
}
|
|
|
|
/**
|
|
* The flyout to render recent activities and quick-start new recordings.
|
|
*
|
|
* @return \Symfony\Component\HttpFoundation\Response
|
|
*/
|
|
public function recentActivitiesAction()
|
|
{
|
|
$user = $this->getUser();
|
|
// TODO make days configurable
|
|
$activeEntries = $this->getRepository()->getRecentActivities($user, new \DateTime('-30 days'));
|
|
|
|
return $this->render(
|
|
'TimesheetBundle:Navbar:recent-activities.html.twig',
|
|
['activities' => $activeEntries]
|
|
);
|
|
}
|
|
}
|