Esempio n. 1
0
 public function process($data)
 {
     $db = Zend_Registry::get('db');
     $institutionMapper = new C3op_Register_InstitutionMapper($db);
     if ($this->isValid($data) !== true) {
         throw new C3op_Form_InstitutionEditException('Invalid data!');
     } else {
         $id = $data['id'];
         $institution = $institutionMapper->findById($id);
         $institution->SetName($this->name->GetValue());
         $institution->SetShortName($this->shortName->GetValue());
         $institution->SetLegalEntity($this->legalEntity->GetValue());
         $institution->SetRegisterNumber($this->registerNumber->GetValue());
         $institution->SetStateRegistration($this->stateRegistration->GetValue());
         $institution->SetLocalRegisterNumber($this->localRegisterNumber->GetValue());
         $institution->SetStreet($this->street->GetValue());
         $institution->SetStreetNumber($this->streetNumber->GetValue());
         $institution->SetAddressComplement($this->addressComplement->GetValue());
         $institution->SetDistrict($this->district->GetValue());
         $institution->SetZipCode($this->zipCode->GetValue());
         $institution->SetCity($this->city->GetValue());
         $institution->SetState($this->state->GetValue());
         $institution->SetWebsite($this->website->GetValue());
         $institution->SetType($this->type->GetValue());
         $institution->SetRelationshipType($this->relationshipType->GetValue());
         $institutionMapper->update($institution);
     }
 }
Esempio n. 2
0
 public function process($data)
 {
     if ($this->isValid($data) !== true) {
         print_r($this->getErrorMessages());
         die;
         throw new C3op_Form_InstitutionCreateException('Invalid data!');
     } else {
         $db = Zend_Registry::get('db');
         $institutionMapper = new C3op_Register_InstitutionMapper($db);
         $institution = new C3op_Register_Institution();
         $institution->SetName($this->name->GetValue());
         $institution->SetShortName($this->shortName->GetValue());
         $institution->SetLegalEntity($this->legalEntity->GetValue());
         $institution->SetRegisterNumber($this->registerNumber->GetValue());
         $institution->SetStateRegistration($this->stateRegistration->GetValue());
         $institution->SetLocalRegisterNumber($this->localRegisterNumber->GetValue());
         $institution->SetStreet($this->street->GetValue());
         $institution->SetStreetNumber($this->streetNumber->GetValue());
         $institution->SetAddressComplement($this->addressComplement->GetValue());
         $institution->SetDistrict($this->district->GetValue());
         $institution->SetZipCode($this->zipCode->GetValue());
         $institution->SetCity($this->city->GetValue());
         $institution->SetState($this->state->GetValue());
         $institution->SetWebsite($this->website->GetValue());
         $institution->SetType($this->type->GetValue());
         $institution->SetRelationshipType($this->relationshipType->GetValue());
         $institutionMapper->insert($institution);
     }
 }
Esempio n. 3
0
 public function detailAction()
 {
     $linkageMapper = new C3op_Register_LinkageMapper($this->db);
     $id = $this->checkIdFromGet();
     $contactBeingDetailed = $this->contactMapper->findById($id);
     $phoneNumbersList = $contactBeingDetailed->getPhoneNumbers();
     $phoneData = array();
     foreach ($phoneNumbersList as $phoneId => $phoneNumber) {
         $phoneData[$phoneId] = array('area_code' => $phoneNumber['area_code'], 'local_number' => $phoneNumber['local_number'], 'label' => $phoneNumber['label']);
     }
     $linkagesIdsList = $this->contactMapper->getAllLinkages($contactBeingDetailed);
     $linkagesList = array();
     reset($linkagesList);
     foreach ($linkagesIdsList as $linkageId) {
         $contactLinkage = $linkageMapper->findById($linkageId);
         if ($contactLinkage->GetInstitution() > 0) {
             $institutionMapper = new C3op_Register_InstitutionMapper($this->db);
             $institutionLinkedToContact = $institutionMapper->findById($contactLinkage->GetInstitution());
         }
         $linkagesList[$linkageId] = array('id' => $linkageId, 'institutionName' => $institutionLinkedToContact->GetName(), 'institutionEdit' => '/register/institution/edit/?id=' . $institutionLinkedToContact->GetId(), 'department' => $contactLinkage->GetDepartment(), 'position' => $contactLinkage->GetPosition());
     }
     $contactInfo = array('id' => $id, 'name' => $contactBeingDetailed->GetName(), 'editLink' => '/register/contact/edit/?id=' . $id, 'linkLinkageCreate' => '/register/linkage/create/?contact=' . $id, 'phoneData' => $phoneData, 'linkagesList' => $linkagesList);
     $this->view->contactInfo = $contactInfo;
 }