info.php 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114
  1. <?php
  2. /* Copyright (C) 2004-2007 Laurent Destailleur <eldy@users.sourceforge.net>
  3. * Copyright (C) 2005-2015 Regis Houssin <regis.houssin@inodbox.com>
  4. *
  5. * This program is free software; you can redistribute it and/or modify
  6. * it under the terms of the GNU General Public License as published by
  7. * the Free Software Foundation; either version 3 of the License, or
  8. * (at your option) any later version.
  9. *
  10. * This program is distributed in the hope that it will be useful,
  11. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  12. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  13. * GNU General Public License for more details.
  14. *
  15. * You should have received a copy of the GNU General Public License
  16. * along with this program. If not, see <https://www.gnu.org/licenses/>.
  17. */
  18. /**
  19. * \file htdocs/user/info.php
  20. * \ingroup core
  21. * \brief Page des informations d'un utilisateur
  22. */
  23. // Load Dolibarr environment
  24. require '../main.inc.php';
  25. require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php';
  26. require_once DOL_DOCUMENT_ROOT.'/core/lib/usergroups.lib.php';
  27. require_once DOL_DOCUMENT_ROOT.'/user/class/user.class.php';
  28. // Load translation files required by page
  29. $langs->load("users");
  30. // Security check
  31. $id = GETPOST('id', 'int');
  32. $ref = GETPOST('ref', 'alpha');
  33. if (!isset($id) || empty($id)) {
  34. accessforbidden();
  35. }
  36. $object = new User($db);
  37. if ($id > 0 || !empty($ref)) {
  38. $result = $object->fetch($id, $ref, '', 1);
  39. $object->getrights();
  40. }
  41. // Security check
  42. $socid = 0;
  43. if ($user->socid > 0) {
  44. $socid = $user->socid;
  45. }
  46. $feature2 = (($socid && $user->hasRight('user', 'self', 'creer')) ? '' : 'user');
  47. $result = restrictedArea($user, 'user', $id, 'user&user', $feature2);
  48. // If user is not user that read and no permission to read other users, we stop
  49. if (($object->id != $user->id) && empty($user->rights->user->user->lire)) {
  50. accessforbidden();
  51. }
  52. /*
  53. * View
  54. */
  55. $form = new Form($db);
  56. $person_name = !empty($object->firstname) ? $object->lastname.", ".$object->firstname : $object->lastname;
  57. $title = $person_name." - ".$langs->trans('Info');
  58. $help_url = '';
  59. llxHeader('', $title, $help_url);
  60. $head = user_prepare_head($object);
  61. $title = $langs->trans("User");
  62. print dol_get_fiche_head($head, 'info', $title, -1, 'user');
  63. $linkback = '';
  64. if ($user->rights->user->user->lire || $user->admin) {
  65. $linkback = '<a href="'.DOL_URL_ROOT.'/user/list.php?restore_lastsearch_values=1">'.$langs->trans("BackToList").'</a>';
  66. }
  67. $morehtmlref = '<a href="'.DOL_URL_ROOT.'/user/vcard.php?id='.$object->id.'&output=file&file='.urlencode(dol_sanitizeFileName($object->getFullName($langs).'.vcf')).'" class="refid" rel="noopener">';
  68. $morehtmlref .= img_picto($langs->trans("Download").' '.$langs->trans("VCard"), 'vcard.png', 'class="valignmiddle marginleftonly paddingrightonly"');
  69. $morehtmlref .= '</a>';
  70. $urltovirtualcard = '/user/virtualcard.php?id='.((int) $object->id);
  71. $morehtmlref .= dolButtonToOpenUrlInDialogPopup('publicvirtualcard', $langs->trans("PublicVirtualCardUrl").' - '.$object->getFullName($langs), img_picto($langs->trans("PublicVirtualCardUrl"), 'card', 'class="valignmiddle marginleftonly paddingrightonly"'), $urltovirtualcard, '', 'nohover');
  72. dol_banner_tab($object, 'id', $linkback, $user->rights->user->user->lire || $user->admin, 'rowid', 'ref', $morehtmlref);
  73. $object->info($id); // This overwrite ->ref with login instead of id
  74. print '<div class="fichecenter">';
  75. print '<div class="underbanner clearboth"></div>';
  76. print '<br>';
  77. dol_print_object_info($object);
  78. print '</div>';
  79. print dol_get_fiche_end();
  80. // End of page
  81. llxFooter();
  82. $db->close();