コード例 #1
0
 public function compile($key, $content)
 {
     $viewTemplate = Wind::getComponent('template');
     $this->_router();
     list($pageName, $unique) = $this->_pageName();
     if (!$pageName && !$unique) {
         $content = str_replace('<pw-start/>', '', $content);
         $content = str_replace('<pw-end/>', '', $content);
         return $viewTemplate->compileStream($content, $this->windViewerResolver);
     }
     foreach ($this->windViewTemplate->getCompiledBlockData() as $key => $value) {
         $content = str_replace('#' . $key . '#', $value ? $value : '', $content);
     }
     Wind::import('SRV:design.srv.PwDesignCompile');
     $this->srv = PwDesignCompile::getInstance();
     //$this->srv = Wekit::load('design.srv.PwDesignCompile');
     $this->srv->setIsDesign($this->getRequest()->getPost('design'));
     $_pk = $unique ? $this->getRequest()->getGet($unique) : '';
     $this->srv->beforeDesign($this->_router, $pageName, $_pk);
     $pageBo = $this->srv->getPageBo();
     $this->srv->setPermission();
     //对模版进行编译
     $portalSrv = new PwPortalCompile($pageBo);
     $isPortalCompile = $this->srv->isPortalCompile();
     //对自定义页编辑
     if ($isPortalCompile == 1) {
         $content = $portalSrv->compilePortal($content);
     }
     //对系统页编辑
     if ($isPortalCompile == 2) {
         $content = $portalSrv->compileTpl($content, true);
     } else {
         $content = $portalSrv->compileTpl($content);
     }
     //$content = $portalSrv->doCompile($content);
     //转换Pw标签
     $content = $this->compileStart($content, $_pk, $this->_url);
     $content = $this->compileSign($content);
     $content = $this->compileTemplate($content);
     //自定义页
     $content = $this->compileDrag($content);
     $content = $this->compileTitle($content);
     $content = $this->compileList($content);
     $content = $this->compileCss($content, $pageBo);
     $content = $this->compileEnd($content, $pageBo);
     $content = $viewTemplate->compileStream($content, $this->windViewerResolver);
     /*if ($isPortalCompile > 0) {
     			$this->srv->refreshPage();
     		}*/
     return $content;
 }
コード例 #2
0
 public function doeditAction()
 {
     $tpl = $this->getInput('tpl', 'post');
     $compid = (int) $this->getInput('compid', 'post');
     $tpl = $this->_getDesignService()->filterTemplate($tpl);
     if (!$this->_getDesignService()->checkTemplate($tpl)) {
         $this->showError("DESIGN:template.error");
     }
     $property = $this->bo->getProperty();
     $limit = $this->compileFor($tpl);
     $property['limit'] = $limit ? $limit : $property['limit'];
     Wind::import('SRV:design.dm.PwDesignModuleDm');
     $dm = new PwDesignModuleDm($this->bo->moduleid);
     $dm->setModuleTpl($tpl)->setCompid($compid)->setProperty($property);
     $resource = $this->_getModuleDs()->updateModule($dm);
     if ($resource instanceof PwError) {
         $this->showError($resource->getError());
     }
     //更新模版
     $module = $this->bo->getModule();
     if ($module['module_type'] == PwDesignModule::TYPE_IMPORT) {
         Wind::import('SRV:design.bo.PwDesignPageBo');
         $pageBo = new PwDesignPageBo($this->pageid);
         $pageInfo = $pageBo->getPage();
         Wind::import('SRV:design.srv.PwPortalCompile');
         $compile = new PwPortalCompile($pageBo);
         if ($pageInfo['page_type'] == PwDesignPage::PORTAL) {
             $compile->replaceList($this->bo->moduleid, $tpl);
         } elseif ($pageInfo['page_type'] == PwDesignPage::SYSTEM) {
             !$module['segment'] && ($module['segment'] = '');
             $compile->replaceList($this->bo->moduleid, $tpl, $module['segment']);
         }
     }
     //更机数据
     Wind::import('SRV:design.srv.data.PwAutoData');
     $srv = new PwAutoData($this->bo->moduleid);
     $srv->addAutoData();
     $this->showMessage("operate.success");
 }
コード例 #3
0
 protected function restoreSegment($pageid, $issnap = 0)
 {
     $segments = $this->_getBakDs()->getBak(PwDesignBak::SEGMENT, $pageid, $issnap);
     $ds = $this->_getSegmentDs();
     $srv = null;
     Wind::import('SRV:design.bo.PwDesignPageBo');
     $bo = new PwDesignPageBo($pageid);
     $pageInfo = $bo->getPage();
     if ($pageInfo['page_type'] == PwDesignPage::SYSTEM) {
         Wind::import('SRV:design.srv.PwPortalCompile');
         $srv = new PwPortalCompile($bo);
     }
     foreach ($segments['bak_info'] as $k => $v) {
         $ds->replaceSegment($k, $pageid, $v['segment_tpl']);
         $strr = substr(strrchr($k, "__"), 1);
         if (isset($srv) && $strr == 'tpl') {
             $file = substr($k, 0, strlen($k) - 5);
             $srv->restoreTpl($file, $v['segment_struct']);
             //门户片段
         }
     }
     return true;
 }
コード例 #4
0
 public function doeditAction()
 {
     $pageid = (int) $this->getInput('pageid', 'post');
     $title = $this->getInput('title', 'post');
     $struct = $this->bo->getStructure();
     if (!$struct) {
         $this->showMessage("operate.fail");
     }
     Wind::import('SRV:design.dm.PwDesignStructureDm');
     $dm = new PwDesignStructureDm();
     $dm->setStructTitle($title)->setStructname($this->bo->name);
     $resource = $this->_getStructureDs()->replaceStruct($dm);
     if ($resource instanceof PwError) {
         $this->showError($resource->getError());
     }
     Wind::import('SRV:design.bo.PwDesignPageBo');
     $pageBo = new PwDesignPageBo($pageid);
     $pageInfo = $pageBo->getPage();
     Wind::import('SRV:design.srv.PwPortalCompile');
     $compile = new PwPortalCompile($pageBo);
     if ($pageInfo['page_type'] == PwDesignPage::PORTAL) {
         $compile->replaceTitle($this->bo->name, $title);
     } elseif ($pageInfo['page_type'] == PwDesignPage::SYSTEM) {
         !$struct['segment'] && ($struct['segment'] = '');
         $compile->replaceTitle($this->bo->name, $title, $struct['segment']);
     }
     $this->setOutput($title, 'data');
     $this->showMessage("operate.success");
 }