/** * Finishes and saves the snippet. * @return void */ public function finish() { if ($this->tag !== NULL) { // rendering flow or non-AJAX request if ($this->tag) { echo "</{$this->tag}>"; } } else { // finish snippet buffering if ($this->level !== ob_get_level()) { throw new InvalidStateException("Snippet '{$this->id}' cannot be ended here."); } $this->payload->snippets[$this->id] = ob_get_clean(); self::$outputAllowed = FALSE; } }
/** * @return void * @throws BadRequestException if no template found */ public function renderTemplate() { $template = $this->getTemplate(); if (!$template) { return; } if ($this->isAjax()) { // TODO! SnippetHelper::$outputAllowed = FALSE; } if ($template instanceof IFileTemplate && !$template->getFile()) { if (isset($template->layout)) { trigger_error('Parameter $template->layout is about to be reserved.', E_USER_WARNING); } unset($template->layout, $template->content); // content template $files = $this->formatTemplateFiles($this->getName(), $this->view); foreach ($files as $file) { if (is_file($file)) { $template->setFile($file); break; } } if (!$template->getFile()) { $file = reset($files); throw new BadRequestException("Page not found. Missing template '{$file}'."); } // layout template if ($this->layout) { foreach ($this->formatLayoutTemplateFiles($this->getName(), $this->layout) as $file) { if (is_file($file)) { if ($this->oldLayoutMode) { $template->content = $template instanceof Template ? $template->subTemplate($template->getFile()) : $template->getFile(); $template->setFile($file); } else { $template->layout = $file; // experimental } break; } } } } $template->render(); }
</span></div> <?php } } array_pop($_cb->its); $iterator = end($_cb->its); if (SnippetHelper::$outputAllowed) { array_pop($_cb->snippets)->finish(); } if (SnippetHelper::$outputAllowed) { ?> </body> <?php } if ($_cb->foo = SnippetHelper::create($control, "popup")) { $_cb->snippets[] = $_cb->foo; ?> <?php } if (isset($show_popup) and $show_popup == true) { if (SnippetHelper::$outputAllowed) { ?> <div id="overlay"></div> <div class="popup"> <a href="<?php echo TemplateHelpers::escapeHtml($control->link("closePopup!")); ?> " class="ajax"><div class="close_popup"></div></a> <?php }
/** * @param PresenterRequest * @return IPresenterResponse */ public function run(PresenterRequest $request) { try { // STARTUP $this->request = $request; $this->payload = (object) NULL; $this->setParent($this->getParent(), $request->getPresenterName()); $this->initGlobalParams(); $this->startup(); if (!$this->startupCheck) { $class = $this->reflection->getMethod('startup')->getDeclaringClass()->getName(); trigger_error("Method {$class}::startup() or its descendant doesn't call parent::startup().", E_USER_WARNING); } // calls $this->action<Action>() $this->tryCall($this->formatActionMethod($this->getAction()), $this->params); if ($this->autoCanonicalize) { $this->canonicalize(); } if ($this->getHttpRequest()->isMethod('head')) { $this->terminate(); } // SIGNAL HANDLING // calls $this->handle<Signal>() $this->processSignal(); // RENDERING VIEW $this->beforeRender(); // calls $this->render<View>() $this->tryCall($this->formatRenderMethod($this->getView()), $this->params); $this->afterRender(); // save component tree persistent state $this->saveGlobalState(); if ($this->isAjax()) { $this->payload->state = $this->getGlobalState(); } // finish template rendering $this->sendTemplate(); } catch (AbortException $e) { // continue with shutting down } if ($this->isAjax()) { try { $hasPayload = (array) $this->payload; unset($hasPayload['state']); if ($this->response instanceof RenderResponse && ($this->isControlInvalid() || $hasPayload)) { // snippets - TODO SnippetHelper::$outputAllowed = FALSE; $this->response->send(); $this->sendPayload(); } elseif (!$this->response && $hasPayload) { // back compatibility for use terminate() instead of sendPayload() $this->sendPayload(); } } catch (AbortException $e) { } } if ($this->hasFlashSession()) { $this->getFlashSession()->setExpiration($this->response instanceof RedirectingResponse ? '+ 30 seconds' : '+ 3 seconds'); } // SHUTDOWN $this->onShutdown($this, $this->response); $this->shutdown($this->response); return $this->response; }
function _cbbc088336200_content($_cb) { extract(func_get_arg(1)); if (SnippetHelper::$outputAllowed) { ?> <div id="content"> <div id="terms_list"> <ol> <?php } if ($_cb->foo = SnippetHelper::create($control, "terms")) { $_cb->snippets[] = $_cb->foo; ?> <?php } foreach ($iterator = $_cb->its[] = new SmartCachingIterator($terms) as $exam) { if (SnippetHelper::$outputAllowed) { ?> <li> <div class="term"> <p class="header"> <span class="date"><strong><?php echo TemplateHelpers::escapeHtml($template->translate('start')); ?> :</strong><?php echo TemplateHelpers::escapeHtml($template->date($exam->start_datetime, '%d.%m.%Y %H:%M')); ?> </span> </p> <div class="left"> <p><strong><?php echo TemplateHelpers::escapeHtml($template->translate('deadline')); ?> :</strong> <?php echo TemplateHelpers::escapeHtml($template->date($exam->application_deadline, '%d.%m.%Y %H:%M')); ?> <strong><?php echo TemplateHelpers::escapeHtml($template->translate('free places')); ?> :</strong> <?php echo TemplateHelpers::escapeHtml($exam->max_students - $exam->students_applied); ?> </p> <p> </p> </div> <div class="right"> <?php if ($exam->my_id !== null) { ?> <div class="icon icon-success"></div><br /><br /><br /><br /><br /> <a href="<?php echo TemplateHelpers::escapeHtml($control->link("cancelApplication!", array('exam_id' => $exam->id, 'popup' => false))); ?> " class="ajax add_new" title="<?php echo TemplateHelpers::escapeHtml($template->translate('Cancel application for exam from %d', $course)); ?> "><div class="icon_remove"></div><span><?php echo TemplateHelpers::escapeHtml($template->translate('Cancel application')); ?> </span></a> <?php } if ($exam->my_id == null and $exam->max_students - $exam->students_applied != 0) { ?> <a href="<?php echo TemplateHelpers::escapeHtml($control->link("applyForExam!", array('exam_id' => $exam->id, 'popup' => false))); ?> " class="ajax add_new" title="<?php echo TemplateHelpers::escapeHtml($template->translate('Apply for exam from %d', $course)); ?> "><div class="icon_add"></div><span><?php echo TemplateHelpers::escapeHtml($template->translate('Apply')); ?> </span></a> <?php } if ($exam->max_students - $exam->students_applied == 0) { ?> <p><strong><?php echo TemplateHelpers::escapeHtml($template->translate('Term full')); ?> </strong></p> <?php } ?> </div> <p class="bottom"><a class="ajax" href="<?php echo TemplateHelpers::escapeHtml($control->link("showDetail!", array('exam_id' => $exam->id))); ?> "><?php echo TemplateHelpers::escapeHtml($template->translate('List of applied students')); ?> </a></p> </div> </li> <?php } } array_pop($_cb->its); $iterator = end($_cb->its); if (SnippetHelper::$outputAllowed) { array_pop($_cb->snippets)->finish(); } if (SnippetHelper::$outputAllowed) { ?> </ol> </div> </div> <?php } }
/** * @return void * @throws BadRequestException if no template found * @throws AbortException */ public function sendTemplate() { $template = $this->getTemplate(); if (!$template) { return; } if ($template instanceof IFileTemplate && !$template->getFile()) { // content template $files = $this->formatTemplateFiles($this->getName(), $this->view); foreach ($files as $file) { if (is_file($file)) { $template->setFile($file); break; } } if (!$template->getFile()) { $file = str_replace(Environment::getVariable('templatesDir'), "…", reset($files)); throw new BadRequestException("Page not found. Missing template '{$file}'."); } // layout template if ($this->layout) { foreach ($this->formatLayoutTemplateFiles($this->getName(), $this->layout) as $file) { if (is_file($file)) { if ($this->oldLayoutMode) { $template->content = clone $template; $template->setFile($file); } else { $template->layout = $template->_extends = $file; } break; } } } } if ($this->isAjax()) { // TODO! /*Nette\Templates\*/ SnippetHelper::$outputAllowed = FALSE; $template->render(); $this->sendPayload(); } $this->terminate(new RenderResponse($template)); }
function finish() { if ($this->tag !== NULL) { if ($this->tag) { echo "</{$this->tag}>"; } } else { if ($this->level !== ob_get_level()) { throw new InvalidStateException("Snippet '{$this->id}' cannot be ended here."); } $this->payload->snippets[$this->id] = ob_get_clean(); self::$outputAllowed = FALSE; } }
<?php //netteCache[01]000203a:2:{s:4:"time";s:21:"0.69509300 1267235076";s:9:"callbacks";a:1:{i:0;a:3:{i:0;a:2:{i:0;s:5:"Cache";i:1;s:9:"checkFile";}i:1;s:48:"D:\www\skusky\app\components\Datagrid/grid.phtml";i:2;i:1263349006;}}} // file D:\www\skusky\app\components\Datagrid/grid.phtml // $_cb = LatteMacros::initRuntime($template, NULL, 'fc280d5fed'); unset($_extends); if (isset($presenter, $control) && $presenter->isAjax()) { LatteMacros::renderSnippets($control, $_cb, get_defined_vars()); } if (SnippetHelper::$outputAllowed) { } if ($_cb->foo = SnippetHelper::create($control, "grid")) { $_cb->snippets[] = $_cb->foo; ?> <?php foreach ($iterator = $_cb->its[] = new SmartCachingIterator($flashes) as $flash) { ?> <div class="flash <?php echo TemplateHelpers::escapeHtml($flash->type); ?> "><?php echo TemplateHelpers::escapeHtml($flash->message); ?> </div> <?php } array_pop($_cb->its); $iterator = end($_cb->its); ?>
</title> <?php if (!$_cb->extends) { call_user_func(reset($_cb->blocks['css']), $_cb, $template->getParams()); } if (!$_cb->extends) { call_user_func(reset($_cb->blocks['js']), $_cb, $template->getParams()); } ?> </head> <body> <div id="container"> <div id="content"> <?php } if ($_cb->foo = SnippetHelper::create($control, "flash")) { $_cb->snippets[] = $_cb->foo; ?> <?php } foreach ($iterator = $_cb->its[] = new SmartCachingIterator($flashes) as $flash) { if (SnippetHelper::$outputAllowed) { ?> <div class="flash <?php echo TemplateHelpers::escapeHtml($flash->type); ?> "><?php echo TemplateHelpers::escapeHtml($flash->message); ?> </div> <?php
function _cbbf1cb892188_content($_cb) { extract(func_get_arg(1)); if (SnippetHelper::$outputAllowed) { ?> <div id="header"> <h1>TreeView</h1> <h2>Nette Framework example.</h2> </div> <br /> <?php } if ($_cb->foo = SnippetHelper::create($control, "message")) { $_cb->snippets[] = $_cb->foo; if (isset($site)) { ?> <div class="ui-widget ui-state-highlight ui-corner-all"> You clicked on "<?php echo TemplateHelpers::escapeHtml($site->name); ?> " link in tree view example. </div> <?php } array_pop($_cb->snippets)->finish(); } if (SnippetHelper::$outputAllowed) { } if ($_cb->foo = SnippetHelper::create($control, "mode")) { $_cb->snippets[] = $_cb->foo; ?> Modes: <a href="<?php echo TemplateHelpers::escapeHtml($control->link("mode!", array(TreeView::EXPANDED))); ?> " class="ajax<?php if ($mode == TreeView::EXPANDED) { ?> active<?php } ?> ">Expanded</a> | <a href="<?php echo TemplateHelpers::escapeHtml($control->link("mode!", array(TreeView::AJAX))); ?> " class="ajax<?php if ($mode == TreeView::AJAX) { ?> active<?php } ?> ">Ajax</a> <?php array_pop($_cb->snippets)->finish(); } if (SnippetHelper::$outputAllowed) { ?> <?php } $control->getWidget("tree")->render(); if (SnippetHelper::$outputAllowed) { } }