1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
declare(strict_types=1); |
4
|
|
|
|
5
|
|
|
/* For licensing terms, see /license.txt */ |
6
|
|
|
|
7
|
|
|
namespace Chamilo\CoreBundle\Controller; |
8
|
|
|
|
9
|
|
|
use Chamilo\CoreBundle\Settings\SettingsManager; |
10
|
|
|
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Security; |
11
|
|
|
use Symfony\Component\HttpFoundation\Request; |
12
|
|
|
use Symfony\Component\HttpFoundation\Response; |
13
|
|
|
use Symfony\Component\Routing\Attribute\Route; |
14
|
|
|
|
15
|
|
|
class IndexController extends BaseController |
16
|
|
|
{ |
17
|
|
|
#[Route('/', name: 'index', options: ['expose' => true], methods: ['GET', 'POST'])] |
18
|
|
|
#[Route('/sessions', name: 'sessions')] |
19
|
|
|
#[Route('/sessions/{extra}', name: 'sessions_options')] |
20
|
|
|
#[Route('/admin/{vueRouting}', name: 'admin_vue_entrypoint', requirements: ['vueRouting' => '.+'])] |
21
|
|
|
#[Route('/home', name: 'home', options: ['expose' => true], methods: ['GET', 'POST'])] |
22
|
|
|
#[Route('/login', name: 'login', options: ['expose' => true], methods: ['GET', 'POST'])] |
23
|
|
|
#[Route('/faq', name: 'faq', options: ['expose' => true], methods: ['GET', 'POST'])] |
24
|
|
|
#[Route('/demo', name: 'demo', options: ['expose' => true], methods: ['GET', 'POST'])] |
25
|
|
|
#[Route('/course/{cid}/home', name: 'chamilo_core_course_home')] |
26
|
|
|
#[Route('/courses', name: 'courses', options: ['expose' => true], methods: ['GET', 'POST'])] |
27
|
|
|
#[Route('/catalogue/{slug}', name: 'catalogue', options: ['expose' => true], methods: ['GET', 'POST'])] |
28
|
|
|
#[Route('/resources/ccalendarevent', name: 'resources_ccalendarevent', methods: ['GET'])] |
29
|
|
|
#[Route('/resources/document/{nodeId}/manager', name: 'resources_filemanager', methods: ['GET'])] |
30
|
|
|
#[Route('/account/home', name: 'chamilo_core_account_home', options: ['expose' => true])] |
31
|
|
|
#[Route('/social', name: 'chamilo_core_socialnetwork', options: ['expose' => true])] |
32
|
|
|
#[Route('/social/{vueRouting}', name: 'chamilo_core_socialnetwork_vue_entrypoint', requirements: ['vueRouting' => '.+'], options: ['expose' => true])] |
33
|
|
|
#[Route('/admin', name: 'admin', options: ['expose' => true])] |
34
|
|
|
#[Route('/admin-dashboard', name: 'admin_dashboard_entry', options: ['expose' => true])] |
35
|
|
|
#[Route('/admin-dashboard/{vueRouting}', name: 'admin_dashboard_vue_entry', requirements: ['vueRouting' => '.+'])] |
36
|
|
|
#[Route('/p/{slug}', name: 'public_page')] |
37
|
|
|
#[Route('/skill/wheel', name: 'skill_wheel')] |
38
|
|
|
public function index(): Response |
39
|
|
|
{ |
40
|
|
|
return $this->render('@ChamiloCore/Layout/no_layout.html.twig', ['content' => '']); |
41
|
|
|
} |
42
|
|
|
|
43
|
|
|
/** |
44
|
|
|
* Toggle the student view action. |
45
|
|
|
*/ |
46
|
|
|
#[Route('/toggle_student_view', methods: ['GET'])] |
47
|
|
|
#[Security("is_granted('ROLE_TEACHER')")] |
48
|
|
|
public function toggleStudentView(Request $request, SettingsManager $settingsManager): Response |
49
|
|
|
{ |
50
|
|
|
if ('true' !== $settingsManager->getSetting('course.student_view_enabled')) { |
51
|
|
|
throw $this->createAccessDeniedException(); |
52
|
|
|
} |
53
|
|
|
|
54
|
|
|
$studentView = $request->getSession()->get('studentview'); |
55
|
|
|
|
56
|
|
|
if (empty($studentView) || 'studentview' === $studentView) { |
57
|
|
|
$content = 'teacherview'; |
58
|
|
|
} else { |
59
|
|
|
$content = 'studentview'; |
60
|
|
|
} |
61
|
|
|
|
62
|
|
|
$request->getSession()->set('studentview', $content); |
63
|
|
|
|
64
|
|
|
return new Response($content); |
65
|
|
|
} |
66
|
|
|
} |
67
|
|
|
|