/** Edit a help topic * @access public * @return void * @throws Pas_Exception_Param */ public function editAction() { if ($this->getParam('id', false)) { $form = new HelpForm(); $form->submit->setLabel('Submit changes'); $form->author->setValue($this->getIdentityForForms()); $this->view->form = $form; if ($this->getRequest()->isPost() && $form->isValid($this->_request->getPost())) { if ($form->isValid($form->getValues())) { $where = array(); $where[] = $this->_help->getAdapter()->quoteInto('id = ?', $this->getParam('id')); $this->_help->update($form->getValues(), $where); $this->getFlash()->addMessage('You updated: <em>' . $form->getValue('title') . '</em> successfully. It is now available for use.'); $this->redirect('admin/help/'); } else { $form->populate($form->getValues()); } } else { $form->populate($this->_help->fetchRow('id= ' . $this->getParam('id'))->toArray()); } } else { throw new Pas_Exception_Param($this->_missingParameter, 500); } }
/** * 取消审核 * @access public */ function auditQuit() { $id = get_post_value('help_id'); $status = get_post_value('status'); //只可修改审核状态 if (!in_array($status, array('10000', '30000'))) { echo '<br>数据不可修改.<a href="index">返回</a><br>'; return; } if ($this->verify($status)) { echo '<br>数据不可修改.<a href="index">返回</a><br>'; return; } $field = array('status' => $status == '30000' ? '10000' : ''); $m = new Help(); $m->clear(); $m->setField($field); ///设置更新字段及值,(键值数组) $m->setTable('vcb_help'); //设置表名 $m->setWhere('help_id', '=', $id); //设置Where条件 $m->update(); //返回 header("Location:index"); }