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


PHP BlockContextInterface::getBlock方法代码示例

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


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

示例1: execute

 /**
  * {@inheritdoc}
  */
 public function execute(BlockContextInterface $blockContext, Response $response = null)
 {
     $context = $blockContext->getBlock()->getSetting('context');
     $criteria = array('mode' => $blockContext->getSetting('mode'), 'context' => $context);
     $order = array($blockContext->getSetting('order') => $blockContext->getSetting('sort'));
     return $this->renderResponse($blockContext->getTemplate(), array('context' => $blockContext, 'settings' => $blockContext->getSettings(), 'block' => $blockContext->getBlock(), 'pager' => $this->galleryManager->getPager($criteria, 1, $blockContext->getSetting('number'), $order)), $response);
 }
开发者ID:nicolasricci,项目名称:SonataMediaBundle,代码行数:10,代码来源:GalleryListBlockService.php

示例2: execute

 /**
  * {@inheritdoc}
  */
 public function execute(BlockContextInterface $blockContext, Response $response = null)
 {
     $criteria = array();
     if ('admin' !== $blockContext->getSetting('mode')) {
         $criteria['customer'] = $this->customerManager->findOneBy(array('user' => $this->securityContext->getToken()->getUser()));
     }
     return $this->renderPrivateResponse($blockContext->getTemplate(), array('context' => $blockContext, 'settings' => $blockContext->getSettings(), 'block' => $blockContext->getBlock(), 'orders' => $this->orderManager->findBy($criteria, array('createdAt' => 'DESC'), $blockContext->getSetting('number'))), $response);
 }
开发者ID:johnulist,项目名称:ecommerce-1,代码行数:11,代码来源:RecentOrdersBlockService.php

示例3: execute

 public function execute(BlockContextInterface $blockContext, Response $response = null)
 {
     $settings = array_merge($this->getDefaultSettings(), $blockContext->getBlock()->getSettings());
     $tours = $this->em->getRepository('AdminAdministrationBundle:Tour');
     $data = array('items' => $tours->findAll(), 'isSpecial' => $tours->findBy(array('isSpecial' => true)), 'isExpired' => $tours->findBy(array('isExpired' => true)));
     return $this->renderResponse('AdminAdministrationBundle:Block:tours.html.twig', array('block' => $blockContext->getBlock(), 'settings' => $settings, 'data' => $data), $response);
 }
开发者ID:AienTech,项目名称:Taban-Parvaz-Asia,代码行数:7,代码来源:ToursBlockService.php

示例4: execute

 /**
  * {@inheritdoc}
  */
 public function execute(BlockContextInterface $blockContext, Response $response = null)
 {
     if (!$response) {
         $response = new Response();
     }
     $block = $blockContext->getBlock();
     // merge settings with those of the concrete block being rendered
     $settings = $blockContext->getSettings();
     $resolver = new OptionsResolver();
     $resolver->setDefaults($settings);
     $settings = $resolver->resolve($block->getOptions());
     $dm = $this->doctrine;
     $qb = $dm->createQueryBuilder();
     $qb->from()->document('ConnectHolland\\PiccoloContentBundle\\Document\\StandardPage', 'n');
     $queryResult = $qb->getQuery()->execute();
     $highlightData = array();
     foreach ($queryResult as $item) {
         if ($item->getName() == $settings["url"]) {
             $highlightData = array($item->getName(), $item->getTitle(), $item->getBody(), $item->getCreateDate());
         }
     }
     if ($blockContext->getBlock()->getEnabled()) {
         $response = $this->renderResponse($blockContext->getTemplate(), array('highlight_data' => $highlightData, 'block' => $blockContext->getBlock()), $response);
     }
     return $response;
 }
开发者ID:reyostallenberg,项目名称:PiccoloContentBundle,代码行数:29,代码来源:HighlightBlockService.php

示例5: execute

 /**
  * {@inheritdoc}
  */
 public function execute(BlockContextInterface $blockContext, Response $response = null)
 {
     $block = $blockContext->getBlock();
     // if the referenced target menu does not exist, we just skip the rendering
     if (!$block->getEnabled() || null === $block->getMenuNode()) {
         return $response ?: new Response();
     }
     $menuNode = $block->getMenuNode();
     return $this->renderResponse($blockContext->getTemplate(), array('menu' => $menuNode->getId(), 'block' => $blockContext->getBlock()), $response);
 }
开发者ID:nvbooster,项目名称:BlockBundle,代码行数:13,代码来源:MenuBlockService.php

示例6: execute

 /**
  * {@inheritdoc}
  */
 public function execute(BlockContextInterface $blockContext, Response $response = null)
 {
     if (!$response) {
         $response = new Response();
     }
     if ($blockContext->getBlock()->getEnabled()) {
         return $this->renderResponse($blockContext->getTemplate(), array('block' => $blockContext->getBlock()), $response);
     }
     return $response;
 }
开发者ID:yookihiroo,项目名称:standard-edition,代码行数:13,代码来源:UnitBlockService.php

示例7: execute

 /**
  * {@inheritdoc}
  */
 public function execute(BlockContextInterface $blockContext, Response $response = null)
 {
     $block = $blockContext->getBlock();
     if (!$block->getSetting('blockId') instanceof BlockInterface) {
         $this->load($block);
     }
     /** @var Block $sharedBlock */
     $sharedBlock = $block->getSetting('blockId');
     return $this->renderResponse($blockContext->getTemplate(), array('block' => $blockContext->getBlock(), 'settings' => $blockContext->getSettings(), 'sharedBlock' => $sharedBlock), $response);
 }
开发者ID:ronanguilloux,项目名称:SonataPageBundle,代码行数:13,代码来源:SharedBlockBlockService.php

示例8: execute

 /**
  * {@inheritdoc}
  */
 public function execute(BlockContextInterface $blockContext, Response $response = null)
 {
     if (!$response) {
         $response = new Response();
     }
     // if the reference target block does not exist, we just skip the rendering
     if ($blockContext->getBlock()->getEnabled() && null !== $blockContext->getBlock()->getReferencedBlock()) {
         $referencedBlockContext = $this->blockContextManager->get($blockContext->getBlock()->getReferencedBlock());
         $response = $this->blockRenderer->render($referencedBlockContext);
     }
     return $response;
 }
开发者ID:frogriotcom,项目名称:BlockBundle,代码行数:15,代码来源:ReferenceBlockService.php

示例9: execute

 public function execute(BlockContextInterface $blockContext, Response $response = null)
 {
     $settings = array_merge($this->getDefaultSettings(), $blockContext->getBlock()->getSettings());
     $data = array();
     $helperCategories = $this->em->getRepository('AdminAdministrationBundle:HelperCategory');
     foreach ($helperCategories->findAll() as $cat) {
         $qb = $this->em->createQueryBuilder();
         $qb->select('h')->from('AdminAdministrationBundle:Helper', 'h')->join('h.categories', 'c')->where('c = :cat')->setParameter('cat', $cat);
         $data[$cat->getName()] = array('name' => $cat->getName(), 'data' => $qb->getQuery()->getResult());
     }
     return $this->renderResponse('AdminAdministrationBundle:Block:helperBlock.html.twig', array('block' => $blockContext->getBlock(), 'settings' => $settings, 'data' => $data), $response);
 }
开发者ID:AienTech,项目名称:Taban-Parvaz-Asia,代码行数:12,代码来源:HelperBlockService.php

示例10: execute

 /**
  * {@inheritdoc}
  */
 public function execute(BlockContextInterface $blockContext, Response $response = null)
 {
     // merge settings
     $settings = $blockContext->getSettings();
     $campaigns = $this->service->getOngoingCampaigns(array('limit' => $settings['limit']));
     return $this->renderResponse($blockContext->getTemplate(), array('campaigns' => $campaigns, 'block' => $blockContext->getBlock(), 'settings' => $settings), $response);
 }
开发者ID:CampaignChain,项目名称:core,代码行数:10,代码来源:CampaignOngoingListGroupBlockService.php

示例11: execute

 public function execute(BlockContextInterface $blockContext, Response $response = null)
 {
     // merge settings
     $settings = $blockContext->getSettings();
     $purchases = $this->purchaseManager->findLatestPurchases(10);
     return $this->renderResponse($blockContext->getTemplate(), array('block' => $blockContext->getBlock(), 'settings' => $settings, 'latestPurchases' => $purchases), $response);
 }
开发者ID:c4d3r,项目名称:mcsuite-application-eyeofender,代码行数:7,代码来源:LatestPurchasesBlockService.php

示例12: execute

 /**
  * Render the block
  *
  * @param BlockContextInterface $blockContext
  * @param Response $response
  */
 public function execute(BlockContextInterface $blockContext, Response $response = null)
 {
     // merge settings
     $settings = $blockContext->getSettings();
     $teachers = $this->entityManager->getRepository('AppBundle:Teacher')->findAll();
     return $this->renderResponse($blockContext->getTemplate(), array('teachers' => $teachers, 'block' => $blockContext->getBlock(), 'settings' => $settings), $response);
 }
开发者ID:kongr45gpen,项目名称:myclass,代码行数:13,代码来源:TeacherScheduleBlock.php

示例13: execute

 /**
  * {@inheritdoc}
  */
 public function execute(BlockContextInterface $blockContext, Response $response = null)
 {
     // merge settings
     $settings = $blockContext->getSettings();
     $milestones = $this->service->getUpcomingMilestones(array('limit' => $settings['limit']));
     return $this->renderResponse($blockContext->getTemplate(), array('milestones' => $milestones, 'block' => $blockContext->getBlock(), 'settings' => $settings), $response);
 }
开发者ID:CampaignChain,项目名称:core,代码行数:10,代码来源:MilestoneUpcomingListGroupBlockService.php

示例14: execute

 public function execute(BlockContextInterface $blockContext, Response $response = null)
 {
     $schoolID = $this->session->get('tsk_school_id');
     $orgID = $this->session->get('tsk_organization_id');
     $em = $this->entityManager;
     $sc = $this->securityContext;
     $erpContext = new \TSK\UserBundle\Form\Model\ErpContext();
     if ($orgID) {
         $organization = $em->getRepository('TSKUserBundle:Organization')->find($orgID);
         $erpContext->setOrganization($organization);
     }
     if ($schoolID) {
         $school = $em->getRepository('TSKSchoolBundle:School')->find($schoolID);
         $erpContext->setSchool($school);
     }
     $isSuperAdmin = false;
     foreach ($sc->getToken()->getRoles() as $role) {
         if ($role->getRole() == 'ROLE_SUPER_ADMIN') {
             $isSuperAdmin = true;
         }
     }
     if ($isSuperAdmin) {
         // Create form
         $form = $this->formFactory->create(new \TSK\UserBundle\Form\Type\AdminErpContextType($em, $sc), $erpContext);
     } else {
         // Determine if user has more than one school ...
         // Create form
         $form = $this->formFactory->create(new \TSK\UserBundle\Form\Type\UserErpContextType($em, $sc), $erpContext);
     }
     return $this->renderResponse($blockContext->getTemplate(), array('block' => $blockContext->getBlock(), 'form' => $form->createView(), 'isSuperAdmin' => $isSuperAdmin, 'settings' => $blockContext->getSettings()), $response);
 }
开发者ID:sgh1986915,项目名称:symfony-tsk,代码行数:31,代码来源:ErpContextSwitcherBlockService.php

示例15: execute

 /**
  * {@inheritdoc}
  */
 public function execute(BlockContextInterface $blockContext, Response $response = null)
 {
     $user_current = $this->securityContext->getToken()->getUser();
     $user_id = $user_current->getId();
     // Tenues stats
     $tenues = $this->em->getRepository('IuchBundle:Tenue')->findAll();
     $nbr_tenues = 0;
     foreach ($tenues as $tenue) {
         $nbr_tenues += $tenue->getNombreDonne();
     }
     // Cles stats
     $cles = $this->em->getRepository('IuchBundle:Cle')->findAll();
     $nbr_cles = 0;
     foreach ($cles as $cle) {
         if ($cle->getRemis() == true) {
             $nbr_cles++;
         }
     }
     // Badges stats
     $badges = $this->em->getRepository('IuchBundle:Badge')->findAll();
     $nbr_badges = 0;
     foreach ($badges as $badge) {
         if ($badge->getRemis() == true) {
             $nbr_badges++;
         }
     }
     return $this->renderResponse($blockContext->getTemplate(), array('block' => $blockContext->getBlock(), 'base_template' => $this->pool->getTemplate('IuchBundle:Block:statuser.html.twig'), 'settings' => $blockContext->getSettings(), 'tenues' => $nbr_tenues, 'cles' => $nbr_cles, 'badges' => $nbr_badges), $response);
 }
开发者ID:luciemannechez,项目名称:projet-intranet_hopital,代码行数:31,代码来源:StatUserBlockService.php


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