/** * Enter description here ... * @param int $pageid * @param int $uniqueid */ public function getNewPageId($pageid, $uniqueid = 0, $isunique = false) { Wind::import('SRV:design.dm.PwDesignPageDm'); $ds = $this->_getPageDs(); $pageInfo = $ds->getPage($pageid); if (!$pageInfo) { return new PwError('operate.fail'); } $dm = new PwDesignPageDm($pageid); if ($isunique) { list($pagename, $id) = $this->getUniquePage($pageInfo['page_router'], $uniqueid); $dm->setIsUnique($id)->setName($pagename); } elseif ($pageInfo['page_type'] != PwDesignPage::PORTAL) { $dm->setIsUnique(0); if ($pageInfo['is_unique']) { $ds->deleteNoUnique($pageInfo['page_router'], 0); } } //设计模式解锁 $dm->setDesignLock(0, 0); $ds->updatePage($dm); return $pageid; }
public function afterDesign() { $ds = Wekit::load('design.PwDesignPage'); Wind::import('SRV:design.dm.PwDesignPageDm'); $dm = new PwDesignPageDm($this->pageid); $dm->setModuleIds(array_unique($this->moduleIds))->setStrucNames($this->structNames)->setSegments($this->segments); $resource = $ds->updatePage($dm); Wekit::load('design.PwDesignModule')->batchUpdateIsUsed($this->moduleIds); if ($this->isDesign) { $loginUser = Wekit::getLoginUser(); $dm = new PwDesignPageDm($this->pageid); $dm->setDesignLock($loginUser->uid, Pw::getTime()); $ds->updatePage($dm); Wekit::load('design.srv.PwPageBakService')->doSnap($this->pageid); } }
/** * 设计模计轮循加锁 * Enter description here ... */ public function lockdesignAction() { $pageid = (int) $this->getInput('pageid', 'post'); $pageInfo = $this->_getPageDs()->getPage($pageid); if (!$pageInfo) { $this->showError("operate.fail"); } Wekit::load('design.PwDesignPermissions'); $permissions = $this->_getPermissionsService()->getPermissionsForPage($this->loginUser->uid, $pageid); if ($permissions <= PwDesignPermissions::NEED_CHECK) { $this->showError("DESIGN:permissions.fail"); } list($uid, $time) = explode('|', $pageInfo['design_lock']); if ($uid != $this->loginUser->uid) { $this->showError("operate.fail"); } Wind::import('SRV:design.dm.PwDesignPageDm'); $dm = new PwDesignPageDm($pageid); $dm->setDesignLock($this->loginUser->uid, Pw::getTime()); $this->_getPageDs()->updatePage($dm); $this->showMessage("operate.success"); }