Ejemplo n.º 1
0
 public function process($data)
 {
     if ($this->isValid($data) !== true) {
         throw new C3op_Form_ContactCreateException('Invalid data!');
     } else {
         $db = Zend_Registry::get('db');
         $contactMapper = new C3op_Register_ContactMapper($db);
         $contact = new C3op_Register_Contact();
         $contact->SetName($this->name->GetValue());
         $contact->SetType($this->type->GetValue());
         $contactMapper->insert($contact);
     }
 }
Ejemplo n.º 2
0
 public function process($data)
 {
     $db = Zend_Registry::get('db');
     $contactMapper = new C3op_Register_ContactMapper($db);
     if ($this->isValid($data) !== true) {
         throw new C3op_Form_ContactEditException('Invalid data!');
     } else {
         $id = $data['id'];
         $contact = $contactMapper->findById($id);
         $contact->SetName($data['name']);
         $contact->SetType($data['type']);
         $contactMapper->update($contact);
         return $id;
     }
 }
Ejemplo n.º 3
0
 public function process($data)
 {
     if ($this->isValid($data) !== true) {
         throw new C3op_Form_ContactCreateException('Invalid data!');
     } else {
         $db = Zend_Registry::get('db');
         $contactMapper = new C3op_Register_ContactMapper($db);
         $contact = $contactMapper->findById($this->contact->GetValue());
         if ($this->localNumber->GetValue() != "") {
             $phoneNumber = array('area_code' => $this->areaCode->GetValue(), 'local_number' => $this->localNumber->GetValue(), 'label' => $this->label->GetValue());
             $contact->AddPhoneNumber($phoneNumber);
         }
         $contactMapper->update($contact);
         return $contact->GetId();
     }
 }
Ejemplo n.º 4
0
 public function process($data)
 {
     if ($this->isValid($data) !== true) {
         throw new C3op_Form_ContactCreateException('Invalid data!');
     } else {
         $db = Zend_Registry::get('db');
         $contactMapper = new C3op_Register_ContactMapper($db);
         $contact = $contactMapper->findById($this->contact->GetValue());
         if ($this->localNumber->GetValue() != "") {
             $phoneNumbers = $contact->GetPhoneNumbers();
             if (isset($phoneNumbers[$this->id->GetValue()])) {
                 $phoneNumber = array('area_code' => $this->areaCode->GetValue(), 'local_number' => $this->localNumber->GetValue(), 'label' => $this->label->GetValue());
                 $phoneNumbers[$this->id->GetValue()] = $phoneNumber;
                 $contact->SetPhoneNumbers($phoneNumbers);
                 $contactMapper->update($contact);
                 return $contact->GetId();
             } else {
                 throw new C3op_Form_ContactEditException('Can\'t find this phone id at this contact phone list');
             }
         }
     }
 }
Ejemplo n.º 5
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;
 }
Ejemplo n.º 6
0
 private function initContactWithCheckedId(C3op_Register_ContactMapper $mapper)
 {
     return $mapper->findById($this->checkIdFromGet());
 }