mirror of
https://github.com/the-djmaze/snappymail.git
synced 2026-09-08 08:57:03 +03:00
CardDAV first look
This commit is contained in:
parent
c031a946e8
commit
7648000521
217 changed files with 31899 additions and 12 deletions
|
|
@ -2,6 +2,8 @@
|
|||
|
||||
namespace RainLoop\Providers\PersonalAddressBook\Classes;
|
||||
|
||||
use RainLoop\Providers\PersonalAddressBook\Enumerations\PropertyType;
|
||||
|
||||
class Contact
|
||||
{
|
||||
/**
|
||||
|
|
@ -115,4 +117,56 @@ class Contact
|
|||
|
||||
return \array_unique($aResult);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function ToVCardObject()
|
||||
{
|
||||
$oVCard = new \Sabre\VObject\Component\VCard('VCARD');
|
||||
|
||||
$oVCard->VERSION = '3.0';
|
||||
$oVCard->PRODID = '-//RainLoop//'.APP_VERSION.'//EN';
|
||||
|
||||
$sFirstName = $sSurName = '';
|
||||
foreach ($this->Properties as /* @var $oProperty \RainLoop\Providers\PersonalAddressBook\Classes\Property */ &$oProperty)
|
||||
{
|
||||
if ($oProperty)
|
||||
{
|
||||
switch ($oProperty->Type)
|
||||
{
|
||||
case PropertyType::FULLNAME:
|
||||
$oVCard->FN = $oProperty->Value;
|
||||
break;
|
||||
case PropertyType::NICK:
|
||||
$oVCard->NICKNAME = $oProperty->Value;
|
||||
break;
|
||||
case PropertyType::FIRST_NAME:
|
||||
$sFirstName = $oProperty->Value;
|
||||
break;
|
||||
case PropertyType::SUR_NAME:
|
||||
$sSurName = $oProperty->Value;
|
||||
break;
|
||||
}
|
||||
|
||||
if (PropertyType::FULLNAME === $oProperty->Type)
|
||||
{
|
||||
$oVCard->FN = $oProperty->Value;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$oVCard->UID = ((string) $this->IdContact).'.vcf';
|
||||
|
||||
// $oVCard->N = array(
|
||||
// $sSurName,
|
||||
// $sFirstName,
|
||||
// '',
|
||||
// '',
|
||||
// '',
|
||||
// ''
|
||||
// );
|
||||
|
||||
return $oVCard;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue