コード例 #1
0
ファイル: OjsExtension.php プロジェクト: necatikartal/ojs
 /**
  * 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;
 }
コード例 #2
0
 /**
  * Finds and displays a ArticleFile entity.
  *
  * @param $id
  * @return Response
  */
 public function showAction($id)
 {
     $em = $this->getDoctrine()->getManager();
     /** @var ArticleFile $entity */
     $entity = $em->getRepository('OjsJournalBundle:ArticleFile')->find($id);
     if (!$entity) {
         throw $this->createNotFoundException('notFound');
     }
     if (!$this->isGranted('VIEW', $entity->getArticle()->getJournal(), 'articles') && !$this->isGranted('VIEW', $entity->getArticle())) {
         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', array('entity' => $entity, 'type' => $type, 'token' => $token));
 }