/** * 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); }
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); }
/** * @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); }
/** * 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); }
/** * @Template() * @Route("/", name="ticket.ticket.index") * @Security("has_role('ROLE_USER')") * @param Request $request * @return array */ public function indexAction(Request $request) { $user = $this->getUser(); $source = new Entity('DreamlexTicketBundle:Ticket'); $source->addHint(\Doctrine\ORM\Query::HINT_CUSTOM_OUTPUT_WALKER, 'Gedmo\\Translatable\\Query\\TreeWalker\\TranslationWalker'); $prefixTitle = 'ticket.label.grid.'; $translator = $this->get('translator'); $tableAlias = $source->getTableAlias(); $source->manipulateQuery(function ($query) use($tableAlias, $user) { /** @var QueryBuilder $query */ $query->andWhere($tableAlias . '.user = :user')->setParameter('user', $user); }); $source->manipulateRow(function ($row) use($user) { /** @var Row $row */ if ($row->getField('lastUser.id') != $user->getId() && !$row->getField('isRead')) { $row->setClass('warning'); } return $row; }); $grid = $this->get('grid'); $grid->setSource($source); $grid->setLimits(10); $grid->setPrefixTitle($prefixTitle); $grid->setId('ticket'); $grid->setNoDataMessage($translator->trans('ticket.message.no_tickets')); $replyAction = new RowAction('ticket.button.reply', 'ticket.ticket.show', false, '_self', ['class' => 'btn btn-success', 'icon' => 'fa fa-reply']); $grid->addRowAction($replyAction); $grid->isReadyForRedirect(); return $grid->getGridResponse(); }
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 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 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 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); }
/** * 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 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 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 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 ArticleAuthor entities. * * @param Integer $articleId * @return Response */ public function indexAction($articleId, Request $request) { $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:ArticleAuthor'); $source->manipulateRow(function (Row $row) use($request) { /* @var ArticleAuthor $entity */ $entity = $row->getEntity(); if (!is_null($entity)) { $entity->getArticle()->setDefaultLocale($request->getDefaultLocale()); $row->setField('article', $entity->getArticle()->getTitle()); } return $row; }); $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_author_show', ['id', 'journalId' => $journal->getId(), 'articleId' => $articleId]); $rowAction[] = $gridAction->editAction('ojs_journal_article_author_edit', ['id', 'journalId' => $journal->getId(), 'articleId' => $articleId]); $rowAction[] = $gridAction->deleteAction('ojs_journal_article_author_delete', ['id', 'journalId' => $journal->getId(), 'articleId' => $articleId]); $actionColumn->setRowActions($rowAction); $grid->addColumn($actionColumn); $data = []; $data['grid'] = $grid; $data['article'] = $article; return $grid->getGridResponse('OjsJournalBundle:ArticleAuthor:index.html.twig', $data); }
/** * Returns setupFinished == false journals * * @param Request $request * @return Response */ public function notFinishedAction(Request $request) { 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 (QueryBuilder $query) use($tableAlias) { $query->andWhere($tableAlias . '.setupFinished = 0'); }); $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('subtitle', $entity->getSubtitle()); $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_journal_show', 'id'); $rowAction[] = $gridAction->editAction('ojs_journal_settings_index', 'id')->setRouteParametersMapping(['id' => 'journalId']); $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); }
/** * @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 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); }
/** * 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 MailTemplate entities. * * @return Response */ public function indexAction() { $journal = $this->get('ojs.journal_service')->getSelectedJournal(); if (!$this->isGranted('VIEW', $journal, 'mailTemplate')) { throw new AccessDeniedException("You are not authorized for view this page!"); } $source = new Entity('OjsJournalBundle:MailTemplate'); $source->addHint(Query::HINT_CUSTOM_OUTPUT_WALKER, 'Gedmo\\Translatable\\Query\\TreeWalker\\TranslationWalker'); $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; }); $ta = $source->getTableAlias(); $source->manipulateQuery(function (QueryBuilder $qb) use($journal, $ta) { return $qb->andWhere($ta . '.journal = :journal')->setParameter('journal', $journal); }); $grid = $this->get('grid.manager'); $gridAction = $this->get('grid_action'); $db_templates = $grid->createGrid('db_templates'); $db_templates->setSource($source); $actionColumn = new ActionsColumn("actions", 'actions'); $rowAction = []; $rowAction[] = $gridAction->showAction('ojs_journal_mail_template_show', ['id', 'journalId' => $journal->getId()]); $rowAction[] = $gridAction->editAction('ojs_journal_mail_template_edit', ['id', 'journalId' => $journal->getId()]); $rowAction[] = $gridAction->deleteAction('ojs_journal_mail_template_delete', ['id', 'journalId' => $journal->getId()]); $actionColumn->setRowActions($rowAction); $db_templates->addColumn($actionColumn); $data = []; $data['db_templates'] = $db_templates; $yamlParser = new Parser(); $defaultTemplates = $yamlParser->parse(file_get_contents($this->container->getParameter('kernel.root_dir') . '/../src/Ojs/JournalBundle/Resources/data/mailtemplates.yml')); $source = new Vector($defaultTemplates, [new NumberColumn(['id' => 'id', 'field' => 'id', 'title' => 'ID', 'source' => true]), new TextColumn(['id' => 'subject', 'field' => 'subject', 'title' => 'mailtemplate.subject', 'source' => true]), new TextColumn(['id' => 'lang', 'field' => 'lang', 'title' => 'mailtemplate.language', 'source' => true]), new TextColumn(['id' => 'type', 'field' => 'type', 'title' => 'mailtemplate.title', 'source' => true]), new TextColumn(['id' => 'template', 'field' => 'template', 'title' => 'mailtemplate.template', 'source' => true, 'visible' => false])]); $defaultTemplates = $grid->createGrid('default_templates'); $defaultTemplates->setSource($source); $actionColumn = new ActionsColumn("actions", 'actions'); $rowAction = []; $rowAction[] = $gridAction->copyAction('ojs_journal_mail_template_copy', ['id', 'journalId' => $journal->getId()]); $actionColumn->setRowActions($rowAction); $defaultTemplates->addColumn($actionColumn); $data['default_templates'] = $defaultTemplates; return $grid->getGridManagerResponse('OjsJournalBundle:MailTemplate:index.html.twig', $data); }
/** * 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'); $source->manipulateRow(function (Row $row) use($request) { /** @var Issue $entity */ $entity = $row->getEntity(); $entity->setDefaultLocale($request->getDefaultLocale()); if (!is_null($entity)) { $row->setField('title', $entity->getTitle()); $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_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; 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()]); } $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'); }
public function indexAction(Request $request, $issueId) { $journal = $this->get('ojs.journal_service')->getSelectedJournal(); $em = $this->getDoctrine()->getManager(); $this->throw404IfNotFound($journal); if (!$this->isGranted('VIEW', $journal, 'issues')) { throw new AccessDeniedException("You not authorized for this page!"); } $source = new Entity('OjsJournalBundle:IssueFile'); $source->manipulateRow(function (Row $row) use($request) { /* @var IssueFile $entity */ $entity = $row->getEntity(); $entity->setDefaultLocale($request->getDefaultLocale()); if (!is_null($entity)) { $row->setField('title', $entity->getTitle()); $row->setField('description', $entity->getDescription()); } return $row; }); /** @var Issue $issue */ $issue = $em->getRepository('OjsJournalBundle:Issue')->find($issueId); $this->throw404IfNotFound($issue); $alias = $source->getTableAlias(); $source->manipulateQuery(function (QueryBuilder $query) use($alias, $issue) { $query->andWhere($alias . '.issue = :issue')->setParameter('issue', $issue); }); $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 new Article submissions entities. * * @param Request $request * @param bool $all * @return RedirectResponse|Response */ public function indexAction(Request $request, $all = false) { $translator = $this->get('translator'); /** @var Journal $currentJournal */ $currentJournal = $this->get('ojs.journal_service')->getSelectedJournal(); if ($all && !$this->isGranted('VIEW', $currentJournal, 'articles') || !$all && !$this->isGranted('CREATE', $currentJournal, 'articles')) { return $this->redirect($this->generateUrl('ojs_user_index')); } $user = $this->getUser(); $source1 = new Entity('OjsJournalBundle:Article', 'submission'); $source2 = new Entity('OjsJournalBundle:Article', 'submission'); $source1TableAlias = $source1->getTableAlias(); $source2TableAlias = $source2->getTableAlias(); $source1->manipulateQuery(function (QueryBuilder $qb) use($source1TableAlias, $user, $currentJournal, $all) { $qb->andWhere($source1TableAlias . '.status IN (:notDraftStatuses)')->setParameter('notDraftStatuses', [ArticleStatuses::STATUS_REJECTED, ArticleStatuses::STATUS_UNPUBLISHED, ArticleStatuses::STATUS_INREVIEW, ArticleStatuses::STATUS_PUBLISHED]); if (!$all) { $qb->andWhere($source1TableAlias . '.submitterUser = :user')->setParameter('user', $user); } return $qb; }); $source2->manipulateQuery(function (QueryBuilder $qb) use($source2TableAlias, $user, $currentJournal, $all) { $qb->andWhere($source2TableAlias . '.status = :status')->setParameter('status', ArticleStatuses::STATUS_NOT_SUBMITTED); if (!$all) { $qb->andWhere($source2TableAlias . '.submitterUser = :user')->setParameter('user', $user); } }); $gridManager = $this->get('grid.manager'); $submissionsGrid = $gridManager->createGrid('submission'); $drafts = $gridManager->createGrid('drafts'); $source1->manipulateRow(function (Row $row) use($translator, $currentJournal) { /** @var Article $entity */ $entity = $row->getEntity(); $entity->setDefaultLocale($currentJournal->getMandatoryLang()->getCode()); $row->setField('status', $translator->trans($entity->getStatusText())); $row->setField('title', $entity->getTitle()); return $row; }); $source2->manipulateRow(function (Row $row) use($translator, $request) { $entity = $row->getEntity(); /** @var Article $entity */ $entity->setDefaultLocale($request->getDefaultLocale()); $row->setField('status', $translator->trans($entity->getStatusText())); $row->setField('title', $entity->getTitle()); return $row; }); $submissionsGrid->setSource($source1); $drafts->setSource($source2); /** @var GridAction $gridAction */ $gridAction = $this->get('grid_action'); $rowAction = []; $actionColumn = new ActionsColumn("actions", 'actions'); $rowAction[] = $gridAction->submissionResumeAction('ojs_journal_submission_edit', ['journalId' => $currentJournal->getId(), 'id']); $rowAction[] = $gridAction->submissionCancelAction('ojs_journal_submission_cancel', ['journalId' => $currentJournal->getId(), 'id']); $actionColumn->setRowActions($rowAction); $drafts->addColumn($actionColumn); $data = ['page' => 'submission', 'submissions' => $submissionsGrid, 'drafts' => $drafts, 'all' => $all]; return $gridManager->getGridManagerResponse('OjsJournalBundle:ArticleSubmission:index.html.twig', $data); }
/** * Lists all new Article submissions entities. * @param bool $all * @return Response */ public function indexAction($all = false) { $translator = $this->get('translator'); /** @var Journal $currentJournal */ $currentJournal = $this->get('ojs.journal_service')->getSelectedJournal(); if ($all && !$this->isGranted('VIEW', $currentJournal, 'articles') || !$all && !$this->isGranted('CREATE', $currentJournal, 'articles')) { return $this->redirect($this->generateUrl('ojs_user_index')); } $user = $this->getUser(); $source1 = new Entity('OjsJournalBundle:Article', 'submission'); $source1TableAlias = $source1->getTableAlias(); $source2 = new Entity('OjsJournalBundle:ArticleSubmissionProgress'); $source2TableAlias = $source2->getTableAlias(); if ($all) { $source1->manipulateQuery(function (QueryBuilder $qb) use($source1TableAlias, $currentJournal) { $qb->where($source1TableAlias . '.status = 0'); $qb->andWhere($source1TableAlias . '.journalId = ' . $currentJournal->getId()); return $qb; }); $source2->manipulateQuery(function (QueryBuilder $qb) use($source2TableAlias, $currentJournal) { $qb->where($source2TableAlias . '.submitted = 0'); $qb->andWhere($source2TableAlias . '.journalId = ' . $currentJournal->getId()); return $qb; }); } else { $source1->manipulateQuery(function (QueryBuilder $qb) use($source1TableAlias, $user, $currentJournal) { $qb->where($qb->expr()->andX($qb->expr()->eq($source1TableAlias . '.submitterId', $user->getId()))); $qb->andWhere($source1TableAlias . '.journalId = ' . $currentJournal->getId()); return $qb; }); $source2->manipulateQuery(function (QueryBuilder $qb) use($source2TableAlias, $user, $currentJournal) { $qb->where($source2TableAlias . '.submitted = 0'); $qb->andWhere($source2TableAlias . '.journalId = ' . $currentJournal->getId()); $qb->andWhere($source2TableAlias . '.userId = ' . $user->getId()); return $qb; }); } $gridManager = $this->get('grid.manager'); $submissionsGrid = $gridManager->createGrid('submission'); $drafts = $gridManager->createGrid('drafts'); $source1->manipulateRow(function ($row) use($translator) { $row->setField('status', $translator->trans(ArticleParams::statusText($row->getField('status')))); return $row; }); $submissionsGrid->setSource($source1); $drafts->setSource($source2); /** @var GridAction $gridAction */ $gridAction = $this->get('grid_action'); $submissionsGrid->addRowAction($gridAction->showAction('ojs_journal_article_show', ['id', 'journalId' => $currentJournal->getId()])); $submissionsGrid->addRowAction($gridAction->editAction('ojs_journal_article_edit', ['id', 'journalId' => $currentJournal->getId()])); $submissionsGrid->addRowAction($gridAction->deleteAction('ojs_journal_article_delete', ['id', 'journalId' => $currentJournal->getId()])); $rowAction = []; $actionColumn = new ActionsColumn("actions", 'actions'); $rowAction[] = $gridAction->submissionResumeAction('article_submission_resume', 'id'); $rowAction[] = $gridAction->deleteAction('article_submission_cancel', 'id'); $actionColumn->setRowActions($rowAction); $drafts->addColumn($actionColumn); $data = ['page' => 'submission', 'submissions' => $submissionsGrid, 'drafts' => $drafts, 'all' => $all]; return $gridManager->getGridManagerResponse('OjsJournalBundle:ArticleSubmission:index.html.twig', $data); }