protected function xmlFormat($moduleId) { Wind::import('SRV:design.bo.PwDesignModuleBo'); $bo = new PwDesignModuleBo($moduleId); $module = $bo->getModule(); if ($module['module_type'] != PwDesignModule::TYPE_SCRIPT) { exit('fail'); } $data = $bo->getData(true); $dom = new DOMDocument('1.0', 'utf-8'); $root = $dom->createElement('root'); $dom->appendChild($root); foreach ($data as $v) { $child = $dom->createElement('data'); foreach ((array) $v as $_k => $_v) { $_k = $dom->createElement($_k); $_k->appendChild($dom->createTextNode($_v)); $child->appendChild($_k); $root->appendChild($child); } } header('Content-type: application/xml'); echo $dom->saveXML(); exit; }
public function moduleAction() { $moduleId = (int) $this->getInput('moduleid', 'post'); Wind::import('SRV:design.bo.PwDesignModuleBo'); $bo = new PwDesignModuleBo($moduleId); $module = $bo->getModule(); if ($module['isused']) { $this->setTemplate(''); } $bo->setStdId(); $key = Wekit::load('design.srv.display.PwDesignDisplay')->bindDataKey($moduleId); $data[$key] = $bo->getData(true, false); $this->setOutput($data, '__design_data'); list($theme, ) = $this->getForward()->getWindView()->getTheme(); if (is_array($theme)) { list($theme, $pack) = $theme; } if (!$theme) { $theme = 'default'; } WindFolder::rm(Wind::getRealDir('DATA:compile.template.' . $theme . '.design.segment.'), true); $this->setTemplate('TPL:design.segment.module'); }