Example #1
0
 private function _displayAssemblyList(array &$arrAssemblyList, IOutputStream $aDevice, $sParentFrameLayout = null)
 {
     if (empty($arrAssemblyList['items'])) {
         return;
     }
     $aDevice->write($this->htmlWrapper($arrAssemblyList, $sParentFrameLayout));
     $aDebugging = Application::singleton()->isDebugging();
     foreach ($arrAssemblyList['items'] as &$arrAssemblyItem) {
         // 视图
         if ($arrAssemblyItem['type'] === 'view') {
             if (empty($arrAssemblyItem['object'])) {
                 if (empty($arrAssemblyItem['id'])) {
                     throw new Exception("视图类型的装配内容,缺少视图注册ID");
                 }
                 if (!($arrAssemblyItem['object'] = View::findRegisteredView($arrAssemblyItem['id']))) {
                     //throw new Exception("在根据装配单输出视图时,无法根据提供的视图ID找到视图对像:%s,该视图可能不存在或未注册。",$arrAssemblyItem['id']) ;
                     continue;
                 }
             }
             $bEmptyView = $arrAssemblyItem['object']->template() ? false : true;
             if (!$bEmptyView) {
                 $aDevice->write($this->htmlWrapper($arrAssemblyItem, $arrAssemblyList['layout']));
                 if ($aDebugging) {
                     $aDevice->write("<!-- view name: " . $arrAssemblyItem['object']->name() . " -->\r\n");
                 }
             }
             $arrAssemblyItem['object']->render($aDevice);
             if (!$bEmptyView) {
                 $aDevice->write("</div>\r\n");
             }
         } else {
             if ($arrAssemblyItem['type'] === 'frame') {
                 $this->_displayAssemblyList($arrAssemblyItem, $aDevice, $arrAssemblyList['layout']);
             } else {
                 throw new Exception("无效的装配内容类型:%s", $arrAssemblyItem['type']);
             }
         }
     }
     $aDevice->write("<div class='jc-layout-item-end'></div></div>\r\n");
 }