public function globalThemesAction()
{
//disable journal filter for get all journal themes
$GLOBALS['Ojs\\JournalBundle\\Entity\\JournalTheme#journalFilter'] = false;
$journal = $this->get('ojs.journal_service')->getSelectedJournal();
if (!$this->isGranted('VIEW', $journal, 'theme')) {
throw new AccessDeniedException("You are not authorized for view this page");
}
$grid1 = $this->get('grid');
$grid2 = $this->get('grid');
$source1 = new Entity('OjsAdminBundle:AdminJournalTheme');
$tableAlias1 = $source1->getTableAlias();
$source1->manipulateQuery(function ($query) use($tableAlias1) {
$query->andWhere($tableAlias1 . '.public = true');
});
$source2 = new Entity('OjsJournalBundle:JournalTheme');
$tableAlias2 = $source2->getTableAlias();
$source2->manipulateQuery(function ($query) use($tableAlias2, $journal) {
$query->andWhere($tableAlias2 . '.public = true')->andWhere($tableAlias2 . '.journal != :journal')->setParameter('journal', $journal);
});
$grid1->setSource($source1);
$gridAction1 = $this->get('grid_action');
$actionColumn1 = new ActionsColumn("actions", 'actions');
$rowAction1[] = $gridAction1->cloneThemeAction('ojs_journal_global_theme_clone', ['id', 'journalId' => $journal->getId(), 'type' => 'global']);
$rowAction1[] = $gridAction1->cloneThemeAction('ojs_journal_global_theme_clone', ['id', 'journalId' => $journal->getId(), 'type' => 'global', 'use'], null, ['icon' => 'css3', 'title' => 'clone.and.use']);
$rowAction1[] = $gridAction1->themePreviewAction('ojs_journal_index', ['id', 'publisher' => $journal->getPublisher()->getSlug(), 'slug' => $journal->getSlug(), 'type' => 'global', 'themePreview']);
$actionColumn1->setRowActions($rowAction1);
$grid1->addColumn($actionColumn1);
$grid2->setSource($source2);
$gridAction2 = $this->get('grid_action');
$actionColumn2 = new ActionsColumn("actions", 'actions');
$rowAction2[] = $gridAction2->cloneThemeAction('ojs_journal_global_theme_clone', ['id', 'journalId' => $journal->getId(), 'type' => 'journal']);
$rowAction2[] = $gridAction2->cloneThemeAction('ojs_journal_global_theme_clone', ['id', 'journalId' => $journal->getId(), 'type' => 'journal', 'use'], null, ['icon' => 'css3', 'title' => 'clone.and.use']);
$rowAction2[] = $gridAction2->themePreviewAction('ojs_journal_index', ['id', 'publisher' => $journal->getPublisher()->getSlug(), 'slug' => $journal->getSlug(), 'type' => 'journal', 'themePreview']);
$actionColumn2->setRowActions($rowAction2);
$grid2->addColumn($actionColumn2);
if ($grid1->isReadyForRedirect() || $grid2->isReadyForRedirect()) {
if ($grid1->isReadyForExport()) {
return $grid1->getExportResponse();
}
if ($grid2->isReadyForExport()) {
return $grid2->getExportResponse();
}
// Url is the same for the grids
return new RedirectResponse($grid1->getRouteUrl());
} else {
return $this->render('OjsJournalBundle:Theme:global_themes.html.twig', array('globalThemesGrid' => $grid1, 'globalJournalThemesGrid' => $grid2));
}
}