public function init() { parent::init(); // initialize form $this->setName('editOutlayForm')->setAction('/projects/outlay/edit')->setMethod('post'); $id = new Zend_Form_Element_Hidden('id'); $id->addValidator('Int')->addFilter('StringTrim'); $this->addElement($id); }
private function populateFieldsAssociatedToHumanResource(C3op_Projects_HumanResource $humanResource, C3op_Form_OutlayCreate $form) { $humanResourceField = $form->getElement('humanResource'); $humanResourceField->setValue($humanResource->Getid()); if ($humanResource->GetContact() > 0) { if (!isset($this->contactMapper)) { $this->contactMapper = new C3op_Register_ContactMapper($this->db); } $humanResourceContact = $this->contactMapper->findById($humanResource->GetContact()); $this->viewInfo['contactName'] = $humanResourceContact->GetName(); $this->viewInfo['linkContactDetail'] = "/register/contact/detail/?id=" . $humanResourceContact->GetId(); } if (!isset($this->actionMapper)) { $this->actionMapper = new C3op_Projects_ActionMapper($this->db); } $actionField = $form->getElement('action'); $actionField->setValue($humanResource->GetAction()); $humanResourceAction = $this->actionMapper->findById($humanResource->GetAction()); $this->viewInfo['actionTitle'] = $humanResourceAction->GetTitle(); $this->viewInfo['linkActionDetail'] = "/projects/action/detail/?id=" . $humanResourceAction->GetId(); $projectField = $form->getElement('project'); $projectField->setValue($humanResourceAction->GetProject()); if (!isset($this->projectMapper)) { $this->projectMapper = new C3op_Projects_ProjectMapper($this->db); } $thisProject = $this->projectMapper->findById($humanResourceAction->GetProject()); $this->viewInfo['projectTitle'] = $thisProject->GetTitle(); $this->viewInfo['linkProjectDetail'] = "/projects/project/detail/?id=" . $thisProject->GetId(); }