コード例 #1
0
 /**
  * EditAction for Contacts
  *
  * @return void
  */
 public function editAction()
 {
     $this->view->title = "Edit Contacts";
     $form = new Supplier_Form_Contact();
     if ($this->getRequest()->isPost()) {
         if ($form->isValid($this->getRequest()->getPost())) {
             $model = new Supplier_Model_Contact();
             $id = $this->getRequest()->getPost('id');
             $model->update($form->getValues(), 'id = ' . (int) $id);
             return $this->_helper->_redirector->gotoSimple('consult', 'supplier', 'supplier');
         } else {
             $form->populate($this->getRequest()->getPost());
         }
     } else {
         $id = $this->_getParam('id', 0);
         if ($id > 0) {
             $model = new Supplier_Model_Contact();
             $form->populate($model->fetchEntry($id));
         }
     }
     $this->view->form = $form;
 }