1.10.x
José Loguercio 10 years ago committed by Yannick Warnier
parent d1aa7a96fe
commit b368843d8e
  1. 6
      app/Resources/public/css/base.css
  2. 22
      main/admin/user_information.php
  3. BIN
      main/img/contact-vcard-icon.png
  4. 11
      main/inc/lib/display.lib.php
  5. 4
      main/inc/lib/social.lib.php
  6. 50
      main/social/vcard_export.php
  7. 6
      main/template/default/social/user_block.tpl

@ -4679,6 +4679,12 @@ i.size-32.icon-new-work{
color: #4d4d4d;
margin-bottom: 0px;
}
.social-avatar .social-avatar-vcard{
font-size: 12px;
padding-top: 2px;
padding-bottom: 2px;
color: #666666;
}
.social-avatar .social-avatar-email,
.social-avatar .social-avatar-chat{
font-size: 12px;

@ -51,6 +51,13 @@ if (api_is_platform_admin()) {
),
api_get_self().'?user_id='.$user['user_id'].'&action=export'
);
$vCardExportLink = Display::url(
Display::return_icon(
'contact-vcard-icon.png', get_lang('Info'),'', ICON_SIZE_MEDIUM
),
api_get_path(WEB_PATH).'main/social/vcard_export.php?userId='.$user['user_id']
);
}
// Show info about who created this user and when
@ -407,13 +414,14 @@ if (isset($_GET['action'])) {
Display::display_header($tool_name);
echo '<div class="actions">
<a href="'.api_get_path(WEB_CODE_PATH).'mySpace/myStudents.php?student='.intval($_GET['user_id']).'" title="'.get_lang('Reporting').'">'.
Display::return_icon('statistics.png', get_lang('Reporting'), '', ICON_SIZE_MEDIUM).'
</a>
'.$login_as_icon.'
'.$editUser.'
'.$exportLink.'
</div>';
<a href="'.api_get_path(WEB_CODE_PATH).'mySpace/myStudents.php?student='.intval($_GET['user_id']).'" title="'.get_lang('Reporting').'">'.
Display::return_icon('statistics.png', get_lang('Reporting'), '', ICON_SIZE_MEDIUM).'
</a>
'.$login_as_icon.'
'.$editUser.'
'.$exportLink.'
'.$vCardExportLink.'
</div>';
echo Display::page_header($tool_name);

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

@ -2071,6 +2071,17 @@ class Display
return $editProfileUrl;
}
/**
* Get the vCard for a user
* @param int $userId The user id
* @return *.*vcf file
*/
public static function getVCardUserLink($userId)
{
$vCardUrl = api_get_path(WEB_PATH).'main/social/vcard_export.php?userId='.intval($userId);;
return $vCardUrl;
}
/**
* @param string $content

@ -1579,12 +1579,16 @@ class SocialManager extends UserManager
if (api_get_user_id() == $userId) {
$profileEditionLink = Display::getProfileEditionLink($userId);
}
$vCardUserLink = Display::getVCardUserLink($userId);
$userInfo = api_get_user_info($userId, true, false, true);
$template->assign('user', $userInfo);
$template->assign('socialAvatarBlock', $socialAvatarBlock);
$template->assign('profileEditionLink', $profileEditionLink);
//Added the link to export the vCard to the Template
$template->assign('vCardUserLink', $vCardUserLink);
if (api_get_setting('gamification_mode') === '1') {
$gamificationPoints = GamificationUtils::getTotalUserPoints(

@ -0,0 +1,50 @@
<?php
/* For licensing terms, see /license.txt */
/**
* VCard Generator
*
* @package chamilo.social
*
* @author José Loguercio Silva <jose.loguercio@beeznest.com>
*/
require_once '../inc/global.inc.php';
require_once api_get_path(WEB_PATH).'vendor/autoload.php';
require_once api_get_path(WEB_PATH).'vendor/jeroendesloovere/vcard/src/VCard.php';
use JeroenDesloovere\VCard\VCard;
parse_str($_SERVER['QUERY_STRING'], $params);
if(isset($params['userId'])) {
$userId = $params['userId'];
}
else {
api_not_allowed();
die();
}
//Return User Info to vCard Export
$userInfo = api_get_user_info($userId, true, false, true);
//Pre-Loaded User Info
$firstname = $userInfo['firstname'];
$lastname = $userInfo['lastname'];
$email = $userInfo['email'];
$phone = $userInfo['phone'];
$language = get_lang('Language').': '.$userInfo['language'];
//Instance the vCard Class
$vcard = new VCard();
//Adding the User Info to the vCard
$vcard->addName($lastname, $firstname);
$vcard->addEmail($email);
$vcard->addPhoneNumber($phone, 'CELL');
$vcard->addNote($language);
//Generate the vCard
return $vcard->download();

@ -5,6 +5,12 @@
<p class="firstname">{{ user.firstname }}</p>
<p class="lastname">{{ user.lastname }}</p>
</div>
<div class="social-avatar-vcard">
<a href="{{ vCardUserLink }}">
<img src="{{ "contacts.png" | icon }}" atl="{{ "Info" | get_lang }}">
{{ "Info" | get_lang }}
</a>
</div>
<div class="social-avatar-email">
<img src="{{ "instant_message.png" | icon }}" atl="{{ "Email" | get_lang }}">
{{ user.email}}

Loading…
Cancel
Save