$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); // add an organization $vcard->addOrganization($contact->company_name); // add dp company id $vcard->setUniqueID($contact->contact_company); // add a phone number $vcard->addTelephone($contact->contact_phone); $vcard->addParam('TYPE', 'PF'); // add a phone number $vcard->addTelephone($contact->contact_phone2); // add a mobile phone number $vcard->addTelephone($contact->contact_mobile); $vcard->addParam('TYPE', 'car'); // add a work email. note that we add the value // first and the param after -- Contact_Vcard_Build // is smart enough to add the param in the correct // place. $vcard->addEmail($contact->contact_email); //$vcard->addParam('TYPE', 'WORK'); $vcard->addParam('TYPE', 'PF');
function vcard($data) { $vcard = new Contact_Vcard_Build(); $vcard->setFormattedName($data["first_name"] . " " . $data["last_name"]); $vcard->setName($data["last_name"], $data["first_name"], NULL, NULL, NULL); if ($data["email"]) { $vcard->addEmail($data['email']); } $address = explode("\n", $data["address"]); $cityregionpost = explode(",", $address[1]); $regionpost = explode(" ", $cityregionpost[1]); $vcard->addAddress(NULL, NULL, $address[0], $cityregionpost[0], $regionpost[0], $regionpost[1], NULL); $vcard->addParam("TYPE", "HOME"); if ($data["work_phone"]) { $vcard->addTelephone($data["work_phone"]); $vcard->addParam("TYPE", "WORK"); } if ($data["home_phone"]) { $vcard->addTelephone($data["home_phone"]); $vcard->addParam("TYPE", "HOME"); } $vcard->setURL($this->config["base_uri"] . "actors/" . $data["mbrid"]); $vcard->setUniqueID($data["barcode_nmbr"]); return $vcard->fetch(); }
$vcard = new Contact_Vcard_Build(); // set a formatted name $vcard->setFormattedName($contacts[0]['contact_first_name'] . ' ' . $contacts[0]['contact_last_name']); // set the structured name parts $vcard->setName($contacts[0]['contact_last_name'], $contacts[0]['contact_first_name'], $contacts[0]['contact_type'], $contacts[0]['contact_title'], ''); // set the source of the vCard $vcard->setSource($dPconfig['company_name'] . ' ' . $dPconfig['page_title'] . ': ' . $dPconfig['site_domain']); // set the birthday of the contact $vcard->setBirthday($contacts[0]['contact_birthday']); // set a note of the contact $contacts[0]['contact_notes'] = str_replace("\r", " ", $contacts[0]['contact_notes']); $vcard->setNote($contacts[0]['contact_notes']); // add an organization $vcard->addOrganization($contacts[0]['company_name']); // add dp company id $vcard->setUniqueID($contacts[0]['contact_company']); // add a phone number $vcard->addTelephone($contacts[0]['contact_phone']); $vcard->addParam('TYPE', 'PF'); // add a phone number $vcard->addTelephone($contacts[0]['contact_phone2']); // add a mobile phone number $vcard->addTelephone($contacts[0]['contact_mobile']); $vcard->addParam('TYPE', 'car'); // add a work email. note that we add the value // first and the param after -- Contact_Vcard_Build // is smart enough to add the param in the correct // place. $vcard->addEmail($contacts[0]['contact_email']); //$vcard->addParam('TYPE', 'WORK'); $vcard->addParam('TYPE', 'PF');
<?php require_once 'Contact_Vcard_Build.php'; require_once "inc/stdLib.php"; include "inc/FirmenLib.php"; $Q = $_GET["Q"] ? $_GET["Q"] : $_POST["Q"]; // instantiate a builder object (defaults to version 3.0) $vcard = new Contact_Vcard_Build(); if ($_GET["pid"]) { include "inc/persLib.php"; $data = getKontaktStamm($_GET["pid"]); //UID $UID = 'P' . $_GET["pid"] . '@' . $_SESSION['mandant']; $vcard->setKey($_GET["pid"]); $vcard->setUniqueID($UID); $vcard->setRevision(date('c')); // set a formatted name $vcard->setFormattedName($data["cp_givenname"] . " " . $data["cp_name"]); // set the structured name parts $prefix = $data["cp_greeting"] ? $data["cp_greeting"] . " " . $data["cp_title"] : $data["cp_title"]; $vcard->setName($data["cp_name"], $data["cp_givenname"], "", $prefix, ""); // add a work email. note that we add the value // first and the param after -- Contact_Vcard_Build // is smart enough to add the param in the correct place. if ($data["cp_email"]) { $vcard->addEmail($data["cp_email"]); $vcard->addParam('TYPE', 'WORK'); $vcard->addParam('TYPE', 'PREF'); } // add a work address $vcard->addAddress('', '', $data["cp_street"], $data["cp_city"], '', $data["cp_zipcode"], $data["cp_country"]);