dolibarr 18.0.6
info.php
Go to the documentation of this file.
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
25// Load Dolibarr environment
26require '../main.inc.php';
27require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php';
28require_once DOL_DOCUMENT_ROOT.'/core/lib/usergroups.lib.php';
29require_once DOL_DOCUMENT_ROOT.'/user/class/user.class.php';
30
31// Load translation files required by page
32$langs->load("users");
33
34// Security check
35$id = GETPOST('id', 'int');
36$ref = GETPOST('ref', 'alpha');
37
38if (!isset($id) || empty($id)) {
40}
41
42$object = new User($db);
43if ($id > 0 || !empty($ref)) {
44 $result = $object->fetch($id, $ref, '', 1);
45 $object->getrights();
46}
47
48// Security check
49$socid = 0;
50if ($user->socid > 0) {
51 $socid = $user->socid;
52}
53$feature2 = (($socid && $user->hasRight('user', 'self', 'creer')) ? '' : 'user');
54
55$result = restrictedArea($user, 'user', $id, 'user&user', $feature2);
56
57// If user is not user that read and no permission to read other users, we stop
58if (($object->id != $user->id) && empty($user->rights->user->user->lire)) {
60}
61
62
63
64/*
65 * View
66 */
67
68$form = new Form($db);
69
70$person_name = !empty($object->firstname) ? $object->lastname.", ".$object->firstname : $object->lastname;
71$title = $person_name." - ".$langs->trans('Info');
72$help_url = '';
73llxHeader('', $title, $help_url);
74
75$head = user_prepare_head($object);
76
77$title = $langs->trans("User");
78print dol_get_fiche_head($head, 'info', $title, -1, 'user');
79
80
81$linkback = '';
82
83if ($user->rights->user->user->lire || $user->admin) {
84 $linkback = '<a href="'.DOL_URL_ROOT.'/user/list.php?restore_lastsearch_values=1">'.$langs->trans("BackToList").'</a>';
85}
86
87$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">';
88$morehtmlref .= img_picto($langs->trans("Download").' '.$langs->trans("VCard"), 'vcard.png', 'class="valignmiddle marginleftonly paddingrightonly"');
89$morehtmlref .= '</a>';
90
91$urltovirtualcard = '/user/virtualcard.php?id='.((int) $object->id);
92$morehtmlref .= dolButtonToOpenUrlInDialogPopup('publicvirtualcard', $langs->trans("PublicVirtualCardUrl").' - '.$object->getFullName($langs), img_picto($langs->trans("PublicVirtualCardUrl"), 'card', 'class="valignmiddle marginleftonly paddingrightonly"'), $urltovirtualcard, '', 'nohover');
93
94dol_banner_tab($object, 'id', $linkback, $user->rights->user->user->lire || $user->admin, 'rowid', 'ref', $morehtmlref);
95
96
97$object->info($id); // This overwrite ->ref with login instead of id
98
99
100print '<div class="fichecenter">';
101print '<div class="underbanner clearboth"></div>';
102
103print '<br>';
104
105dol_print_object_info($object);
106
107print '</div>';
108
109
110print dol_get_fiche_end();
111
112// End of page
113llxFooter();
114$db->close();
if(!defined('NOREQUIRESOC')) if(!defined( 'NOREQUIRETRAN')) if(!defined('NOTOKENRENEWAL')) if(!defined( 'NOREQUIREMENU')) if(!defined('NOREQUIREHTML')) if(!defined( 'NOREQUIREAJAX')) llxHeader()
Empty header.
Definition wrapper.php:56
llxFooter()
Empty footer.
Definition wrapper.php:70
Class to manage generation of HTML components Only common components must be here.
Class to manage Dolibarr users.
dol_print_object_info($object, $usetable=0)
Show informations on an object TODO Move this into html.formother.
dol_banner_tab($object, $paramid, $morehtml='', $shownav=1, $fieldid='rowid', $fieldref='ref', $morehtmlref='', $moreparam='', $nodbprefix=0, $morehtmlleft='', $morehtmlstatus='', $onlybanner=0, $morehtmlright='')
Show tab footer of a card.
dol_get_fiche_head($links=array(), $active='', $title='', $notab=0, $picto='', $pictoisfullpath=0, $morehtmlright='', $morecss='', $limittoshow=0, $moretabssuffix='', $dragdropfile=0)
Show tabs of a record.
dolButtonToOpenUrlInDialogPopup($name, $label, $buttonstring, $url, $disabled='', $morecss='classlink button bordertransp', $jsonopen='', $backtopagejsfields='', $accesskey='')
Return HTML code to output a button to open a dialog popup box.
dol_get_fiche_end($notab=0)
Return tab footer of a card.
img_picto($titlealt, $picto, $moreatt='', $pictoisfullpath=false, $srconly=0, $notitle=0, $alt='', $morecss='', $marginleftonlyshort=2)
Show picto whatever it's its name (generic function)
GETPOST($paramname, $check='alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
dol_sanitizeFileName($str, $newstr='_', $unaccent=1)
Clean a string to use it as a file name.
restrictedArea(User $user, $features, $object=0, $tableandshare='', $feature2='', $dbt_keyfield='fk_soc', $dbt_select='rowid', $isdraft=0, $mode=0)
Check permissions of a user to show a page and an object.
accessforbidden($message='', $printheader=1, $printfooter=1, $showonlymessage=0, $params=null)
Show a message to say access is forbidden and stop program.
user_prepare_head(User $object)
Prepare array with list of tabs.