当前位置: 首页>>代码示例>>PHP>>正文


PHP vCal::unfold方法代码示例

本文整理汇总了PHP中vCal::unfold方法的典型用法代码示例。如果您正苦于以下问题:PHP vCal::unfold方法的具体用法?PHP vCal::unfold怎么用?PHP vCal::unfold使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在vCal的用法示例。


在下文中一共展示了vCal::unfold方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: 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());
    }
开发者ID:vojtajina,项目名称:sitellite,代码行数:58,代码来源:User.php

示例2: 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;
开发者ID:vojtajina,项目名称:sitellite,代码行数:31,代码来源:index.php


注:本文中的vCal::unfold方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。