public function find($recId,Pment_Models_Record $record) { $resultSet = $this->getDbTable()->find($recId); if (0 == count($resultSet)) { return; } $row = $resultSet->current(); $record->setrecId($row->recId) ->setProjectId($row->projectId) ->setRecDate($row->recDate) ->setRecNumber($row->recNumber) ->setRecUnit($row->recUnit) ->setContent($row->content) ->setContactId($row->contactId) ->setRemark($row->remark) ->setCTime($row->cTime); $contacts = new Employee_Models_ContactMapper(); $contactName = $contacts->findcontactName($record->getContactId()); $record->setContactName($contactName); }
public function editAction() { $errorMsg = null; $editForm = new Pment_Forms_RecordSave(); $records = new Pment_Models_RecordMapper(); $editForm->submit->setLabel('保存修改'); $editForm->submit2->setAttrib('class','hide'); $recId = $this->_getParam('id',0); $projectId =$this->_getProjectId(); $editForm = $records->formValidator($editForm,1); if($this->getRequest()->isPost()) { $formData = $this->getRequest()->getPost(); if($editForm->isValid($formData)) { $array = $records->dataValidator($formData,1); $trigger = $array['trigger']; $errorMsg = $array['errorMsg']; if($trigger == 0) { $record = new Pment_Models_Record(); $record->setRecId($recId); $record->setProjectId($projectId); $record->setRecDate($editForm->getValue('recDate')); $record->setRecUnit($editForm->getValue('recUnit')); $record->setRecNumber($editForm->getValue('recNumber')); $record->setContent($editForm->getValue('content')); $record->setContactId($editForm->getValue('contactId')); $record->setRemark($editForm->getValue('remark')); $records->save($record); $this->_helper->flashMessenger->addMessage('对工程备案信息的修改成功。'); $this->_redirect('/pment/record'); } else { $editForm->populate($formData); } } else { $editForm->populate($formData); } } else { if($recId >0) { $arrayRecord = $records->findarrayRecord($recId); $editForm->populate($arrayRecord); } else { $this->_redirect('/pment/record'); } } $this->view->errorMsg = $errorMsg; $this->view->editForm = $editForm; $this->view->id = $recId; }