/**
  * 得到 pagelet 的配置,用于Quickling输出
  *
  * @param PageletContext $pagelet
  * @param string $html
  * @param array $resourceMap
  * @param array $hooks
  */
 private function getPageletConfig($pagelet, &$html, &$resourceMap, &$hooks)
 {
     $config = array();
     $config["id"] = $pagelet->getParam("id");
     $config["children"] = array();
     foreach ($pagelet->children as $child) {
         $config["children"][] = $child->getParam("id");
     }
     if ($pagelet->parent) {
         $config["parent"] = $pagelet->parent->getParam("id");
     }
     if (!empty($pagelet->html)) {
         //生成容器ID
         $containerId = $this->sessionUniqId("__cnt_");
         //生成注释的内容
         //$html = "<code id=\"$containerId\" style=\"display:none\"><!-- ";
         //$html = $this->getCommentHTML($pagelet->html);
         $html = $pagelet->html;
         //$html .= " --></code>";
         //设置html属性
         $config["html"]["container"] = $containerId;
         $config["html"]["html"] = $html;
     }
     foreach (self::$knownEvents as $type) {
         $event = $pagelet->getEvent($type);
         if ($event !== false) {
             foreach ($event->hooks as $hook) {
                 //$hookId                   = $this->sessionUniqId("__cb_");
                 //$hooks[$hookId]           = $hook;
                 $config["hooks"][$type][] = $hook;
             }
             //deps
             $requireResources = BigPipeResource::pathToResource($event->requires);
             $config["deps"][$type] = array_keys($requireResources);
             $resourceMap = array_merge($resourceMap, $event->requires, $event->requireAsyncs);
         }
     }
     return $config;
 }
 /**
  * collectScript 收集脚本
  * 
  * @param PageletContext $context 当前 Pagelet 上下文
  * @access protected
  * @return void
  */
 protected function collectScript($context)
 {
     $context->parent->addScript(ob_get_clean(), $context->getBigPipeConfig("on", "load"), $context->getBigPipeConfig("deps"), $context->getBigPipeConfig("asyncs"));
 }
 public function setPriority($priority)
 {
     if ($this->parent !== null && $this->parent->priorityArray !== null) {
         $priorityArray = $this->parent->priorityArray;
     } else {
         $priorityArray = array();
     }
     $priorityArray[] = $priority;
     $this->priorityArray = $priorityArray;
     self::$priority_list[] = $this->priorityArray;
     self::$max_priority = max(self::$max_priority, strlen($priority));
 }