dolibarr  16.0.5
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  *
8  * This program is free software; you can redistribute it and/or modify
9  * it under the terms of the GNU General Public License as published by
10  * the Free Software Foundation; either version 3 of the License, or
11  * (at your option) any later version.
12  *
13  * This program is distributed in the hope that it will be useful,
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16  * GNU General Public License for more details.
17  *
18  * You should have received a copy of the GNU General Public License
19  * along with this program. If not, see <https://www.gnu.org/licenses/>.
20  */
21 
28 if (!defined('NOLOGIN')) {
29  define("NOLOGIN", 1); // This means this output page does not require to be logged.
30 }
31 if (!defined('NOCSRFCHECK')) {
32  define("NOCSRFCHECK", 1); // We accept to go on this page from external web site.
33 }
34 if (!defined('NOIPCHECK')) {
35  define('NOIPCHECK', '1'); // Do not check IP defined into conf $dolibarr_main_restrict_ip
36 }
37 if (!defined('NOBROWSERNOTIF')) {
38  define('NOBROWSERNOTIF', '1');
39 }
40 
41 // For MultiCompany module.
42 // Do not use GETPOST here, function is not defined and define must be done before including main.inc.php
43 // TODO This should be useless. Because entity must be retrieve from object ref and not from url.
44 $entity = (!empty($_GET['entity']) ? (int) $_GET['entity'] : (!empty($_POST['entity']) ? (int) $_POST['entity'] : 1));
45 if (is_numeric($entity)) {
46  define("DOLENTITY", $entity);
47 }
48 
49 require '../../main.inc.php';
50 require_once DOL_DOCUMENT_ROOT.'/adherents/class/adherent.class.php';
51 require_once DOL_DOCUMENT_ROOT.'/adherents/class/adherent_type.class.php';
52 require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php';
53 
54 // Security check
55 if (empty($conf->adherent->enabled)) {
56  accessforbidden('', 0, 0, 1);
57 }
58 
59 
60 $langs->loadLangs(array("main", "members", "companies", "other"));
61 
62 $id = GETPOST('id', 'int');
63 $object = new Adherent($db);
64 $extrafields = new ExtraFields($db);
65 
66 
67 
68 /*
69  * Actions
70  */
71 
72 // None
73 
74 
75 
76 /*
77  * View
78  */
79 
80 $morehead = '';
81 if (!empty($conf->global->MEMBER_PUBLIC_CSS)) {
82  $morehead = '<link rel="stylesheet" type="text/css" href="'.$conf->global->MEMBER_PUBLIC_CSS.'">';
83 } else {
84  $morehead = '<link rel="stylesheet" type="text/css" href="'.DOL_URL_ROOT.'/theme/eldy/style.css.php">';
85 }
86 
87 llxHeaderVierge($langs->trans("MemberCard"), $morehead);
88 
89 // fetch optionals attributes and labels
90 $extrafields->fetch_name_optionals_label($object->table_element);
91 
92 if ($id > 0) {
93  $res = $object->fetch($id);
94  if ($res < 0) {
95  dol_print_error($db, $object->error); exit;
96  }
97  $res = $object->fetch_optionals();
98 
99  print load_fiche_titre($langs->trans("MemberCard"), '', '');
100 
101  if (empty($object->public)) {
102  print $langs->trans("ErrorThisMemberIsNotPublic");
103  } else {
104  print '<table class="public_border" width="100%" cellpadding="3">';
105 
106  print '<tr><td width="15%">'.$langs->trans("Type").'</td><td class="valeur">'.$object->type."</td></tr>\n";
107  print '<tr><td>'.$langs->trans("Person").'</td><td class="valeur">'.$object->morphy.'</td></tr>';
108  print '<tr><td>'.$langs->trans("Firstname").'</td><td class="valeur" width="35%">'.$object->firstname.'&nbsp;</td></tr>';
109  print '<tr><td>'.$langs->trans("Lastname").'</td><td class="valeur">'.$object->lastname.'&nbsp;</td></tr>';
110  print '<tr><td>'.$langs->trans("Gender").'</td><td class="valeur">'.$object->gender.'&nbsp;</td></tr>';
111  print '<tr><td>'.$langs->trans("Company").'</td><td class="valeur">'.$object->company.'&nbsp;</td></tr>';
112  print '<tr><td>'.$langs->trans("Address").'</td><td class="valeur">'.nl2br($object->address).'&nbsp;</td></tr>';
113  print '<tr><td>'.$langs->trans("Zip").' / '.$langs->trans("Town").'</td><td class="valeur">'.$object->zip.' '.$object->town.'&nbsp;</td></tr>';
114  print '<tr><td>'.$langs->trans("Country").'</td><td class="valeur">'.$object->country.'&nbsp;</td></tr>';
115  print '<tr><td>'.$langs->trans("EMail").'</td><td class="valeur">'.$object->email.'&nbsp;</td></tr>';
116  print '<tr><td>'.$langs->trans("Birthday").'</td><td class="valeur">'.dol_print_date($object->birth, 'day').'</td></tr>';
117 
118  if (isset($object->photo) && $object->photo != '') {
119  $form = new Form($db);
120  print '<tr><td>URL Photo</td><td class="valeur">';
121  print $form->showphoto('memberphoto', $object, 64);
122  print '</td></tr>'."\n";
123  }
124  // foreach($extrafields->attributes[$object->table_element]['label'] as $key=>$value){
125  // print "<tr><td>$value</td><td>".$object->array_options["options_$key"]."&nbsp;</td></tr>\n";
126  // }
127 
128  print '<tr><td class="tdtop">'.$langs->trans("Comments").'</td><td>'.nl2br($object->note_public).'</td></tr>';
129 
130  print '</table>';
131  }
132 }
133 
134 
136 
137 $db->close();
138 
139 
140 
148 function llxHeaderVierge($title, $head = "")
149 {
150  top_htmlhead($head, $title);
151 
152  print '<body class="public_body">'."\n";
153 }
154 
160 function llxFooterVierge()
161 {
162  printCommonFooter('public');
163 
164  print "</body>\n";
165  print "</html>\n";
166 }
load_fiche_titre
load_fiche_titre($titre, $morehtmlright='', $picto='generic', $pictoisfullpath=0, $id='', $morecssontable='', $morehtmlcenter='')
Load a title with picto.
Definition: functions.lib.php:5204
GETPOST
GETPOST($paramname, $check='alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
Definition: functions.lib.php:484
dol_print_error
dol_print_error($db='', $error='', $errors=null)
Displays error message system with all the information to facilitate the diagnosis and the escalation...
Definition: functions.lib.php:4844
top_htmlhead
top_htmlhead($head, $title='', $disablejs=0, $disablehead=0, $arrayofjs='', $arrayofcss='', $disableforlogin=0, $disablenofollow=0, $disablenoindex=0)
Ouput html header of a page.
Definition: main.inc.php:1482
$form
if($cancel &&! $id) if($action=='add' &&! $cancel) if($action=='delete') if($id) $form
Actions.
Definition: card.php:142
llxFooterVierge
llxFooterVierge()
Show footer for card member.
Definition: public_card.php:160
printCommonFooter
printCommonFooter($zone='private')
Print common footer : conf->global->MAIN_HTML_FOOTER js for switch of menu hider js for conf->global-...
Definition: functions.lib.php:9150
dol_print_date
dol_print_date($time, $format='', $tzoutput='auto', $outputlangs='', $encodetooutput=false)
Output date in a string format according to outputlangs (or langs if not defined).
Definition: functions.lib.php:2514
llxHeaderVierge
llxHeaderVierge($title, $head="")
Show header for card member.
Definition: public_card.php:148
Adherent
Class to manage members of a foundation.
Definition: adherent.class.php:46
ExtraFields
Class to manage standard extra fields.
Definition: extrafields.class.php:39
Form
Class to manage generation of HTML components Only common components must be here.
Definition: html.form.class.php:52
accessforbidden
accessforbidden($message='', $printheader=1, $printfooter=1, $showonlymessage=0, $params=null)
Show a message to say access is forbidden and stop program Calling this function terminate execution ...
Definition: security.lib.php:933