public function findAction() { // display a search field to enter a user's name // display an alphabetical list of users // @TODO implement pagination set limit per page set overal limit for results // @TODO implement list of alphabet to display all members whose name starts with that letter - see Packtpub.PHP.5.Social.Networking.Oct.2010 $request = $this->getRequest(); $form = new Application_Form_Member(); if ($request->isPost()) { if ($form->isValid($request->getPost())) { $memberMapper = new Application_Model_MemberMapper(); try { $auth = Zend_Auth::getInstance(); $identity = $auth->getIdentity(); $rows = $memberMapper->fetchAllByName($form->getValue('name'), $identity->id); } catch (Exception $e) { throw new Exception($e->getMessage()); } $this->view->rows = $rows->toArray(); } } $this->view->form = $form; }
public function editAction() { $form = new Application_Form_Member(); $form->submit->setLabel('Save'); $this->view->form = $form; if ($this->getRequest()->isPost()) { $formData = $this->getRequest()->getPost(); if ($form->isValid($formData)) { $id = (int)$form->getValue('mid'); $title = $form->getValue('title'); $firstnames = $form->getValue('firstnames'); $surname = $form->getValue('surname'); $address = $form->getValue('address'); $email = $form->getValue('email'); $phone = $form->getValue('phone'); $nic = $form->getValue('nic'); $reg_no = $form->getValue('reg_no'); $index_no = $form->getValue('index_no'); $type = $form->getValue('type'); $category = $form->getValue('category'); $login_type = $form->getValue('login_type'); $expired = $form->getValue('expired'); $members = new Application_Model_DbTable_Members(); $members->updateMember($id, $title, $firstnames, $surname, $address, $email, $phone, $nic, $reg_no, $index_no, $type, $category, $login_type, $expired); $this->_helper->redirector('index'); } else { $form->populate($formData); } } else { $id = $this->_getParam('id', 0); if ($id > 0) { $members = new Application_Model_DbTable_Members(); $form->populate($members->getMember($id)); } } }