Exemplo n.º 1
0
 /**
  * @return ITemplate
  */
 public function getTemplate()
 {
     if (!$this->template) {
         $this->template = $this->templateFactory->createTemplate();
     }
     return $this->template;
 }
Exemplo n.º 2
0
 public function render(Form $form)
 {
     $template = $this->templateFactory->createTemplate();
     $template->setFile($this->file);
     $template->form = $form;
     return (string) $template;
 }
Exemplo n.º 3
0
 /**
  * Nastavi templatu emailu
  * @param string $templateFile
  * @return \Nette\Application\UI\ITemplate
  */
 private function setTemplate($templateFile)
 {
     $template = $this->templateFactory->createTemplate();
     $template->setFile(__DIR__ . '/templates/' . $templateFile);
     $template->_presenter = $this->getPresenter();
     return $template;
 }
Exemplo n.º 4
0
 /**
  * @param callable $templateCallback
  * @param array $param
  * @return \Nette\Application\UI\ITemplate
  */
 private function prepareTemplate(callable $templateCallback, array $param = [])
 {
     $template = $this->templateFactory->createTemplate();
     array_unshift($param, $template);
     call_user_func_array($templateCallback, $param);
     $template->link = $this->linkGenerator;
     return $template;
 }
Exemplo n.º 5
0
 public function create()
 {
     $template = $this->templateFactory->createTemplate();
     $template->getLatte()->addProvider('uiControl', $this->linkGenerator);
     foreach ($this->variables as $name => $value) {
         $template->{$name} = $value;
     }
     return $template;
 }
Exemplo n.º 6
0
 public function getRenderedNavigation($navigationId)
 {
     $template = $this->templateFactory->createTemplate();
     $template->setFile(__DIR__ . '/navigation.latte');
     $nodes = $this->navigationReader->getEntireNavigation($navigationId);
     $rootNode = $this->treeBuilder->buildTree($nodes);
     $template->node = $rootNode;
     return $template->__toString();
 }
Exemplo n.º 7
0
 public function createTemplate(Control $control)
 {
     $template = $this->templateFactory->createTemplate($control);
     $this->setTemplateFile($template, $control);
     if (property_exists($control, 'onRenderModeChange')) {
         $control->onRenderModeChange[] = function (Control $control) {
             $this->setTemplateFile($control->getTemplate(), $control);
         };
     }
     return $template;
 }
Exemplo n.º 8
0
 public function __construct($config, $mails, Nette\Mail\IMailer $mailer, Nette\Mail\Message $message, Nette\Application\LinkGenerator $linkGenerator, Nette\Application\UI\ITemplateFactory $templateFactory, ILogger $logger, $args)
 {
     $this->config = $config;
     $this->mails = $mails;
     $this->mailer = $mailer;
     $this->message = $message;
     $this->linkGenerator = $linkGenerator;
     $this->logger = $logger;
     $this->args = $args;
     $this->template = $templateFactory->createTemplate();
     /**
      * Initiate mail composing
      */
     $this->compose($this->message, $this->args);
 }
Exemplo n.º 9
0
 /**
  * @param  string
  * @return Nette\Application\UI\ITemplate
  */
 public function createTemplate($which)
 {
     $template = $this->templateFactory->createTemplate();
     $template->addFilter(NULL, 'Ublaboo\\ApiDocu\\TemplateFilters::common');
     $template->setFile(__DIR__ . '/templates/' . $which);
     if ($template instanceof Nette\Application\UI\ITemplate) {
         $template->base_dir = __DIR__ . '/templates';
     }
     $template->addFilter('routeMaskStyles', function ($mask) {
         return str_replace(['<', '>'], ['<span class="apiDocu-mask-param">&lt;', '&gt;</span>'], $mask);
     });
     $template->addFilter('apiDocuResponseCode', function ($code) {
         if ($code >= 200 && $code <= 202) {
             return "<span class=\"apiDocu-code-success\">{$code}</span>";
         } else {
             if ($code >= 300 && $code < 500) {
                 return "<span class=\"apiDocu-code-warning\">{$code}</span>";
             } else {
                 if ($code >= 500) {
                     return "<span class=\"apiDocu-code-error\">{$code}</span>";
                 }
             }
         }
         return "<span class=\"apiDocu-code-other\">{$code}</span>";
     });
     return $template;
 }
Exemplo n.º 10
0
 /**
  * @return \Nette\Application\UI\ITemplate
  */
 private function createTemplate()
 {
     $template = $this->templateFactory->createTemplate();
     $template->setTranslator($this->translator);
     $template->_control = $this->linkFactory;
     $template->wwwDir = $this->wwwDir;
     return $template;
 }
Exemplo n.º 11
0
 /**
  * @return ITemplate
  */
 public function getTemplate()
 {
     if (!$this->template) {
         $this->setTemplate($this->templateFactory->createTemplate(NULL));
         $this->template->_control = $this->linkGenerator;
     }
     return $this->template;
 }
 public function createTemplate(Control $control = null)
 {
     $template = $this->innerTemplateFactory->createTemplate($control);
     $this->assignVariables($template);
     return $template;
 }
Exemplo n.º 13
0
 /**
  * @param UI\Control|null $control
  * @return UI\ITemplate
  */
 public function createTemplate(UI\Control $control = null)
 {
     $template = $this->baseFactory->createTemplate($control);
     $this->onCreateTemplate($template);
     return $template;
 }
Exemplo n.º 14
0
 protected function createTemplate()
 {
     $this->templateFactory = $this->templateFactory ?: $this->lookup(Presenter::class)->getTemplateFactory();
     return $this->templateFactory->createTemplate();
 }
 /**
  * @param IListingPdfDataAdapter $pdfDataAdapter
  * @param array $settings
  * @return IPdfSource
  */
 public function create(IListingPdfDataAdapter $pdfDataAdapter, array $settings)
 {
     return new ListingPdfSource($this->templateFactory->createTemplate(), $pdfDataAdapter, $settings);
 }