add user preference: default report (#2430)

This commit is contained in:
Kevin Papst
2021-03-14 13:32:47 +01:00
committed by GitHub
parent 0a6ea6be42
commit c0378b4f51
16 changed files with 264 additions and 57 deletions

View File

@@ -18,8 +18,10 @@ use App\Form\Type\CalendarViewType;
use App\Form\Type\FirstWeekDayType;
use App\Form\Type\InitialViewType;
use App\Form\Type\LanguageType;
use App\Form\Type\ReportType;
use App\Form\Type\SkinType;
use App\Form\Type\ThemeLayoutType;
use App\Reporting\ReportingService;
use Symfony\Component\EventDispatcher\EventDispatcherInterface;
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
use Symfony\Component\Form\Extension\Core\Type\CheckboxType;
@@ -30,24 +32,15 @@ use Symfony\Component\Validator\Constraints\Range;
final class UserPreferenceSubscriber implements EventSubscriberInterface
{
/**
* @var EventDispatcherInterface
*/
private $eventDispatcher;
/**
* @var AuthorizationCheckerInterface
*/
private $voter;
/**
* @var SystemConfiguration
*/
private $configuration;
public function __construct(EventDispatcherInterface $dispatcher, AuthorizationCheckerInterface $voter, SystemConfiguration $formConfig)
public function __construct(EventDispatcherInterface $eventDispatcher, AuthorizationCheckerInterface $voter, SystemConfiguration $systemConfiguration)
{
$this->eventDispatcher = $dispatcher;
$this->eventDispatcher = $eventDispatcher;
$this->voter = $voter;
$this->configuration = $formConfig;
$this->configuration = $systemConfiguration;
}
public static function getSubscribedEvents(): array
@@ -153,6 +146,13 @@ final class UserPreferenceSubscriber implements EventSubscriberInterface
->setSection('behaviour')
->setType(CalendarViewType::class),
(new UserPreference())
->setName('reporting.initial_view')
->setValue(ReportingService::DEFAULT_VIEW)
->setOrder(650)
->setSection('behaviour')
->setType(ReportType::class),
(new UserPreference())
->setName('login.initial_view')
->setValue(InitialViewType::DEFAULT_VIEW)