public.php 6.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189
  1. <?php
  2. /* Copyright (C) 2001-2002 Rodolphe Quiedeville <rodolphe@quiedeville.org>
  3. * Copyright (C) 2006-2010 Laurent Destailleur <eldy@users.sourceforge.net>
  4. *
  5. * This program is free software; you can redistribute it and/or modify
  6. * it under the terms of the GNU General Public License as published by
  7. * the Free Software Foundation; either version 2 of the License, or
  8. * (at your option) any later version.
  9. *
  10. * This program is distributed in the hope that it will be useful,
  11. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  12. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  13. * GNU General Public License for more details.
  14. *
  15. * You should have received a copy of the GNU General Public License
  16. * along with this program. If not, see <http://www.gnu.org/licenses/>.
  17. */
  18. /**
  19. * \file htdocs/adherents/admin/public.php
  20. * \ingroup member
  21. * \brief File of main public page for member module
  22. * \author Laurent Destailleur
  23. */
  24. require("../../main.inc.php");
  25. require_once(DOL_DOCUMENT_ROOT."/lib/admin.lib.php");
  26. require_once(DOL_DOCUMENT_ROOT."/lib/company.lib.php");
  27. require_once(DOL_DOCUMENT_ROOT."/lib/member.lib.php");
  28. $langs->load("members");
  29. $langs->load("admin");
  30. $action=GETPOST('action');
  31. /*
  32. * Actions
  33. */
  34. if ($action == 'update')
  35. {
  36. $i=0;
  37. $i+=dolibarr_set_const($db, "MEMBER_ENABLE_PUBLIC",$_POST["MEMBER_ENABLE_PUBLIC"],'chaine',0,'',$conf->entity);
  38. $i+=dolibarr_set_const($db, "MEMBER_NEWFORM_AMOUNT",$_POST["MEMBER_NEWFORM_AMOUNT"],'chaine',0,'',$conf->entity);
  39. $i+=dolibarr_set_const($db, "MEMBER_NEWFORM_EDITAMOUNT",$_POST["MEMBER_NEWFORM_EDITAMOUNT"],'chaine',0,'',$conf->entity);
  40. $i+=dolibarr_set_const($db, "MEMBER_NEWFORM_PAYONLINE",$_POST["MEMBER_NEWFORM_PAYONLINE"],'chaine',0,'',$conf->entity);
  41. if ($i == 4) $mesg=$langs->trans("RecordModifiedSuccessfully");
  42. }
  43. /*
  44. * View
  45. */
  46. $form=new Form($db);
  47. $help_url='EN:Module_Foundations|FR:Module_Adh&eacute;rents|ES:M&oacute;dulo_Miembros';
  48. llxHeader('',$langs->trans("MembersSetup"),$help_url);
  49. $linkback='<a href="'.DOL_URL_ROOT.'/admin/modules.php">'.$langs->trans("BackToModuleList").'</a>';
  50. print_fiche_titre($langs->trans("MembersSetup"),$linkback,'setup');
  51. $head = member_admin_prepare_head($adh);
  52. dol_fiche_head($head, 'public', $langs->trans("Member"), 0, 'user');
  53. dol_htmloutput_mesg($mesg);
  54. if ($conf->use_javascript_ajax)
  55. {
  56. print "\n".'<script type="text/javascript" language="javascript">';
  57. print 'jQuery(document).ready(function () {
  58. function initfields()
  59. {
  60. if (jQuery("#MEMBER_ENABLE_PUBLIC").val()==\'0\')
  61. {
  62. jQuery(".drag").hide();
  63. }
  64. if (jQuery("#MEMBER_ENABLE_PUBLIC").val()==\'1\')
  65. {
  66. jQuery(".drag").show();
  67. }
  68. }
  69. initfields();
  70. jQuery("#MEMBER_ENABLE_PUBLIC").change(function() {
  71. initfields();
  72. });
  73. })';
  74. print '</script>'."\n";
  75. }
  76. print $langs->trans("BlankSubscriptionFormDesc").'<br><br>';
  77. print '<form action="'.$_SERVER["PHP_SELF"].'" method="post">';
  78. print '<input type="hidden" name="action" value="update">';
  79. print '<table class="noborder" width="100%">';
  80. print '<tr class="liste_titre">';
  81. print '<td>'.$langs->trans("Parameter").'</td>';
  82. print '<td align="center" width="60">'.$langs->trans("Value").'</td>';
  83. print "</tr>\n";
  84. $var=true;
  85. // Allow public form
  86. $var=! $var;
  87. print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
  88. print '<tr '.$bc[$var].'><td>';
  89. print $langs->trans("EnablePublicSubscriptionForm");
  90. print '</td><td width="60" align="right">';
  91. print $form->selectyesno("MEMBER_ENABLE_PUBLIC",$conf->global->MEMBER_ENABLE_PUBLIC,1);
  92. print "</td></tr>\n";
  93. print '</form>';
  94. // Type
  95. /*$var=! $var;
  96. print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
  97. print '<tr '.$bcdd[$var].'><td>';
  98. print $langs->trans("EnablePublicSubscriptionForm");
  99. print '</td><td width="60" align="center">';
  100. print $form->selectyesno("forcedate",$conf->global->MEMBER_NEWFORM_FORCETYPE,1);
  101. print "</td></tr>\n"; */
  102. // Amount
  103. $var=! $var;
  104. print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
  105. print '<tr '.$bcdd[$var].'><td>';
  106. print $langs->trans("DefaultAmount");
  107. print '</td><td width="60" align="right">';
  108. print '<input type="text" id="MEMBER_NEWFORM_AMOUNT" name="MEMBER_NEWFORM_AMOUNT" size="5" value="'.$conf->global->MEMBER_NEWFORM_AMOUNT.'">';;
  109. print "</td></tr>\n";
  110. // Can edit
  111. $var=! $var;
  112. print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
  113. print '<tr '.$bcdd[$var].'><td>';
  114. print $langs->trans("CanEditAmount");
  115. print '</td><td width="60" align="right">';
  116. print $form->selectyesno("MEMBER_NEWFORM_EDITAMOUNT",$conf->global->MEMBER_NEWFORM_EDITAMOUNT,1);
  117. print "</td></tr>\n";
  118. if ($conf->paybox->enabled || $conf->paypal->enabled)
  119. {
  120. // Jump to an online payment page
  121. $var=! $var;
  122. print '<tr '.$bcdd[$var].'><td>';
  123. print $langs->trans("MEMBER_NEWFORM_PAYONLINE");
  124. print '</td><td width="60" align="right">';
  125. $listofval=array();
  126. if ($conf->paybox->enabled) $listofval['paybox']='Paybox';
  127. if ($conf->paypal->enabled) $listofval['paypal']='PayPal';
  128. print $form->selectarray("MEMBER_NEWFORM_PAYONLINE",$listofval,$conf->global->MEMBER_NEWFORM_PAYONLINE,1);
  129. print "</td></tr>\n";
  130. }
  131. print '</table>';
  132. print '<center>';
  133. print '<input type="submit" class="button" value="'.$langs->trans("Modify").'">';
  134. print '</center>';
  135. print '</form>';
  136. dol_fiche_end();
  137. print '<br>';
  138. //print $langs->trans('FollowingLinksArePublic').'<br>';
  139. print img_picto('','object_globe.png').' '.$langs->trans('BlankSubscriptionForm').':<br>';
  140. print '<a target="_blank" href="'.DOL_URL_ROOT.'/public/members/new.php'.'">'.DOL_MAIN_URL_ROOT.'/public/members/new.php'.'</a>';
  141. /*
  142. print '<table class="border" cellspacing="0" cellpadding="3">';
  143. print '<tr class="liste_titre"><td>'.$langs->trans("Description").'</td><td>'.$langs->trans("URL").'</td></tr>';
  144. print '<tr><td>'.$langs->trans("BlankSubscriptionForm").'</td><td>'..'</td></tr>';
  145. print '<tr><td>'.$langs->trans("PublicMemberList").'</td><td>'.img_picto('','object_globe.png').' '.'<a target="_blank" href="'.DOL_URL_ROOT.'/public/members/public_list.php'.'">'.DOL_MAIN_URL_ROOT.'/public/members/public_list.php'.'</a></td></tr>';
  146. print '<tr><td>'.$langs->trans("PublicMemberCard").'</td><td>'.img_picto('','object_globe.png').' '.DOL_MAIN_URL_ROOT.'/public/members/public_card.php?id=xxx'.'</td></tr>';
  147. print '</table>';
  148. */
  149. $db->close();
  150. llxFooter();
  151. ?>