Ojs\JournalBundle\Controller\JournalFileController::indexAction PHP Method

indexAction() public method

public indexAction ( Request $request ) : Response
$request Symfony\Component\HttpFoundation\Request
return Symfony\Component\HttpFoundation\Response
    public function indexAction(Request $request)
    {
        $journal = $this->get('ojs.journal_service')->getSelectedJournal();
        if (!$this->isGranted('VIEW', $journal, 'files')) {
            throw new AccessDeniedException("You are not authorized for this file!");
        }
        $router = $this->get('router');
        $source = new Entity('OjsJournalBundle:JournalFile');
        $source->manipulateRow(function (Row $row) use($request, $router) {
            /* @var JournalFile $entity */
            $entity = $row->getEntity();
            $pathLinkTemplate = '<a target="_blank" href="uploads/files/' . $entity->getPath() . '">' . $entity->getPath() . '</a>';
            $row->setField('path', $pathLinkTemplate);
            return $row;
        });
        $grid = $this->get('grid')->setSource($source);
        $gridAction = $this->get('grid_action');
        $actionColumn = new ActionsColumn("actions", 'actions');
        $rowAction[] = $gridAction->showAction('ojs_journal_filemanager_show', ['id', 'journalId' => $journal->getId()]);
        $rowAction[] = $gridAction->editAction('ojs_journal_filemanager_edit', ['id', 'journalId' => $journal->getId()]);
        $rowAction[] = $gridAction->deleteAction('ojs_journal_filemanager_delete', ['id', 'journalId' => $journal->getId()]);
        $actionColumn->setRowActions($rowAction);
        $grid->addColumn($actionColumn);
        return $grid->getGridResponse('OjsJournalBundle:JournalFile:index.html.twig', ['grid' => $grid]);
    }