Skip to content

Commit 8ed07f8

Browse files
committed
Added a small easter egg
1 parent e4137a0 commit 8ed07f8

File tree

1 file changed

+36
-1
lines changed

1 file changed

+36
-1
lines changed

src/Controller/Admin/DashboardController.php

Lines changed: 36 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -239,14 +239,49 @@ public function configureMenuItems(): iterable
239239
->setPermission('ROLE_READ_USER');
240240

241241
$version = $this->app_version.'-'.$this->gitVersionInfo->getGitCommitHash() ?? '';
242-
yield MenuItem::section('Version '.$version, 'fas fa-info');
242+
yield MenuItem::section('Version '.$version, $this->infoIconEasterEgg());
243243
yield MenuItem::linktoRoute('dashboard.menu.audits', 'fas fa-binoculars', 'dh_auditor_list_audits')
244244
->setPermission('ROLE_VIEW_AUDITS');
245245
yield MenuItem::linktoRoute('dashboard.menu.homepage', 'fas fa-home', 'homepage');
246246
yield MenuItem::linkToUrl('dashboard.menu.stura', 'fab fa-rebel', 'https://www.stura.uni-jena.de/');
247247
yield MenuItem::linkToUrl('dashboard.menu.github', 'fab fa-github', 'https://github.com/jbtronics/StuRa-Finanzsoftware');
248248
}
249249

250+
/**
251+
* A little easteregg, that show different icons for the version info, depending on the date
252+
* @param \DateTimeInterface|null $dateTime
253+
* @return string
254+
*/
255+
private function infoIconEasterEgg(?\DateTimeInterface $dateTime = null): string
256+
{
257+
if ($dateTime === null) {
258+
$dateTime = new \DateTimeImmutable();
259+
}
260+
261+
$day = (int) $dateTime->format('d');
262+
$month = (int) $dateTime->format('m');
263+
264+
return 'fas ' . match ([$day, $month]) {
265+
[31, 10] => 'fa-ghost',
266+
[24, 12] => 'fa-gifts',
267+
[25, 12] => 'fa-sleigh',
268+
[31, 12] => 'fa-champagne-glasses',
269+
[1, 1] => 'fa-clover',
270+
[29, 2] => 'fa-frog',
271+
[13, 4] => 'fa-cake-candles',
272+
[4, 5] => 'fa-jedi',
273+
[14, 3] => 'fa-chart-pie',
274+
[20, 9] => 'fa-children',
275+
[3, 10] => 'fa-flag',
276+
[9, 5] => 'fa-earth-europe',
277+
278+
[1, 10] => 'fa-snowflake',
279+
[1, 4] => 'fa-sun',
280+
281+
default => 'fa-info'
282+
};
283+
}
284+
250285
public function configureUserMenu(UserInterface $user): UserMenu
251286
{
252287
/** @var User $user */

0 commit comments

Comments
 (0)