Adding new action to parse group/user pictures

skala
Julio Montoya 12 years ago
parent 7ad45b4dda
commit 76964dfb7b
  1. 2
      .htaccess
  2. 33
      src/ChamiloLMS/Controller/IndexController.php

@ -32,6 +32,8 @@
RewriteCond %{QUERY_STRING} ^([a-z0-9A-z]*)
RewriteRule ^user.php?$ web/user/%1? [R,L]
# User images
# Portal news
# news_list.php?id=5 --> web/news/5
RewriteCond %{QUERY_STRING} ^id=([0-9]*)

@ -341,6 +341,39 @@ class IndexController extends CommonController
}
}
/**
* @param Application $app
* @param $groupId
* @param $file
* @return \Symfony\Component\HttpFoundation\BinaryFileResponse|void
*/
public function getGroupFile(Application $app, $groupId, $file)
{
try {
$file = $app['chamilo.filesystem']->get('upload/groups/'.$groupId.'/'.$file);
return $app->sendFile($file->getPathname());
} catch (\InvalidArgumentException $e) {
return $app->abort(404, 'File not found');
}
}
/**
* @param Application $app
* @param $file
* @return \Symfony\Component\HttpFoundation\BinaryFileResponse|void
*/
public function getUserFile(Application $app)
{
try {
$file = $app['request']->get('file');
$file = $app['chamilo.filesystem']->get('upload/users/'.$file);
return $app->sendFile($file->getPathname());
} catch (\InvalidArgumentException $e) {
return $app->abort(404, 'File not found');
}
}
/**
* Reacts on a failed login.
* Displays an explanation with a link to the registration form.

Loading…
Cancel
Save