User profile layout (#2402)

This commit is contained in:
Kevin Papst
2021-03-06 12:34:34 +01:00
committed by GitHub
parent d3099aca39
commit 5583caa9e4
30 changed files with 550 additions and 268 deletions

View File

@@ -0,0 +1,41 @@
<?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\Event;
use App\Entity\User;
class PageActionsEvent extends ThemeEvent
{
private $action;
public function __construct(User $user, array $payload, string $action)
{
if (!\array_key_exists('actions', $payload)) {
$payload['actions'] = [];
}
parent::__construct($user, $payload);
$this->action = $action;
}
public function getActionName(): string
{
return $this->action;
}
public function getActions(): array
{
return $this->payload['actions'];
}
public function setActions(array $actions): void
{
$this->payload['actions'] = $actions;
}
}

View File

@@ -12,7 +12,7 @@ namespace App\Event;
use App\Entity\User;
use Symfony\Contracts\EventDispatcher\Event;
final class ThemeEvent extends Event
class ThemeEvent extends Event
{
public const JAVASCRIPT = 'app.theme.javascript';
public const STYLESHEET = 'app.theme.css';
@@ -25,15 +25,15 @@ final class ThemeEvent extends Event
/**
* @var User|null
*/
protected $user;
private $user;
/**
* @var string
*/
protected $content = '';
private $content = '';
/**
* @var mixed
*/
protected $payload = null;
protected $payload;
public function __construct(?User $user = null, $payload = null)
{
@@ -41,13 +41,8 @@ final class ThemeEvent extends Event
$this->payload = $payload;
}
/**
* @deprecated since 1.0
*/
public function getUser(): ?User
{
@trigger_error('Using ThemeEvent::getUser() is deprecated and will be removed with 2.0', E_USER_DEPRECATED);
return $this->user;
}