navigation = []; $this->navigation[] = new NavigationEntry('Startseite', '/'); if ($this->session === null) { $this->navigation[] = new NavigationEntry('Registrieren', '/register.php'); $this->navigation[] = new NavigationEntry('Einloggen', '/login.php'); } else { $this->navigation[] = new NavigationEntry('Umsatzübersicht', '/bookings.php'); if ($this->session->user->isAdmin) { $this->navigation[] = new NavigationEntry('Einzahlen', '/deposit.php'); $this->navigation[] = new NavigationEntry('Auszahlen', '/withdraw.php'); } $this->navigation[] = new NavigationEntry('Überweisen', '/transfer.php'); $this->navigation[] = new NavigationEntry('Ausloggen', '/logout.php'); } } public static function init(string $url): self { $context = new self(); $context->requestTime = time(); $context->currentPage = $url; $context->session = Session::load(); $context->initNavigation(); return $context; } }