/** * return vcard and convert Addressbook_Model_Contact to vcard if needed * * @return string */ protected function _getVCard() { if ($this->_vcard == null) { $this->_vcard = $this->_converter->fromTine20Model($this->getRecord()); } return $this->_vcard->serialize(); }
/** * (non-PHPdoc) * @see Addressbook_Convert_Contact_VCard_Abstract::_toTine20ModelParseTel() */ protected function _toTine20ModelParseTel(&$data, \Sabre\VObject\Property $property) { if (!isset($property['TYPE'])) { // CardDAVSync sends OTHER just as TEL:12345678 without any TYPE $data['tel_other'] = $property->getValue(); } parent::_toTine20ModelParseTel($data, $property); }
/** * (non-PHPdoc) * @see Addressbook_Convert_Contact_VCard_Abstract::toTine20Model() */ public function toTine20Model($_blob, Tinebase_Record_Abstract $_record = null, $options = array()) { $contact = parent::toTine20Model($_blob, $_record, $options); if (!empty($contact->url)) { $contact->url = strtr($contact->url, array('http\\:' => 'http:')); } if (!empty($contact->url_home)) { $contact->url_home = strtr($contact->url_home, array('http\\:' => 'http:')); } return $contact; }
/** * (non-PHPdoc) * @see Addressbook_Convert_Contact_VCard_Abstract::_toTine20ModelParseTel() */ protected function _toTine20ModelParseTel(&$data, \Sabre\VObject\Property $property) { $telField = null; if (isset($property['TYPE'])) { // CELL if ($property['TYPE']->has('cell') && $property['TYPE']->has('voice') && !$property['TYPE']->has('iphone')) { $telField = 'tel_cell'; } elseif ($property['TYPE']->has('cell') && $property['TYPE']->has('iphone')) { $telField = 'tel_cell_private'; } } if (!empty($telField)) { $data[$telField] = $property->getValue(); } else { parent::_toTine20ModelParseTel($data, $property); } }
/** * (non-PHPdoc) * @see Addressbook_Convert_Contact_VCard_Abstract::_toTine20ModelParseTel() */ protected function _toTine20ModelParseTel(&$data, \Sabre\VObject\Property $property) { parent::_toTine20ModelParseTel($data, $property); $telfield = null; if (isset($property['TYPE'])) { // CELL if ($property['TYPE']->has('cell')) { if ($property['TYPE']->has('work')) { $telField = 'tel_cell'; } else { // this will map TEL;TYPE=CELL;TYPE=PREF: to private mobile; point of discussion whether this is private or work. $telField = 'tel_cell_private'; } // PAGER } elseif ($property['TYPE']->has('pager')) { $telField = 'tel_pager'; // FAX } elseif ($property['TYPE']->has('fax')) { if ($property['TYPE']->has('work')) { $telField = 'tel_fax'; } elseif ($property['TYPE']->has('home')) { $telField = 'tel_fax_home'; } // HOME } elseif ($property['TYPE']->has('home')) { $telField = 'tel_home'; // WORK } elseif ($property['TYPE']->has('work')) { $telField = 'tel_work'; // CAR } elseif ($property['TYPE']->has('car')) { // not yet supported by CalkDAVSynchronizer $telField = 'tel_car'; // ASSISTENT } elseif ($property['TYPE']->has('assistant')) { // not yet supported by CalDAVSynchronizer $telField = 'tel_assistent'; } else { // OTHER $telField = 'other'; } } if (!empty($telField)) { $data[$telField] = $property->getValue(); } }
/** * (non-PHPdoc) * @see Addressbook_Convert_Contact_VCard_Abstract::toTine20Model() */ public function toTine20Model($blob, Tinebase_Record_Abstract $_record = null, $options = array()) { $vcard = self::getVObject($blob); $contact = parent::toTine20Model($blob, $_record, $options); foreach ($vcard->children() as $property) { switch ($property->name) { case 'X-KADDRESSBOOK-X-AssistantsName': $contact->assistent = $property->getValue(); break; default: if (Tinebase_Core::isLogLevel(Zend_Log::DEBUG)) { Tinebase_Core::getLogger()->debug(__METHOD__ . '::' . __LINE__ . ' cardData ' . $property->name); } break; } } return $contact; }
protected function _toTine20ModelParseTel(&$data, $property) { $telField = null; $types = array(); if (isset($property['TYPE'])) { // get all types foreach ($property['TYPE'] as $typeProperty) { $types[] = strtoupper($typeProperty->value); } // CELL if (in_array('CELL', $types) && in_array('VOICE', $types) && !in_array('IPHONE', $types)) { $telField = 'tel_cell'; } elseif (in_array('CELL', $types) && in_array('IPHONE', $types)) { $telField = 'tel_cell_private'; } } if (!empty($telField)) { $data[$telField] = $property->value; } else { parent::_toTine20ModelParseTel($data, $property); } }
/** * parse telephone * * @param array $data * @param \Sabre\VObject\Property $property */ protected function _toTine20ModelParseTel(&$data, \Sabre\VObject\Property $property) { parent::_toTine20ModelParseTel($data, $property); if ($property['TYPE']->has('other')) { $data['tel_cell_private'] = $property->getValue(); } }
/** * (non-PHPdoc) * @see Addressbook_Convert_Contact_VCard_Abstract::_toTine20ModelParseTel() */ protected function _toTine20ModelParseTel(&$data, \Sabre\VObject\Property $property) { $telField = null; if (isset($property['TYPE'])) { // CELL if ($property['TYPE']->has('cell')) { $telField = 'tel_cell'; } elseif ($property['TYPE']->has('other')) { $telField = 'tel_cell_private'; // TEL } elseif ($property['TYPE']->has('work') && $property['TYPE']->has('voice')) { $telField = 'tel_work'; } elseif ($property['TYPE']->has('home') && $property['TYPE']->has('voice')) { $telField = 'tel_home'; // FAX } elseif ($property['TYPE']->has('work') && $property['TYPE']->has('fax')) { $telField = 'tel_fax'; } elseif ($property['TYPE']->has('home') && $property['TYPE']->has('fax')) { $telField = 'tel_fax_home'; } } if (!empty($telField)) { $data[$telField] = $property->getValue(); } else { parent::_toTine20ModelParseTel($data, $property); } }