Ejemplo n.º 1
0
 public function doaddAction()
 {
     list($name, $url, $descrip, $logo, $ifcheck, $contact) = $this->getInput(array('name', 'url', 'descrip', 'logo', 'ifcheck', 'contact'), 'post');
     Wind::import('SRC:service.link.dm.PwLinkDm');
     $linkDm = new PwLinkDm();
     $linkDm->setName($name);
     $linkDm->setUrl($url);
     $linkDm->setDescrip($descrip);
     $linkDm->setLogo($logo);
     $linkDm->setIfcheck(0);
     $linkDm->setContact($contact);
     $logo && $linkDm->setIflogo(1);
     if (($result = $this->_getLinkDs()->addLink($linkDm)) instanceof PwError) {
         $this->showError($result->getError());
     }
     $this->showMessage('operate.success');
 }
Ejemplo n.º 2
0
 /**
  * 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');
 }