render('@ChamiloCore/Index/vue.html.twig'); } /** * Use only in PHPUnit tests. * * @param mixed $name */ public function classic($name): Response { if ('test' !== ($_SERVER['APP_ENV'] ?? '')) { exit; } $rootDir = $this->getParameter('kernel.project_dir'); $mainPath = $rootDir.'/public/main/'; $fileToLoad = $mainPath.$name; ob_start(); require_once $fileToLoad; $content = ob_get_contents(); ob_end_clean(); return $this->render( '@ChamiloCore/Layout/layout_one_col.html.twig', ['content' => $content] ); } /** * Toggle the student view action. */ #[Route('/toggle_student_view', methods: ['GET'])] #[Security("is_granted('ROLE_TEACHER')")] public function toggleStudentViewAction(Request $request, SettingsManager $settingsManager): Response { if (!api_is_allowed_to_edit(false, false, false, false)) { throw $this->createAccessDeniedException(); } if ('true' !== $settingsManager->getSetting('course.student_view_enabled')) { throw $this->createAccessDeniedException(); } $studentView = $request->getSession()->get('studentview'); if (empty($studentView) || 'studentview' === $studentView) { $content = 'teacherview'; } else { $content = 'studentview'; } $request->getSession()->set('studentview', $content); return new Response($content); } }