Ejemplo n.º 1
0
 public function doeditstyleAction()
 {
     $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.PwDesignStructureDm');
     $dm = new PwDesignStructureDm();
     $dm->setStructStyle($font, $link, $border, $margin, $padding, $background, $styleclass)->setStructName($this->bo->name)->setStructTitle($this->bo->getTitle());
     $resource = $this->_getStructureDs()->replaceStruct($dm);
     if ($resource instanceof PwError) {
         $this->showError($resource->getError());
     }
     $style = $dm->getStyle();
     //$style = array('font'=>$font, 'link'=>$link, 'border'=>$border, 'margin'=>$margin, 'padding'=>$padding, 'background'=>$background, 'styleclass'=>$styleclass);
     $styleSrv = $this->_getStyleService();
     $styleSrv->setDom($this->bo->name);
     $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");
 }