当前位置: 首页>>代码示例>>PHP>>正文


PHP Entity::manipulateQuery方法代码示例

本文整理汇总了PHP中APY\DataGridBundle\Grid\Source\Entity::manipulateQuery方法的典型用法代码示例。如果您正苦于以下问题:PHP Entity::manipulateQuery方法的具体用法?PHP Entity::manipulateQuery怎么用?PHP Entity::manipulateQuery使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在APY\DataGridBundle\Grid\Source\Entity的用法示例。


在下文中一共展示了Entity::manipulateQuery方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: indexAction

 /**
  * 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);
 }
开发者ID:necatikartal,项目名称:ojs,代码行数:65,代码来源:ArticleSubmissionController.php

示例2: indexAction

 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);
 }
开发者ID:hasantayyar,项目名称:ojs,代码行数:30,代码来源:AdminJournalApplicationController.php

示例3: indexAction

 /**
  * 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);
 }
开发者ID:necatikartal,项目名称:ojs,代码行数:39,代码来源:JournalSectionController.php

示例4: indexAction

 /**
  * 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);
 }
开发者ID:ojs,项目名称:ojs,代码行数:38,代码来源:DesignController.php

示例5: indexAction

 /**
  * 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);
 }
开发者ID:ojs,项目名称:ojs,代码行数:32,代码来源:ManagerPublisherThemeController.php

示例6: notFinishedAction

 /**
  * 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);
 }
开发者ID:necatikartal,项目名称:ojs,代码行数:29,代码来源:AdminJournalController.php

示例7: indexAction

 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);
 }
开发者ID:ojs,项目名称:ojs,代码行数:28,代码来源:AdminPublisherApplicationController.php

示例8: indexAction

 /**
  * 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');
 }
开发者ID:ojs,项目名称:ojs,代码行数:33,代码来源:CitationController.php

示例9: typeAction

 /**
  * Index view of content by type
  *
  * @param int $type
  * @return Response
  */
 public function typeAction($type)
 {
     $contentType = $this->get('opifer.content.content_type_manager')->getRepository()->find($type);
     if (!$contentType) {
         throw $this->createNotFoundException(sprintf('Content Type with ID %d could not be found.', $type));
     }
     $queryBuilder = $this->get('opifer.content.content_manager')->getRepository()->createValuedQueryBuilder('c');
     $source = new Entity($this->getParameter('opifer_content.content_class'));
     $source->initQueryBuilder($queryBuilder);
     $tableAlias = $source->getTableAlias();
     $source->manipulateQuery(function ($query) use($tableAlias, $contentType) {
         $query->andWhere($tableAlias . '.contentType = :contentType')->setParameter('contentType', $contentType);
     });
     $editAction = new RowAction('button.edit', 'opifer_content_contenteditor_design');
     $editAction->setRouteParameters(['id', 'type' => 'content']);
     //$deleteAction = new RowAction('button.delete', 'opifer_content_content_delete');
     //$deleteAction->setRouteParameters(['id']);
     /* @var $grid \APY\DataGridBundle\Grid\Grid */
     $grid = $this->get('grid');
     $grid->setId('content')->setSource($source)->addRowAction($editAction);
     //->addRowAction($deleteAction)
     foreach ($contentType->getSchema()->getAttributes() as $attribute) {
         $name = $attribute->getName();
         $column = new TextColumn(['id' => $name, 'field' => 'attributes.' . $attribute->getName() . '.value', 'title' => $attribute->getDisplayName()]);
         $column->manipulateRenderCell(function ($value, $row, $router) use($name) {
             $value = $row->getEntity()->getAttributes()[$name];
             return $value;
         });
         $grid->addColumn($column);
     }
     return $grid->getGridResponse($this->getParameter('opifer_content.content_type_view'), ['content_type' => $contentType, 'grid' => $grid]);
 }
开发者ID:dzoke,项目名称:Cms,代码行数:38,代码来源:ContentController.php

示例10: indexAction

 /**
  * 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);
 }
开发者ID:necatikartal,项目名称:ojs,代码行数:34,代码来源:SubmissionChecklistController.php

示例11: listAction

 /**
  * List all website config
  *
  * @throws AccessDeniedException If authenticate user is not allowed to access to this resource (minimum ROLE_ADMIN)
  * @return \Symfony\Component\HttpFoundation\Response
  */
 public function listAction()
 {
     if (false === $this->get('security.authorization_checker')->isGranted('ROLE_ADMIN')) {
         throw new AccessDeniedException();
     }
     // Set Datagrid source
     $source = new Entity($this->get('asf_website.config.manager')->getClassName());
     $tableAlias = $source->getTableAlias();
     $source->manipulateQuery(function ($query) use($tableAlias) {
         $query instanceof QueryBuilder;
         if (count($query->getDQLPart('orderBy')) == 0) {
             $query->orderBy($tableAlias . '.name', 'ASC');
         }
     });
     // Get Grid instance
     $grid = $this->get('grid');
     $grid instanceof Grid;
     // Attach the source to the grid
     $grid->setSource($source);
     $grid->setId('asf_website_config_list');
     // Columns configuration
     $grid->hideColumns(array('id'));
     $grid->getColumn('name')->setTitle($this->get('translator')->trans('Config name', array(), 'asf_website'))->setDefaultOperator('like')->setOperatorsVisible(false);
     $editAction = new RowAction('btn_edit', 'asf_website_config_edit');
     $editAction->setRouteParameters(array('id'));
     $grid->addRowAction($editAction);
     $deleteAction = new RowAction('btn_delete', 'asf_website_config_delete', true);
     $deleteAction->setRouteParameters(array('id'))->setConfirmMessage($this->get('translator')->trans('Do you want to delete this config?', array(), 'asf_website'));
     $grid->addRowAction($deleteAction);
     $grid->setNoDataMessage($this->get('translator')->trans('No config was found.', array(), 'asf_website'));
     return $grid->getGridResponse('ASFWebsiteBundle:Config:list.html.twig');
 }
开发者ID:artscorestudio,项目名称:website-bundle,代码行数:38,代码来源:ConfigController.php

示例12: listAction

 /**
  * List all brands.
  *
  * @throws AccessDeniedException If authenticate user is not allowed to access to this resource (minimum ROLE_ADMIN)
  *
  * @return \Symfony\Component\HttpFoundation\Response
  */
 public function listAction()
 {
     $this->get('event_dispatcher')->dispatch(ProductEvents::LIST_BRANDS, new Event());
     // Set Datagrid source
     $source = new Entity($this->getParameter('asf_product.brand.entity'));
     $tableAlias = $source->getTableAlias();
     $source->manipulateQuery(function ($query) use($tableAlias) {
         $query instanceof QueryBuilder;
         if (count($query->getDQLPart('orderBy')) == 0) {
             $query->orderBy($tableAlias . '.name', 'ASC');
         }
     });
     // Get Grid instance
     $grid = $this->get('grid');
     $grid instanceof Grid;
     // Attach the source to the grid
     $grid->setSource($source);
     $grid->setId('asf_brands_list');
     // Columns configuration
     $editAction = new RowAction('btn_edit', 'asf_product_brand_edit');
     $editAction->setRouteParameters(array('id'));
     $grid->addRowAction($editAction);
     $deleteAction = new RowAction('btn_delete', 'asf_product_brand_delete', true);
     $deleteAction->setRouteParameters(array('id'))->setConfirmMessage($this->get('translator')->trans('asf.product.msg.delete.confirm', array('%name%' => $this->get('translator')->trans('asf.product.default_value.this_brand'))));
     $grid->addRowAction($deleteAction);
     $grid->setNoDataMessage($this->get('translator')->trans('asf.product.msg.list.no_brand'));
     return $grid->getGridResponse('ASFProductBundle:Brand:list.html.twig');
 }
开发者ID:artscorestudio,项目名称:product-bundle,代码行数:35,代码来源:BrandController.php

示例13: indexAction

 /**
  * @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();
 }
开发者ID:dreamlex,项目名称:ticketbundle,代码行数:37,代码来源:TicketController.php

示例14: indexAction

 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);
 }
开发者ID:ulakjira,项目名称:ojs,代码行数:34,代码来源:AdminJournalApplicationController.php

示例15: indexAction

 /**
  * 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);
 }
开发者ID:necatikartal,项目名称:ojs,代码行数:29,代码来源:BoardController.php


注:本文中的APY\DataGridBundle\Grid\Source\Entity::manipulateQuery方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。