private function _UpdateGroupsInContact(ContactContainer $contactsContainer) { $IdContact = $contactsContainer->GetValue('IdAddress', 'int'); $groupsArray = $contactsContainer->GetValue('Groups'); if ($IdContact > 0) { $this->_executeSql($this->_commandCreator->RemoveContactFromGroups($IdContact)); if ($groupsArray && is_array($groupsArray) && count($groupsArray) > 0) { foreach ($groupsArray as $groupContainer) { $IdGroup = $groupContainer->GetValue('GroupId', 'int'); if ($IdGroup > 0) { $this->_AddContactToGroup($IdContact, $IdGroup); } } } } return true; }
function UpdateVCardContact(ContactContainer $contactContainer) { $this->_cleanBuffer(); $this->_currentContainer = $contactContainer; $contactId = $contactContainer->GetValue('IdAddress', 'int'); $this->_setStringValueToBuffer('StrId', 'str_id'); $this->_setStringValueToBuffer('FullName', 'fullname'); $this->_setStringValueToBuffer('Notes', 'notes'); $this->_setStringValueToBuffer('HomeEmail', 'h_email'); $this->_setStringValueToBuffer('HomeStreet', 'h_street'); $this->_setStringValueToBuffer('HomeCity', 'h_city'); $this->_setStringValueToBuffer('HomeState', 'h_state'); $this->_setStringValueToBuffer('HomeZip', 'h_zip'); $this->_setStringValueToBuffer('HomeCountry', 'h_country'); $this->_setStringValueToBuffer('HomePhone', 'h_phone'); $this->_setStringValueToBuffer('HomeFax', 'h_fax'); $this->_setStringValueToBuffer('HomeMobile', 'h_mobile'); $this->_setStringValueToBuffer('HomeWeb', 'h_web'); $this->_setStringValueToBuffer('BusinessEmail', 'b_email'); $this->_setStringValueToBuffer('BusinessCompany', 'b_company'); $this->_setStringValueToBuffer('BusinessStreet', 'b_street'); $this->_setStringValueToBuffer('BusinessCity', 'b_city'); $this->_setStringValueToBuffer('BusinessState', 'b_state'); $this->_setStringValueToBuffer('BusinessZip', 'b_zip'); $this->_setStringValueToBuffer('BusinessCountry', 'b_country'); $this->_setStringValueToBuffer('BusinessJobTitle', 'b_job_title'); $this->_setStringValueToBuffer('BusinessDepartment', 'b_department'); $this->_setStringValueToBuffer('BusinessOffice', 'b_office'); $this->_setStringValueToBuffer('BusinessPhone', 'b_phone'); $this->_setStringValueToBuffer('BusinessFax', 'b_fax'); $this->_setStringValueToBuffer('BusinessWeb', 'b_web'); $this->_setStringValueToBuffer('OtherEmail', 'other_email'); $this->_setIntValueToBuffer('BirthdayDay', 'birthday_day'); $this->_setIntValueToBuffer('BirthdayMonth', 'birthday_month'); $this->_setIntValueToBuffer('BirthdayYear', 'birthday_year'); $this->_setStringValueToBuffer('DateModified', 'date_modified'); $dateModified = $contactContainer->GetValue('DateModified'); $dateModified = $this->convertInsertDate($dateModified); $this->_setValueToBuffer('date_modified', $dateModified); if (count($this->_buffer) > 0) { $sql = "UPDATE %sawm_addr_book SET %s WHERE id_addr = %d"; $sql = sprintf($sql, $this->_dbPrefix, implode(', ', $this->_buffer), $contactId); return $sql; } return new ContactCommandCreatorException(self::ERR_MSG_SQL_UPDATE_CONTACT, self::ERR_NO_SQL_UPDATE_CONTACT); }