added project detail report (#2651)
- avatars via css only - random colors for entities - improves print view - added colors for teams - added color to tag
This commit is contained in:
@@ -9,6 +9,58 @@
|
||||
|
||||
namespace App\Model;
|
||||
|
||||
class ActivityStatistic extends TimesheetCountedStatistic
|
||||
use App\Entity\Activity;
|
||||
|
||||
class ActivityStatistic extends TimesheetCountedStatistic implements \JsonSerializable
|
||||
{
|
||||
/**
|
||||
* @var Activity
|
||||
*/
|
||||
private $activity;
|
||||
|
||||
public function getActivity(): ?Activity
|
||||
{
|
||||
return $this->activity;
|
||||
}
|
||||
|
||||
public function setActivity(Activity $activity): void
|
||||
{
|
||||
$this->activity = $activity;
|
||||
}
|
||||
|
||||
/**
|
||||
* Added for simpler re-use in frontend (charts).
|
||||
*
|
||||
* @return string|null
|
||||
*/
|
||||
public function getColor(): ?string
|
||||
{
|
||||
if ($this->activity === null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return $this->activity->getColor();
|
||||
}
|
||||
|
||||
/**
|
||||
* Added for simpler re-use in frontend (charts).
|
||||
*
|
||||
* @return string|null
|
||||
*/
|
||||
public function getName(): ?string
|
||||
{
|
||||
if ($this->activity === null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return $this->activity->getName();
|
||||
}
|
||||
|
||||
public function jsonSerialize()
|
||||
{
|
||||
return array_merge(parent::jsonSerialize(), [
|
||||
'name' => $this->getName(),
|
||||
'color' => $this->getColor(),
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user