예제 #1
0
 public function getCalls()
 {
     $sql = sprintf("SELECT * FROM %s.%s AS a RIGHT JOIN %s AS b ON (a.contact_id = b.id_contact)", DB_CTCRM, 'calls', 'contacts');
     $calls = $this->handler->getAll($sql);
     $callDtoArray = array();
     foreach ($calls as $call) {
         $contact = new ContactDto();
         $contact->setId($call['contact_id']);
         $contact->setCompanyId($call['company_id']);
         $contact->setContactGroupId($call['contact_group_id']);
         $contact->setContactTitleId($call['contact_title_id']);
         $contact->setFirstName($call['first_name']);
         $contact->setLastName($call['last_name']);
         $contact->setEmail($call['email']);
         $contact->setInfo($call['info']);
         $callDto = new CallDto();
         $callDto->setId($call['id']);
         $callDto->setContact($contact);
         $callDto->setDirection($call['direction']);
         $callDto->setNumberId($call['number_id']);
         $callDto->setState($call['state']);
         $callDto->setTimestamp($call['timestamp']);
         $callDto->setNote($call['note']);
         $callDtoArray[] = $callDto;
     }
     return json_encode($callDtoArray, JSON_UNESCAPED_UNICODE | JSON_PRETTY_PRINT);
 }
예제 #2
0
 private function createContactDto(array $contact, $numbersList)
 {
     $contactDto = new ContactDto();
     $contactDto->setId($contact['id']);
     $contactDto->setContactTitleId($contact['contact_title_id']);
     $contactDto->setFirstName($contact['first_name']);
     $contactDto->setLastName($contact['last_name']);
     $contactDto->setEmail($contact['email']);
     $contactDto->setContactGroupId($contact['contact_group_id']);
     $contactDto->setCompanyId($contact['company_name']);
     $contactDto->setInfo($contact['info']);
     $contactDto->setNumberList($numbersList);
     return $contactDto;
 }