/** * 用于segment中模块的转换 * Enter description here ... * @param unknown_type $content <design id="D_mod_60" role="module"></design> */ public function replaceModule($content = '') { if (preg_match_all('/\\<design\\s*id=\\"*D_mod_(\\d+)\\"*\\s*role=\\"*module\\"*\\s*[>|\\/>]<\\/design>/isU', $content, $matches)) { Wind::import('SRV:design.bo.PwDesignModuleBo'); foreach ($matches[1] as $k => $v) { $this->appendModuleId($v); $bo = new PwDesignModuleBo($v); $html = $bo->getTemplate(); $caption = $bo->getTitleHtml(); $standard = $bo->getStandardSign(); $view = $bo->getView(); if (preg_match('/\\<title>/isU', $html, $m)) { $html = str_replace($m[0], $caption, $html); } else { $html = $caption . $html; } $html = $this->_compileSign($html, $bo->moduleid, $standard['sTitle'], $standard['sUrl'], $view['isblank']); $content = str_replace($matches[0][$k], $html, $content); } } return $content; }
protected function decompileTpl($section) { Wind::import("SRV:design.bo.PwDesignModuleBo"); if (preg_match_all('/\\<design\\s*id=\\"*D_mod_(\\d+)\\"*\\s*role=\\"*module\\"*\\s*[>|\\/>]<\\/design>/isU', $section, $matches)) { foreach ($matches[1] as $k => $v) { $bo = new PwDesignModuleBo($v); $module = $bo->getModule(); $property = $bo->getView(); $_html = '<pw-list id="' . $k . '">'; $_html .= $bo->getTemplate(); $_html .= '</pw-list>'; $section = str_replace($matches[0][$k], $_html, $section); $this->_moduleConf[$k] = array('itemid' => $k, 'name' => $module['module_name'], 'model' => $bo->getModel(), 'id' => $v, 'titlenum' => strval($property['titlenum']), 'desnum' => strval($property['desnum']), 'timefmt' => $property['timefmt'], 'limit' => strval($property['limit'])); } } return $section; }