|
1
|
|
|
<?php |
|
2
|
|
|
/* For licensing terms, see /license.txt */ |
|
3
|
|
|
|
|
4
|
|
|
namespace Chamilo\CoreBundle\Controller; |
|
5
|
|
|
|
|
6
|
|
|
use Symfony\Component\HttpFoundation\Response; |
|
7
|
|
|
use Symfony\Component\Routing\Annotation\Route; |
|
8
|
|
|
|
|
9
|
|
|
/** |
|
10
|
|
|
* Class IndexController |
|
11
|
|
|
* author Julio Montoya <[email protected]>. |
|
12
|
|
|
* @Route("/online") |
|
13
|
|
|
* |
|
14
|
|
|
* @package Chamilo\CoreBundle\Controller |
|
15
|
|
|
*/ |
|
16
|
|
|
class OnlineController extends BaseController |
|
17
|
|
|
{ |
|
18
|
|
|
/** |
|
19
|
|
|
* @Route("/", name="users_online", methods={"GET"}, options={"expose"=true}) |
|
20
|
|
|
* |
|
21
|
|
|
* @return Response |
|
22
|
|
|
*/ |
|
23
|
|
|
public function indexAction(): Response |
|
24
|
|
|
{ |
|
25
|
|
|
// @todo don't use legacy code |
|
26
|
|
|
$users = who_is_online(0, MAX_ONLINE_USERS); |
|
27
|
|
|
$users = \SocialManager::display_user_list($users); |
|
28
|
|
|
|
|
29
|
|
|
return $this->render( |
|
30
|
|
|
'@ChamiloCore/Online/index.html.twig', |
|
31
|
|
|
[ |
|
32
|
|
|
'whoisonline' => $users, |
|
33
|
|
|
] |
|
34
|
|
|
); |
|
35
|
|
|
} |
|
36
|
|
|
|
|
37
|
|
|
/** |
|
38
|
|
|
* @Route("/in_course/{cidReq}", name="online_users_in_course", methods={"GET", "POST"}, options={"expose"=true}) |
|
39
|
|
|
* |
|
40
|
|
|
* @return Response |
|
41
|
|
|
*/ |
|
42
|
|
|
public function onlineUsersInCoursesAction($cidReq): Response |
|
43
|
|
|
{ |
|
44
|
|
|
// @todo don't use legacy code |
|
45
|
|
|
$users = who_is_online_in_this_course( |
|
46
|
|
|
0, |
|
47
|
|
|
MAX_ONLINE_USERS, |
|
48
|
|
|
api_get_user_id(), |
|
49
|
|
|
api_get_setting('time_limit_whosonline'), |
|
50
|
|
|
$cidReq |
|
51
|
|
|
); |
|
52
|
|
|
|
|
53
|
|
|
$users = \SocialManager::display_user_list($users); |
|
54
|
|
|
|
|
55
|
|
|
return $this->render( |
|
56
|
|
|
'@ChamiloCore/Online/index.html.twig', |
|
57
|
|
|
[ |
|
58
|
|
|
'whoisonline' => $users, |
|
59
|
|
|
] |
|
60
|
|
|
); |
|
61
|
|
|
} |
|
62
|
|
|
|
|
63
|
|
|
/** |
|
64
|
|
|
* |
|
65
|
|
|
* @Route("/in_sessions", name="online_users_in_session", methods={"GET", "POST"}, options={"expose"=true}) |
|
66
|
|
|
* |
|
67
|
|
|
* @param int $id |
|
68
|
|
|
* |
|
69
|
|
|
* @return Response |
|
70
|
|
|
*/ |
|
71
|
|
|
public function onlineUsersInCoursesSessionAction($id = 0): Response |
|
72
|
|
|
{ |
|
73
|
|
|
$users = who_is_online_in_this_course( |
|
74
|
|
|
0, |
|
75
|
|
|
MAX_ONLINE_USERS, |
|
76
|
|
|
api_get_user_id(), |
|
77
|
|
|
api_get_setting('time_limit_whosonline'), |
|
78
|
|
|
$_GET['cidReq'] |
|
79
|
|
|
); |
|
80
|
|
|
|
|
81
|
|
|
$users = \SocialManager::display_user_list($users); |
|
82
|
|
|
return $this->render( |
|
83
|
|
|
'@ChamiloCore/Online/index.html.twig', |
|
84
|
|
|
[ |
|
85
|
|
|
'whoisonline' => $users, |
|
86
|
|
|
] |
|
87
|
|
|
); |
|
88
|
|
|
} |
|
89
|
|
|
} |
|
90
|
|
|
|