public function onOpenPdf(PlayFileEvent $event)
 {
     $path = $this->container->getParameter('claroline.param.files_directory') . DIRECTORY_SEPARATOR . $event->getResource()->getHashName();
     $content = $this->container->get('templating')->render('ClarolinePdfPlayerBundle::pdf.html.twig', array('path' => $path, 'pdf' => $event->getResource(), '_resource' => $event->getResource()));
     $response = new Response($content);
     $event->setResponse($response);
     $event->stopPropagation();
 }
 public function onOpenImage(PlayFileEvent $event)
 {
     $images = $this->container->get('claroline.manager.resource_manager')->getByMimeTypeAndParent('image', $event->getResource()->getResourceNode()->getParent(), $this->container->get('security.token_storage')->getToken()->getRoles());
     $path = $this->container->getParameter('claroline.param.files_directory') . DIRECTORY_SEPARATOR . $event->getResource()->getHashName();
     $content = $this->container->get('templating')->render('ClarolineImagePlayerBundle::image.html.twig', array('path' => $path, 'image' => $event->getResource(), '_resource' => $event->getResource(), 'images' => $images));
     $response = new Response($content);
     $event->setResponse($response);
     $event->stopPropagation();
 }
 public function onOpenPdf(PlayFileEvent $event)
 {
     $canDownload = $this->container->get('security.authorization_checker')->isGranted('EXPORT', $event->getResource()->getResourceNode());
     $path = $this->container->getParameter('claroline.param.files_directory') . DIRECTORY_SEPARATOR . $event->getResource()->getHashName();
     $content = $this->container->get('templating')->render('ClarolinePdfPlayerBundle::pdf.html.twig', ['path' => $path, 'pdf' => $event->getResource(), 'canDownload' => $canDownload, '_resource' => $event->getResource()]);
     $response = new Response($content);
     $event->setResponse($response);
     $event->stopPropagation();
 }
 /**
  * @DI\Observe("play_file_video")
  * @DI\Observe("play_file_audio")
  */
 public function onOpenVideo(PlayFileEvent $event)
 {
     $authorization = $this->container->get('security.authorization_checker');
     $collection = new ResourceCollection([$event->getResource()->getResourceNode()]);
     $canExport = $authorization->isGranted('EXPORT', $collection);
     $path = $this->fileDir . DIRECTORY_SEPARATOR . $event->getResource()->getHashName();
     $content = $this->templating->render('ClarolineVideoPlayerBundle::video.html.twig', ['workspace' => $event->getResource()->getResourceNode()->getWorkspace(), 'path' => $path, 'video' => $event->getResource(), '_resource' => $event->getResource(), 'tracks' => $this->container->get('claroline.manager.video_player_manager')->getTracksByVideo($event->getResource()), 'canExport' => $canExport]);
     $response = new Response($content);
     $event->setResponse($response);
     $event->stopPropagation();
 }
 /**
  * @DI\Observe("play_file_text")
  *
  * @param PlayFileEvent $event
  */
 public function onOpenText(PlayFileEvent $event)
 {
     $authorization = $this->container->get('security.authorization_checker');
     $collection = new ResourceCollection([$event->getResource()->getResourceNode()]);
     $canExport = $authorization->isGranted('EXPORT', $collection);
     $path = $this->container->getParameter('claroline.param.files_directory') . DIRECTORY_SEPARATOR . $event->getResource()->getHashName();
     $text = file_get_contents($path);
     $content = $this->container->get('templating')->render('ClarolineTextPlayerBundle::text.html.twig', ['path' => $path, 'text' => $text, '_resource' => $event->getResource(), 'canExport' => $canExport]);
     $response = new Response($content);
     $event->setResponse($response);
     $event->stopPropagation();
 }
 public function onOpenImage(PlayFileEvent $event)
 {
     $authorization = $this->container->get('security.authorization_checker');
     $collection = new ResourceCollection([$event->getResource()->getResourceNode()]);
     $canExport = $authorization->isGranted('EXPORT', $collection);
     $images = $this->container->get('claroline.manager.resource_manager')->getByMimeTypeAndParent('image', $event->getResource()->getResourceNode()->getParent(), $this->container->get('security.token_storage')->getToken()->getRoles());
     $path = $this->container->getParameter('claroline.param.files_directory') . DIRECTORY_SEPARATOR . $event->getResource()->getHashName();
     $content = $this->container->get('templating')->render('ClarolineImagePlayerBundle::image.html.twig', ['path' => $path, 'image' => $event->getResource(), '_resource' => $event->getResource(), 'images' => $images, 'canExport' => $canExport]);
     $response = new Response($content);
     $event->setResponse($response);
     $event->stopPropagation();
 }