Esempio n. 1
0
 public function editAction()
 {
     $form = new C3op_Form_ReceivableEdit();
     $this->view->form = $form;
     if ($this->getRequest()->isPost()) {
         $postData = $this->getRequest()->getPost();
         if ($form->isValid($postData)) {
             $form->process($postData);
             $this->_helper->getHelper('FlashMessenger')->addMessage('The record was successfully updated.');
             $this->_redirect('/projects/project/success-create');
         } else {
             throw new C3op_Projects_ProjectException("A project must have a valid title.");
         }
     } else {
         $data = $this->_request->getParams();
         $filters = array('id' => new Zend_Filter_Alnum());
         $validators = array('id' => new C3op_Util_ValidId());
         $input = new Zend_Filter_Input($filters, $validators, $data);
         if ($input->isValid()) {
             $id = $input->id;
             if (!isset($this->receivableMapper)) {
                 $this->receivableMapper = new C3op_Projects_ReceivableMapper($this->db);
             }
             $thisReceivable = $this->receivableMapper->findById($id);
             C3op_Util_FormFieldValueSetter::SetValueToFormField($form, 'title', $thisReceivable->GetTitle());
             C3op_Util_FormFieldValueSetter::SetValueToFormField($form, 'id', $id);
             $this->SetDateValueToFormField($form, 'predictedDate', $thisReceivable->GetPredictedDate());
             C3op_Util_FormFieldValueSetter::SetValueToFormField($form, 'predictedValue', $thisReceivable->GetPredictedValue());
             $this->SetDateValueToFormField($form, 'realDate', $thisReceivable->GetRealDate());
             C3op_Util_FormFieldValueSetter::SetValueToFormField($form, 'realValue', $thisReceivable->GetRealValue());
             $projectId = $this->populateProjectFields($thisReceivable->GetProject(), $form);
         }
     }
 }
Esempio n. 2
0
 public function editAction()
 {
     $form = new C3op_Form_OutlayEdit();
     $this->view->form = $form;
     if ($this->getRequest()->isPost()) {
         $postData = $this->getRequest()->getPost();
         if ($form->isValid($postData)) {
             $form->process($postData);
             $this->_helper->getHelper('FlashMessenger')->addMessage('The record was successfully updated.');
             $this->_redirect('/projects/outlay/success-create/?id=' . $postData['action']);
         } else {
             throw new C3op_Projects_ProjectException("Invalid data for an outlay.");
         }
     } else {
         $data = $this->_request->getParams();
         $filters = array('id' => new Zend_Filter_Alnum());
         $validators = array('id' => new C3op_Util_ValidId());
         $input = new Zend_Filter_Input($filters, $validators, $data);
         if ($input->isValid()) {
             $id = $input->id;
             if (!isset($this->outlayMapper)) {
                 $this->outlayMapper = new C3op_Projects_OutlayMapper($this->db);
             }
             $thisOutlay = $this->outlayMapper->findById($id);
             C3op_Util_FormFieldValueSetter::SetValueToFormField($form, 'id', $id);
             C3op_Util_FormFieldValueSetter::SetValueToFormField($form, 'project', $thisOutlay->GetProject());
             C3op_Util_FormFieldValueSetter::SetValueToFormField($form, 'action', $thisOutlay->GetAction());
             C3op_Util_FormFieldValueSetter::SetValueToFormField($form, 'humanResource', $thisOutlay->GetHumanResource());
             $this->SetDateValueToFormField($form, 'predictedDate', $thisOutlay->GetPredictedDate());
             C3op_Util_FormFieldValueSetter::SetValueToFormField($form, 'predictedValue', $thisOutlay->GetPredictedValue());
             C3op_Util_FormFieldValueSetter::SetValueToFormField($form, 'observation', $thisOutlay->GetObservation());
         }
     }
 }
Esempio n. 3
0
 public function editAction()
 {
     $form = new C3op_Form_UserEdit();
     $this->view->form = $form;
     if ($this->getRequest()->isPost()) {
         $postData = $this->getRequest()->getPost();
         try {
             if ($form->isValid($postData)) {
                 $form->process($postData);
                 $this->_helper->getHelper('FlashMessenger')->addMessage('The record was successfully updated.');
                 $this->_redirect('/auth/user/success-create');
             }
         } catch (Exception $e) {
             $this->_helper->getHelper('FlashMessenger')->addMessage($e->getMessage());
             $this->view->form = $form;
             return $this->render('create');
         }
     } else {
         // GET
         $thisUser = $this->InitUserWithCheckedId($this->userMapper);
         $id = $this->checkIdFromGet();
         C3op_Util_FormFieldValueSetter::SetValueToFormField($form, 'id', $id);
         C3op_Util_FormFieldValueSetter::SetValueToFormField($form, 'name', $thisUser->GetName());
         C3op_Util_FormFieldValueSetter::SetValueToFormField($form, 'login', $thisUser->GetLogin());
         C3op_Util_FormFieldValueSetter::SetValueToFormField($form, 'email', $thisUser->GetEmail());
         C3op_Util_FormFieldValueSetter::SetValueToFormField($form, 'role', $thisUser->GetRole());
     }
 }
Esempio n. 4
0
 public function editAction()
 {
     $form = new C3op_Form_ProjectEdit();
     $this->view->form = $form;
     if ($this->getRequest()->isPost()) {
         $postData = $this->getRequest()->getPost();
         if ($form->isValid($postData)) {
             $form->process($postData);
             $this->_helper->getHelper('FlashMessenger')->addMessage('The record was successfully updated.');
             $this->_redirect('/projects/project/success-create');
         } else {
             throw new C3op_Projects_ProjectException("A project must have a valid title.");
         }
     } else {
         // GET
         $thisProject = $this->InitProjectWithCheckedId($this->projectMapper);
         $id = $this->checkIdFromGet();
         C3op_Util_FormFieldValueSetter::SetValueToFormField($form, 'id', $id);
         C3op_Util_FormFieldValueSetter::SetValueToFormField($form, 'title', $thisProject->GetTitle());
         C3op_Util_FormFieldValueSetter::SetValueToFormField($form, 'client', $thisProject->GetClient());
         $this->PopulateClientField($form, $thisProject->GetClient());
         $this->PopulateOurResponsibleField($form, $thisProject->GetOurResponsible());
         C3op_Util_FormFieldValueSetter::SetValueToFormField($form, 'responsibleAtClient', $thisProject->GetResponsibleAtClient());
         $this->SetDateValueToFormField($form, 'beginDate', $thisProject->GetBeginDate());
         $this->SetDateValueToFormField($form, 'finishDate', $thisProject->GetFinishDate());
         C3op_Util_FormFieldValueSetter::SetValueToFormField($form, 'value', $thisProject->GetValue());
         C3op_Util_FormFieldValueSetter::SetValueToFormField($form, 'status', $thisProject->GetStatus());
         C3op_Util_FormFieldValueSetter::SetValueToFormField($form, 'contractNature', $thisProject->GetContractNature());
         C3op_Util_FormFieldValueSetter::SetValueToFormField($form, 'areaActivity', $thisProject->GetAreaActivity());
         C3op_Util_FormFieldValueSetter::SetValueToFormField($form, 'overhead', $thisProject->GetOverhead());
         C3op_Util_FormFieldValueSetter::SetValueToFormField($form, 'managementFee', $thisProject->GetManagementFee());
         C3op_Util_FormFieldValueSetter::SetValueToFormField($form, 'object', $thisProject->GetObject());
         C3op_Util_FormFieldValueSetter::SetValueToFormField($form, 'summary', $thisProject->GetSummary());
         C3op_Util_FormFieldValueSetter::SetValueToFormField($form, 'observation', $thisProject->GetObservation());
     }
 }
Esempio n. 5
0
 private function PopulateContactFields($contactId, C3op_Form_LinkageCreate $form)
 {
     $validator = new C3op_Util_ValidId();
     if ($validator->isValid($contactId)) {
         $contactField = $form->getElement('contact');
         $contactField->setValue($contactId);
         if (!isset($this->contactMapper)) {
             $this->contactMapper = new C3op_Register_ContactMapper($this->db);
         }
         $thisContact = $this->contactMapper->findById($contactId);
         $this->view->contactName = $thisContact->GetName();
         $this->view->linkContactDetail = "/register/contact/detail/?id=" . $thisContact->GetId();
         C3op_Util_FormFieldValueSetter::SetValueToFormField($form, 'contact', $contactId);
         return $contactId;
     } else {
         throw new C3op_Register_LinkageException("Linkage needs a positive integer contact id.");
     }
 }
Esempio n. 6
0
 public function editAction()
 {
     $form = new C3op_Form_InstitutionEdit();
     $this->view->form = $form;
     if ($this->getRequest()->isPost()) {
         $postData = $this->getRequest()->getPost();
         try {
             if ($form->isValid($postData)) {
                 $form->process($postData);
                 $this->_helper->getHelper('FlashMessenger')->addMessage('The record was successfully updated.');
                 $this->_redirect('/register/institution/success-create');
             }
             //                else throw new C3op_Register_InstitutionException("Invalid data for institution.");
         } catch (Exception $e) {
             throw $e;
             $this->view->form = $form;
             return $this->render('edit');
         }
     } else {
         // GET
         $id = $this->checkIdFromGet();
         $thisInstitution = $this->institutionMapper->findById($id);
         C3op_Util_FormFieldValueSetter::SetValueToFormField($form, 'name', $thisInstitution->getName());
         C3op_Util_FormFieldValueSetter::SetValueToFormField($form, 'id', $id);
         C3op_Util_FormFieldValueSetter::SetValueToFormField($form, 'shortName', $thisInstitution->getShortName());
         C3op_Util_FormFieldValueSetter::SetValueToFormField($form, 'legalEntity', $thisInstitution->getLegalEntity());
         C3op_Util_FormFieldValueSetter::SetValueToFormField($form, 'registerNumber', $thisInstitution->getRegisterNumber());
         C3op_Util_FormFieldValueSetter::SetValueToFormField($form, 'stateRegistration', $thisInstitution->getStateRegistration());
         C3op_Util_FormFieldValueSetter::SetValueToFormField($form, 'localRegisterNumber', $thisInstitution->getLocalRegisterNumber());
         C3op_Util_FormFieldValueSetter::SetValueToFormField($form, 'street', $thisInstitution->getStreet());
         C3op_Util_FormFieldValueSetter::SetValueToFormField($form, 'streetNumber', $thisInstitution->getStreetNumber());
         C3op_Util_FormFieldValueSetter::SetValueToFormField($form, 'addressComplement', $thisInstitution->getAddressComplement());
         C3op_Util_FormFieldValueSetter::SetValueToFormField($form, 'district', $thisInstitution->getDistrict());
         C3op_Util_FormFieldValueSetter::SetValueToFormField($form, 'zipCode', $thisInstitution->getZipCode());
         C3op_Util_FormFieldValueSetter::SetValueToFormField($form, 'city', $thisInstitution->getCity());
         C3op_Util_FormFieldValueSetter::SetValueToFormField($form, 'state', $thisInstitution->getState());
         C3op_Util_FormFieldValueSetter::SetValueToFormField($form, 'website', $thisInstitution->getWebsite());
         C3op_Util_FormFieldValueSetter::SetValueToFormField($form, 'type', $thisInstitution->getType());
         C3op_Util_FormFieldValueSetter::SetValueToFormField($form, 'relationshipType', $thisInstitution->getRelationshipType());
     }
 }
Esempio n. 7
0
 public function changePhoneNumberAction()
 {
     // cria form
     if ($this->getRequest()->isPost()) {
         $postData = $this->getRequest()->getPost();
         $form = new C3op_Form_PhoneNumberEdit();
         $this->view->form = $form;
         if ($form->isValid($postData)) {
             $id = $form->process($postData);
             $this->_helper->getHelper('FlashMessenger')->addMessage('The record was successfully updated.');
             $this->_redirect('/register/contact/success-create/?id=' . $id);
         } else {
             throw new C3op_Register_ContactException("Invalid data for phone number.");
         }
     } else {
         $data = $this->_request->getParams();
         $filters = array('phoneId' => new Zend_Filter_Alnum());
         $validators = array('phoneId' => array('Digits', new Zend_Validate_GreaterThan(0)));
         $input = new Zend_Filter_Input($filters, $validators, $data);
         if ($input->isValid()) {
             $phoneId = $input->phoneId;
         } else {
             throw new C3op_Register_ContactException("Invalid Contact Id from Get");
         }
         $contactHasPhone = $this->contactMapper->findByPhoneId($phoneId);
         $phoneNumbers = $contactHasPhone->GetPhoneNumbers();
         $phoneNumber = $phoneNumbers[$phoneId];
         $data = $this->_request->getParams();
         $form = new C3op_Form_PhoneNumberEdit();
         C3op_Util_FormFieldValueSetter::SetValueToFormField($form, 'contact', $contactHasPhone->GetId());
         C3op_Util_FormFieldValueSetter::SetValueToFormField($form, 'id', $phoneId);
         C3op_Util_FormFieldValueSetter::SetValueToFormField($form, 'areaCode', $phoneNumber['area_code']);
         C3op_Util_FormFieldValueSetter::SetValueToFormField($form, 'localNumber', $phoneNumber['local_number']);
         C3op_Util_FormFieldValueSetter::SetValueToFormField($form, 'label', $phoneNumber['label']);
         $this->view->form = $form;
         $contactInfo = array('id' => $contactHasPhone->GetId(), 'name' => $contactHasPhone->GetName());
         $this->view->contactInfo = $contactInfo;
     }
 }