/** Edit one of your social media accounts * @access public * @return void * @throws Pas_Exception_Param */ public function editAction() { if ($this->getParam('id', false)) { $form = new SocialAccountsForm(); $form->submit->setLabel('Save profile'); $this->view->form = $form; if ($this->_request->isPost()) { if ($form->isValid($this->_request->getPost())) { $where = array(); $where[] = $this->_accounts->getAdapter()->quoteInto('id = ?', $this->getParam('id')); $where[] = $this->_accounts->getAdapter()->quoteInto('userID = ?', $this->getIdentityForForms()); $this->_accounts->update($form->getValues(), $where); $this->getFlash()->addMessage('Webservice details updated.'); $this->redirect('/users/social'); } else { $form->populate($this->_request->getPost()); } } else { // find id is expected in $params['id'] $id = (int) $this->_request->getParam('id', 0); if ($id > 0) { $service = $this->_accounts->fetchRow('userID = ' . $this->getIdentityForForms() . ' AND id=' . $id); if (count($service)) { $form->populate($service->toArray()); } else { throw new Pas_Exception_Param($this->_nothingFound, 404); } } } } else { throw new Pas_Exception_Param($this->_missingParameter, 500); } }