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


PHP Control::getPresenter方法代码示例

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


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

示例1: create

 /**
  * Starts conditional snippet rendering. Returns SnippetHelper object if snippet was started.
  * @param  Control control
  * @param  string  snippet name
  * @param  string  start element
  * @return SnippetHelper
  */
 public static function create(Control $control, $name = NULL, $tag = 'div')
 {
     if (self::$outputAllowed) {
         // rendering flow or non-AJAX request
         $obj = new self();
         $obj->tag = trim($tag, '<>');
         if ($obj->tag) {
             echo '<', $obj->tag, ' id="', $control->getSnippetId($name), '">';
         }
         return $obj;
         // or string?
     } elseif ($control->isControlInvalid($name)) {
         // start snippet buffering
         $obj = new self();
         $obj->id = $control->getSnippetId($name);
         $obj->payload = $control->getPresenter()->getPayload();
         ob_start();
         $obj->level = ob_get_level();
         self::$outputAllowed = TRUE;
         return $obj;
     } else {
         return FALSE;
     }
 }
开发者ID:jaroslavlibal,项目名称:MDW,代码行数:31,代码来源:SnippetHelper.php

示例2: renderSnippets

 public static function renderSnippets(Control $control, stdClass $local, array $params)
 {
     $control->snippetMode = FALSE;
     $payload = $control->getPresenter()->getPayload();
     if (isset($local->blocks)) {
         foreach ($local->blocks as $name => $function) {
             if ($name[0] !== '_' || !$control->isControlInvalid(substr($name, 1))) {
                 continue;
             }
             ob_start();
             $function = reset($function);
             $snippets = $function($local, $params);
             $payload->snippets[$id = $control->getSnippetId(substr($name, 1))] = ob_get_clean();
             if ($snippets) {
                 $payload->snippets += $snippets;
                 unset($payload->snippets[$id]);
             }
         }
     }
     $control->snippetMode = TRUE;
     if ($control instanceof IRenderable) {
         $queue = array($control);
         do {
             foreach (array_shift($queue)->getComponents() as $child) {
                 if ($child instanceof IRenderable) {
                     if ($child->isControlInvalid()) {
                         $child->snippetMode = TRUE;
                         $child->render();
                         $child->snippetMode = FALSE;
                     }
                 } elseif ($child instanceof IComponentContainer) {
                     $queue[] = $child;
                 }
             }
         } while ($queue);
     }
 }
开发者ID:riskatlas,项目名称:micka,代码行数:37,代码来源:UIMacros.php


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