/** * Lists all Section entities. * * @param Request $request * @return Response */ public function indexAction(Request $request) { $journal = $this->get('ojs.journal_service')->getSelectedJournal(); $eventDispatcher = $this->get('event_dispatcher'); if (!$this->isGranted('VIEW', $journal, 'sections')) { throw new AccessDeniedException("You are not authorized for view this journal's sections!"); } $source = new Entity('OjsJournalBundle:Section'); $grid = $this->get('grid')->setSource($source); $gridAction = $this->get('grid_action'); $actionColumn = new ActionsColumn("actions", 'actions'); $rowAction[] = $gridAction->showAction('ojs_journal_section_show', ['id', 'journalId' => $journal->getId()]); if ($this->isGranted('EDIT', $this->get('ojs.journal_service')->getSelectedJournal(), 'sections')) { $rowAction[] = $gridAction->editAction('ojs_journal_section_edit', ['id', 'journalId' => $journal->getId()]); } if ($this->isGranted('DELETE', $this->get('ojs.journal_service')->getSelectedJournal(), 'sections')) { $rowAction[] = $gridAction->deleteAction('ojs_journal_section_delete', ['id', 'journalId' => $journal->getId()]); } $actionColumn->setRowActions($rowAction); $grid->addColumn($actionColumn); $listEvent = new ListEvent(); $listEvent->setGrid($grid); $eventDispatcher->dispatch(SectionEvents::LISTED, $listEvent); $grid = $listEvent->getGrid(); return $grid->getGridResponse('OjsJournalBundle:Section:index.html.twig'); }
/** * Lists all SubmissionFile entities. * */ public function indexAction() { $journal = $this->get('ojs.journal_service')->getSelectedJournal(); $eventDispatcher = $this->get('event_dispatcher'); if (!$this->isGranted('VIEW', $journal, 'file')) { throw new AccessDeniedException("You are not authorized for view this page!"); } if (!$journal) { throw new NotFoundHttpException("Journal not found!"); } $source = new Entity('OjsJournalBundle:JournalSubmissionFile'); $grid = $this->get('grid')->setSource($source); $gridAction = $this->get('grid_action'); $actionColumn = new ActionsColumn("actions", 'actions'); $rowAction[] = $gridAction->showAction('ojs_journal_file_show', ['id', 'journalId' => $journal->getId()]); $rowAction[] = $gridAction->editAction('ojs_journal_file_edit', ['id', 'journalId' => $journal->getId()]); $rowAction[] = $gridAction->deleteAction('ojs_journal_file_delete', ['id', 'journalId' => $journal->getId()]); $actionColumn->setRowActions($rowAction); $grid->addColumn($actionColumn); $listEvent = new ListEvent(); $listEvent->setGrid($grid); $eventDispatcher->dispatch(JournalSubmissionFileEvents::LISTED, $listEvent); $grid = $listEvent->getGrid(); return $grid->getGridResponse('OjsJournalBundle:SubmissionFile:index.html.twig'); }
/** * Lists all JournalContact entities. * * @param Request $request * @return Response */ public function indexAction(Request $request) { $journal = $this->get('ojs.journal_service')->getSelectedJournal(); $eventDispatcher = $this->get('event_dispatcher'); if (!$this->isGranted('VIEW', $journal, 'contacts')) { throw new AccessDeniedException("You are not authorized for view this page!"); } $source = new Entity('OjsJournalBundle:JournalContact'); $source->manipulateRow(function (Row $row) use($request) { /* @var JournalContact $entity */ $entity = $row->getEntity(); $entity->setDefaultLocale($request->getDefaultLocale()); if (!is_null($entity)) { $row->setField('title', $entity->getTitle()); $row->setField('contactTypeName', $entity->getContactType()->getName()); } return $row; }); $grid = $this->get('grid'); $grid->setSource($source); $gridAction = $this->get('grid_action'); $actionColumn = new ActionsColumn("actions", 'actions'); $rowAction = []; $rowAction[] = $gridAction->showAction('ojs_journal_journal_contact_show', ['id', 'journalId' => $journal->getId()]); $rowAction[] = $gridAction->editAction('ojs_journal_journal_contact_edit', ['id', 'journalId' => $journal->getId()]); $rowAction[] = $gridAction->deleteAction('ojs_journal_journal_contact_delete', ['id', 'journalId' => $journal->getId()]); $actionColumn->setRowActions($rowAction); $grid->addColumn($actionColumn); $listEvent = new ListEvent(); $listEvent->setGrid($grid); $eventDispatcher->dispatch(JournalContactEvents::LISTED, $listEvent); $grid = $listEvent->getGrid(); return $grid->getGridResponse('OjsJournalBundle:JournalContact:index.html.twig'); }
/** * Lists all Issue entities. * * @param Request $request * @return Response */ public function indexAction(Request $request) { $journal = $this->get('ojs.journal_service')->getSelectedJournal(); $eventDispatcher = $this->get('event_dispatcher'); if (!$this->isGranted('VIEW', $journal, 'issues')) { throw new AccessDeniedException("You not authorized for this page!"); } $source = new Entity('OjsJournalBundle:Issue'); $grid = $this->get('grid')->setSource($source); $gridAction = $this->get('grid_action'); $actionColumn = new ActionsColumn("actions", 'actions'); $rowAction[] = $gridAction->showAction('ojs_journal_issue_show', ['id', 'journalId' => $journal->getId()]); $articleAction = new RowAction('<i class="fa fa-file-text"></i>', 'ojs_journal_issue_view'); $articleAction->setRouteParameters(['journalId' => $journal->getId(), 'id']); $articleAction->setAttributes(['class' => 'btn btn-success btn-xs ', 'data-toggle' => 'tooltip', 'title' => $this->get('translator')->trans("Articles")]); $rowAction[] = $articleAction; $lastIssueAction = new RowAction('<i class="fa fa-cog"></i>', 'ojs_journal_issue_make_last'); $lastIssueAction->setRouteParameters(['journalId' => $journal->getId(), 'id']); $lastIssueAction->setAttributes(['class' => 'btn btn-success btn-xs ', 'data-toggle' => 'tooltip', 'title' => $this->get('translator')->trans("make.last.issue")]); $rowAction[] = $lastIssueAction; if ($this->isGranted('EDIT', $journal, 'issues')) { $rowAction[] = $gridAction->editAction('ojs_journal_issue_edit', ['id', 'journalId' => $journal->getId()]); } if ($this->isGranted('DELETE', $journal, 'issues')) { $rowAction[] = $gridAction->deleteAction('ojs_journal_issue_delete', ['id', 'journalId' => $journal->getId()]); } $rowAction[] = $gridAction->filesAction('ojs_journal_issue_file_index', ['journalId' => $journal->getId(), 'id']); $actionColumn->setRowActions($rowAction); $grid->addColumn($actionColumn); $listEvent = new ListEvent(); $listEvent->setGrid($grid); $eventDispatcher->dispatch(IssueEvents::LISTED, $listEvent); $grid = $listEvent->getGrid(); return $grid->getGridResponse('OjsJournalBundle:Issue:index.html.twig'); }
/** * Lists all article entities for journal * * @param Request $request * @return Response */ public function indexAction(Request $request) { $eventDispatcher = $this->get('event_dispatcher'); $journal = $this->get('ojs.journal_service')->getSelectedJournal(); $this->throw404IfNotFound($journal); $translator = $this->get('translator'); if (!$this->isGranted('VIEW', $journal, 'articles')) { throw new AccessDeniedException("You not authorized for this page!"); } $source = new Entity('OjsJournalBundle:Article'); $source->manipulateRow(function (Row $row) use($request, $translator) { /** @var Article $entity */ $entity = $row->getEntity(); if (!is_null($entity)) { $entity->setDefaultLocale($request->getDefaultLocale()); $doi = $entity->getDoi(); if ($doi !== null) { $row->setField('title', $entity->getTitle() . ' / ' . $doi); } else { $row->setField('title', $entity->getTitle()); } $row->setField('status', $translator->trans(Article::$statuses[$entity->getStatus()])); if (!is_null($entity->getIssue())) { $row->setField('issue', $entity->getIssue()->getTitle()); } } return $row; }); $grid = $this->get('grid')->setSource($source); $gridAction = $this->get('grid_action'); $actionColumn = new ActionsColumn("actions", 'actions'); $rowAction[] = $gridAction->showAction('ojs_journal_article_show', ['id', 'journalId' => $journal->getId()]); $rowAction[] = $gridAction->editAction('ojs_journal_article_edit', ['id', 'journalId' => $journal->getId()]); $rowAction[] = $gridAction->deleteAction('ojs_journal_article_delete', ['id', 'journalId' => $journal->getId()]); $actionColumn->setRowActions($rowAction); $grid->addColumn($actionColumn); $grid->getColumn('numerator')->manipulateRenderCell(function ($value, $row, $router) use($journal) { if ($journal->getTitleAbbr() !== null) { return $journal->getTitleAbbr() . '.' . $value; } else { return $journal->getSlug() . '.' . $value; } }); $listEvent = new ListEvent(); $listEvent->setGrid($grid); $eventDispatcher->dispatch(ArticleEvents::LISTED, $listEvent); $grid = $listEvent->getGrid(); return $grid->getGridResponse('OjsJournalBundle:Article:index.html.twig'); }
/** * Lists all Section entities. * * @param Request $request * @return Response */ public function indexAction(Request $request) { $journal = $this->get('ojs.journal_service')->getSelectedJournal(); $eventDispatcher = $this->get('event_dispatcher'); if (!$this->isGranted('VIEW', $journal, 'sections')) { throw new AccessDeniedException("You are not authorized for view this journal's sections!"); } $source = new Entity('OjsJournalBundle:Section'); $source->manipulateRow(function (Row $row) use($request) { /* @var Section $entity */ $entity = $row->getEntity(); $entity->setDefaultLocale($request->getDefaultLocale()); if (!is_null($entity)) { $row->setField('title', $entity->getTitle()); if ($row->getField('title') && strlen($row->getField('title')) > 20) { $row->setField('title', substr($row->getField('title'), 0, 20) . "..."); } } return $row; }); $grid = $this->get('grid')->setSource($source); $gridAction = $this->get('grid_action'); $actionColumn = new ActionsColumn("actions", 'actions'); $rowAction[] = $gridAction->showAction('ojs_journal_section_show', ['id', 'journalId' => $journal->getId()]); if ($this->isGranted('EDIT', $this->get('ojs.journal_service')->getSelectedJournal(), 'sections')) { $rowAction[] = $gridAction->editAction('ojs_journal_section_edit', ['id', 'journalId' => $journal->getId()]); } if ($this->isGranted('DELETE', $this->get('ojs.journal_service')->getSelectedJournal(), 'sections')) { $rowAction[] = $gridAction->deleteAction('ojs_journal_section_delete', ['id', 'journalId' => $journal->getId()]); } $actionColumn->setRowActions($rowAction); $grid->addColumn($actionColumn); $listEvent = new ListEvent(); $listEvent->setGrid($grid); $eventDispatcher->dispatch(SectionEvents::LISTED, $listEvent); $grid = $listEvent->getGrid(); return $grid->getGridResponse('OjsJournalBundle:Section:index.html.twig'); }
/** * Lists all Board entities. * */ public function indexAction() { $journal = $this->get('ojs.journal_service')->getSelectedJournal(); $eventDispatcher = $this->get('event_dispatcher'); if (!$this->isGranted('VIEW', $journal, 'boards')) { throw new AccessDeniedException("You not authorized for view this journal's boards!"); } $source = new Entity('OjsJournalBundle:Board'); $grid = $this->get('grid')->setSource($source); $gridAction = $this->get('grid_action'); $actionColumn = new ActionsColumn("actions", 'actions'); $rowAction[] = $gridAction->showAction('ojs_journal_board_show', ['id', 'journalId' => $journal->getId()], null, ['icon' => 'users', 'title' => 'add.user']); if ($this->isGranted('EDIT', $journal, 'boards')) { $rowAction[] = $gridAction->editAction('ojs_journal_board_edit', ['id', 'journalId' => $journal->getId()]); $rowAction[] = $gridAction->deleteAction('ojs_journal_board_delete', ['id', 'journalId' => $journal->getId()]); } $actionColumn->setRowActions($rowAction); $grid->addColumn($actionColumn); $listEvent = new ListEvent(); $listEvent->setGrid($grid); $eventDispatcher->dispatch(BoardEvents::LISTED, $listEvent); $grid = $listEvent->getGrid(); return $grid->getGridResponse('OjsJournalBundle:Board:index.html.twig'); }