|
1
|
|
|
<?php |
|
2
|
|
|
/* For licensing terms, see /license.txt */ |
|
3
|
|
|
|
|
4
|
|
|
namespace Chamilo\CoreBundle\Controller\User; |
|
5
|
|
|
|
|
6
|
|
|
use Chamilo\CoreBundle\Controller\BaseController; |
|
7
|
|
|
use Silex\Application; |
|
8
|
|
|
use Symfony\Component\Routing\Annotation\Route; |
|
9
|
|
|
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Method; |
|
10
|
|
|
use Symfony\Component\HttpFoundation\Response; |
|
11
|
|
|
|
|
12
|
|
|
/** |
|
13
|
|
|
* Class ProfileController |
|
14
|
|
|
* @package Chamilo\CoreBundle\Controller |
|
15
|
|
|
*/ |
|
16
|
|
|
class ProfileController extends BaseController |
|
17
|
|
|
{ |
|
18
|
|
|
/** |
|
19
|
|
|
* My files |
|
20
|
|
|
* @Route("/{username}/files") |
|
21
|
|
|
* @Method({"GET"}) |
|
22
|
|
|
*/ |
|
23
|
|
|
public function fileAction($username) |
|
24
|
|
|
{ |
|
25
|
|
|
if ($this->getUser()->getUsername() != $username) { |
|
26
|
|
|
return $this->abort(401); |
|
27
|
|
|
} |
|
28
|
|
|
|
|
29
|
|
|
$userId = \UserManager::get_user_id_from_username($username); |
|
30
|
|
|
$userInfo = api_get_user_info($userId); |
|
31
|
|
|
|
|
32
|
|
|
$this->getTemplate()->assign( |
|
33
|
|
|
'driver_list', |
|
34
|
|
|
'PersonalDriver,DropBoxDriver' |
|
35
|
|
|
); |
|
36
|
|
|
|
|
37
|
|
|
$editor = $this->getTemplate()->renderTemplate( |
|
|
|
|
|
|
38
|
|
|
$this->getHtmlEditor()->getEditorStandAloneTemplate() |
|
39
|
|
|
); |
|
40
|
|
|
|
|
41
|
|
|
$this->getTemplate()->assign('user', $userInfo); |
|
42
|
|
|
$this->getTemplate()->assign('editor', $editor); |
|
43
|
|
|
|
|
44
|
|
|
$response = $this->getTemplate()->renderTemplate( |
|
|
|
|
|
|
45
|
|
|
$this->getTemplatePath().'files.tpl' |
|
46
|
|
|
); |
|
47
|
|
|
|
|
48
|
|
|
return new Response($response, 200, array()); |
|
49
|
|
|
} |
|
50
|
|
|
|
|
51
|
|
|
/** |
|
52
|
|
|
* Gets that rm.wav sound |
|
53
|
|
|
* @Route("/{username}/sounds/{file}") |
|
54
|
|
|
* @Method({"GET"}) |
|
55
|
|
|
*/ |
|
56
|
|
|
public function getSoundAction() |
|
57
|
|
|
{ |
|
58
|
|
|
$file = api_get_path(LIBRARY_PATH).'elfinder/rm.wav'; |
|
59
|
|
|
|
|
60
|
|
|
return $this->app->sendFile($file); |
|
61
|
|
|
} |
|
62
|
|
|
|
|
63
|
|
|
/** |
|
64
|
|
|
* {@inheritdoc} |
|
65
|
|
|
*/ |
|
66
|
|
|
public function getTemplatePath() |
|
67
|
|
|
{ |
|
68
|
|
|
return 'user/'; |
|
69
|
|
|
} |
|
70
|
|
|
} |
|
71
|
|
|
|
This check marks calls to methods that do not seem to exist on an object.
This is most likely the result of a method being renamed without all references to it being renamed likewise.