Example #1
0
 function CarteIndividu($individu)
 {
     $v = new vCard();
     $acl = Zend_Registry::get('acl');
     $ind = Zend_Registry::get('user');
     if ($acl->isAllowed($ind, $individu, 'fiche')) {
         $v->setName($individu->nom, $individu->prenom);
         if ($individu->naissance) {
             $v->setBirthday($individu->naissance);
         }
         $t0 = explode("\n", $individu->adresse);
         $t0 = array_pad($t0, 3, '');
         list($adresse, $ville, $pays) = $t0;
         if (preg_match("`(\\d{5}) (.*)`", $ville, $res)) {
             $v->setAddress("", "", $adresse, $res[2], "", $res[1], $pays);
         }
         $v->setPhoneNumber($individu->fixe, "HOME");
         $v->setPhoneNumber($individu->portable, "CELL");
         if ($photo = $individu->getCheminImage()) {
             $v->setPhoto('jpeg', file_get_contents($photo));
         }
         $v->setEmail($individu->adelec);
         $v->setURL($this->view->urlIndividu($individu, 'fiche', 'individus', true, true));
     } else {
         $v->setName($individu->getName());
         $v->setBirthday(substr($individu->naissance, 0, 4));
     }
     array_push($this->view->vcards, $v);
 }
Example #2
0
 function testVCard2()
 {
     $vCard = new vCard();
     $vCard->setOrganization('Testing, Inc.');
     $vCard->setName('Smith', 'John', 'J.', 'Mr.', 'Jr.');
     $vCard->setEmail('*****@*****.**');
     $vCard->setPhoneNumber('612-555-3000', 'CELL');
     $vCard->setTitle('Senior Tester');
     $vCard->setAddress('555 Testing Dr', 'Suite 100', 'Testertown', 'TN', '12345', '', 'USA', '', 'HOME');
     $vCard->setNote('Test note.');
     $vCard->setURL('http://www.slashdot.org');
     $output = trim($vCard->getVCard());
     $outputLines = explode("\n", $output);
     $outputLines = array_map('trim', $outputLines);
     $this->assertIdentical($outputLines[0], 'BEGIN:VCARD');
     $this->assertIdentical($outputLines[1], 'VERSION:2.1');
     $this->assertIdentical($outputLines[2], 'ORG;ENCODING=QUOTED-PRINTABLE:Testing, Inc.');
     $this->assertIdentical($outputLines[3], 'N:Smith;John;J.;Mr.;Jr.');
     $this->assertIdentical($outputLines[4], 'FN:Mr. John J. Smith Jr.');
     $this->assertIdentical($outputLines[5], 'EMAIL;INTERNET:test@testerson.org');
     $this->assertIdentical($outputLines[6], 'TEL;CELL:612-555-3000');
     $this->assertIdentical($outputLines[7], 'TITLE;ENCODING=QUOTED-PRINTABLE:Senior Tester');
     $this->assertIdentical($outputLines[8], 'ADR;HOME;ENCODING=QUOTED-PRINTABLE:;Suite 100;555 Testing Dr;Testertown;TN;12345;USA');
     $this->assertIdentical($outputLines[9], 'ORG;ENCODING=QUOTED-PRINTABLE:Test note.');
     $this->assertIdentical($outputLines[10], 'URL:http://www.slashdot.org');
     /* Test revision timestamp. */
     $this->assertPatternIn('/^REV:\\d{8}T\\d{6}$/', $outputLines[11]);
     $currentREVNumeric = date('YmdHis');
     $vCardREVNumeric = preg_replace('/REV:|T/', '', $outputLines[11]);
     $this->assertTrue($vCardREVNumeric >= $currentREVNumeric - 5 && $vCardREVNumeric <= $currentREVNumeric + 5, 'REV is within +/-5 seconds of current timestamp');
     $this->assertIdentical($outputLines[12], 'MAILER:CATS');
     $this->assertIdentical($outputLines[13], 'END:VCARD');
     $this->assertIdentical($vCard->getFilename(), 'John Smith.vcf');
 }
Example #3
0
print_organizations($top_content_parent_id, $content, 0, '', array(), $toc_html);
//Exoprt Forum:
print_resources_forum();
$organizations_str = ob_get_contents();
ob_end_clean();
// end of modified by Cindy Qi Li on Jan 12, 2010
/* append the Organizations and Resources to the imsmanifest */
$imsmanifest_xml .= str_replace(array('{ORGANIZATIONS}', '{GLOSSARY}', '{RESOURCES}', '{TEST_ITEMS}', '{COURSE_TITLE}'), array($organizations_str, $glossary_manifest_xml, $resources, $test_xml_items, $ims_course_title), $ims_template_xml['final']);
// generate the vcard for the instructor/author
$usersDAO = new UsersDAO();
$row = $usersDAO->getUserByID($instructor_id);
//$sql = "SELECT first_name, last_name, email, website, login, phone FROM ".TABLE_PREFIX."members WHERE member_id=$instructor_id";
//$result = mysql_query($sql, $db);
$vcard = new vCard();
if (isset($row)) {
    $vcard->setName($row['last_name'], $row['first_name'], $row['login']);
    $vcard->setEmail($row['email']);
    $vcard->setNote('Originated from an AContent at ' . TR_BASE_HREF . '. See ATutor.ca for additional information.');
    $vcard->setURL($row['website']);
    $imsmanifest_xml = str_replace('{VCARD}', $vcard->getVCard(), $imsmanifest_xml);
} else {
    $imsmanifest_xml = str_replace('{VCARD}', '', $imsmanifest_xml);
}
/* save the imsmanifest.xml file */
$zipfile->add_file($imsmanifest_xml, 'imsmanifest.xml');
/* Commented by Cindy Qi Li on Jan 12, 2010
// AContent does not have glossary and forums (discussion tools)
if ($glossary_xml) {
	$zipfile->create_dir('resources/GlossaryItem/');
	$zipfile->add_file($glossary_xml,  'resources/GlossaryItem/glossary.xml');
}
Example #4
0
 /**
  * Generate vcard for the current user
  **/
 function generateVcard()
 {
     include_once GLPI_ROOT . "/lib/vcardclass/classes-vcard.php";
     // build the Vcard
     $vcard = new vCard();
     if (!empty($this->fields["realname"]) || !empty($this->fields["firstname"])) {
         $vcard->setName($this->fields["realname"], $this->fields["firstname"], "", "");
     } else {
         $vcard->setName($this->fields["name"], "", "", "");
     }
     $vcard->setPhoneNumber($this->fields["phone"], "PREF;WORK;VOICE");
     $vcard->setPhoneNumber($this->fields["phone2"], "HOME;VOICE");
     $vcard->setPhoneNumber($this->fields["mobile"], "WORK;CELL");
     $vcard->setEmail($this->getDefaultEmail());
     $vcard->setNote($this->fields["comment"]);
     // send the  VCard
     $output = $vcard->getVCard();
     $filename = $vcard->getFileName();
     // "xxx xxx.vcf"
     @Header("Content-Disposition: attachment; filename=\"{$filename}\"");
     @Header("Content-Length: " . Toolbox::strlen($output));
     @Header("Connection: close");
     @Header("content-type: text/x-vcard; charset=UTF-8");
     echo $output;
 }
Example #5
0
}
$toc_html = str_replace(array('{TOC}', '{COURSE_PRIMARY_LANGUAGE_CHARSET}', '{COURSE_PRIMARY_LANGUAGE_CODE}'), array($toc_html, $course_language_charset, $course_language_code), $html_toc);
if ($first['content_path']) {
    $first['content_path'] .= '/';
}
$frame = str_replace(array('{COURSE_TITLE}', '{FIRST_ID}', '{PATH}', '{COURSE_PRIMARY_LANGUAGE_CHARSET}', '{COURSE_PRIMARY_LANGUAGE_CODE}'), array($ims_course_title, $first['content_id'], $first['content_path'], $course_language_charset, $course_language_code), $html_frame);
$html_mainheader = str_replace(array('{COURSE_TITLE}', '{COURSE_PRIMARY_LANGUAGE_CHARSET}', '{COURSE_PRIMARY_LANGUAGE_CODE}'), array($ims_course_title, $course_language_charset, $course_language_code), $html_mainheader);
$footer = str_replace(array('{COURSE_PRIMARY_LANGUAGE_CODE}', '{CONTENT_PACKAGE_TITLE}', '{COURSE_PRIMARY_LANGUAGE_CHARSET}', '{CONTENT_PACKAGE_HOW_TO}'), array($course_language_code, _AT('content_package') . ' - ' . $ims_course_title, $course_language_charset, _AT('general_help', AT_GUIDES_PATH . 'index_list.php?lang=' . $_SESSION['lang'])), $footer_html);
/* append the Organizations and Resources to the imsmanifest */
$imsmanifest_xml .= str_replace(array('{ORGANIZATIONS}', '{RESOURCES}', '{COURSE_TITLE}'), array($organizations_str, $resources, $ims_course_title), $ims_template_xml['final']);
/* generate the vcard for the instructor/author */
$sql = "SELECT first_name, last_name, email, website, login, phone FROM %smembers WHERE member_id=%d";
$row_members = queryDB($sql, array(TABLE_PREFIX, $instructor_id), TRUE);
$vcard = new vCard();
if (count($row_members) > 0) {
    $vcard->setName($row_members['last_name'], $row_members['first_name'], $row_members['login']);
    $vcard->setEmail($row_members['email']);
    $vcard->setNote('Originated from an ATutor at ' . AT_BASE_HREF . '. See ATutor.ca for additional information.');
    $vcard->setURL($row_members['website']);
    $imsmanifest_xml = str_replace('{VCARD}', $vcard->getVCard(), $imsmanifest_xml);
} else {
    $imsmanifest_xml = str_replace('{VCARD}', '', $imsmanifest_xml);
}
/* save the imsmanifest.xml file */
$zipfile->add_file($frame, 'index.html');
$zipfile->add_file($toc_html, 'toc.html');
$zipfile->add_file($imsmanifest_xml, 'imsmanifest.xml');
$zipfile->add_file($html_mainheader, 'header.html');
$zipfile->add_file($footer, 'footer.html');
if ($glossary_xml) {
    $zipfile->add_file($glossary_xml, 'glossary.xml');
Example #6
0
 /**
  * Generate the Vcard for the current Contact
  *
  *@return Nothing (display)
  **/
 function generateVcard()
 {
     include GLPI_ROOT . "/lib/vcardclass/classes-vcard.php";
     if (!$this->can($this->fields['id'], READ)) {
         return false;
     }
     // build the Vcard
     $vcard = new vCard();
     $vcard->setName($this->fields["name"], $this->fields["firstname"], "", "");
     $vcard->setPhoneNumber($this->fields["phone"], "PREF;WORK;VOICE");
     $vcard->setPhoneNumber($this->fields["phone2"], "HOME;VOICE");
     $vcard->setPhoneNumber($this->fields["mobile"], "WORK;CELL");
     $addr = $this->GetAddress();
     if (is_array($addr)) {
         $vcard->setAddress($addr["name"], "", $addr["address"], $addr["town"], $addr["state"], $addr["postcode"], $addr["country"], "WORK;POSTAL");
     }
     $vcard->setEmail($this->fields["email"]);
     $vcard->setNote($this->fields["comment"]);
     $vcard->setURL($this->GetWebsite(), "WORK");
     // send the  VCard
     $output = $vcard->getVCard();
     $filename = $vcard->getFileName();
     // "xxx xxx.vcf"
     @Header("Content-Disposition: attachment; filename=\"{$filename}\"");
     @Header("Content-Length: " . Toolbox::strlen($output));
     @Header("Connection: close");
     @Header("content-type: text/x-vcard; charset=UTF-8");
     echo $output;
 }
$id = GETPOST('id', 'int');
// Security check
$result = restrictedArea($user, 'contact', $id, 'socpeople&societe');
$contact = new Contact($db);
$result = $contact->fetch($id);
$physicalperson = 1;
$company = new Societe($db);
if ($contact->socid) {
    $result = $company->fetch($contact->socid);
    //print "ee";
}
// We create VCard
$v = new vCard();
$v->setProdId('Dolibarr ' . DOL_VERSION);
$v->setUid('DOLIBARR-CONTACTID-' . $contact->id);
$v->setName($contact->lastname, $contact->firstname, "", "", "");
$v->setFormattedName($contact->getFullName($langs));
// By default, all informations are for work (except phone_perso and phone_mobile)
$v->setPhoneNumber($contact->phone_pro, "PREF;WORK;VOICE");
$v->setPhoneNumber($contact->phone_mobile, "CELL;VOICE");
$v->setPhoneNumber($contact->fax, "WORK;FAX");
$v->setAddress("", "", $contact->address, $contact->town, "", $contact->zip, $contact->country_code ? $contact->country_id : '', "WORK;POSTAL");
$v->setLabel("", "", $contact->address, $contact->town, "", $contact->zip, $contact->country_code ? $contact->country_id : '', "WORK");
$v->setEmail($contact->email, 'internet,pref');
$v->setNote($contact->note);
$v->setTitle($contact->poste);
// Data from linked company
if ($company->id) {
    $v->setURL($company->url, "WORK");
    if (!$contact->phone_pro) {
        $v->setPhoneNumber($company->phone, "WORK;VOICE");
 function create_vcard($user)
 {
     global $config, $conn;
     require_once $config['basepath'] . '/include/misc.inc.php';
     $misc = new misc();
     require_once $config['basepath'] . '/include/class/vcard/vcard.inc.php';
     $v = new vCard();
     $first = $this->get_user_first_name($user);
     $last = $this->get_user_last_name($user);
     $v->setName($last, $first);
     $sql = 'SELECT userdb_emailaddress FROM ' . $config['lang_table_prefix'] . 'userdb WHERE userdb_id=' . $user;
     $recordSet = $conn->Execute($sql);
     if ($recordSet === false) {
         $misc->log_error($sql);
     }
     $email = $recordSet->fields['userdb_emailaddress'];
     $v->setEmail($email);
     $sql = $sql = "SELECT userdbelements_field_name,userdbelements_field_value FROM " . $config['lang_table_prefix'] . "userdbelements WHERE userdb_id=" . $user;
     $recordSet = $conn->Execute($sql);
     if ($recordSet === false) {
         $misc->log_error($sql);
     }
     while (!$recordSet->EOF) {
         if ($recordSet->fields['userdbelements_field_name'] == $config['vcard_phone']) {
             $phone = $misc->make_db_unsafe($recordSet->fields['userdbelements_field_value']);
             $v->setPhoneNumber($phone, "HOME;VOICE");
         } elseif ($recordSet->fields['userdbelements_field_name'] == $config['vcard_fax']) {
             $fax = $misc->make_db_unsafe($recordSet->fields['userdbelements_field_value']);
             $v->setPhoneNumber($fax, "HOME;FAX");
         } elseif ($recordSet->fields['userdbelements_field_name'] == $config['vcard_mobile']) {
             $mobile = $misc->make_db_unsafe($recordSet->fields['userdbelements_field_value']);
             $v->setPhoneNumber($mobile, "HOME;CELL");
         } elseif ($recordSet->fields['userdbelements_field_name'] == $config['vcard_notes']) {
             $notes = $misc->make_db_unsafe($recordSet->fields['userdbelements_field_value']);
             $v->setNote($notes);
         } elseif ($recordSet->fields['userdbelements_field_name'] == $config['vcard_url']) {
             $url = $misc->make_db_unsafe($recordSet->fields['userdbelements_field_value']);
             $v->setURL($url, "HOME");
         } elseif ($recordSet->fields['userdbelements_field_name'] == $config['vcard_address']) {
             $address = $misc->make_db_unsafe($recordSet->fields['userdbelements_field_value']);
         } elseif ($recordSet->fields['userdbelements_field_name'] == $config['vcard_city']) {
             $city = $misc->make_db_unsafe($recordSet->fields['userdbelements_field_value']);
         } elseif ($recordSet->fields['userdbelements_field_name'] == $config['vcard_state']) {
             $state = $misc->make_db_unsafe($recordSet->fields['userdbelements_field_value']);
         } elseif ($recordSet->fields['userdbelements_field_name'] == $config['vcard_zip']) {
             $zip = $misc->make_db_unsafe($recordSet->fields['userdbelements_field_value']);
         } elseif ($recordSet->fields['userdbelements_field_name'] == $config['vcard_country']) {
             $country = $misc->make_db_unsafe($recordSet->fields['userdbelements_field_value']);
         }
         $v->setAddress("", "", $address, $city, $state, $zip, $country, "HOME;POSTAL");
         $recordSet->MoveNext();
     }
     $output = $v->getVCard();
     echo $output;
     $filename = $v->getFileName();
     Header("Content-Disposition: attachment; filename={$filename}");
     Header("Content-Length: " . strlen($output));
     Header("Connection: close");
     Header("Content-Type: text/x-vCard; name={$filename}");
 }
Example #9
0
<?php

#Application name: PhpCollab
#Status page: 0
#Path by root: ../users/exportuser.php
$export = "true";
$checkSession = "false";
include_once '../includes/library.php';
include "../includes/vcard.class.php";
$tmpquery = "WHERE mem.id = '{$id}'";
$userDetail = new request();
$userDetail->openMembers($tmpquery);
$v = new vCard();
$v->setPhoneNumber($userDetail->mem_phone_work[0]);
$v->setName($userDetail->mem_name[0]);
$v->setTitle($userDetail->mem_title[0]);
$v->setOrganization($userDetail->mem_org_name[0]);
$v->setEmail($userDetail->mem_email_work[0]);
$v->setPhoneNumber($userDetail->mem_phone_work[0], "WORK;VOICE");
$v->setPhoneNumber($userDetail->mem_phone_home[0], "HOME;VOICE");
$v->setPhoneNumber($userDetail->mem_mobile[0], "CELL;VOICE");
$v->setPhoneNumber($userDetail->mem_fax[0], "WORK;FAX");
$output = $v->getVCard();
$filename = $v->getFileName();
Header("Content-Disposition: attachment; filename={$filename}");
Header("Content-Length: " . strlen($output));
Header("Connection: close");
Header("Content-Type: text/x-vCard; name={$filename}");
echo $output;
Example #10
0
Header("Content-Type: text/x-vCard; name=$filename");

echo $output;
?>
*/
$user_id = $_REQUEST['user_id'];
$user_id = mysql_real_escape_string($user_id);
$query = "\tSELECT\n\t\t\t\t\tuser.homenr,\n\t\t\t\t\tuser.mobilnr,\n\t\t\t\t\tuser.scoutname,\n\t\t\t\t\tuser.firstname,\n\t\t\t\t\tuser.surname,\n\t\t\t\t\tuser.birthday,\n\t\t\t\t\tuser.street,\n\t\t\t\t\tuser.zipcode,\n\t\t\t\t\tuser.city,\n\t\t\t\t\tuser.mail\n\t\t\t\tFROM\n\t\t\t\t\tuser,\n\t\t\t\t\tuser as my_user,\n\t\t\t\t\tuser_camp,\n\t\t\t\t\tuser_camp as my_user_camp\n\t\t\t\tWHERE\n\t\t\t\t\tuser.id = {$user_id} AND\n\t\t\t\t\tmy_user.id = {$_user->id} AND\n\t\t\t\t\tmy_user.id = my_user_camp.user_id AND\n\t\t\t\t\tuser.id = user_camp.user_id AND\n\t\t\t\t\tuser_camp.camp_id = my_user_camp.camp_id";
$result = mysql_query($query);
if (mysql_num_rows($result) < 1) {
    die("no result");
}
$user_data = mysql_fetch_assoc($result);
$birthday = new c_date();
$birthday->setDay2000($user_data[birthday]);
$v = new vCard();
$v->setPhoneNumber($user_data[homenr], "PREF;HOME;VOICE");
$v->setPhoneNumber($user_data[mobilnr], "PREF;CELL;VOICE");
$v->setName($user_data[surname], $user_data[firstname], $user_data[scoutname], "");
$v->setBirthday($birthday->getString("Y-m-d"));
$v->setAddress("", "", $user_data[street], $user_data[city], "", $user_data[zipcode], "");
$v->setEmail($user_data[mail]);
$v->setNote("Automatisch generiert auf Basis der Daten von eCamp");
$output = $v->getVCard();
$filename = $v->getFileName();
Header("Content-Disposition: attachment; filename={$filename}");
Header("Content-Length: " . strlen($output));
Header("Connection: close");
Header("Content-Type: text/x-vCard; name={$filename}");
echo $output;
die;
Example #11
0
$sql2 = "SELECT * FROM contacts_titlelist WHERE title_id = '{$contact_title}' LIMIT 1";
$result2 = mysql_query($sql2, $conn) or die(mysql_error());
$array2 = mysql_fetch_array($result2);
$title_name = $array2['title_name'];
// WRAP UP OTHER INFORMATION INTO A NOTE
if ($contact_reference != "") {
    $contact_reference = "Notes:\n" . $contact_reference;
}
$contact_reference = $contact_reference . "\nContact Added to Database:\n" . $contact_added;
//  USAGE EXAMPLE
$v = new vCard();
$v->setPhoneNumber($output_telephone, "TEL;PREF;WORK;VOICE");
$v->setPhoneNumber($contact_telephone_home, "TEL;HOME;VOICE");
$v->setPhoneNumber($output_fax, "TEL;WORK;FAX");
$v->setPhoneNumber($contact_mobile, "TEL;CELL;VOICE");
$v->setName($contact_namesecond, $contact_namefirst, "", "");
$v->setTitle($title_name);
$v->setBirthday("");
$v->setCompany($company_name);
$v->setLabel("", "", $contact_address, $contact_city, "", $contact_postcode);
$v->setAddress("", "", $company_address, $company_city, "", $company_postcode);
$v->setEmail($contact_email);
$v->setNote($contact_reference);
$v->setURL($company_web);
$output = $v->getVCard();
$filename = $v->getFileName();
//Header("Content-Disposition: attachment; filename=$filename");
//Header("Content-Length: ".strlen($output));
//Header("Connection: close");
//Header("Content-Type: text/x-vCard; name=$filename");
echo $output;
Example #12
0
        $text = "BEGIN:VCARD\r\n";
        $text .= "VERSION:2.1\r\n";
        foreach ($this->properties as $key => $value) {
            $text .= "{$key}:{$value}\r\n";
        }
        $text .= "REV:" . date("Y-m-d") . "T" . date("H:i:s") . "Z\r\n";
        $text .= "END:VCARD\r\n";
        return $text;
    }
    function getFileName()
    {
        return $this->filename;
    }
}
return;
//  USAGE EXAMPLE
$v = new vCard();
$v->setPhoneNumber("+49 23 456789", "PREF;HOME;VOICE");
$v->setName("Mustermann", "Thomas", "", "Herr");
$v->setBirthday("1960-07-31");
$v->setAddress("", "", "Musterstrasse 20", "Musterstadt", "", "98765", "Deutschland");
$v->setEmail("*****@*****.**");
$v->setNote("You can take some notes here.\r\nMultiple lines are supported via \\r\\n.");
$v->setURL("http://www.thomas-mustermann.de", "WORK");
$output = $v->getVCard();
$filename = $v->getFileName();
Header("Content-Disposition: attachment; filename={$filename}");
Header("Content-Length: " . strlen($output));
Header("Connection: close");
Header("Content-Type: text/x-vCard; name={$filename}");
echo $output;