isGranted('IS_AUTHENTICATED_FULLY')) { return $this->redirect('/index.php/home'); } return $this->render('default/index.html.twig'); } #[Route('/home', name: 'app_home')] public function home(Request $req, EntityManagerInterface $emi, #[CurrentUser()] ?User $user): Response { $this->denyAccessUnlessGranted('IS_AUTHENTICATED_FULLY'); $last4Notes = $emi->getRepository(Note::class)->getLast4Notes($user); $openNotes = $emi->getRepository(Note::class)->reverseNoteSort($user); $meta = $user->getMetaData(); return $this->render('default/home.html.twig', [ 'last4Notes' => $last4Notes, 'reverseNoteSort' => $openNotes, 'isAdmin' => $this->isGranted('ROLE_ADMIN'), 'meta' => $meta, ]); } #[Route('/cheat-sheet', name: 'app_cheat_sheet')] public function cheatSheet(): Response { return $this->render('default/cheat-sheet.html.twig'); } #[Route('/profile', name: 'app_profile')] public function profile(): Response { /** @var User $user */ $user = $this->getUser(); if (!$user) { return $this->redirectToRoute('app_login'); } $meta = $user->getMetaData(); if (!$meta) { $meta = [ 'saveInterval' => 15, 'saveReferences' => 'checked', 'noteTextSize' => 12, 'trackSaveSize' => null, 'saveFailureCount' => 3, 'saveTimeout' => 5, ]; } else { $meta['saveReferences'] = $meta['saveReferences'] ? 'checked' : null; $meta['trackSaveSize'] = $meta['trackSaveSize'] ? 'checked' : null; } return $this->render('default/profile.html.twig', [ 'meta' => $meta, ]); } #[Route('/reference-editor', name: 'app_reference_editor')] public function referenceEditor(EntityManagerInterface $emi): Response { $this->denyAccessUnlessGranted('ROLE_ADMIN'); return $this->render('editors/reference-editor.html.twig'); } #[Route('/template-editor', name: 'app_template_editor')] public function templateEditor(): Response { $this->denyAccessUnlessGranted('IS_AUTHENTICATED_FULLY'); return $this->render('editors/template-editor.html.twig'); } }