vcard_export.php 965 B

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. <?php
  2. /* For licensing terms, see /license.txt */
  3. use JeroenDesloovere\VCard\VCard;
  4. /**
  5. * VCard Generator
  6. * @package chamilo.social
  7. * @author José Loguercio Silva <jose.loguercio@beeznest.com>
  8. */
  9. require_once __DIR__.'/../inc/global.inc.php';
  10. api_block_anonymous_users();
  11. if (isset($_REQUEST['userId'])) {
  12. $userId = intval($_REQUEST['userId']);
  13. } else {
  14. api_not_allowed(true);
  15. }
  16. // Return User Info to vCard Export
  17. $userInfo = api_get_user_info($userId, true, false, true);
  18. // Pre-Loaded User Info
  19. $language = get_lang('Language').': '.$userInfo['language'];
  20. // Instance the vCard Class
  21. $vcard = new VCard();
  22. // Adding the User Info to the vCard
  23. $vcard->addName($userInfo['firstname'], $userInfo['lastname']);
  24. if (api_get_setting('show_email_addresses') == 'true') {
  25. $vcard->addEmail($userInfo['email']);
  26. }
  27. $vcard->addPhoneNumber($userInfo['phone'], 'CELL');
  28. $vcard->addNote($language);
  29. // Generate the vCard
  30. return $vcard->download();