Code Duplication    Length = 15-17 lines in 7 locations

src/Chamilo/ThemeBundle/Controller/SidebarController.php 3 locations

@@ 28-42 (lines=15) @@
25
     * Avatar user panel
26
     * @return Response
27
     */
28
    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
@@ 48-62 (lines=15) @@
45
     * User inbox, profile links
46
     * @return Response
47
     */
48
    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
@@ 68-82 (lines=15) @@
65
     * User social network section
66
     * @return Response
67
     */
68
    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

src/Chamilo/ThemeBundle/Controller/NavbarController.php 4 locations

@@ 33-49 (lines=17) @@
30
     * @param int $max
31
     * @return Response
32
     */
33
    public function notificationsAction($max = 5)
34
    {
35
        if (!$this->getDispatcher()->hasListeners(ThemeEvents::THEME_NOTIFICATIONS)) {
36
            return new Response();
37
        }
38
39
        $listEvent = $this->getDispatcher()->dispatch(ThemeEvents::THEME_NOTIFICATIONS, new NotificationListEvent());
40
41
        return $this->render(
42
            'ChamiloThemeBundle:Navbar:notifications.html.twig',
43
            array(
44
                'notifications' => $listEvent->getNotifications(),
45
                'total' => $listEvent->getTotal(),
46
            )
47
        );
48
49
    }
50
51
    /**
52
     * @param int $max
@@ 55-71 (lines=17) @@
52
     * @param int $max
53
     * @return Response
54
     */
55
    public function messagesAction($max = 5)
56
    {
57
        if (!$this->getDispatcher()->hasListeners(ThemeEvents::THEME_MESSAGES)) {
58
            return new Response();
59
        }
60
61
        $listEvent = $this->getDispatcher()->dispatch(ThemeEvents::THEME_MESSAGES, new MessageListEvent());
62
63
        return $this->render(
64
            'ChamiloThemeBundle:Navbar:messages.html.twig',
65
            array(
66
                'messages' => $listEvent->getMessages(),
67
                'total' => $listEvent->getTotal(),
68
            )
69
        );
70
    }
71
72
    /**
73
     * @param int $max
74
     * @return Response
@@ 76-91 (lines=16) @@
73
     * @param int $max
74
     * @return Response
75
     */
76
    public function tasksAction($max = 5)
77
    {
78
        if (!$this->getDispatcher()->hasListeners(ThemeEvents::THEME_TASKS)) {
79
            return new Response();
80
        }
81
        $listEvent = $this->getDispatcher()->dispatch(ThemeEvents::THEME_TASKS, new TaskListEvent());
82
83
        return $this->render(
84
            'ChamiloThemeBundle:Navbar:tasks.html.twig',
85
            array(
86
                'tasks' => $listEvent->getTasks(),
87
                'total' => $listEvent->getTotal(),
88
            )
89
        );
90
    }
91
92
    /**
93
     * @return Response
94
     */
@@ 95-109 (lines=15) @@
92
    /**
93
     * @return Response
94
     */
95
    public function userAction()
96
    {
97
        if (!$this->getDispatcher()->hasListeners(ThemeEvents::THEME_NAVBAR_USER)) {
98
            return new Response();
99
        }
100
        $userEvent = $this->getDispatcher()->dispatch(ThemeEvents::THEME_NAVBAR_USER, new ShowUserEvent());
101
102
        return $this->render(
103
            'ChamiloThemeBundle:Navbar:user.html.twig',
104
            array(
105
                'user' => $userEvent->getUser(),
106
            )
107
        );
108
    }
109
}
110