public function createAction() { // cria form $form = new C3op_Form_HumanResourceCreate(); $this->view->form = $form; if ($this->getRequest()->isPost()) { $postData = $this->getRequest()->getPost(); if ($form->isValid($postData)) { $id = $form->process($postData); $this->_helper->getHelper('FlashMessenger')->addMessage('The record was successfully updated.'); $this->_redirect('/projects/human-resource/success-create/?id=' . $id); } else { throw new C3op_Projects_ActionException("An action must have a valid title."); } } else { $data = $this->_request->getParams(); $actionId = $data['actionId']; if (!isset($this->actionMapper)) { $this->actionMapper = new C3op_Projects_ActionMapper($this->db); } $thisAction = $this->actionMapper->findById($actionId); $this->view->actionTitle = $thisAction->GetTitle(); $this->view->linkActionDetail = "/projects/action/detail/?id=" . $thisAction->getId(); $actionField = $form->getElement('action'); $actionField->setValue($actionId); $contactField = $form->getElement('contact'); if (!isset($this->contactMapper)) { $this->contactMapper = new C3op_Register_ContactMapper($this->db); } $allContacts = $this->contactMapper->getAllIds(); while (list($key, $contactId) = each($allContacts)) { $eachContact = $this->contactMapper->findById($contactId); $contactField->addMultiOption($contactId, $eachContact->GetName()); } } }