Exemple #1
0
<?php

/* $Id$ $URL$ */
if (!defined('W2P_BASE_DIR')) {
    die('You should not access this file directly.');
}
// get GETPARAMETER for contact_id
$contact_id = (int) w2PgetParam($_GET, 'contact_id', 0);
$canRead = $perms->checkModule('contacts', 'view');
if (!$canRead) {
    $AppUI->redirect('m=public&a=access_denied');
}
if ($contact_id) {
    $contact = new CContact();
    $contact->loadFull($AppUI, $contact_id);
    // include PEAR vCard class
    require_once $AppUI->getLibraryClass('PEAR/Contact_Vcard_Build');
    // instantiate a builder object
    // (defaults to version 3.0)
    $vcard = new Contact_Vcard_Build();
    // set a formatted name
    $vcard->setFormattedName($contact->contact_first_name . ' ' . $contact->contact_last_name);
    // set the structured name parts
    $vcard->setName($contact->contact_last_name, $contact->contact_first_name, $contact->contact_type, $contact->contact_title, '');
    // set the source of the vCard
    $vcard->setSource($w2Pconfig['company_name'] . ' ' . $w2Pconfig['page_title'] . ': ' . $w2Pconfig['site_domain']);
    // set the birthday of the contact
    $vcard->setBirthday($contact->contact_birthday);
    // set a note of the contact
    $contact->contact_notes = mb_str_replace("\r", ' ', $contact->contact_notes);
    $vcard->setNote($contact->contact_notes);
<?php

if (!defined('W2P_BASE_DIR')) {
    die('You should not access this file directly.');
}
// @todo    convert to template
// get GETPARAMETER for contact_id
$contact_id = (int) w2PgetParam($_GET, 'contact_id', 0);
$canRead = canView('contacts');
if (!$canRead) {
    $AppUI->redirect(ACCESS_DENIED);
}
if ($contact_id) {
    $contact = new CContact();
    $contact->loadFull(null, $contact_id);
    $contactMethods = $contact->getContactMethods();
    // instantiate a builder object
    // (defaults to version 3.0)
    $vcard = new Contact_Vcard_Build();
    // set a formatted name
    $vcard->setFormattedName($contact->contact_display_name);
    // set the structured name parts
    $vcard->setName($contact->contact_last_name, $contact->contact_first_name, $contact->contact_type, $contact->contact_title, '');
    // set the source of the vCard
    $vcard->setSource($w2Pconfig['company_name'] . ' ' . $w2Pconfig['page_title'] . ': ' . $w2Pconfig['site_domain']);
    // set the birthday of the contact
    $vcard->setBirthday($contact->contact_birthday);
    // set a note of the contact
    $contact->contact_notes = mb_str_replace("\r", ' ', $contact->contact_notes);
    $vcard->setNote($contact->contact_notes);
    // add an organization