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); } }
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; } }
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(); } }
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'); } } } }
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; }
private function initContactWithCheckedId(C3op_Register_ContactMapper $mapper) { return $mapper->findById($this->checkIdFromGet()); }