dolibarr 24.0.0-beta
public_card.php
Go to the documentation of this file.
1<?php
2/* Copyright (C) 2001-2003 Rodolphe Quiedeville <rodolphe@quiedeville.org>
3 * Copyright (C) 2002-2003 Jean-Louis Bergamo <jlb@j1b.org>
4 * Copyright (C) 2007-2012 Laurent Destailleur <eldy@users.sourceforge.net>
5 * Copyright (C) 2012 Regis Houssin <regis.houssin@inodbox.com>
6 * Copyright (C) 2018 Alexandre Spangaro <aspangaro@open-dsi.fr>
7 * Copyright (C) 2024-2026 Frédéric France <frederic.france@free.fr>
8 * Copyright (C) 2025 MDW <mdeweerd@users.noreply.github.com>
9 *
10 * This program is free software; you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License as published by
12 * the Free Software Foundation; either version 3 of the License, or
13 * (at your option) any later version.
14 *
15 * This program is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU General Public License for more details.
19 *
20 * You should have received a copy of the GNU General Public License
21 * along with this program. If not, see <https://www.gnu.org/licenses/>.
22 */
23
30if (!defined('NOLOGIN')) {
31 define("NOLOGIN", 1); // This means this output page does not require to be logged.
32}
33if (!defined('NOCSRFCHECK')) {
34 define("NOCSRFCHECK", 1); // We accept to go on this page from external web site.
35}
36if (!defined('NOIPCHECK')) {
37 define('NOIPCHECK', '1'); // Do not check IP defined into conf $dolibarr_main_restrict_ip
38}
39if (!defined('NOBROWSERNOTIF')) {
40 define('NOBROWSERNOTIF', '1');
41}
42
43// For MultiCompany module.
44// Do not use GETPOST here, function is not defined and define must be done before including main.inc.php
45// Because 2 entities can have the same ref.
46$entity = (!empty($_GET['entity']) ? (int) $_GET['entity'] : (!empty($_POST['entity']) ? (int) $_POST['entity'] : 1));
47// if (is_numeric($entity)) { // $entity is casted to int
48define("DOLENTITY", $entity);
49// }
50
51// Load Dolibarr environment
52require '../../main.inc.php';
53require_once DOL_DOCUMENT_ROOT.'/adherents/class/adherent.class.php';
54require_once DOL_DOCUMENT_ROOT.'/adherents/class/adherent_type.class.php';
55require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php';
61// Security check
62if (!isModEnabled('member')) {
63 httponly_accessforbidden('Module Membership not enabled');
64}
65
66
67$langs->loadLangs(array("main", "members", "companies", "other"));
68
69$id = GETPOSTINT('id');
70$object = new Adherent($db);
71$extrafields = new ExtraFields($db);
72
73
74
75/*
76 * Actions
77 */
78
79// None
80
81
82
83/*
84 * View
85 */
86
87if (!getDolGlobalString('MEMBER_PUBLIC_ENABLED')) {
88 httponly_accessforbidden('Public access of list of members is not enabled. See setup of module membership to enable it.');
89}
90
91$morehead = '';
92if (getDolGlobalString('MEMBER_PUBLIC_CSS')) {
93 $morehead = '<link rel="stylesheet" type="text/css" href="' . getDolGlobalString('MEMBER_PUBLIC_CSS').'">';
94} else {
95 $morehead = '<link rel="stylesheet" type="text/css" href="'.DOL_URL_ROOT.'/theme/eldy/style.css.php">';
96}
97
98llxHeaderVierge($langs->trans("MemberCard"), $morehead);
99
100// fetch optionals attributes and labels
101$extrafields->fetch_name_optionals_label($object->table_element);
102
103if ($id > 0) {
104 $res = $object->fetch($id);
105 if ($res < 0) {
106 dol_print_error($db, $object->error);
107 exit;
108 }
109 $res = $object->fetch_optionals();
110
111 print load_fiche_titre($langs->trans("MemberCard"), '', '');
112
113 if (empty($object->public)) {
114 print $langs->trans("ErrorThisMemberIsNotPublic");
115 } else {
116 print '<table class="public_border centpercent" cellpadding="3">';
117
118 print '<tr><td width="15%">'.$langs->trans("Type").'</td><td class="valeur">'.dolPrintHTML($object->type)."</td></tr>\n";
119 print '<tr><td>'.$langs->trans("Person").'</td><td class="valeur">'.dolPrintHTML($object->morphy).'</td></tr>';
120 print '<tr><td>'.$langs->trans("Firstname").'</td><td class="valeur" width="35%">'.dolPrintHTML($object->firstname).'&nbsp;</td></tr>';
121 print '<tr><td>'.$langs->trans("Lastname").'</td><td class="valeur">'.dolPrintHTML($object->lastname).'&nbsp;</td></tr>';
122 print '<tr><td>'.$langs->trans("Gender").'</td><td class="valeur">'.dolPrintHTML($object->gender).'&nbsp;</td></tr>';
123 print '<tr><td>'.$langs->trans("Company").'</td><td class="valeur">'.dolPrintHTML($object->company).'&nbsp;</td></tr>';
124 print '<tr><td>'.$langs->trans("Address").'</td><td class="valeur">'.dolPrintHTML(dol_nl2br($object->address)).'&nbsp;</td></tr>';
125 print '<tr><td>'.$langs->trans("Zip").' / '.$langs->trans("Town").'</td><td class="valeur">'.dolPrintHTML($object->zip.' '.$object->town).'</td></tr>';
126 print '<tr><td>'.$langs->trans("Country").'</td><td class="valeur">'.dolPrintHTML($object->country).'&nbsp;</td></tr>';
127 print '<tr><td>'.$langs->trans("EMail").'</td><td class="valeur">'.dolPrintHTML($object->email).'&nbsp;</td></tr>';
128 print '<tr><td>'.$langs->trans("Birthday").'</td><td class="valeur">'.dol_print_date($object->birth, 'day').'</td></tr>';
129
130 if (isset($object->photo) && $object->photo != '') {
131 $form = new Form($db);
132 print '<tr><td>URL Photo</td><td class="valeur">';
133 print $form->showphoto('memberphoto', $object, 64);
134 print '</td></tr>'."\n";
135 }
136 // foreach($extrafields->attributes[$object->table_element]['label'] as $key=>$value){
137 // print "<tr><td>$value</td><td>".$object->array_options["options_$key"]."&nbsp;</td></tr>\n";
138 // }
139
140 print '<tr><td class="tdtop">'.$langs->trans("Comments").'</td><td class="valeur sensiblehtmlcontent">'.dolPrintHTML($object->note_public).'</td></tr>';
141
142 print '</table>';
143 }
144}
145
146
148
149$db->close();
150
151
152
167function llxHeaderVierge($title, $head = "", $disablejs = 0, $disablehead = 0, $arrayofjs = [], $arrayofcss = [], $ws = '') // @phan-suppress-current-line PhanRedefineFunction
168{
169 top_htmlhead($head, $title);
170
171 print '<body class="public_body">'."\n";
172}
173
181function llxFooterVierge() // @phan-suppress-current-line PhanRedefineFunction
182{
183 printCommonFooter('public');
184
185 print "</body>\n";
186 print "</html>\n";
187}
$id
Support class for third parties, contacts, members, users or resources.
Definition account.php:47
if(! $sortfield) if(! $sortorder) $object
Definition account.php:100
Class to manage members of a foundation.
Class to manage standard extra fields.
Class to manage generation of HTML components Only common components must be here.
if(!isModEnabled('ai')||!getDolGlobalString('AI_ASSISTANT_ENABLED')) global $db
API class for accounts.
GETPOSTINT($paramname, $method=0)
Return the value of a $_GET or $_POST supervariable, converted into integer.
dolPrintHTML($s, $allowiframe=0, $moreallowedtags=array())
Return a string (that can be on several lines) ready to be output on a HTML page.
dol_nl2br($stringtoencode, $nl2brmode=0, $forxml=false)
Replace CRLF in string with a HTML BR tag.
printCommonFooter($zone='private')
Print common footer : conf->global->MAIN_HTML_FOOTER js for switch of menu hider js for conf->global-...
dol_print_date($time, $format='', $tzoutput='auto', $outputlangs=null, $encodetooutput=false, $decorate=0)
Output date in a string format according to outputlangs (or langs if not defined).
dol_print_error($db=null, $error='', $errors=null)
Displays error message system with all the information to facilitate the diagnosis and the escalation...
load_fiche_titre($title, $morehtmlright='', $picto='generic', $pictoisfullpath=0, $id='', $morecssontable='', $morehtmlcenter='', $morecssonpicto='widthpictotitle')
Load a title with picto.
getDolGlobalString($key, $default='')
Return a Dolibarr global constant string value.
isModEnabled($module)
Is Dolibarr module enabled.
top_htmlhead($head, $title='', $disablejs=0, $disablehead=0, $arrayofjs=array(), $arrayofcss=array(), $disableforlogin=0, $disablenofollow=0, $disablenoindex=0)
Output html header of a page.
llxHeaderVierge($title, $head="", $disablejs=0, $disablehead=0, $arrayofjs=[], $arrayofcss=[], $ws='')
Show header for card member.
llxFooterVierge()
Show footer for card member.
httponly_accessforbidden($message='1', $http_response_code=403, $stringalreadysanitized=0)
Show a message to say access is forbidden and stop program.