/** * converts vcard to Addressbook_Model_Contact * * @param \Sabre\VObject\Component|stream|string $blob the vcard to parse * @param Tinebase_Record_Abstract $_record update existing contact * @param array $options array of options * @return Addressbook_Model_Contact */ public function toTine20Model($blob, Tinebase_Record_Abstract $_record = null, $options = array()) { $contact = parent::toTine20Model($blob, $_record, $options); $contact['adr_two_countryname'] = $this->_toTine20ParseCountry($contact['adr_two_countryname']); $contact['adr_one_countryname'] = $this->_toTine20ParseCountry($contact['adr_one_countryname']); return $contact; }
/** * (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::toTine20Model() */ public function toTine20Model($_blob, Tinebase_Record_Abstract $_record = null, $options = array()) { $contact = parent::toTine20Model($_blob, $_record, $options); Tinebase_Core::getLogger()->warn(__METHOD__ . '::' . __LINE__ . ' contact (RAW) ' . print_r($_blob, true)); Tinebase_Core::getLogger()->warn(__METHOD__ . '::' . __LINE__ . ' tine20 contact ' . print_r($contact->toArray(), true)); 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; }
/** * Updates the VCard-formatted object * * @param string $cardData * @throws DAV\Exception\Forbidden * @return string */ public function put($cardData) { if (get_class($this->_converter) == 'Addressbook_Convert_Contact_VCard_Generic') { if (Tinebase_Core::isLogLevel(Zend_Log::WARN)) { Tinebase_Core::getLogger()->warn(__METHOD__ . '::' . __LINE__ . " update by generic client not allowed. See Addressbook_Convert_Contact_VCard_Factory for supported clients."); } throw new DAV\Exception\Forbidden('Update denied for unknow client'); } $contact = $this->_converter->toTine20Model($cardData, $this->getRecord(), array(Addressbook_Convert_Contact_VCard_Abstract::OPTION_USE_SERVER_MODLOG => true)); try { $this->_contact = Addressbook_Controller_Contact::getInstance()->update($contact, false); } catch (Tinebase_Exception_AccessDenied $tead) { Tinebase_Exception::log($tead); throw new DAV\Exception\Forbidden('Access denied'); } $this->_vcard = null; return $this->getETag(); }
/** * (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; }