Example #1
0
 public function createAction()
 {
     // cria form
     if ($this->getRequest()->isPost()) {
         $postData = $this->getRequest()->getPost();
         $options = array();
         $options['contact'] = $postData['contact'];
         $form = new C3op_Form_LinkageCreate($options);
         $this->view->form = $form;
         if ($form->isValid($postData)) {
             $form->process($postData);
             $this->_helper->getHelper('FlashMessenger')->addMessage('The record was successfully updated.');
             $this->_redirect('/register/linkage/success-create');
         } else {
             throw new C3op_Register_LinkageException("An linkage must have valid data.");
         }
     } else {
         $data = $this->_request->getParams();
         $contactId = $data['contact'];
         $options = array();
         $options['contact'] = $data['contact'];
         $form = new C3op_Form_LinkageCreate($options);
         $this->view->form = $form;
         $this->PopulateContactFields($contactId, $form);
         $this->PopulateInstitutionsField($form, 0);
     }
 }