protected function _initContainerField() { parent::_initContainerField(); $this->_container['GroupId'] = null; $this->_container['GroupStrId'] = null; $this->_container['GroupName'] = null; unset($this->_container['Groups']); }
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); }
/** * * @param <type> $fnContactContainer * @return <type> */ private function ConvertFunambolToWMContactContainer(&$fnContactContainer, $user_id, $updateDate = FALSE) { $wmContactContainer = new ContactContainer(); $wmContactContainer->SetValue('IdUser', $user_id); $wmContactContainer->SetValue('FunambolContactId', $fnContactContainer->GetValue('id')); $wmContactContainer->SetValue('Title', $fnContactContainer->GetValue('title')); $subject = $fnContactContainer->GetValue('subject'); if (empty($subject)) { $fname = $fnContactContainer->GetValue('first_name'); if (is_null($fname)) { $fname = ''; } $lname = $fnContactContainer->GetValue('last_name'); if (is_null($lname)) { $lname = ''; } $wmContactContainer->SetValue('FullName', $fname . ' ' . $lname); } else { $wmContactContainer->SetValue('FullName', $subject); } if ($fnContactContainer->GetValue('status') == FUNAMBOL_STATUS_DELETED) { $wmContactContainer->SetValue('Deleted', 1); } else { $wmContactContainer->SetValue('Deleted', 0); } $wmContactContainer->SetValue('FirstName', $fnContactContainer->GetValue('first_name')); $wmContactContainer->SetValue('SurName', $fnContactContainer->GetValue('last_name')); $wmContactContainer->SetValue('NickName', $fnContactContainer->GetValue('nickname')); $wmContactContainer->SetValue('Notes', $fnContactContainer->GetValue('body')); $wmContactContainer->SetValue('UseFriendlyName', 1); $wmContactContainer->SetValue('HomeStreet', $fnContactContainer->GetValue('HomeStreet')); $wmContactContainer->SetValue('HomeCity', $fnContactContainer->GetValue('HomeCity')); $wmContactContainer->SetValue('HomeState', $fnContactContainer->GetValue('HomeState')); $wmContactContainer->SetValue('HomeZip', $fnContactContainer->GetValue('HomeZip')); $wmContactContainer->SetValue('HomeCountry', $fnContactContainer->GetValue('HomeCountry')); $wmContactContainer->SetValue('HomePhone', $fnContactContainer->GetValue('HomePhone')); $wmContactContainer->SetValue('HomeFax', $fnContactContainer->GetValue('HomeFax')); $wmContactContainer->SetValue('HomeMobile', $fnContactContainer->GetValue('HomeMobile')); $wmContactContainer->SetValue('HomeEmail', $fnContactContainer->GetValue('HomeEmail')); $wmContactContainer->SetValue('HomeWeb', $fnContactContainer->GetValue('HomeWeb')); $wmContactContainer->SetValue('BusinessEmail', $fnContactContainer->GetValue('BusinessEmail')); $wmContactContainer->SetValue('BusinessCompany', $fnContactContainer->GetValue('company')); $wmContactContainer->SetValue('BusinessStreet', $fnContactContainer->GetValue('BusinessStreet')); $wmContactContainer->SetValue('BusinessCity', $fnContactContainer->GetValue('BusinessCity')); $wmContactContainer->SetValue('BusinessState', $fnContactContainer->GetValue('BusinessState')); $wmContactContainer->SetValue('BusinessZip', $fnContactContainer->GetValue('BusinessZip')); $wmContactContainer->SetValue('BusinessCountry', $fnContactContainer->GetValue('BusinessCountry')); $wmContactContainer->SetValue('BusinessJobTitle', $fnContactContainer->GetValue('job_title')); $wmContactContainer->SetValue('BusinessDepartment', $fnContactContainer->GetValue('department')); $wmContactContainer->SetValue('BusinessOffice', $fnContactContainer->GetValue('office_location')); $wmContactContainer->SetValue('BusinessPhone', $fnContactContainer->GetValue('BusinessPhone')); // $wmContactContainer->SetValue('BusinessMobile'); $wmContactContainer->SetValue('BusinessFax', $fnContactContainer->GetValue('BusinessFax')); // $wmContactContainer->SetValue('BusinessWeb',); $wmContactContainer->SetValue('OtherEmail', $fnContactContainer->GetValue('OtherEmail')); // $wmContactContainer->SetValue('PrimaryEmail',); // $this->_container['IdPreviousAddress'] = null; // $this->_container['Temp'] = null; if (strlen($fnContactContainer->GetValue('birthday')) >= 10) { // we have sufficient length $ts = strtotime($fnContactContainer->GetValue('birthday')); $wmContactContainer->SetValue('BirthdayDay', date('d', $ts)); // 01 through 31 $wmContactContainer->SetValue('BirthdayMonth', date('m', $ts)); // 01 through 12 $wmContactContainer->SetValue('BirthdayYear', date('Y', $ts)); // 2010 } else { // birthday looks like bad } if ($updateDate) { // as seconds from Epoch $fnTimestampModified = $this->ConvertFNtoWMTimestamp($fnContactContainer->GetValue('last_update'), TRUE); $fnDateModified = date('Y-m-d H:i:s', $fnTimestampModified); $wmContactContainer->SetValue('DateCreated', $fnDateModified); //FIXIT $wmContactContainer->SetValue('DateModified', $fnDateModified); } else { //$wmContactContainer->_container['DateCreated'] = null; //$wmContactContainer->_container['DateModified'] = null; } return $wmContactContainer; }