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


PHP PhpRenderer::setResolver方法代码示例

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


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

示例1: PdfAction

 public function PdfAction()
 {
     $pdf = new TCPDF('L');
     $pdf->SetPrintHeader(true);
     $pdf->SetDefaultMonospacedFont(PDF_FONT_MONOSPACED);
     // set margins
     $pdf->SetMargins(PDF_MARGIN_LEFT, PDF_MARGIN_TOP, PDF_MARGIN_RIGHT);
     $pdf->SetFooterMargin(PDF_MARGIN_FOOTER);
     // set auto page breaks
     $pdf->SetAutoPageBreak(TRUE, PDF_MARGIN_BOTTOM);
     // set image scale factor
     $pdf->setImageScale(PDF_IMAGE_SCALE_RATIO);
     // set some language-dependent strings (optional)
     if (@file_exists(dirname(__FILE__) . '/lang/eng.php')) {
         require_once dirname(__FILE__) . '/lang/eng.php';
         $pdf->setLanguageArray($l);
     }
     // set font
     $pdf->SetFont('helvetica', '', 8);
     // add a page
     $pdf->AddPage();
     //get report data into $data variable
     $project = $this->getServiceLocator()->get('ProjectTable');
     $data = $project->getWsr();
     $view = new PhpRenderer();
     $resolver = new TemplateMapResolver();
     //set the path of the pdf.phtml file
     $resolver->setMap(array('PDFTemplate' => '/var/www/html/WSRAutomation/module/Application/view/application/index/pdf.phtml'));
     $view->setResolver($resolver);
     $viewModel = new ViewModel();
     $viewModel->setTemplate('PDFTemplate')->setVariables(array('projects' => $data, 'view' => 'pdf'));
     $html = $view->render($viewModel);
     $pdf->writeHTML($html, true, 0, true, 0);
     $pdf->Output('WsrReport.pdf', 'I');
 }
开发者ID:vikas1monu,项目名称:ProductionWsr,代码行数:35,代码来源:IndexController.php

示例2: onRoute

 public function onRoute(MvcEvent $e)
 {
     $request = $e->getRequest();
     if (!$request instanceof HttpRequest) {
         return;
     }
     $application = $e->getApplication();
     $serviceLocator = $application->getServiceManager();
     // Load the configuration for maintenance mode
     if ($serviceLocator->has('MaintenanceConfig')) {
         $config = $serviceLocator->get('MaintenanceConfig');
     } else {
         $config = new Config();
     }
     if (!$config->isEnabled()) {
         // Maintenance mode is disabled.
         return;
     }
     // Check the white list
     if ($request instanceof PhpRequest) {
         $address = $request->getServer('REMOTE_ADDR', null);
     } else {
         $address = isset($_SERVER['REMOTE_ADDR']) ? $_SERVER['REMOTE_ADDR'] : null;
     }
     if (!empty($address)) {
         if (in_array($address, $config->getWhitelist())) {
             return;
         }
     }
     // Render the maintenance layout
     $renderer = new PhpRenderer();
     if ($serviceLocator->has('ViewHelperManager')) {
         $renderer->setHelperPluginManager($serviceLocator->get('ViewHelperManager'));
     }
     $resolver = new TemplateMapResolver();
     $resolver->add('maintenance', $config->getTemplate());
     $renderer->setResolver($resolver);
     $content = $renderer->render('maintenance');
     // Set the response
     $response = $e->getResponse();
     if (!$response instanceof HttpResponse) {
         $response = new HttpResponse();
     }
     $statusCode = $config->getStatusCode();
     $response->setStatusCode($statusCode);
     if ($statusCode === 503 && !$response->getHeaders()->has('Retry-After')) {
         $retryDate = $config->getRetryAfter();
         if ($retryDate instanceof DateTime) {
             $retryAfter = new RetryAfter();
             $retryAfter->setDate($retryDate);
             $response->getHeaders()->addHeader($retryAfter);
         }
     }
     $response->setContent($content);
     $e->setResponse($response);
     // Return the response
     return $response;
 }
开发者ID:zend-modules,项目名称:maintenance,代码行数:58,代码来源:MaintenanceListener.php

示例3: setUp

 public function setUp()
 {
     $this->formConfig = ['template' => 't4web-form-renderer/element/form', 'children' => ['name' => ['template' => 't4web-form-renderer/element/text', 'variables' => ['label' => 'Name', 'placeholder' => 'Enter name']], 'link' => ['template' => 't4web-form-renderer/element/text', 'variables' => ['label' => 'Link', 'placeholder' => 'Enter link']]], 'variables' => ['action' => '/admin/news/create', 'cancelLink' => '/admin/list']];
     $this->renderer = new PhpRenderer();
     $stack = new Resolver\TemplatePathStack(array('script_paths' => array(dirname(dirname(__DIR__)) . '/view')));
     $this->renderer->setResolver($stack);
 }
开发者ID:andrearruda,项目名称:FormRenderer,代码行数:7,代码来源:FactoryTest.php

示例4: __construct

 protected function __construct($directory)
 {
     $this->directory = $directory;
     $this->phpRenderer = new PhpRenderer();
     $resolver = new AggregateResolver();
     $this->phpRenderer->setResolver($resolver);
     $path = Module::getBaseDirectory() . $this->directory;
     $stack = new TemplatePathStack(array('script_paths' => array($path)));
     $resolver->attach($stack);
 }
开发者ID:kidaa,项目名称:evedata,代码行数:10,代码来源:Renderer.php

示例5: __invoke

 /**
  * @param ContainerInterface $container
  * @returns ZendViewRenderer
  */
 public function __invoke(ContainerInterface $container)
 {
     $config = $container->has('config') ? $container->get('config') : [];
     $config = isset($config['templates']) ? $config['templates'] : [];
     // Configuration
     $resolver = new Resolver\AggregateResolver();
     $resolver->attach(new Resolver\TemplateMapResolver(isset($config['map']) ? $config['map'] : []), 100);
     // Create the renderer
     $renderer = new PhpRenderer();
     $renderer->setResolver($resolver);
     $manager = $container->has(HelperPluginManager::class) ? $container->get(HelperPluginManager::class) : new HelperPluginManager();
     // Inject helpers
     $this->injectHelpers($renderer, $manager);
     // Initialize renderer for HelperPluginManager
     $manager->setRenderer($renderer);
     // Inject renderer
     $view = new ZendViewRenderer($renderer, isset($config['layout']) ? $config['layout'] : null);
     // Add template paths
     $allPaths = isset($config['paths']) && is_array($config['paths']) ? $config['paths'] : [];
     foreach ($allPaths as $namespace => $paths) {
         $namespace = is_numeric($namespace) ? null : $namespace;
         foreach ((array) $paths as $path) {
             $view->addPath($path, $namespace);
         }
     }
     return $view;
 }
开发者ID:fabiocarneiro,项目名称:zend-expressive-zendviewrenderer,代码行数:31,代码来源:ZendViewRendererFactory.php

示例6: __invoke

 /**
  * @param  ContainerInterface $container
  * @param  string $name
  * @param  null|array $options
  * @return PhpRenderer
  */
 public function __invoke(ContainerInterface $container, $name, array $options = null)
 {
     $renderer = new PhpRenderer();
     $renderer->setHelperPluginManager($container->get('ViewHelperManager'));
     $renderer->setResolver($container->get('ViewResolver'));
     return $renderer;
 }
开发者ID:kuisatz,项目名称:ustalarMerkezi,代码行数:13,代码来源:ViewPhpRendererFactory.php

示例7: getTestRenderer

 /**
  * @return PhpRenderer
  */
 public function getTestRenderer()
 {
     $resolver = new TemplatePathStack();
     $resolver->addPath(__DIR__ . '/../views');
     $renderer = new PhpRenderer();
     $renderer->setResolver($resolver);
     return $renderer;
 }
开发者ID:SalesAndOrders,项目名称:zf2-mail,代码行数:11,代码来源:ServiceTest.php

示例8: setUp

 public function setUp()
 {
     $this->transport = new MockTransport();
     $config = (include __DIR__ . '/../../config/module.config.php');
     $renderer = new PhpRenderer();
     $renderer->setResolver(new TemplatePathStack($config['view_manager']['template_path_stack']));
     $this->mailService = new MailService(new Message(), $this->transport, $renderer);
 }
开发者ID:quangdungninh,项目名称:zendvnteam,代码行数:8,代码来源:MailServiceTest.php

示例9: setUp

 public function setUp()
 {
     $config = (include __DIR__ . '/../../../config/module.config.php');
     $renderer = new PhpRenderer();
     $renderer->setResolver(new TemplateMapResolver($config['view_manager']['template_map']));
     $router = TreeRouteStack::factory($config['router']);
     $this->helper = new QrCodeHelper($renderer, $router, new QrCodeServiceMock('foobar'));
 }
开发者ID:acelaya,项目名称:zf2-acqrcode,代码行数:8,代码来源:QrCodeHelperTest.php

示例10: autocompleteAction

 public function autocompleteAction(Request $request, Response $response = null)
 {
     $serviceManager = $this->getServiceLocator();
     $console = $serviceManager->get('console');
     $resolver = $serviceManager->get('ViewResolver');
     $render = new PhpRenderer();
     $render->setResolver($resolver);
     $console->write($render->render('client/manual/autocomplete'));
 }
开发者ID:alexb-uk,项目名称:ZendServerSDK,代码行数:9,代码来源:ManualController.php

示例11: getContent

 public function getContent()
 {
     $info = new \SplFileInfo($this->file);
     $renderer = new PhpRenderer();
     $stack = new TemplatePathStack();
     $stack->addPath($info->getPath());
     $stack->setDefaultSuffix(pathinfo($this->file, PATHINFO_EXTENSION));
     $renderer->setResolver($stack);
     return $renderer->render($info->getBasename());
 }
开发者ID:robertdamoc,项目名称:zf2-module-assets,代码行数:10,代码来源:RenderedAsset.php

示例12: renderTemplatePath

 protected function renderTemplatePath($strPath, $arrVariables)
 {
     $view = new PhpRenderer();
     $resolver = new TemplateMapResolver();
     $resolver->setMap(array('mailTemplate' => __DIR__ . '/../../../' . $strPath));
     $view->setResolver($resolver);
     $viewModel = new ViewModel();
     $viewModel->setTemplate('mailTemplate')->setVariables($arrVariables);
     return $view->render($viewModel);
 }
开发者ID:ualisonaguiar,项目名称:shome2,代码行数:10,代码来源:RenderTemplateTrait.php

示例13: checkRenderer

 /**
  * Check renderer, create if not exists
  * Copy helper plugin manager from application service manager
  *
  * @return \Gc\View\Renderer
  */
 protected function checkRenderer()
 {
     if (is_null($this->renderer)) {
         $this->renderer = new PhpRenderer();
         $renderer = Registry::get('Application')->getServiceManager()->get('Zend\\View\\Renderer\\PhpRenderer');
         $this->renderer->setHelperPluginManager(clone $renderer->getHelperPluginManager());
         $this->renderer->setResolver(new TemplatePathStack());
     }
     return $this;
 }
开发者ID:gotcms,项目名称:gotcms,代码行数:16,代码来源:Renderer.php

示例14: render

 public function render()
 {
     $renderer = new PhpRenderer();
     $resolver = new Resolver\AggregateResolver();
     $renderer->setResolver($resolver);
     $map = new Resolver\TemplateMapResolver(array(static::getTemplate() => __DIR__ . '/view/' . static::getTemplate() . '.phtml'));
     $resolver->attach($map);
     // this will be consulted first
     return $renderer->render($this);
 }
开发者ID:Niloofareyjey,项目名称:ellie-ui,代码行数:10,代码来源:Set.php

示例15: setUp

 /**
  * Sets up the fixture, for example, open a network connection.
  * This method is called before a test is executed.
  *
  * @access protected
  */
 protected function setUp()
 {
     $resolver = new Resolver\TemplatePathStack(array('script_paths' => array(__DIR__ . '/_files/scripts')));
     $view = new View();
     $view->setResolver($resolver);
     Helper\PaginationControl::setDefaultViewPartial(null);
     $this->_viewHelper = new Helper\PaginationControl();
     $this->_viewHelper->setView($view);
     $this->_paginator = Paginator\Paginator::factory(range(1, 101));
 }
开发者ID:navassouza,项目名称:zf2,代码行数:16,代码来源:PaginationControlTest.php


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