Chamilo is a learning management system focused on ease of use and accessibility
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
chamilo-lms/main/social/vcard_export.php

43 lines
978 B

9 years ago
<?php
/* For licensing terms, see /license.txt */
/**
* VCard Generator
* @package chamilo.social
9 years ago
* @author José Loguercio Silva <jose.loguercio@beeznest.com>
*/
require_once __DIR__.'/../inc/global.inc.php';
9 years ago
use JeroenDesloovere\VCard\VCard;
api_block_anonymous_users();
9 years ago
if (isset($_REQUEST['userId'])) {
$userId = intval($_REQUEST['userId']);
} else {
api_not_allowed();
9 years ago
}
// Return User Info to vCard Export
9 years ago
$userInfo = api_get_user_info($userId, true, false, true);
// Pre-Loaded User Info
9 years ago
$firstname = $userInfo['firstname'];
$lastname = $userInfo['lastname'];
$email = $userInfo['email'];
$phone = $userInfo['phone'];
$language = get_lang('Language').': '.$userInfo['language'];
// Instance the vCard Class
9 years ago
$vcard = new VCard();
// Adding the User Info to the vCard
9 years ago
$vcard->addName($lastname, $firstname);
$vcard->addEmail($email);
$vcard->addPhoneNumber($phone, 'CELL');
$vcard->addNote($language);
// Generate the vCard
9 years ago
return $vcard->download();