當前位置: 首頁>>代碼示例>>PHP>>正文


PHP BlockContextInterface::getTemplate方法代碼示例

本文整理匯總了PHP中Sonata\BlockBundle\Block\BlockContextInterface::getTemplate方法的典型用法代碼示例。如果您正苦於以下問題:PHP BlockContextInterface::getTemplate方法的具體用法?PHP BlockContextInterface::getTemplate怎麽用?PHP BlockContextInterface::getTemplate使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Sonata\BlockBundle\Block\BlockContextInterface的用法示例。


在下文中一共展示了BlockContextInterface::getTemplate方法的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('mode' => $blockContext->getSetting('mode'));
     $userManager = $this->container->get('fos_user.user_manager');
     $user = $userManager->findUserByUsername($this->container->get('security.context')->getToken()->getUser());
     $mapbookmarks = null;
     $ecosystems = $this->em->getRepository('YorkuJuturnaBundle:EcoSystemService')->findBy(array(), array("id" => "ASC"));
     if ($user && $user != 'anon.') {
         $mapbookmarks = $this->em->getRepository('Map2uCoreBundle:MapBookmark')->findBy(array("userId" => $user->getId()), array("seq" => "ASC"));
     }
     $wellbeingdomains = $this->em->getRepository('YorkuJuturnaBundle:HumanWellBeingDomain')->findBy(array(), array("id" => "ASC"));
     $parameters = array('context' => $blockContext, 'settings' => $blockContext->getSettings(), 'ecosystems' => $ecosystems, 'wellbeingdomains' => $wellbeingdomains, 'mapbookmarks' => $mapbookmarks, 'block' => $blockContext->getBlock());
     if ($blockContext->getSetting('mode') === 'admin') {
         return $this->renderPrivateResponse($blockContext->getTemplate(), $parameters, $response);
     }
     return $this->renderResponse($blockContext->getTemplate(), $parameters, $response);
 }
開發者ID:josephzhao,項目名稱:cvcbrowser,代碼行數:20,代碼來源:FixedTopmenuBlockService.php

示例3: 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

示例4: execute

 /**
  * {@inheritdoc}
  */
 public function execute(BlockContextInterface $blockContext, Response $response = null)
 {
     $criteria = array('mode' => $blockContext->getSetting('mode'));
     $parameters = array('context' => $blockContext, 'settings' => $blockContext->getSettings(), 'block' => $blockContext->getBlock(), 'pager' => $this->manager->getPager($criteria, 1, $blockContext->getSetting('number')), 'admin_pool' => $this->adminPool);
     if ($blockContext->getSetting('mode') === 'admin') {
         return $this->renderPrivateResponse($blockContext->getTemplate(), $parameters, $response);
     }
     return $this->renderResponse($blockContext->getTemplate(), $parameters, $response);
 }
開發者ID:kinkinweb,項目名稱:lhvb,代碼行數:12,代碼來源:RecentCommentsBlockService.php

示例5: execute

 /**
  * {@inheritdoc}
  */
 public function execute(BlockContextInterface $blockContext, Response $response = null)
 {
     $criteria = array('mode' => $blockContext->getSetting('mode'));
     $indicators = $this->em->getRepository('YorkuJuturnaBundle:Indicator')->findBy(array(), array("id" => "ASC"));
     $parameters = array('context' => $blockContext, 'settings' => $blockContext->getSettings(), 'indicators' => $indicators, 'block' => $blockContext->getBlock());
     if ($blockContext->getSetting('mode') === 'admin') {
         return $this->renderPrivateResponse($blockContext->getTemplate(), $parameters, $response);
     }
     return $this->renderResponse($blockContext->getTemplate(), $parameters, $response);
 }
開發者ID:josephzhao,項目名稱:cvcbrowser,代碼行數:13,代碼來源:IndicatorColumnBlockService.php

示例6: execute

 /**
  * {@inheritdoc}
  */
 public function execute(BlockContextInterface $blockContext, Response $response = null)
 {
     $pages = $this->em->getAllSortBy('updatedAt');
     $draftPageCount = 0;
     $reviewPageCount = 0;
     $publishedPageCount = 0;
     $reviewPages = array();
     $draftPages = array();
     foreach ($pages as $page) {
         /** @var \Networking\InitCmsBundle\Model\PageInterface $page */
         if ($page->hasPublishedVersion()) {
             $publishedPageCount++;
         }
         if ($page->isReview()) {
             $reviewPageCount++;
             $draftPageCount++;
             $reviewPages[\Locale::getDisplayLanguage($page->getLocale())][] = $page;
         }
         if ($page->isDraft()) {
             $draftPageCount++;
             $draftPages[\Locale::getDisplayLanguage($page->getLocale())][] = $page;
         }
     }
     return $this->renderResponse($blockContext->getTemplate(), array('block' => $blockContext->getBlock(), 'draft_pages' => $draftPageCount, 'review_pages' => $reviewPageCount, 'published_pages' => $publishedPageCount, 'pages' => $pages, 'reviewPages' => $reviewPages, 'draftPages' => $draftPages), $response);
 }
開發者ID:lzdv,項目名稱:init-cms-bundle,代碼行數:28,代碼來源:PagesBlockService.php

示例7: 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

示例8: 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

示例9: execute

 public function execute(BlockContextInterface $blockContext, Response $response = null)
 {
     $qb = $this->em->createQueryBuilder()->select('t')->from('AldorPortfolioBundle:Technology', 't');
     $entities = $qb->getQuery()->getResult();
     $settings = $blockContext->getSettings();
     return $this->renderResponse($blockContext->getTemplate(), array('tags' => $entities, 'title' => $settings['title'], 'ribbon' => $settings['ribbon']), $response);
 }
開發者ID:Aldor007,項目名稱:mkaciuba.pl,代碼行數:7,代碼來源:TechnologiesBlockService.php

示例10: 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

示例11: 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

示例12: 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

示例13: 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

示例14: execute

 public function execute(BlockContextInterface $blockContext, Response $response = null)
 {
     // merge settings
     $settings = $blockContext->getSettings();
     $hotCourses = \CourseManager::returnHotCourses();
     return $this->renderResponse($blockContext->getTemplate(), array('hot_courses' => $hotCourses, 'block' => $blockContext->getBlock(), 'settings' => $settings), $response);
 }
開發者ID:par-orillonsoft,項目名稱:chamilo-lms,代碼行數:7,代碼來源:CourseBlockService.php

示例15: execute

 public function execute(BlockContextInterface $blockContext, Response $response = null)
 {
     $user = $this->securityContext->getToken()->getUser();
     if ($user->hasRole('ROLE_SUPER_ADMIN')) {
         $query = $this->entityManager->createQuery('SELECT p from TSK\\SchoolBundle\\Entity\\School p JOIN p.contact c WHERE c.organization=:org');
         $query->setParameter(':org', $this->session->get($this->orgSessionKey));
         $schools = $query->getResult();
     } else {
         $schools = $user->getContact()->getSchools()->toArray();
         // if (count($userSchools)) {
         //     foreach ($userSchools as $us) {
         //         $schools[] = $us->getId();
         //     }
         //     // Filter schools by org and according to your contact_schools list
         //     $query = $this->entityManager->createQuery('SELECT s from TSK\SchoolBundle\Entity\School s WHERE s.id IN (:schools)');
         //     $query->setParameter(':schools', join($schools));
         // }
     }
     $scs = array();
     if (count($schools)) {
         foreach ($schools as $school) {
             $scs[$school->getId()] = array('id' => $school->getId(), 'title' => $school->getContact()->getFirstName() . ' ' . $school->getContact()->getLastName(), 'selected' => $school->getId() == $this->session->get($this->schoolSessionKey) ? 'selected' : '');
         }
     }
     return $this->renderResponse($blockContext->getTemplate(), array('block' => $blockContext->getBlock(), 'schools' => $scs, 'settings' => $blockContext->getSettings()), $response);
 }
開發者ID:sgh1986915,項目名稱:symfony-tsk,代碼行數:26,代碼來源:SchoolSwitcherBlockService.php


注:本文中的Sonata\BlockBundle\Block\BlockContextInterface::getTemplate方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。