/** * do编辑友情链接 * * @return void */ public function doeditAction() { list($vieworder, $name, $url, $descrip, $logo, $ifcheck, $contact, $typeids, $lid) = $this->getInput(array('vieworder', 'name', 'url', 'descrip', 'logo', 'ifcheck', 'contact', 'typeids', 'lid'), 'post'); if (!$typeids) { $this->showError('LINK:require_empty'); } Wind::import('SRC:service.link.dm.PwLinkDm'); $linkDm = new PwLinkDm($lid); $linkDm->setVieworder($vieworder)->setName($name)->setUrl($url)->setDescrip($descrip)->setLogo($logo)->setIfcheck($ifcheck)->setContact($contact); $logo && $linkDm->setIflogo(1); if (($result = $linkDm->beforeUpdate()) instanceof PwError) { $this->showError($result->getError()); } $this->_getLinkDs()->updateLink($linkDm); $this->_getLinkDs()->delRelationsByLid($lid); foreach ($typeids as $v) { $this->_getLinkDs()->addRelation($lid, $v); } $this->showMessage('LINK:edit.success'); }
/** * 更新友情链接 * * @param PwLinksDm $dm * @return boolean */ public function updateLink(PwLinkDm $dm) { if (($result = $dm->beforeUpdate()) !== true) { return $result; } return $this->_getLinkDao()->updateLink($dm->getLid(), $dm->getData()); }