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


PHP Templating\EngineInterface类代码示例

本文整理汇总了PHP中Symfony\Bundle\FrameworkBundle\Templating\EngineInterface的典型用法代码示例。如果您正苦于以下问题:PHP EngineInterface类的具体用法?PHP EngineInterface怎么用?PHP EngineInterface使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


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

示例1: array

 function it_should_return_converted_data(Request $request, Convert $convert, EngineInterface $templating)
 {
     $result = $this->indexAction($request);
     $convert->convert(Argument::any([]), Argument::any('string'))->shouldBeCalled();
     $convert->convert(Argument::any([]), Argument::any('string'))->willReturn('string');
     $templating->render('default/index.html.twig', array('result' => $result));
 }
开发者ID:bogdan-dubyk,项目名称:phpSpecTest,代码行数:7,代码来源:DefaultControllerSpec.php

示例2: DashboardStatistics

 function it_renders_dashboard_with_statistics(Request $request, DashboardStatisticsProviderInterface $dashboardStatsProvider, EngineInterface $templatingEngine, Response $response)
 {
     $dashboardStats = new DashboardStatistics(1245, 5, 6);
     $dashboardStatsProvider->getStatistics()->willReturn($dashboardStats);
     $templatingEngine->renderResponse('SyliusAdminBundle:Dashboard:index.html.twig', ['statistics' => $dashboardStats])->willReturn($response);
     $this->indexAction($request)->shouldReturn($response);
 }
开发者ID:okwinza,项目名称:Sylius,代码行数:7,代码来源:DashboardControllerSpec.php

示例3: array

 /**
  * @param \Symfony\Bundle\FrameworkBundle\Templating\EngineInterface $templating
  * @param \Symfony\Component\Form\FormInterface $form
  * @param \Symfony\Component\Form\FormView $formView
  * @param \Symfony\Component\HttpFoundation\Request $request
  * @param \Symfony\Component\HttpFoundation\Response $response
  */
 function it_render_template_with_change_password_form($templating, $form, $formView, $request, $response)
 {
     $form->handleRequest($request)->shouldBeCalled();
     $form->isValid()->shouldBeCalled()->willReturn(false);
     $form->createView()->shouldBeCalled()->willReturn($formView);
     $templating->renderResponse('FSiAdminSecurityBundle:Admin:change_password.html.twig', array('form' => $formView))->shouldBeCalled()->willReturn($response);
     $this->changePasswordAction($request)->shouldReturn($response);
 }
开发者ID:szymach,项目名称:admin-security-bundle,代码行数:15,代码来源:AdminControllerSpec.php

示例4: sendResettingEmailMessage

 /**
  * {@inheritDoc}
  */
 public function sendResettingEmailMessage(UserInterface $user)
 {
     $template = $this->parameters['resetting_password.template'];
     $url = $this->router->generate('fos_user_resetting_reset', array('token' => $user->getConfirmationToken()), true);
     $rendered = $this->templating->render($template, array('confirmationUrl' => $url, 'user' => $user));
     $this->sendEmailMessage($rendered, $user->getEmail());
 }
开发者ID:mattvick,项目名称:FOSUserBundleMandrillMailer,代码行数:10,代码来源:FOSUserBundleMailer.php

示例5: indexAction

 public function indexAction(Request $request, $configurationId)
 {
     $configuration = $this->getConfigurationOr404($configurationId);
     $pagination = $this->createPagination($configuration, $request);
     $reports = $this->reportManager->getJobReportsByConfiguration($configuration, $pagination->getOffset(), $pagination->getPerPage());
     return $this->templating->renderResponse('AurejaJobQueueBundle:JobReport:index.html.twig', ['configuration' => $this->getConfigurationOr404($configurationId), 'pagination' => $pagination, 'reports' => $reports]);
 }
开发者ID:aistis-,项目名称:JobQueueBundle,代码行数:7,代码来源:JobReportController.php

示例6: associationsAction

 /**
  * Display association grids
  *
  * @param Request $request the request
  * @param integer $id      the product id (owner)
  *
  * @AclAncestor("pim_enrich_associations_view")
  *
  * @return Response
  */
 public function associationsAction(Request $request, $id)
 {
     $product = $this->findProductOr404($id);
     $this->productManager->ensureAllAssociationTypes($product);
     $associationTypes = $this->doctrine->getRepository('PimCatalogBundle:AssociationType')->findAll();
     return $this->templating->renderResponse('PimEnrichBundle:Association:_associations.html.twig', array('product' => $product, 'associationTypes' => $associationTypes, 'dataLocale' => $request->get('dataLocale', null)));
 }
开发者ID:javiersantos,项目名称:pim-community-dev,代码行数:17,代码来源:AssociationController.php

示例7: findTemplate

 /**
  * Returns template.
  *
  * @return string
  */
 private function findTemplate()
 {
     if ($this->templateName !== null && $this->templateEngine->exists($this->templateName)) {
         return $this->templateName;
     }
     return 'TwigBundle:Exception:exception_full.html.twig';
 }
开发者ID:Silwereth,项目名称:sulu,代码行数:12,代码来源:PreviewExceptionListener.php

示例8: onKernelException

 /**
  * Renders the defined {@see ExceptionListener::$errorTemplate}, which has been defined via YAML
  * settings, on exception.
  *
  * Note, that the function is only called, if the *debug value* is set or *error pages* are
  * enabled via Parameter *stvd.error_page.enabled*.
  *
  * @param GetResponseForExceptionEvent $event
  */
 public function onKernelException(GetResponseForExceptionEvent $event)
 {
     // don't do anything if it's not the master request
     if (HttpKernel::MASTER_REQUEST != $event->getRequestType()) {
         return;
     }
     // You get the exception object from the received event
     $exception = $event->getException();
     // Customize your response object to display the exception details
     $response = new Response();
     // set response content
     $response->setContent($this->templating->render($this->errorTemplate, array('exception' => $exception)));
     // HttpExceptionInterface is a special type of exception that
     // holds status code and header details
     if ($exception instanceof HttpExceptionInterface) {
         $response->setStatusCode($exception->getStatusCode());
         $response->headers->replace($exception->getHeaders());
     } else {
         // If the exception's status code is not valid, set it to *500*. If it's valid, the
         // status code will be transferred to the response.
         if ($exception->getCode()) {
             $response->setStatusCode($exception->getCode());
         } else {
             $response->setStatusCode(500);
         }
     }
     // Send the modified response object to the event
     $event->setResponse($response);
 }
开发者ID:intermundiasolutions,项目名称:CjwPublishToolsBundle,代码行数:38,代码来源:ExceptionListener.php

示例9: onCoreRequest

 /**
  * @param GetResponseEvent $event
  */
 public function onCoreRequest(GetResponseEvent $event)
 {
     if (HttpKernel::MASTER_REQUEST != $event->getRequestType()) {
         return;
     }
     $token = $this->securityContext->getToken();
     if (!$token) {
         return;
     }
     if (!$token instanceof UsernamePasswordToken) {
         return;
     }
     $key = $this->helper->getSessionKey($this->securityContext->getToken());
     $request = $event->getRequest();
     $session = $event->getRequest()->getSession();
     $user = $this->securityContext->getToken()->getUser();
     if (!$session->has($key)) {
         return;
     }
     if ($session->get($key) === true) {
         return;
     }
     $state = 'init';
     if ($request->getMethod() == 'POST') {
         if ($this->helper->checkCode($user, $request->get('_code')) == true) {
             $session->set($key, true);
             return;
         }
         $state = 'error';
     }
     $event->setResponse($this->templating->renderResponse('SonataUserBundle:Admin:Security/two_step_form.html.twig', array('state' => $state)));
 }
开发者ID:lordrhodos,项目名称:SonataUserBundle,代码行数:35,代码来源:RequestListener.php

示例10: onResponse

 /**
  * Checking request and response and decide whether we need a redirect
  *
  * @param FilterResponseEvent $event
  */
 public function onResponse(FilterResponseEvent $event)
 {
     $request = $event->getRequest();
     $response = $event->getResponse();
     if ($request->get(self::HASH_NAVIGATION_HEADER) || $request->headers->get(self::HASH_NAVIGATION_HEADER)) {
         $location = '';
         $isFullRedirect = false;
         if ($response->isRedirect()) {
             $location = $response->headers->get('location');
             if ($request->attributes->get('_fullRedirect') || !is_object($this->security->getToken())) {
                 $isFullRedirect = true;
             }
         }
         if ($response->isNotFound() || $response->getStatusCode() == 503 && !$this->isDebug) {
             $location = $request->getUri();
             $isFullRedirect = true;
         }
         if ($location) {
             $response = $this->templating->renderResponse('OroNavigationBundle:HashNav:redirect.html.twig', array('full_redirect' => $isFullRedirect, 'location' => $location));
         }
         // disable cache for ajax navigation pages and change content type to json
         $response->headers->set('Content-Type', 'application/json');
         $response->headers->addCacheControlDirective('no-cache', true);
         $response->headers->addCacheControlDirective('max-age', 0);
         $response->headers->addCacheControlDirective('must-revalidate', true);
         $response->headers->addCacheControlDirective('no-store', true);
         $event->setResponse($response);
     }
 }
开发者ID:ramunasd,项目名称:platform,代码行数:34,代码来源:ResponseHashnavListener.php

示例11: onKernelResponse

 public function onKernelResponse(FilterResponseEvent $event)
 {
     return;
     // disabled theming for the time being while it gets refactored.
     if ($event->getRequestType() == HttpKernelInterface::MASTER_REQUEST) {
         $response = $event->getResponse();
         if ($request->isXmlHttpRequest()) {
             return;
         }
         if ($response instanceof RedirectResponse || $response instanceof PlainResponse || $response instanceof AbstractBaseResponse) {
             // dont theme redirects, plain responses or Ajax responses
             return;
         }
         $request = $event->getRequest();
         //            if (!$request->isXmlHttpRequest()
         //                && strpos($response->getContent(), '</body>') === false
         //                && !$response->isRedirection()
         //                && 'html' === $request->getRequestFormat()
         //                && (($response->headers->has('Content-Type') && false !== strpos($response->headers->get('Content-Type'), 'html')) || !$response->headers->has('Content-Type') )) {
         //                $content = $this->templating->render($this->activeTheme.'::master.html.twig', array('maincontent' => $response->getContent()));
         //                $response->setContent('ddd'.$content);
         //            }
         $content = $this->templating->render($this->activeTheme . '::master.html.twig', array('maincontent' => $response->getContent()));
         $response->setContent($content);
     }
 }
开发者ID:rtznprmpftl,项目名称:Zikulacore,代码行数:26,代码来源:ThemeListener.php

示例12: render

 public function render()
 {
     if ($this->templateEngine === null) {
         $this->templateEngine = $this->container->get('templating');
     }
     $menus = $this->container->get('enhavo_app.menu_loader')->getMenu();
     return $this->templateEngine->render($this->template, array('menus' => $menus));
 }
开发者ID:npakai,项目名称:enhavo,代码行数:8,代码来源:AdminMenuRender.php

示例13: loginAction

 public function loginAction(Request $request)
 {
     $form = $this->formFactory->create(LoginType::class);
     if ($error = $this->getAuthenticationError($request)) {
         $form->addError(new FormError($error->getMessage()));
     }
     return $this->templating->renderResponse('Security/login.html.twig', ['form' => $form->createView()]);
 }
开发者ID:havvg,项目名称:symfony-havvg-edition,代码行数:8,代码来源:SecurityController.php

示例14: onJobCreated

 /**
  * @param JobEvent $jobEvent
  */
 public function onJobCreated(JobEvent $jobEvent)
 {
     $job = $jobEvent->getJob();
     // Notification message to User
     $this->jobBoardMailer->sendMessage(sprintf('The job %s has been Sent', $job->getTitle()), 'no-reply@hossamyoussef.com', $job->getEmail(), $this->templating->renderResponse('Email/user.html.twig', array('job' => $job)));
     // Notification message to Job-Board Moderator
     $this->jobBoardMailer->sendMessage(sprintf('The job %s has been created', $job->getTitle()), 'no-reply@hossamyoussef.com', 'admin@hossamyoussef.com', $this->templating->renderResponse('Email/moderator.html.twig', array('job' => $job)));
 }
开发者ID:HossamYoussef2009,项目名称:JobBoard,代码行数:11,代码来源:JobEmailListener.php

示例15: generateMail

 /**
  * @param $test
  * @return \Swift_Mime_MimePart
  * @throws \TijsVerkoyen\CssToInlineStyles\Exception
  */
 private function generateMail(Test $test, $template, $to)
 {
     $html = $this->template->render($template, array("test" => $test));
     $css = file_get_contents($this->assetsHelper->getUrl('bundles/corrigeatonmailer/css/main.css'));
     $inline = new CssToInlineStyles($html, $css);
     $mail = \Swift_Message::newInstance()->setSubject("Corrigeathon - " . $test->getName())->setFrom($this->emailSend)->setTo($to)->setBcc("corrigeathon@etud.insa-toulouse.fr")->setBody($inline->convert(), 'text/html');
     return $mail;
 }
开发者ID:livet01,项目名称:corrigeaton,代码行数:13,代码来源:MailerListener.php


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