dolibarr  13.0.2
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')) define("NOLOGIN", 1); // This means this output page does not require to be logged.
29 if (!defined('NOCSRFCHECK')) define("NOCSRFCHECK", 1); // We accept to go on this page from external web site.
30 if (!defined('NOIPCHECK')) define('NOIPCHECK', '1'); // Do not check IP defined into conf $dolibarr_main_restrict_ip
31 if (!defined('NOBROWSERNOTIF')) define('NOBROWSERNOTIF', '1');
32 
33 // For MultiCompany module.
34 // Do not use GETPOST here, function is not defined and define must be done before including main.inc.php
35 // TODO This should be useless. Because entity must be retrieve from object ref and not from url.
36 $entity = (!empty($_GET['entity']) ? (int) $_GET['entity'] : (!empty($_POST['entity']) ? (int) $_POST['entity'] : 1));
37 if (is_numeric($entity)) define("DOLENTITY", $entity);
38 
39 require '../../main.inc.php';
40 require_once DOL_DOCUMENT_ROOT.'/adherents/class/adherent.class.php';
41 require_once DOL_DOCUMENT_ROOT.'/adherents/class/adherent_type.class.php';
42 require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php';
43 
44 // Security check
45 if (empty($conf->adherent->enabled)) accessforbidden('', 0, 0, 1);
46 
47 
48 $langs->loadLangs(array("main", "members", "companies", "other"));
49 
50 $id = GETPOST('id', 'int');
51 $object = new Adherent($db);
52 $extrafields = new ExtraFields($db);
53 
54 
55 
56 /*
57  * Actions
58  */
59 
60 // None
61 
62 
63 
64 /*
65  * View
66  */
67 
68 $morehead = '';
69 if (!empty($conf->global->MEMBER_PUBLIC_CSS)) $morehead = '<link rel="stylesheet" type="text/css" href="'.$conf->global->MEMBER_PUBLIC_CSS.'">';
70 else $morehead = '<link rel="stylesheet" type="text/css" href="'.DOL_URL_ROOT.'/theme/eldy/style.css.php">';
71 
72 llxHeaderVierge($langs->trans("MemberCard"), $morehead);
73 
74 // fetch optionals attributes and labels
75 $extrafields->fetch_name_optionals_label($object->table_element);
76 
77 if ($id > 0)
78 {
79  $res = $object->fetch($id);
80  if ($res < 0) { dol_print_error($db, $object->error); exit; }
81  $res = $object->fetch_optionals();
82 
83  print load_fiche_titre($langs->trans("MemberCard"), '', '');
84 
85  if (empty($object->public))
86  {
87  print $langs->trans("ErrorThisMemberIsNotPublic");
88  } else {
89  print '<table class="public_border" cellspacing="0" width="100%" cellpadding="3">';
90 
91  print '<tr><td width="15%">'.$langs->trans("Type").'</td><td class="valeur">'.$object->type."</td></tr>\n";
92  print '<tr><td>'.$langs->trans("Person").'</td><td class="valeur">'.$object->morphy.'</td></tr>';
93  print '<tr><td>'.$langs->trans("Firstname").'</td><td class="valeur" width="35%">'.$object->firstname.'&nbsp;</td></tr>';
94  print '<tr><td>'.$langs->trans("Lastname").'</td><td class="valeur">'.$object->lastname.'&nbsp;</td></tr>';
95  print '<tr><td>'.$langs->trans("Gender").'</td><td class="valeur">'.$object->gender.'&nbsp;</td></tr>';
96  print '<tr><td>'.$langs->trans("Company").'</td><td class="valeur">'.$object->company.'&nbsp;</td></tr>';
97  print '<tr><td>'.$langs->trans("Address").'</td><td class="valeur">'.nl2br($object->address).'&nbsp;</td></tr>';
98  print '<tr><td>'.$langs->trans("Zip").' / '.$langs->trans("Town").'</td><td class="valeur">'.$object->zip.' '.$object->town.'&nbsp;</td></tr>';
99  print '<tr><td>'.$langs->trans("Country").'</td><td class="valeur">'.$object->country.'&nbsp;</td></tr>';
100  print '<tr><td>'.$langs->trans("EMail").'</td><td class="valeur">'.$object->email.'&nbsp;</td></tr>';
101  print '<tr><td>'.$langs->trans("Birthday").'</td><td class="valeur">'.dol_print_date($object->birth, 'day').'</td></tr>';
102 
103  if (isset($object->photo) && $object->photo != '')
104  {
105  $form = new Form($db);
106  print '<tr><td>URL Photo</td><td class="valeur">';
107  print $form->showphoto('memberphoto', $object, 64);
108  print '</td></tr>'."\n";
109  }
110  // foreach($extrafields->attributes[$object->table_element]['label'] as $key=>$value){
111  // print "<tr><td>$value</td><td>".$object->array_options["options_$key"]."&nbsp;</td></tr>\n";
112  // }
113 
114  print '<tr><td class="tdtop">'.$langs->trans("Comments").'</td><td>'.nl2br($object->note_public).'</td></tr>';
115 
116  print '</table>';
117  }
118 }
119 
120 
122 
123 $db->close();
124 
125 
126 
134 function llxHeaderVierge($title, $head = "")
135 {
136  global $user, $conf, $langs;
137 
138  header("Content-type: text/html; charset=".$conf->file->character_set_client);
139  print "<html>\n";
140  print "<head>\n";
141  print "<title>".$title."</title>\n";
142  if ($head) print $head."\n";
143  print "</head>\n";
144  print '<body class="public_body">'."\n";
145 }
146 
152 function llxFooterVierge()
153 {
154  printCommonFooter('public');
155 
156  print "</body>\n";
157  print "</html>\n";
158 }
GETPOST($paramname, $check= 'alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
printCommonFooter($zone= 'private')
Print common footer : conf-&gt;global-&gt;MAIN_HTML_FOOTER js for switch of menu hider js for conf-&gt;global-...
Class to manage standard extra fields.
Class to manage generation of HTML components Only common components must be here.
load_fiche_titre($titre, $morehtmlright= '', $picto= 'generic', $pictoisfullpath=0, $id= '', $morecssontable= '', $morehtmlcenter= '')
Load a title with picto.
Class to manage members of a foundation.
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 ...
llxHeaderVierge()
Header function.
print
Draft customers invoices.
Definition: index.php:89
dol_print_date($time, $format= '', $tzoutput= 'auto', $outputlangs= '', $encodetooutput=false)
Output date in a string format according to outputlangs (or langs if not defined).
llxFooterVierge()
Footer function.
dol_print_error($db= '', $error= '', $errors=null)
Displays error message system with all the information to facilitate the diagnosis and the escalation...