public_card.php 5.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166
  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. /**
  22. * \file htdocs/public/members/public_card.php
  23. * \ingroup member
  24. * \brief File to show a public card of a member
  25. */
  26. if (!defined('NOLOGIN')) {
  27. define("NOLOGIN", 1); // This means this output page does not require to be logged.
  28. }
  29. if (!defined('NOCSRFCHECK')) {
  30. define("NOCSRFCHECK", 1); // We accept to go on this page from external web site.
  31. }
  32. if (!defined('NOIPCHECK')) {
  33. define('NOIPCHECK', '1'); // Do not check IP defined into conf $dolibarr_main_restrict_ip
  34. }
  35. if (!defined('NOBROWSERNOTIF')) {
  36. define('NOBROWSERNOTIF', '1');
  37. }
  38. // For MultiCompany module.
  39. // Do not use GETPOST here, function is not defined and define must be done before including main.inc.php
  40. // TODO This should be useless. Because entity must be retrieve from object ref and not from url.
  41. $entity = (!empty($_GET['entity']) ? (int) $_GET['entity'] : (!empty($_POST['entity']) ? (int) $_POST['entity'] : 1));
  42. if (is_numeric($entity)) {
  43. define("DOLENTITY", $entity);
  44. }
  45. require '../../main.inc.php';
  46. require_once DOL_DOCUMENT_ROOT.'/adherents/class/adherent.class.php';
  47. require_once DOL_DOCUMENT_ROOT.'/adherents/class/adherent_type.class.php';
  48. require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php';
  49. // Security check
  50. if (empty($conf->adherent->enabled)) {
  51. accessforbidden('', 0, 0, 1);
  52. }
  53. $langs->loadLangs(array("main", "members", "companies", "other"));
  54. $id = GETPOST('id', 'int');
  55. $object = new Adherent($db);
  56. $extrafields = new ExtraFields($db);
  57. /*
  58. * Actions
  59. */
  60. // None
  61. /*
  62. * View
  63. */
  64. $morehead = '';
  65. if (!empty($conf->global->MEMBER_PUBLIC_CSS)) {
  66. $morehead = '<link rel="stylesheet" type="text/css" href="'.$conf->global->MEMBER_PUBLIC_CSS.'">';
  67. } else {
  68. $morehead = '<link rel="stylesheet" type="text/css" href="'.DOL_URL_ROOT.'/theme/eldy/style.css.php">';
  69. }
  70. llxHeaderVierge($langs->trans("MemberCard"), $morehead);
  71. // fetch optionals attributes and labels
  72. $extrafields->fetch_name_optionals_label($object->table_element);
  73. if ($id > 0) {
  74. $res = $object->fetch($id);
  75. if ($res < 0) {
  76. dol_print_error($db, $object->error); exit;
  77. }
  78. $res = $object->fetch_optionals();
  79. print load_fiche_titre($langs->trans("MemberCard"), '', '');
  80. if (empty($object->public)) {
  81. print $langs->trans("ErrorThisMemberIsNotPublic");
  82. } else {
  83. print '<table class="public_border" width="100%" cellpadding="3">';
  84. print '<tr><td width="15%">'.$langs->trans("Type").'</td><td class="valeur">'.$object->type."</td></tr>\n";
  85. print '<tr><td>'.$langs->trans("Person").'</td><td class="valeur">'.$object->morphy.'</td></tr>';
  86. print '<tr><td>'.$langs->trans("Firstname").'</td><td class="valeur" width="35%">'.$object->firstname.'&nbsp;</td></tr>';
  87. print '<tr><td>'.$langs->trans("Lastname").'</td><td class="valeur">'.$object->lastname.'&nbsp;</td></tr>';
  88. print '<tr><td>'.$langs->trans("Gender").'</td><td class="valeur">'.$object->gender.'&nbsp;</td></tr>';
  89. print '<tr><td>'.$langs->trans("Company").'</td><td class="valeur">'.$object->company.'&nbsp;</td></tr>';
  90. print '<tr><td>'.$langs->trans("Address").'</td><td class="valeur">'.nl2br($object->address).'&nbsp;</td></tr>';
  91. print '<tr><td>'.$langs->trans("Zip").' / '.$langs->trans("Town").'</td><td class="valeur">'.$object->zip.' '.$object->town.'&nbsp;</td></tr>';
  92. print '<tr><td>'.$langs->trans("Country").'</td><td class="valeur">'.$object->country.'&nbsp;</td></tr>';
  93. print '<tr><td>'.$langs->trans("EMail").'</td><td class="valeur">'.$object->email.'&nbsp;</td></tr>';
  94. print '<tr><td>'.$langs->trans("Birthday").'</td><td class="valeur">'.dol_print_date($object->birth, 'day').'</td></tr>';
  95. if (isset($object->photo) && $object->photo != '') {
  96. $form = new Form($db);
  97. print '<tr><td>URL Photo</td><td class="valeur">';
  98. print $form->showphoto('memberphoto', $object, 64);
  99. print '</td></tr>'."\n";
  100. }
  101. // foreach($extrafields->attributes[$object->table_element]['label'] as $key=>$value){
  102. // print "<tr><td>$value</td><td>".$object->array_options["options_$key"]."&nbsp;</td></tr>\n";
  103. // }
  104. print '<tr><td class="tdtop">'.$langs->trans("Comments").'</td><td>'.nl2br($object->note_public).'</td></tr>';
  105. print '</table>';
  106. }
  107. }
  108. llxFooterVierge();
  109. $db->close();
  110. /**
  111. * Show header for card member
  112. *
  113. * @param string $title Title
  114. * @param string $head More info into header
  115. * @return void
  116. */
  117. function llxHeaderVierge($title, $head = "")
  118. {
  119. top_htmlhead($head, $title);
  120. print '<body class="public_body">'."\n";
  121. }
  122. /**
  123. * Show footer for card member
  124. *
  125. * @return void
  126. */
  127. function llxFooterVierge()
  128. {
  129. printCommonFooter('public');
  130. print "</body>\n";
  131. print "</html>\n";
  132. }