Exemplo n.º 1
0
 /**
  * 自定义页面升级  start
  * 
  * @return boolean
  */
 protected function _designUpgrade()
 {
     Wind::import('SRV:design.srv.vo.PwDesignPortalSo');
     $vo = new PwDesignPortalSo();
     $vo->setIsopen(1);
     $list = $this->_getPortalDs()->searchPortal($vo, 0, 100);
     $dirList = array();
     foreach ($list as $k => $v) {
         if (empty($v['template'])) {
             $dirList[$k] = $v['id'];
         }
     }
     $dir = Wind::getRealDir('THEMES:portal.local.');
     $_dir = array();
     if (!is_dir($dir)) {
         return array();
     }
     if (!($handle = @opendir($dir))) {
         return array();
     }
     while (false !== ($file = @readdir($handle))) {
         if ('.' === $file || '..' === $file) {
             continue;
         }
         $fileName = $dir . $file;
         if (is_file($fileName)) {
             continue;
         } elseif (is_dir($fileName) && is_numeric($file)) {
             $key = array_search($file, $dirList);
             unset($dirList[$k]);
             if ((int) $file != $file) {
                 continue;
             }
             $tplPath = 'special_' . $file;
             Wind::import('SRV:design.dm.PwDesignPortalDm');
             $dm = new PwDesignPortalDm($file);
             $dm->setTemplate($tplPath);
             Wekit::load('design.PwDesignPortal')->updatePortal($dm);
             $this->copyRecur($fileName, $dir . $tplPath . '/');
         }
     }
     $srv = Wekit::load('design.srv.PwDesignService');
     foreach ($dirList as $k => $v) {
         $tplPath = 'special_' . $v;
         $result = $srv->defaultTemplate($k, $tplPath);
         if ($result) {
             WindFile::write($dir . $tplPath . '/template/index.htm', $this->_tpl());
             Wind::import('SRV:design.dm.PwDesignPortalDm');
             $dm = new PwDesignPortalDm($v);
             $dm->setTemplate($tplPath);
             Wekit::load('design.PwDesignPortal')->updatePortal($dm);
         }
     }
     @closedir($handle);
     return true;
 }
Exemplo n.º 2
0
 public function countPartal(PwDesignPortalSo $vo)
 {
     return $this->_getDao()->countPartal($vo->getData());
 }