public function indexAction(Request $request) { $data = array(); $source = new Entity('OjsJournalBundle:Journal'); $source->manipulateRow(function (Row $row) use($request) { /* @var Journal $entity */ $entity = $row->getEntity(); $entity->setDefaultLocale($request->getDefaultLocale()); if (!is_null($entity)) { $row->setField('title', $entity->getTitle()); } return $row; }); $alias = $source->getTableAlias(); $source->manipulateQuery(function (QueryBuilder $query) use($alias) { $query->andWhere($alias . '.status = :status')->setParameter('status', '0'); return $query; }); $grid = $this->get('grid')->setSource($source); $gridAction = $this->get('grid_action'); $rowAction = array(); $rowAction[] = $gridAction->editAction('ojs_admin_application_journal_edit', 'id'); $rowAction[] = $gridAction->showAction('ojs_admin_application_journal_show', 'id'); $rowAction[] = $gridAction->deleteAction('ojs_admin_application_journal_delete', 'id'); $actionColumn = new ActionsColumn("actions", 'actions'); $actionColumn->setRowActions($rowAction); $grid->addColumn($actionColumn); $data['grid'] = $grid; return $grid->getGridResponse('OjsAdminBundle:AdminApplication:journal.html.twig', $data); }
/** * Finds and displays a Users of a Journal with roles * * @param Request $request * @return Response */ public function indexAction(Request $request) { $journal = $this->get('ojs.journal_service')->getSelectedJournal(); if (!$this->isGranted('VIEW', $journal, 'userRole')) { throw new AccessDeniedException("You are not authorized for view this page"); } $source = new Entity('OjsJournalBundle:JournalUser'); $source->manipulateRow(function (Row $row) use($request) { /* @var JournalUser $entity */ $entity = $row->getEntity(); if (!is_null($entity)) { $entity->getJournal()->setDefaultLocale($request->getDefaultLocale()); if (!is_null($entity)) { $row->setField('journal', $entity->getJournal()->getTitle()); } } return $row; }); $grid = $this->get('grid'); $grid->setSource($source); $gridAction = $this->get('grid_action'); $rowAction = []; $rowAction[] = $gridAction->editAction('ojs_journal_user_edit', ['journalId' => $journal->getId(), 'id']); $rowAction[] = $gridAction->deleteAction('ojs_journal_user_delete', ['journalId' => $journal->getId(), 'id']); $actionColumn = new ActionsColumn("actions", "actions"); $actionColumn->setRowActions($rowAction); $grid->addColumn($actionColumn); return $grid->getGridResponse('OjsJournalBundle:JournalUser:index.html.twig', $grid); }
/** * @param Request $request * @return 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]); }
/** * Lists all ArticleFile entities. * @param Integer $articleId * @return Response */ public function indexAction($articleId) { $journal = $this->get('ojs.journal_service')->getSelectedJournal(); $article = $this->getDoctrine()->getRepository('OjsJournalBundle:Article')->find($articleId); $this->throw404IfNotFound($article); if (!$this->isGranted('VIEW', $journal, 'articles')) { throw new AccessDeniedException("You not authorized for this page!"); } $source = new Entity('OjsJournalBundle:ArticleFile'); $tableAlias = $source->getTableAlias(); $source->manipulateQuery(function (QueryBuilder $qb) use($article, $tableAlias) { return $qb->where($tableAlias . '.article = :article')->setParameter('article', $article); }); $grid = $this->get('grid')->setSource($source); $gridAction = $this->get('grid_action'); $actionColumn = new ActionsColumn("actions", 'actions'); $rowAction[] = $gridAction->showAction('ojs_journal_article_file_show', ['id', 'journalId' => $journal->getId(), 'articleId' => $articleId]); $rowAction[] = $gridAction->editAction('ojs_journal_article_file_edit', ['id', 'journalId' => $journal->getId(), 'articleId' => $articleId]); $rowAction[] = $gridAction->deleteAction('ojs_journal_article_file_delete', ['id', 'journalId' => $journal->getId(), 'articleId' => $articleId]); $actionColumn->setRowActions($rowAction); $grid->addColumn($actionColumn); $data = []; $data['grid'] = $grid; $data['article'] = $article; return $grid->getGridResponse('OjsJournalBundle:ArticleFile:index.html.twig', $data); }
/** * Lists all Design entities. * * @param Request $request * @return Response */ public function indexAction(Request $request) { $journal = $this->get('ojs.journal_service')->getSelectedJournal(); if (!$this->isGranted('VIEW', $journal, 'design')) { throw new AccessDeniedException("You are not authorized for view this journal's designs!"); } $source = new Entity('OjsJournalBundle:Design'); $tableAlias = $source->getTableAlias(); $source->manipulateQuery(function ($query) use($tableAlias, $journal) { $query->andWhere($tableAlias . '.owner = :journal')->setParameter('journal', $journal); }); $source->manipulateRow(function (Row $row) use($request) { /* @var Design $entity */ $entity = $row->getEntity(); if (!is_null($entity)) { $entity->getOwner()->setDefaultLocale($request->getDefaultLocale()); $row->setField('owner', $entity->getOwner()->getTitle()); } return $row; }); $grid = $this->get('grid')->setSource($source); $gridAction = $this->get('grid_action'); $actionColumn = new ActionsColumn("actions", 'actions'); $rowAction[] = $gridAction->showAction('ojs_journal_design_show', ['id', 'journalId' => $journal->getId()]); $rowAction[] = $gridAction->editAction('ojs_journal_design_edit', ['id', 'journalId' => $journal->getId()]); $rowAction[] = $gridAction->deleteAction('ojs_journal_design_delete', ['id', 'journalId' => $journal->getId()]); $actionColumn->setRowActions($rowAction); $grid->addColumn($actionColumn); $data = []; $data['grid'] = $grid; return $grid->getGridResponse('OjsJournalBundle:Design:index.html.twig', $data); }
/** * Returns setupStatus == false journals * @return Response */ public function notFinishedAction() { if (!$this->isGranted('VIEW', new Journal())) { throw new AccessDeniedException("You not authorized for list journals!"); } $source = new Entity('OjsJournalBundle:Journal'); $tableAlias = $source->getTableAlias(); $source->manipulateQuery(function ($query) use($tableAlias) { $query->andWhere($tableAlias . '.setup_status = 0'); }); $source->addHint(Query::HINT_CUSTOM_OUTPUT_WALKER, 'Gedmo\\Translatable\\Query\\TreeWalker\\TranslationWalker'); $grid = $this->get('grid')->setSource($source); $gridAction = $this->get('grid_action'); $actionColumn = new ActionsColumn("actions", 'actions'); $rowAction[] = $gridAction->showAction('ojs_admin_journal_show', 'id'); $rowAction[] = $gridAction->editAction('ojs_admin_journal_edit', 'id'); $rowAction[] = $gridAction->cmsAction(); $rowAction[] = $gridAction->deleteAction('ojs_admin_journal_delete', 'id'); $rowAction[] = (new RowAction('Manage', 'change_selected_journal'))->setRouteParameters('id')->setRouteParametersMapping(array('id' => 'journal_id'))->setAttributes(array('class' => 'btn btn-success btn-xs', 'data-toggle' => 'tooltip', 'title' => "Manage")); $actionColumn->setRowActions($rowAction); $grid->addColumn($actionColumn); $data = []; $data['grid'] = $grid; return $grid->getGridResponse('OjsAdminBundle:AdminJournal:index.html.twig', $data); }
/** * Lists all PublisherThemes entities. * * @param integer $publisherId * @return Response */ public function indexAction($publisherId) { $em = $this->getDoctrine()->getManager(); $publisher = $em->getRepository('OjsJournalBundle:Publisher')->find($publisherId); $this->throw404IfNotFound($publisher); if (!$this->isGrantedForPublisher($publisher)) { throw new AccessDeniedException("You are not authorized for this page!"); } $source = new Entity('OjsJournalBundle:PublisherTheme'); $alias = $source->getTableAlias(); $source->manipulateQuery(function (QueryBuilder $qb) use($publisher, $alias) { $qb->andWhere($alias . '.publisher = :publisher')->setParameter('publisher', $publisher); }); $grid = $this->get('grid')->setSource($source); $gridAction = $this->get('grid_action'); $actionColumn = new ActionsColumn("actions", 'actions'); $rowAction[] = $gridAction->showAction('ojs_publisher_manager_theme_show', ['publisherId' => $publisher->getId(), 'id']); $rowAction[] = $gridAction->editAction('ojs_publisher_manager_theme_edit', ['publisherId' => $publisher->getId(), 'id']); $rowAction[] = $gridAction->deleteAction('ojs_publisher_manager_theme_delete', ['publisherId' => $publisher->getId(), 'id']); $actionColumn->setRowActions($rowAction); $grid->addColumn($actionColumn); $data = []; $data['grid'] = $grid; $data['publisher'] = $publisher; return $grid->getGridResponse('OjsJournalBundle:ManagerPublisherTheme:index.html.twig', $data); }
/** * Lists all JournalIndex entities. * * @param Request $request * @return Response */ public function indexAction(Request $request) { $journal = $this->get('ojs.journal_service')->getSelectedJournal(); if (!$this->isGranted('VIEW', $journal, 'index')) { throw new AccessDeniedException("You are not authorized for view this page!"); } $source = new Entity('OjsJournalBundle:JournalIndex'); $source->manipulateRow(function (Row $row) use($request) { /* @var JournalIndex $entity */ $entity = $row->getEntity(); $entity->getJournal()->setDefaultLocale($request->getDefaultLocale()); return $row; }); $grid = $this->get('grid')->setSource($source); $gridAction = $this->get('grid_action'); $actionColumn = new ActionsColumn("actions", 'actions'); $rowAction[] = $gridAction->showAction('ojs_journal_index_show', ['id', 'journalId' => $journal->getId()]); $rowAction[] = $gridAction->editAction('ojs_journal_index_edit', ['id', 'journalId' => $journal->getId()]); $rowAction[] = $gridAction->deleteAction('ojs_journal_index_delete', ['id', 'journalId' => $journal->getId()]); $actionColumn->setRowActions($rowAction); $grid->addColumn($actionColumn); $data = []; $data['grid'] = $grid; return $grid->getGridResponse('OjsJournalBundle:JournalIndex:index.html.twig', $data); }
/** * 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 Subject entities. * * @param Request $request * @return Response */ public function indexAction(Request $request) { if (!$this->isGranted('VIEW', new Subject())) { throw new AccessDeniedException("You are not authorized for this page!"); } $source = new Entity("OjsJournalBundle:Subject"); $source->manipulateRow(function (Row $row) use($request) { /* @var Subject $entity */ $entity = $row->getEntity(); $entity->setDefaultLocale($request->getDefaultLocale()); if (!is_null($entity)) { $row->setField('subject', $entity->getSubject()); $row->setField('description', $entity->getDescription()); } return $row; }); $grid = $this->get('grid')->setSource($source); $gridAction = $this->get('grid_action'); $actionColumn = new ActionsColumn("actions", 'actions'); $rowAction[] = $gridAction->showAction('ojs_admin_subject_show', 'id'); $rowAction[] = $gridAction->editAction('ojs_admin_subject_edit', 'id'); $rowAction[] = $gridAction->deleteAction('ojs_admin_subject_delete', 'id'); $actionColumn->setRowActions($rowAction); $grid->addColumn($actionColumn); /** @var ArrayCollection|Subject[] $all */ $all = $this->getDoctrine()->getRepository('OjsJournalBundle:Subject')->findAll(); $data = ['grid' => $grid, 'tree' => $this->createTreeView($all)]; return $grid->getGridResponse('OjsAdminBundle:AdminSubject:index.html.twig', $data); }
/** * Lists all PublisherTypes entities. * * @param Request $request * @return Response */ public function indexAction(Request $request) { if (!$this->isGranted('VIEW', new PublisherTypes())) { throw new AccessDeniedException("You are not authorized for this page!"); } $source = new Entity('OjsJournalBundle:PublisherTypes'); $source->manipulateRow(function (Row $row) use($request) { /* @var PublisherTypes $entity */ $entity = $row->getEntity(); $entity->setDefaultLocale($request->getDefaultLocale()); if (!is_null($entity)) { $row->setField('name', $entity->getName()); $row->setField('description', $entity->getDescription()); } return $row; }); $grid = $this->get('grid')->setSource($source); $gridAction = $this->get('grid_action'); $actionColumn = new ActionsColumn("actions", 'actions'); $rowAction[] = $gridAction->showAction('ojs_admin_publisher_type_show', 'id'); $rowAction[] = $gridAction->editAction('ojs_admin_publisher_type_edit', 'id'); $rowAction[] = $gridAction->deleteAction('ojs_admin_publisher_type_delete', 'id'); $actionColumn->setRowActions($rowAction); $grid->addColumn($actionColumn); $data = []; $data['grid'] = $grid; return $grid->getGridResponse('OjsAdminBundle:AdminPublisherType:index.html.twig', $data); }
/** * Lists all Board entities. * */ public function indexAction() { $journal = $this->get('ojs.journal_service')->getSelectedJournal(); if (!$this->isGranted('VIEW', $journal, 'boards')) { throw new AccessDeniedException("You not authorized for view this journal's boards!"); } $source = new Entity('OjsJournalBundle:Board'); $ta = $source->getTableAlias(); $source->manipulateQuery(function (QueryBuilder $query) use($ta, $journal) { $query->andWhere($ta . '.journal = :journal')->setParameter('journal', $journal); }); $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()]); 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); $data = []; $data['grid'] = $grid; return $grid->getGridResponse('OjsJournalBundle:Board:index.html.twig', $data); }
/** * Lists all Section entities. * * @param Request $request * @return Response */ public function indexAction(Request $request) { $journal = $this->get('ojs.journal_service')->getSelectedJournal(); 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); $data = []; $data['grid'] = $grid; return $grid->getGridResponse('OjsJournalBundle:Section:index.html.twig', $data); }
/** * Lists all Subject entities. * */ public function indexAction() { if (!$this->isGranted('VIEW', new Subject())) { throw new AccessDeniedException("You are not authorized for this page!"); } $source = new Entity("OjsJournalBundle:Subject"); $source->addHint(Query::HINT_CUSTOM_OUTPUT_WALKER, 'Gedmo\\Translatable\\Query\\TreeWalker\\TranslationWalker'); $grid = $this->get('grid')->setSource($source); $gridAction = $this->get('grid_action'); $actionColumn = new ActionsColumn("actions", 'actions'); $rowAction[] = $gridAction->showAction('ojs_admin_subject_show', 'id'); $rowAction[] = $gridAction->editAction('ojs_admin_subject_edit', 'id'); $rowAction[] = $gridAction->deleteAction('ojs_admin_subject_delete', 'id'); $actionColumn->setRowActions($rowAction); $grid->addColumn($actionColumn); $data = []; $data['grid'] = $grid; /** @var SubjectRepository $repo */ $repo = $this->getDoctrine()->getRepository('OjsJournalBundle:Subject'); $options = array('decorate' => true, 'rootOpen' => '<ul>', 'rootClose' => '</ul>', 'childOpen' => '<li>', 'childClose' => '</li>', 'idField' => true, 'nodeDecorator' => function ($node) { return '<a href="' . $this->generateUrl('ojs_admin_subject_show', array('id' => $node['id'])) . '">' . $node['subject'] . '</a>'; }); $data['htmlTree'] = $repo->childrenHierarchy(null, false, $options); return $grid->getGridResponse('OjsAdminBundle:AdminSubject:index.html.twig', $data); }
/** * Lists all JournalSection entities. * */ public function indexAction() { $journal = $this->get('ojs.journal_service')->getSelectedJournal(); if (!$this->isGranted('VIEW', $journal, 'sections')) { throw new AccessDeniedException("You are not authorized for view this journal's sections!"); } $source = new Entity('OjsJournalBundle:JournalSection'); $source->addHint(Query::HINT_CUSTOM_OUTPUT_WALKER, 'Gedmo\\Translatable\\Query\\TreeWalker\\TranslationWalker'); $ta = $source->getTableAlias(); $source->manipulateQuery(function (QueryBuilder $qb) use($journal, $ta) { $qb->where($qb->expr()->eq($ta . '.journalId', $journal->getId())); return $qb; }); $source->manipulateRow(function (Row $row) { 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); $data = []; $data['grid'] = $grid; return $grid->getGridResponse('OjsJournalBundle:JournalSection:index.html.twig', $data); }
/** * @param Request $request * @return Response */ public function indexAction(Request $request) { $router = $this->get('router'); $source = new Entity('OjsJournalBundle:Journal'); $source->manipulateRow(function (Row $row) use($request, $router) { /* @var Journal $entity */ $entity = $row->getEntity(); if (!is_null($entity)) { $journalLinkTemplate = $entity->getTitleTranslations(); if ($entity->isIndexable() && $entity->getPublisher() !== null) { $generateJournalLink = $router->generate('ojs_journal_index', ['slug' => $entity->getSlug()]); $journalLinkTemplate = '<a target="_blank" href="' . $generateJournalLink . '">' . $entity->getTitleTranslations() . '</a>'; } $row->setField('translations.title:translation_agg', $journalLinkTemplate); } return $row; }); $grid = $this->get('grid')->setSource($source); $gridAction = $this->get('grid_action'); $actionColumn = new ActionsColumn("actions", 'actions'); $rowAction[] = $gridAction->showAction('ojs_admin_journal_show', 'id'); $rowAction[] = $gridAction->editAction('ojs_admin_journal_edit', 'id'); $rowAction[] = $gridAction->contactsAction('ojs_journal_journal_contact_index'); $rowAction[] = (new RowAction('Manage', 'ojs_journal_dashboard_index'))->setRouteParameters('id')->setRouteParametersMapping(array('id' => 'journalId'))->setAttributes(array('class' => 'btn btn-success btn-xs', 'data-toggle' => 'tooltip', 'title' => "Manage")); $actionColumn->setRowActions($rowAction); $grid->addColumn($actionColumn); $data = []; $data['grid'] = $grid; return $grid->getGridResponse('OjsAdminBundle:AdminJournal:index.html.twig', $data); }
/** * @param Request $request * @return Response */ public function indexAction(Request $request) { if (!$this->isGranted('VIEW', new Journal())) { throw new AccessDeniedException("You not authorized for list journals!"); } $source = new Entity('OjsJournalBundle:Journal'); $source->manipulateRow(function (Row $row) use($request) { /* @var Journal $entity */ $entity = $row->getEntity(); $entity->setDefaultLocale($request->getDefaultLocale()); if (!is_null($entity)) { $row->setField('title', $entity->getTitle()); $row->setField('status', Journal::$statuses[$entity->getStatus()]); } return $row; }); $grid = $this->get('grid')->setSource($source); $gridAction = $this->get('grid_action'); $actionColumn = new ActionsColumn("actions", 'actions'); $rowAction[] = $gridAction->showAction('ojs_admin_journal_show', 'id'); $rowAction[] = $gridAction->editAction('ojs_admin_journal_edit', 'id'); $rowAction[] = $gridAction->cmsAction(); $rowAction[] = $gridAction->deleteAction('ojs_admin_journal_delete', 'id'); $rowAction[] = (new RowAction('Manage', 'ojs_journal_dashboard_index'))->setRouteParameters('id')->setRouteParametersMapping(array('id' => 'journalId'))->setAttributes(array('class' => 'btn btn-success btn-xs', 'data-toggle' => 'tooltip', 'title' => "Manage")); $actionColumn->setRowActions($rowAction); $grid->addColumn($actionColumn); $data = []; $data['grid'] = $grid; return $grid->getGridResponse('OjsAdminBundle:AdminJournal:index.html.twig', $data); }
/** * Lists all SubmissionChecklist entities. * */ public function indexAction() { $journal = $this->get('ojs.journal_service')->getSelectedJournal(); if (!$this->isGranted('VIEW', $journal, 'checklist')) { throw new AccessDeniedException("You are not authorized for view this page!"); } $source = new Entity('OjsJournalBundle:SubmissionChecklist'); $source->addHint(Query::HINT_CUSTOM_OUTPUT_WALKER, 'Gedmo\\Translatable\\Query\\TreeWalker\\TranslationWalker'); if ($journal) { $ta = $source->getTableAlias(); $source->manipulateQuery(function (QueryBuilder $qb) use($journal, $ta) { $qb->andWhere($qb->expr()->eq("{$ta}.journal_id", ':journal'))->setParameter('journal', $journal->getId()); }); } if (!$journal) { throw new NotFoundHttpException("Journal not found!"); } $grid = $this->get('grid')->setSource($source); $gridAction = $this->get('grid_action'); $actionColumn = new ActionsColumn("actions", 'actions'); $rowAction[] = $gridAction->showAction('ojs_journal_checklist_show', ['id', 'journalId' => $journal->getId()]); $rowAction[] = $gridAction->editAction('ojs_journal_checklist_edit', ['id', 'journalId' => $journal->getId()]); $rowAction[] = $gridAction->deleteAction('ojs_journal_checklist_delete', ['id', 'journalId' => $journal->getId()]); $actionColumn->setRowActions($rowAction); $grid->addColumn($actionColumn); $data = []; $data['grid'] = $grid; $data['journal_id'] = $journal; return $grid->getGridResponse('OjsJournalBundle:SubmissionChecklist:index.html.twig', $data); }
public function indexAction(Request $request) { $data = array(); $source = new Entity('OjsJournalBundle:Journal'); $source->manipulateRow(function (Row $row) use($request) { /* @var Journal $entity */ $entity = $row->getEntity(); $entity->setDefaultLocale($request->getDefaultLocale()); if (!is_null($entity)) { $row->setField('title', $entity->getTitle()); } return $row; }); $alias = $source->getTableAlias(); $source->manipulateQuery(function (QueryBuilder $query) use($alias) { $query->andWhere($alias . '.status = :status')->setParameter('status', JournalStatuses::STATUS_PREPARING); return $query; }); $grid = $this->get('grid')->setSource($source); $gridAction = $this->get('grid_action'); $saveAction = new RowAction('<i class="fa fa-save"></i>', 'ojs_admin_application_journal_save'); $saveAction->setRouteParameters(['id']); $saveAction->setAttributes(['class' => 'btn btn-primary btn-xs', 'title' => $this->get('translator')->trans('journal.merge_as_new_journal')]); $rowAction = array(); $rowAction[] = $saveAction; $rowAction[] = $gridAction->editAction('ojs_admin_application_journal_edit', 'id'); $rowAction[] = $gridAction->showAction('ojs_admin_application_journal_show', 'id'); $rowAction[] = $gridAction->deleteAction('ojs_admin_application_journal_delete', 'id'); $actionColumn = new ActionsColumn("actions", 'actions'); $actionColumn->setRowActions($rowAction); $grid->addColumn($actionColumn); $data['grid'] = $grid; return $grid->getGridResponse('OjsAdminBundle:AdminApplication:journal.html.twig', $data); }
/** * 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'); }
public function indexAction() { $data = array(); $source = new Entity('OjsJournalBundle:Publisher', 'application'); $tableAlias = $source->getTableAlias(); $source->manipulateQuery(function (QueryBuilder $query) use($tableAlias) { $query->andWhere($tableAlias . ".status = :status")->setParameter('status', 0); return $query; }); $grid = $this->get('grid')->setSource($source); $gridAction = $this->get('grid_action'); $grid->getColumn('status')->manipulateRenderCell(function ($value) { return $this->get('translator')->trans(Publisher::$statuses[$value]); }); $rowAction = array(); $saveAction = new RowAction('<i class="fa fa-save"></i>', 'ojs_admin_application_publisher_save'); $saveAction->setRouteParameters(['id']); $saveAction->setAttributes(['class' => 'btn btn-primary btn-xs', 'title' => $this->get('translator')->trans('institute.merge_as_new_institute')]); $rowAction[] = $saveAction; $rowAction[] = $gridAction->showAction('ojs_admin_application_publisher_show', 'id'); $rowAction[] = $gridAction->editAction('ojs_admin_application_publisher_edit', 'id'); $rowAction[] = $gridAction->deleteAction('ojs_admin_application_publisher_delete', 'id'); $actionColumn = new ActionsColumn("actions", 'actions'); $actionColumn->setRowActions($rowAction); $grid->addColumn($actionColumn); $data['grid'] = $grid; return $grid->getGridResponse('OjsAdminBundle:AdminApplication:publisher.html.twig', $data); }
/** * Lists all JournalContact entities. * * @param Request $request * @return Response */ public function indexAction(Request $request) { if (!$this->isGranted('VIEW', new JournalContact())) { 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'); $rowAction = []; $rowAction[] = $gridAction->showAction('ojs_admin_contact_show', 'id'); $rowAction[] = $gridAction->editAction('ojs_admin_contact_edit', 'id'); $rowAction[] = $gridAction->deleteAction('ojs_admin_contact_delete', 'id'); $actionColumn = new ActionsColumn("actions", 'actions'); $actionColumn->setRowActions($rowAction); $grid->addColumn($actionColumn); return $grid->getGridResponse('OjsAdminBundle:AdminContact:index.html.twig', ['grid' => $grid]); }
/** * Lists all Citation entities. * * @param Request $request * @param Integer $articleId * @return Response */ public function indexAction(Request $request, $articleId) { $journal = $this->get('ojs.journal_service')->getSelectedJournal(); $this->throw404IfNotFound($journal); if (!$this->isGranted('VIEW', $journal, 'articles')) { throw new AccessDeniedException("You not authorized for this page!"); } $article = $this->getDoctrine()->getRepository('OjsJournalBundle:Article')->find($articleId); $this->throw404IfNotFound($article); $source = new Entity('OjsJournalBundle:Citation'); if ($articleId !== null) { $alias = $source->getTableAlias(); $source->manipulateQuery(function (QueryBuilder $query) use($alias, $articleId) { $query->join($alias . '.articles', 'a')->where('a.id = :articleId')->setParameter('articleId', $articleId); }); } $grid = $this->get('grid')->setSource($source); $gridAction = $this->get('grid_action'); $actionColumn = new ActionsColumn("actions", 'actions'); $rowAction[] = $gridAction->showAction('ojs_journal_citation_show', ['id', 'journalId' => $journal->getId(), 'articleId' => $articleId]); $rowAction[] = $gridAction->editAction('ojs_journal_citation_edit', ['id', 'journalId' => $journal->getId(), 'articleId' => $articleId]); $rowAction[] = $gridAction->deleteAction('ojs_journal_citation_delete', ['id', 'journalId' => $journal->getId(), 'articleId' => $articleId]); $actionColumn->setRowActions($rowAction); $grid->addColumn($actionColumn); return $grid->getGridResponse('OjsJournalBundle:Citation: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'); $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'); }
public function indexAction(Request $request, $issueId) { $journal = $this->get('ojs.journal_service')->getSelectedJournal(); $this->throw404IfNotFound($journal); if (!$this->isGranted('VIEW', $journal, 'issues')) { throw new AccessDeniedException("You not authorized for this page!"); } $source = new Entity('OjsJournalBundle:IssueFile'); $source->addHint(Query::HINT_CUSTOM_OUTPUT_WALKER, 'Gedmo\\Translatable\\Query\\TreeWalker\\TranslationWalker'); $issue = $this->getDoctrine()->getRepository('OjsJournalBundle:Issue')->find($issueId); $this->throw404IfNotFound($issue); $alias = $source->getTableAlias(); $source->manipulateQuery(function (QueryBuilder $query) use($alias, $issueId) { $query->join($alias . '.issue', 'i')->where('i.id = :issueId')->setParameter('issueId', $issueId); }); $grid = $this->get('grid')->setSource($source); $gridAction = $this->get('grid_action'); $actionColumn = new ActionsColumn("actions", 'actions'); $rowAction[] = $gridAction->showAction('ojs_journal_issue_file_show', ['id', 'journalId' => $journal->getId(), 'issueId' => $issueId]); $rowAction[] = $gridAction->editAction('ojs_journal_issue_file_edit', ['id', 'journalId' => $journal->getId(), 'issueId' => $issueId]); $rowAction[] = $gridAction->deleteAction('ojs_journal_issue_file_delete', ['id', 'journalId' => $journal->getId(), 'issueId' => $issueId]); $actionColumn->setRowActions($rowAction); $grid->addColumn($actionColumn); $data = []; $data['grid'] = $grid; $data['issue'] = $issue; return $grid->getGridResponse('OjsJournalBundle:IssueFile:index.html.twig', $data); }
/** * Lists all JournalPost entities. * * @param Request $request * @return Response */ public function indexAction(Request $request) { $journal = $this->get('ojs.journal_service')->getSelectedJournal(); if (!$this->isGranted('VIEW', $journal, 'posts')) { throw new AccessDeniedException("You are not authorized for this post!"); } $source = new Entity('OjsJournalBundle:JournalPost'); $source->manipulateRow(function (Row $row) use($request) { /* @var JournalPost $entity */ $entity = $row->getEntity(); $entity->setDefaultLocale($request->getDefaultLocale()); if (!is_null($entity)) { $row->setField('title', $entity->getTitle()); $row->setField('content', $entity->getContent()); } return $row; }); $grid = $this->get('grid')->setSource($source); $gridAction = $this->get('grid_action'); $actionColumn = new ActionsColumn("actions", 'actions'); $rowAction[] = $gridAction->showAction('ojs_journal_post_show', ['id', 'journalId' => $journal->getId()]); $rowAction[] = $gridAction->editAction('ojs_journal_post_edit', ['id', 'journalId' => $journal->getId()]); $rowAction[] = $gridAction->deleteAction('ojs_journal_post_delete', ['id', 'journalId' => $journal->getId()]); $actionColumn->setRowActions($rowAction); $grid->addColumn($actionColumn); return $grid->getGridResponse('OjsJournalBundle:JournalPost:index.html.twig', ['grid' => $grid]); }
/** * 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'); }
/** * List all page entities * * @param Request $request * @return Response */ public function indexAction(Request $request) { $source = new Entity('OjsAdminBundle:AdminPage'); $grid = $this->get('grid')->setSource($source); $gridAction = $this->get('grid_action'); $actionColumn = new ActionsColumn("actions", 'actions'); $rowAction[] = $gridAction->showAction('ojs_admin_page_show', 'id'); $rowAction[] = $gridAction->editAction('ojs_admin_page_edit', 'id'); $rowAction[] = $gridAction->deleteAction('ojs_admin_page_delete', 'id'); $actionColumn->setRowActions($rowAction); $grid->addColumn($actionColumn); return $grid->getGridResponse('OjsAdminBundle:AdminPage:index.html.twig', ['grid' => $grid]); }
/** * 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 Period entities. * * @param Request $request * @return Response */ public function indexAction(Request $request) { $source = new Entity('OjsJournalBundle:Period'); $grid = $this->get('grid')->setSource($source); $gridAction = $this->get('grid_action'); $actionColumn = new ActionsColumn("actions", 'actions'); $rowAction[] = $gridAction->showAction('ojs_admin_period_show', 'id'); $rowAction[] = $gridAction->editAction('ojs_admin_period_edit', 'id'); $rowAction[] = $gridAction->deleteAction('ojs_admin_period_delete', 'id'); $actionColumn->setRowActions($rowAction); $grid->addColumn($actionColumn); $data = []; $data['grid'] = $grid; return $grid->getGridResponse('OjsAdminBundle:AdminPeriod:index.html.twig', $data); }