Пример #1
0
 public function process($data)
 {
     $db = Zend_Registry::get('db');
     $linkageMapper = new C3op_Register_LinkageMapper($db);
     if ($this->isValid($data) !== true) {
         throw new C3op_Form_LinkageEditException('Invalid data!');
     } else {
         $id = $data['id'];
         $linkage = $linkageMapper->findById($id);
         $linkage->SetDepartment($data['department']);
         $linkage->SetContact($data['contact']);
         $linkage->SetState($data['state']);
         $linkage->SetInstitution($data['institution']);
         $linkage->SetPosition($data['position']);
         $linkageMapper->update($linkage);
     }
 }
Пример #2
0
 public function detailAction()
 {
     $linkageMapper = new C3op_Register_LinkageMapper($this->db);
     $contactMapper = new C3op_Register_ContactMapper($this->db);
     $id = $this->checkIdFromGet();
     $thisInstitution = $this->institutionMapper->findById($id);
     $linkagesIdsList = $this->institutionMapper->getAllLinkages($thisInstitution);
     $linkagesList = array();
     reset($linkagesList);
     foreach ($linkagesIdsList as $linkageId) {
         $thisLinkage = $linkageMapper->findById($linkageId);
         $thisContact = $contactMapper->findById($thisLinkage->GetContact());
         $linkagesList[$linkageId] = array('name' => $thisContact->GetName(), 'position' => $thisLinkage->GetPosition(), 'department' => $thisLinkage->GetDepartment(), 'editLink' => '/register/contact/edit/?id=' . $linkageId);
     }
     $institutionInfo = array('name' => $thisInstitution->GetName(), 'editLink' => '/register/institution/edit/?id=' . $id, 'linkLinkageCreate' => '/register/linkage/create/?institution=' . $id, 'contactsList' => $linkagesList);
     $this->view->institutionInfo = $institutionInfo;
 }
Пример #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;
 }