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

46 lines
1018 B

9 years ago
<?php
/* For licensing terms, see /license.txt */
use JeroenDesloovere\VCard\VCard;
9 years ago
/**
* 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
api_block_anonymous_users();
9 years ago
if (isset($_REQUEST['userId'])) {
$userId = intval($_REQUEST['userId']);
} else {
api_not_allowed(true);
9 years ago
}
// Return User Info to vCard Export
9 years ago
$userInfo = api_get_user_info($userId, true, false, true);
if (empty($userInfo)) {
api_not_allowed(true);
}
// Pre-Loaded User Info
9 years ago
$language = get_lang('Language').': '.$userInfo['language'];
// Instance the vCard Class
9 years ago
$vcard = new VCard();
// Adding the User Info to the vCard
$vcard->addName($userInfo['firstname'], $userInfo['lastname']);
if (api_get_setting('show_email_addresses') == 'true') {
$vcard->addEmail($userInfo['email']);
}
$vcard->addPhoneNumber($userInfo['phone'], 'CELL');
9 years ago
$vcard->addNote($language);
// Generate the vCard
9 years ago
return $vcard->download();