|
1
|
|
|
<?php |
|
2
|
|
|
/** |
|
3
|
|
|
* SidebarController.php |
|
4
|
|
|
* avanzu-admin |
|
5
|
|
|
* Date: 23.02.14 |
|
6
|
|
|
*/ |
|
7
|
|
|
|
|
8
|
|
|
namespace Chamilo\ThemeBundle\Controller; |
|
9
|
|
|
|
|
10
|
|
|
use Chamilo\ThemeBundle\Event\ShowUserEvent; |
|
11
|
|
|
use Chamilo\ThemeBundle\Event\SidebarMenuEvent; |
|
12
|
|
|
use Chamilo\ThemeBundle\Event\SidebarMenuKnpEvent; |
|
13
|
|
|
use Chamilo\ThemeBundle\Event\ThemeEvents; |
|
14
|
|
|
use Symfony\Bundle\FrameworkBundle\Controller\Controller; |
|
15
|
|
|
use Symfony\Component\HttpFoundation\Request; |
|
16
|
|
|
use Symfony\Component\HttpFoundation\Response; |
|
17
|
|
|
|
|
18
|
|
|
/** |
|
19
|
|
|
* Class SidebarController |
|
20
|
|
|
* @package Chamilo\ThemeBundle\Controller |
|
21
|
|
|
*/ |
|
22
|
|
|
class SidebarController extends Controller |
|
23
|
|
|
{ |
|
24
|
|
|
/** |
|
25
|
|
|
* Avatar user panel |
|
26
|
|
|
* @return Response |
|
27
|
|
|
*/ |
|
28
|
|
View Code Duplication |
public function userPanelAction() |
|
29
|
|
|
{ |
|
30
|
|
|
if (!$this->getDispatcher()->hasListeners(ThemeEvents::THEME_SIDEBAR_USER)) { |
|
31
|
|
|
return new Response(); |
|
32
|
|
|
} |
|
33
|
|
|
|
|
34
|
|
|
$userEvent = $this->getDispatcher()->dispatch(ThemeEvents::THEME_SIDEBAR_USER, new ShowUserEvent()); |
|
35
|
|
|
|
|
36
|
|
|
return $this->render( |
|
37
|
|
|
'ChamiloThemeBundle:Sidebar:user-panel.html.twig', |
|
38
|
|
|
array( |
|
39
|
|
|
'user' => $userEvent->getUser() |
|
40
|
|
|
) |
|
41
|
|
|
); |
|
42
|
|
|
} |
|
43
|
|
|
|
|
44
|
|
|
/** |
|
45
|
|
|
* User inbox, profile links |
|
46
|
|
|
* @return Response |
|
47
|
|
|
*/ |
|
48
|
|
View Code Duplication |
public function userProfileAction() |
|
49
|
|
|
{ |
|
50
|
|
|
if (!$this->getDispatcher()->hasListeners(ThemeEvents::THEME_SIDEBAR_USER)) { |
|
51
|
|
|
return new Response(); |
|
52
|
|
|
} |
|
53
|
|
|
|
|
54
|
|
|
$userEvent = $this->getDispatcher()->dispatch(ThemeEvents::THEME_SIDEBAR_USER, new ShowUserEvent()); |
|
55
|
|
|
|
|
56
|
|
|
return $this->render( |
|
57
|
|
|
'ChamiloThemeBundle:Sidebar:user-profile.html.twig', |
|
58
|
|
|
array( |
|
59
|
|
|
'user' => $userEvent->getUser() |
|
60
|
|
|
) |
|
61
|
|
|
); |
|
62
|
|
|
} |
|
63
|
|
|
|
|
64
|
|
|
/** |
|
65
|
|
|
* User social network section |
|
66
|
|
|
* @return Response |
|
67
|
|
|
*/ |
|
68
|
|
View Code Duplication |
public function socialPanelAction() |
|
69
|
|
|
{ |
|
70
|
|
|
if (!$this->getDispatcher()->hasListeners(ThemeEvents::THEME_SIDEBAR_USER)) { |
|
71
|
|
|
return new Response(); |
|
72
|
|
|
} |
|
73
|
|
|
|
|
74
|
|
|
$userEvent = $this->getDispatcher()->dispatch(ThemeEvents::THEME_SIDEBAR_USER, new ShowUserEvent()); |
|
75
|
|
|
|
|
76
|
|
|
return $this->render( |
|
77
|
|
|
'ChamiloThemeBundle:Sidebar:social-panel.html.twig', |
|
78
|
|
|
array( |
|
79
|
|
|
'user' => $userEvent->getUser() |
|
80
|
|
|
) |
|
81
|
|
|
); |
|
82
|
|
|
} |
|
83
|
|
|
|
|
84
|
|
|
/** |
|
85
|
|
|
* Search bar |
|
86
|
|
|
* @return Response |
|
87
|
|
|
*/ |
|
88
|
|
|
public function searchFormAction() |
|
89
|
|
|
{ |
|
90
|
|
|
return $this->render('ChamiloThemeBundle:Sidebar:search-form.html.twig', array()); |
|
91
|
|
|
} |
|
92
|
|
|
|
|
93
|
|
|
/** |
|
94
|
|
|
* @return EventDispatcher |
|
95
|
|
|
*/ |
|
96
|
|
|
protected function getDispatcher() |
|
97
|
|
|
{ |
|
98
|
|
|
return $this->get('event_dispatcher'); |
|
99
|
|
|
} |
|
100
|
|
|
|
|
101
|
|
|
/** |
|
102
|
|
|
* @param Request $request |
|
103
|
|
|
* @return Response |
|
104
|
|
|
*/ |
|
105
|
|
|
public function menuKnpAction(Request $request) |
|
106
|
|
|
{ |
|
107
|
|
|
if (!$this->getDispatcher()->hasListeners(ThemeEvents::THEME_SIDEBAR_SETUP_MENU_KNP)) { |
|
108
|
|
|
return new Response(); |
|
109
|
|
|
} |
|
110
|
|
|
|
|
111
|
|
|
/** @var SidebarMenuKnpEvent $event */ |
|
112
|
|
|
$event = $this->getDispatcher()->dispatch( |
|
113
|
|
|
ThemeEvents::THEME_SIDEBAR_SETUP_MENU_KNP, |
|
114
|
|
|
new SidebarMenuKnpEvent($request) |
|
115
|
|
|
); |
|
116
|
|
|
|
|
117
|
|
|
return $this->render( |
|
118
|
|
|
'ChamiloThemeBundle:Sidebar:menu_knp.html.twig', |
|
119
|
|
|
array( |
|
120
|
|
|
'menu' => $event->getMenu() |
|
121
|
|
|
) |
|
122
|
|
|
); |
|
123
|
|
|
} |
|
124
|
|
|
} |
|
125
|
|
|
|