當前位置: 首頁>>代碼示例>>PHP>>正文


PHP vCal::addProperty方法代碼示例

本文整理匯總了PHP中vCal::addProperty方法的典型用法代碼示例。如果您正苦於以下問題:PHP vCal::addProperty方法的具體用法?PHP vCal::addProperty怎麽用?PHP vCal::addProperty使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在vCal的用法示例。


在下文中一共展示了vCal::addProperty方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的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: vCal

<?php

loader_import('siteevent.Event');
loader_import('saf.Date');
loader_import('saf.Date.vCalendar');
if (!isset($parameters['limit'])) {
    $parameters['limit'] = 50;
}
$e = new SiteEvent_Event();
$list = $e->getUpcoming($parameters['limit'], $parameters['category'], $parameters['audience']);
$cal = new vCal();
$cal->addProperty('METHOD', 'PUBLISH');
$cal->addProperty('CALSCALE', 'GREGORIAN');
$cal->addProperty('PRODID', '-//SIMIAN systems//NONSGML SiteEvent//EN');
$cal->addProperty('VERSION', '2.0');
foreach (array_keys($list) as $k) {
    $item =& $list[$k];
    $e =& $cal->addEvent('VEVENT');
    $e->addProperty('UID', site_domain() . '/siteevent/' . $item->id);
    $e->addProperty('SEQUENCE', $k + 1);
    $p =& $e->addProperty('URL', 'http://' . site_domain() . site_prefix() . '/index/siteevent-details-action/id.' . $item->id . '/title.' . siteevent_filter_link_title($item->title));
    $p->addParameter('VALUE', 'URI');
    $e->addProperty('STATUS', 'CONFIRMED');
    if ($item->time && $item->time > '00:00:00') {
        $e->addProperty('DTSTART', Date::timestamp($item->date . ' ' . $item->time, 'Ymd\\THis'));
    } else {
        $p =& $e->addProperty('DTSTART', Date::format($item->date, 'Ymd'));
        $p->addParameter('VALUE', 'DATE');
    }
    if ($item->until_date && $item->until_date > '0000-00-00') {
        if ($item->until_time && $item->until_time > '00:00:00') {
開發者ID:vojtajina,項目名稱:sitellite,代碼行數:31,代碼來源:index.php

示例3: die

<?php

$user = db_single('select * from sitellite_user where username = ?', $parameters['user']);
if (!$user) {
    die('User not found');
}
loader_import('saf.Date.vCalendar');
$card = new vCal();
$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)) {
開發者ID:vojtajina,項目名稱:sitellite,代碼行數:31,代碼來源:index.php


注:本文中的vCal::addProperty方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。