InfoController.php 1.4KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283
  1. <?php
  2. namespace Muzich\CoreBundle\Controller;
  3. use Muzich\CoreBundle\lib\Controller;
  4. use Sensio\Bundle\FrameworkExtraBundle\Configuration\Template;
  5. use Symfony\Component\HttpFoundation\Response;
  6. use Symfony\Component\HttpKernel\Exception\HttpException;
  7. class InfoController extends Controller
  8. {
  9. /**
  10. *
  11. * @Template()
  12. */
  13. public function aboutAction()
  14. {
  15. return array();
  16. }
  17. /**
  18. *
  19. * @Template()
  20. */
  21. public function developmentAction()
  22. {
  23. return array();
  24. }
  25. /**
  26. *
  27. * @Template()
  28. */
  29. public function sitesAction()
  30. {
  31. return array();
  32. }
  33. public function teapotAction()
  34. {
  35. throw new HttpException(418, "I'm a teapot !");
  36. }
  37. /**
  38. *
  39. * @Template()
  40. */
  41. public function cguAction()
  42. {
  43. return array();
  44. }
  45. public function helpboxAction($ressource_id)
  46. {
  47. if (!in_array($ressource_id, array(
  48. 'element_add_url',
  49. 'tags_prompt',
  50. 'know_more'
  51. )))
  52. {
  53. return $this->jsonNotFoundResponse();
  54. }
  55. return $this->jsonResponse(array(
  56. 'status' => 'success',
  57. 'data' => $this->render('MuzichCoreBundle:Helpbox:'.$ressource_id.'.html.twig')
  58. ->getContent()
  59. ));
  60. }
  61. public function testErrorAction($code)
  62. {
  63. if (!in_array($code, array('404', '403', '')))
  64. {
  65. throw new HttpException(404);
  66. }
  67. return $this->render('TwigBundle:Exception:error'.$code.'.html.twig');
  68. }
  69. }