public_card.php 5.6 KB

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