protected function restoreModule($pageid, $issnap = 0) { Wind::import('SRV:design.dm.PwDesignModuleDm'); $bakDs = $this->_getBakDs(); $conpDs = $this->_getComponentDs(); $module = $bakDs->getBak(PwDesignBak::MODULE, $pageid, $issnap); if (!is_array($module['bak_info'])) { return false; } $ds = $this->_getModuleDs(); Wind::import('SRV:design.bo.PwDesignPageBo'); $bo = new PwDesignPageBo($pageid); Wind::import('SRV:design.srv.PwPortalCompile'); $srv = new PwPortalCompile($bo); foreach ($module['bak_info'] as $k => $v) { $dm = new PwDesignModuleDm($k); $dm->setFlag($v['model_flag'])->setName($v['module_name'])->setCompid($v['module_compid'])->setProperty(unserialize($v['module_property']))->setCache(unserialize($v['module_cache']))->setTitle(unserialize($v['module_title']))->setModuleTpl($v['module_tpl'])->setIsused($v['isused']); $style = unserialize($v['module_style']); $dm->setStyle($style['font'], $style['link'], $style['border'], $style['margin'], $style['padding'], $style['background'], $style['styleclass']); $ds->updateModule($dm); } $pageInfo = $bo->getPage(); if ($pageInfo['page_type'] == PwDesignPage::PORTAL) { $srv->restoreList($module['bak_info'], 'index'); } return true; }
public function doeditAction() { $styleclass = $this->getInput('styleclass', 'post'); $font = $this->getInput('font', 'post'); $link = $this->getInput('link', 'post'); $border = $this->getInput('border', 'post'); $margin = $this->getInput('margin', 'post'); $padding = $this->getInput('padding', 'post'); $background = $this->getInput('background', 'post'); if ($border['isdiffer']) { unset($border['linewidth']); unset($border['style']); unset($border['color']); } else { unset($border['top']); unset($border['left']); unset($border['right']); unset($border['bottom']); } if ($margin['isdiffer']) { unset($margin['both']); } else { unset($margin['top']); unset($margin['right']); unset($margin['left']); unset($margin['bottom']); } if ($padding['isdiffer']) { unset($padding['both']); } else { unset($padding['top']); unset($padding['right']); unset($padding['left']); unset($padding['bottom']); } Wind::import('SRV:design.dm.PwDesignModuleDm'); $dm = new PwDesignModuleDm($this->bo->moduleid); $dm->setStyle($font, $link, $border, $margin, $padding, $background, $styleclass); $resource = $this->_getModuleDs()->updateModule($dm); if ($resource instanceof PwError) { $this->showError($resource->getError()); } $display = Wekit::load('design.srv.display.PwDesignDisplay'); $styleSrv = $this->_getStyleService(); $styleSrv->setDom($display->bindDataKey($this->bo->moduleid)); $style = $dm->getStyle(); //$style = array('font'=>$font, 'link'=>$link, 'border'=>$border, 'margin'=>$margin, 'padding'=>$padding, 'background'=>$background, 'styleclass'=>$styleclass); $styleSrv->setStyle($style); //$this->differStyle($style) $_style['styleDomId'] = $styleSrv->getCss($style); $_style['styleDomIdLink'] = $styleSrv->getLink($style); $_style['styleDomClass'] = $styleclass; $this->setOutput($_style, 'data'); $this->showMessage("operate.success"); }