/**
  * Lists all Institution entities.
  *
  */
 public function institutionIndexAction()
 {
     $data = array();
     $source = new Entity('OjsJournalBundle:Institution', 'application');
     $tableAlias = $source->getTableAlias();
     $source->manipulateQuery(function (QueryBuilder $query) use($tableAlias) {
         $query->andWhere($tableAlias . ".status = :status")->setParameter('status', 0);
         return $query;
     });
     $source->addHint(Query::HINT_CUSTOM_OUTPUT_WALKER, 'Gedmo\\Translatable\\Query\\TreeWalker\\TranslationWalker');
     $grid = $this->get('grid')->setSource($source);
     $gridAction = $this->get('grid_action');
     $grid->getColumn('status')->manipulateRenderCell(function ($value, $row, $router) {
         return $this->get('translator')->trans(CommonParams::institutionStatus($row->getField('status')));
     });
     $rowAction = array();
     $rowAction[] = $gridAction->editAction('ojs_admin_application_institution_edit', 'id');
     $rowAction[] = $gridAction->showAction('ojs_admin_application_institution_show', 'id');
     $rowAction[] = $gridAction->deleteAction('ojs_admin_application_institution_delete', 'id');
     $actionColumn = new ActionsColumn("actions", 'actions');
     $actionColumn->setRowActions($rowAction);
     $grid->addColumn($actionColumn);
     $data['grid'] = $grid;
     return $grid->getGridResponse('OjsAdminBundle:AdminApplication:institution.html.twig', $data);
 }
Exemplo n.º 2
0
 /**
  * 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);
 }
Exemplo n.º 3
0
 /**
  * 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);
 }
Exemplo n.º 4
0
 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);
 }
Exemplo n.º 5
0
 /**
  * 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);
 }
Exemplo n.º 6
0
 /**
  * @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();
 }
 /**
  * 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);
 }
Exemplo n.º 8
0
 /**
  * Lists all Proxy entities.
  */
 public function indexAction()
 {
     if (!$this->isGranted('VIEW', new Proxy())) {
         throw new AccessDeniedException("You are not authorized for this page!");
     }
     $source = new Entity('OjsUserBundle:Proxy');
     $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_proxy_show', 'id');
     $rowAction[] = $gridAction->editAction('ojs_admin_proxy_edit', 'id');
     $rowAction[] = $gridAction->deleteAction('ojs_admin_proxy_delete', 'id');
     $actionColumn->setRowActions($rowAction);
     $grid->addColumn($actionColumn);
     return $grid->getGridResponse('OjsAdminBundle:AdminProxy:index.html.twig', ['grid' => $grid]);
 }
Exemplo n.º 9
0
 /**
  * Lists all EventLogs
  *
  * @return mixed
  */
 public function indexAction()
 {
     $logTypes = EventLogParams::adminLevelEventLogs();
     $source = new Entity('OjsUserBundle:EventLog');
     $source->addHint(Query::HINT_CUSTOM_OUTPUT_WALKER, 'Gedmo\\Translatable\\Query\\TreeWalker\\TranslationWalker');
     $tableAlias = $source->getTableAlias();
     $source->manipulateQuery(function (QueryBuilder $qb) use($tableAlias, $logTypes) {
         $expression = $qb->expr()->in($tableAlias . '.eventInfo', ':logTypes');
         $qb->andWhere($expression)->setParameters(['logTypes' => $logTypes]);
         return $qb;
     });
     $grid = $this->get('grid')->setSource($source);
     $gridAction = $this->get('grid_action');
     $actionColumn = new ActionsColumn("actions", "actions");
     $actionColumn->setRowActions([$gridAction->showAction('ojs_admin_event_log_show', 'id')]);
     $grid->addColumn($actionColumn);
     return $grid->getGridResponse('OjsAdminBundle:AdminEventLog:index.html.twig', ['grid' => $grid]);
 }
Exemplo n.º 10
0
 /**
  * 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 InstitutionTypes entities.
  *
  */
 public function indexAction()
 {
     if (!$this->isGranted('VIEW', new InstitutionTypes())) {
         throw new AccessDeniedException("You are not authorized for this page!");
     }
     $source = new Entity('OjsJournalBundle:InstitutionTypes');
     $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_institution_type_show', 'id');
     $rowAction[] = $gridAction->editAction('ojs_admin_institution_type_edit', 'id');
     $rowAction[] = $gridAction->deleteAction('ojs_admin_institution_type_delete', 'id');
     $actionColumn->setRowActions($rowAction);
     $grid->addColumn($actionColumn);
     $data = [];
     $data['grid'] = $grid;
     return $grid->getGridResponse('OjsAdminBundle:AdminInstitutionType:index.html.twig', $data);
 }
Exemplo n.º 12
0
 /**
  * Lists all JournalTheme entities.
  *
  */
 public function indexAction()
 {
     $journal = $this->get('ojs.journal_service')->getSelectedJournal();
     if (!$this->isGranted('VIEW', $journal, 'theme')) {
         throw new AccessDeniedException("You are not authorized for view this page");
     }
     $source = new Entity('OjsJournalBundle:JournalTheme');
     $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_journal_theme_show', ['id', 'journalId' => $journal->getId()]);
     $rowAction[] = $gridAction->editAction('ojs_journal_theme_edit', ['id', 'journalId' => $journal->getId()]);
     $rowAction[] = $gridAction->deleteAction('ojs_journal_theme_delete', ['id', 'journalId' => $journal->getId()]);
     $actionColumn->setRowActions($rowAction);
     $grid->addColumn($actionColumn);
     $data = [];
     $data['grid'] = $grid;
     return $grid->getGridResponse('OjsJournalBundle:JournalTheme:index.html.twig', $data);
 }
Exemplo n.º 13
0
 /**
  * Lists all EventLog according to user role.
  * @todo Add items to EventLogParams for every role
  *
  * @return mixed
  */
 public function indexAction()
 {
     /** @var User $user */
     $user = $this->getUser();
     $logTypes = EventLogParams::editorLevelEventLogs();
     $source = new Entity('OjsUserBundle:EventLog');
     $source->addHint(Query::HINT_CUSTOM_OUTPUT_WALKER, 'Gedmo\\Translatable\\Query\\TreeWalker\\TranslationWalker');
     $tableAlias = $source->getTableAlias();
     $source->manipulateQuery(function (QueryBuilder $qb) use($tableAlias, $logTypes, $user) {
         $expression = $qb->expr()->in($tableAlias . '.eventInfo', ':logTypes');
         $qb->andWhere($expression)->setParameter('logTypes', $logTypes);
         $qb->andWhere("{$tableAlias}.userId = :userId OR {$tableAlias}.affectedUserId = :userId")->setParameter('userId', $user->getId());
         return $qb;
     });
     $grid = $this->get('grid')->setSource($source);
     $gridAction = $this->get('grid_action');
     $actionColumn = new ActionsColumn("actions", "actions");
     $rowAction[] = $gridAction->showAction('user_eventlog_show', 'id');
     $actionColumn->setRowActions($rowAction);
     $grid->addColumn($actionColumn);
     return $grid->getGridResponse('OjsUserBundle:EventLog:index.html.twig', ['grid' => $grid]);
 }
Exemplo n.º 14
0
 /**
  * Lists all article entities for journal
  *
  * @return Response
  */
 public function indexAction()
 {
     $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!");
     }
     $source = new Entity('OjsJournalBundle:Article');
     $source->addHint(Query::HINT_CUSTOM_OUTPUT_WALKER, 'Gedmo\\Translatable\\Query\\TreeWalker\\TranslationWalker');
     $alias = $source->getTableAlias();
     $source->manipulateQuery(function (QueryBuilder $query) use($alias, $journal) {
         $query->andWhere($alias . '.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_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);
     return $grid->getGridResponse('OjsJournalBundle:Article:index.html.twig', ['journal' => $journal]);
 }
Exemplo n.º 15
0
 /**
  * Finds and displays a Users of a Journal with roles
  * @return mixed
  */
 public function indexAction()
 {
     $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->addHint(Query::HINT_CUSTOM_OUTPUT_WALKER, 'Gedmo\\Translatable\\Query\\TreeWalker\\TranslationWalker');
     $alias = $source->getTableAlias();
     $source->manipulateQuery(function (QueryBuilder $qb) use($journal, $alias) {
         $qb->andWhere($alias . '.journal = :journal')->setParameter('journal', $journal);
     });
     $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);
 }
Exemplo n.º 16
0
 /**
  * Displays a form to edit an existing Issue entity.
  *
  * @param   int $id
  * @return  Response
  */
 public function editAction($id)
 {
     $journal = $this->get('ojs.journal_service')->getSelectedJournal();
     if (!$this->isGranted('EDIT', $journal, 'issues')) {
         throw new AccessDeniedException("You are not authorized for edit this journal's issue!");
     }
     $em = $this->getDoctrine()->getManager();
     /** @var Issue $entity */
     $entity = $em->getRepository('OjsJournalBundle:Issue')->findOneBy(array('id' => $id, 'journal' => $journal));
     $this->throw404IfNotFound($entity);
     $editForm = $this->createEditForm($entity, $journal->getId());
     $source = new Entity('OjsJournalBundle:IssueFile');
     $source->addHint(Query::HINT_CUSTOM_OUTPUT_WALKER, 'Gedmo\\Translatable\\Query\\TreeWalker\\TranslationWalker');
     $ta = $source->getTableAlias();
     $source->manipulateQuery(function (QueryBuilder $query) use($ta, $entity) {
         $query->andWhere($ta . '.issueId = :issue_id')->setParameter('issue_id', $entity->getId());
     });
     $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');
     if ($this->isGranted('EDIT', $this->get('ojs.journal_service')->getSelectedJournal(), 'issues')) {
         $rowAction[] = $gridAction->editAction('ojs_journal_issue_file_edit', 'id');
     }
     if ($this->isGranted('DELETE', $this->get('ojs.journal_service')->getSelectedJournal(), 'issues')) {
         $rowAction[] = $gridAction->deleteAction('ojs_journal_issue_file_delete', 'id');
     }
     $actionColumn->setRowActions($rowAction);
     $grid->addColumn($actionColumn);
     return $grid->getGridResponse('OjsJournalBundle:Issue:edit.html.twig', ['entity' => $entity, 'edit_form' => $editForm->createView(), 'grid' => $grid]);
 }