本文整理匯總了PHP中vCal::write方法的典型用法代碼示例。如果您正苦於以下問題:PHP vCal::write方法的具體用法?PHP vCal::write怎麽用?PHP vCal::write使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類vCal
的用法示例。
在下文中一共展示了vCal::write方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: strtoupper
}
}
$e->addProperty('CATEGORIES', strtoupper($item->category));
$e->addProperty('SUMMARY', $item->title);
$details = strip_tags($item->details);
$details = preg_replace('|[\\r\\n]|s', '\\n', $details);
$e->addProperty('DESCRIPTION', $details);
if (!empty($item->contact_email)) {
$p =& $e->addProperty('ORGANIZER', array('MAILTO', $item->contact_email));
if (!empty($item->contact)) {
$p->addParameter('CN', $item->contact);
}
}
$loc = '';
$concat = '';
foreach (get_object_vars($item) as $k => $v) {
if ($k == 'loc_map') {
continue;
}
if (strpos($k, 'loc_') === 0 && !empty($v)) {
$loc .= $concat . $v;
$concat = ', ';
}
}
if (!empty($loc)) {
$e->addProperty('LOCATION', $loc);
}
}
header('Content-Type: text/calendar');
echo $cal->write();
exit;
示例2: export
function export($user)
{
global $db, $loader;
$row = $db->fetch('
select
*
from
sitellite_user
where
username = ?', $user);
if (!$row) {
$this->error = $db->error;
return false;
}
// build vcard
$loader->import('saf.Date.vCalendar');
$card = new vCal();
$card->tag = 'VCARD';
$card->addProperty('VERSION', '3.0');
$card->addProperty('PRODID', '-//Simian Systems\\, Inc//NONSGML Sitellite CMS ' . SITELLITE_VERSION . '//EN');
if (empty($row->firstname) && empty($row->lastname)) {
// skip name
$card->addProperty('N', $row->username);
} else {
$card->addProperty('N', array($row->firstname, $row->lastname));
$card->addProperty('FN', $row->firstname . ' ' . $row->lastname);
}
if (!empty($row->company)) {
$card->addProperty('ORG', $row->company);
}
if (!empty($row->position)) {
$title =& $card->addProperty('TITLE', $row->position);
$title->addParameter('LANGUAGE', $row->lang);
}
if (!empty($row->email)) {
$card->addProperty('EMAIL', $row->email, array('type' => 'WORK'));
}
if (!empty($row->phone)) {
$card->addProperty('TEL', $row->phone, array('type' => 'WORK'));
}
if (!empty($row->cell)) {
$card->addProperty('TEL', $row->cell, array('type' => 'CELL'));
}
if (!empty($row->fax)) {
$card->addProperty('TEL', $row->fax, array('type' => 'FAX'));
}
if (!empty($row->home)) {
$card->addProperty('TEL', $row->home, array('type' => 'HOME'));
}
if (!empty($row->address1)) {
$card->addProperty('ADR', array('', '', $row->address1, $row->city, $row->province, $row->postal_code, $row->country), array('type' => 'HOME'));
}
if (!empty($row->website)) {
$card->addProperty('URL', $row->website);
}
// write the vcard
return $card->unfold($card->write());
}
示例3: array
$card->tag = 'VCARD';
$card->addProperty('VERSION', '3.0');
$card->addProperty('FN', $user->firstname . ' ' . $user->lastname);
$card->addProperty('N', array($user->lastname, $user->firstname));
if (!empty($user->company)) {
$card->addProperty('ORG', $user->company);
}
if (!empty($user->website)) {
$card->addProperty('URL', $user->website, array('TYPE' => 'WORK'));
}
if (!empty($user->email)) {
$card->addProperty('EMAIL', $user->email, array('PREF' => 'INTERNET'));
}
if (!empty($user->phone)) {
$card->addProperty('TEL', $user->phone, array('TYPE' => 'WORK'));
}
if (!empty($user->cell)) {
$card->addProperty('TEL', $user->cell, array('TYPE' => 'CELL'));
}
if (!empty($user->home)) {
$card->addProperty('TEL', $user->home, array('TYPE' => 'HOME'));
}
if (!empty($user->address1)) {
$card->addProperty('item1.ADR', array($user->address1, $user->address2, $user->city, $user->province, $user->postal_code, $user->country), array('TYPE' => 'WORK'));
}
$card->addProperty('X-SITELLITE', $user->username, array('TYPE' => 'WORK'));
// phone & address info...
header('Content-Type: text/x-vcard');
header('Content-Disposition: attachment; filename="' . $user->firstname . ' ' . $user->lastname . '.vcf');
echo $card->unfold($card->write());
exit;