/** * 编辑钩子 * * @param PwHookDm $hook * @return boolean */ public function update($hook) { $r = $hook->beforeUpdate(); if ($r !== true) { return new PwError($r[0], $r[1]); } return $this->_load()->update($hook->getField('name'), $hook->getData()); }
/** * hook编辑 */ public function doEditAction() { $this->getRequest()->isPost() || $this->showError('operate.fail'); list($name, $app, $dec, $param, $interface) = $this->getInput(array('name', 'app', 'dec', 'param', 'interface'), 'post'); list($appId, $appName) = explode('|', $app); $dm = new PwHookDm(); $dm->setAppId($appId); $dm->setAppName($appName); $dm->setDocument(implode($this->sep, array($dec, $param, $interface))); $dm->setName($name); $dm->setModifiedTime(Pw::getTime()); $r = $this->_hookDs()->update($dm); if ($r instanceof PwError) { $this->showError($r->getError()); } $this->showMessage('success'); }