Esempio n. 1
0
 /**
  * Return file type string from given filetype integer value
  * @param  integer $arg
  * @return string
  */
 public function fileType($arg)
 {
     $text = ArticleFileParams::fileType($arg);
     return $text ? $this->translator->trans($text) : null;
 }
Esempio n. 2
0
 /**
  * Finds and displays a ArticleFile entity.
  * @param integer $id
  * @param integer $articleId
  * @return Response
  */
 public function showAction($id, $articleId)
 {
     $journal = $this->get('ojs.journal_service')->getSelectedJournal();
     $em = $this->getDoctrine()->getManager();
     $article = $em->getRepository('OjsJournalBundle:Article')->find($articleId);
     $this->throw404IfNotFound($article);
     /** @var ArticleFile $entity */
     $entity = $em->getRepository('OjsJournalBundle:ArticleFile')->findOneBy(['article' => $article, 'id' => $id]);
     $this->throw404IfNotFound($entity);
     if (!$this->isGranted('VIEW', $journal, 'articles')) {
         throw new AccessDeniedException("You not authorized for this page!");
     }
     $type = ArticleFileParams::fileType($entity->getType());
     $token = $this->get('security.csrf.token_manager')->refreshToken('ojs_journal_article_file' . $entity->getId());
     return $this->render('OjsJournalBundle:ArticleFile:show.html.twig', ['entity' => $entity, 'type' => $type, 'token' => $token]);
 }
Esempio n. 3
0
 /**
  * Finds and displays a ArticleFile entity.
  *
  * @param  ArticleFile $articleFile
  * @param  Article     $article
  * @return Response
  */
 public function showAction(ArticleFile $articleFile, Article $article)
 {
     $journal = $this->get('ojs.journal_service')->getSelectedJournal();
     if ($articleFile->getArticle() !== $article) {
         $this->throw404IfNotFound($articleFile);
     }
     if (!$this->isGranted('VIEW', $journal, 'articles')) {
         throw new AccessDeniedException("You not authorized for this page!");
     }
     $type = ArticleFileParams::fileType($articleFile->getType());
     $token = $this->get('security.csrf.token_manager')->refreshToken('ojs_journal_article_file' . $articleFile->getId());
     return $this->render('OjsJournalBundle:ArticleFile:show.html.twig', array('entity' => $articleFile, 'type' => $type, 'token' => $token));
 }