public function addlinkAction() { if($this->_auth->hasIdentity() && $this->_request->isXmlHttpRequest()) { $id = $this->_getParam('id'); if($this->_auth->hasIdentity() && $this->user->isAdministrator($id)) { $table = new FaqsLinks(); $faq = $table->fetchRow(array('id = ?' => $id)); $this->view->faq = $faq; if($this->_request->isPost()) { $filters = array(); $validators = array(); $input = new Zend_Input_Filter($filters, $validators, $_POST); if($input->isValid()) { $faq->name = $input->name; $faq->save(); $response = array('success' => true, 'html' => $this->_helper->partial('addlink')); $this->_helper->json($response); } else { $response = array('success' => false); $this->_helper->json($response); } } else { $this->_response->setBody($this->_helper->partial()); } } } }