PageRenderTime 133ms CodeModel.GetById 70ms app.highlight 8ms RepoModel.GetById 52ms app.codeStats 0ms

/htdocs/adherent/admin/public.php

https://bitbucket.org/speedealing/speedealing
PHP | 204 lines | 112 code | 41 blank | 51 comment | 10 complexity | 2ee9cdd78a2cf0a88944713cc24dfbb6 MD5 | raw file
  1<?php
  2/* Copyright (C) 2001-2002	Rodolphe Quiedeville	<rodolphe@quiedeville.org>
  3 * Copyright (C) 2006-2011	Laurent Destailleur		<eldy@users.sourceforge.net>
  4 * Copyright (C) 2006-2012	Regis Houssin			<regis.houssin@capnetworks.com>
  5 * Copyright (C) 2011		Juanjo Menent			<jmenent@2byte.es>
  6 *
  7 * This program is free software; you can redistribute it and/or modify
  8 * it under the terms of the GNU General Public License as published by
  9 * the Free Software Foundation; either version 3 of the License, or
 10 * (at your option) any later version.
 11 *
 12 * This program is distributed in the hope that it will be useful,
 13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 15 * GNU General Public License for more details.
 16 *
 17 * You should have received a copy of the GNU General Public License
 18 * along with this program. If not, see <http://www.gnu.org/licenses/>.
 19 */
 20
 21/**
 22 *     	\file       htdocs/adherents/admin/public.php
 23 *		\ingroup    member
 24 *		\brief      File of main public page for member module
 25 *		\author	    Laurent Destailleur
 26 */
 27
 28require '../../main.inc.php';
 29require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php';
 30require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php';
 31require_once DOL_DOCUMENT_ROOT.'/core/lib/member.lib.php';
 32
 33$langs->load("members");
 34$langs->load("admin");
 35
 36$action=GETPOST('action', 'alpha');
 37
 38if (! $user->admin) accessforbidden();
 39
 40
 41/*
 42 * Actions
 43 */
 44
 45if ($action == 'update')
 46{
 47	$public=GETPOST('MEMBER_ENABLE_PUBLIC');
 48	$amount=GETPOST('MEMBER_NEWFORM_AMOUNT');
 49	$editamount=GETPOST('MEMBER_NEWFORM_EDITAMOUNT');
 50	$payonline=GETPOST('MEMBER_NEWFORM_PAYONLINE');
 51
 52    $res=dolibarr_set_const($db, "MEMBER_ENABLE_PUBLIC",$public,'chaine',0,'',$conf->entity);
 53    $res=dolibarr_set_const($db, "MEMBER_NEWFORM_AMOUNT",$amount,'chaine',0,'',$conf->entity);
 54    $res=dolibarr_set_const($db, "MEMBER_NEWFORM_EDITAMOUNT",$editamount,'chaine',0,'',$conf->entity);
 55    $res=dolibarr_set_const($db, "MEMBER_NEWFORM_PAYONLINE",$payonline,'chaine',0,'',$conf->entity);
 56
 57    if (! $res > 0) $error++;
 58
 59 	if (! $error)
 60    {
 61        $mesg = "<font class=\"ok\">".$langs->trans("SetupSaved")."</font>";
 62    }
 63    else
 64    {
 65        $mesg = "<font class=\"error\">".$langs->trans("Error")."</font>";
 66    }
 67}
 68
 69
 70/*
 71 * View
 72 */
 73
 74$form=new Form($db);
 75
 76
 77llxHeader('',$langs->trans("MembersSetup"));
 78
 79
 80$linkback='<a href="'.DOL_URL_ROOT.'/admin/modules.php">'.$langs->trans("BackToModuleList").'</a>';
 81print_fiche_titre($langs->trans("MembersSetup"),$linkback,'setup');
 82
 83$head = member_admin_prepare_head();
 84
 85dol_fiche_head($head, 'public', $langs->trans("Member"), 0, 'user');
 86
 87dol_htmloutput_mesg($mesg);
 88
 89if ($conf->use_javascript_ajax)
 90{
 91    print "\n".'<script type="text/javascript" language="javascript">';
 92    print 'jQuery(document).ready(function () {
 93                function initfields()
 94                {
 95                    if (jQuery("#MEMBER_ENABLE_PUBLIC").val()==\'0\')
 96                    {
 97                        jQuery(".drag").hide();
 98                    }
 99                    if (jQuery("#MEMBER_ENABLE_PUBLIC").val()==\'1\')
100                    {
101                        jQuery(".drag").show();
102                    }
103                }
104                initfields();
105                jQuery("#MEMBER_ENABLE_PUBLIC").change(function() {
106                    initfields();
107                });
108           })';
109    print '</script>'."\n";
110}
111
112
113print $langs->trans("BlankSubscriptionFormDesc").'<br><br>';
114
115print '<form action="'.$_SERVER["PHP_SELF"].'" method="post">';
116print '<input type="hidden" name="action" value="update">';
117
118print '<table class="noborder" width="100%">';
119
120print '<tr class="liste_titre">';
121print '<td>'.$langs->trans("Parameter").'</td>';
122print '<td align="center" width="60">'.$langs->trans("Value").'</td>';
123print "</tr>\n";
124$var=true;
125
126// Allow public form
127$var=! $var;
128print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
129print '<tr '.$bc[$var].'><td>';
130print $langs->trans("EnablePublicSubscriptionForm");
131print '</td><td width="60" align="right">';
132print $form->selectyesno("MEMBER_ENABLE_PUBLIC",(! empty($conf->global->MEMBER_ENABLE_PUBLIC)?$conf->global->MEMBER_ENABLE_PUBLIC:0),1);
133print "</td></tr>\n";
134
135// Type
136/*$var=! $var;
137print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
138print '<tr '.$bcdd[$var].'><td>';
139print $langs->trans("EnablePublicSubscriptionForm");
140print '</td><td width="60" align="center">';
141print $form->selectyesno("forcedate",$conf->global->MEMBER_NEWFORM_FORCETYPE,1);
142print "</td></tr>\n"; */
143
144// Amount
145$var=! $var;
146print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
147print '<tr '.$bcdd[$var].'><td>';
148print $langs->trans("DefaultAmount");
149print '</td><td width="60" align="right">';
150print '<input type="text" id="MEMBER_NEWFORM_AMOUNT" name="MEMBER_NEWFORM_AMOUNT" size="5" value="'.(! empty($conf->global->MEMBER_NEWFORM_AMOUNT)?$conf->global->MEMBER_NEWFORM_AMOUNT:'').'">';;
151print "</td></tr>\n";
152
153// Can edit
154$var=! $var;
155print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
156print '<tr '.$bcdd[$var].'><td>';
157print $langs->trans("CanEditAmount");
158print '</td><td width="60" align="right">';
159print $form->selectyesno("MEMBER_NEWFORM_EDITAMOUNT",(! empty($conf->global->MEMBER_NEWFORM_EDITAMOUNT)?$conf->global->MEMBER_NEWFORM_EDITAMOUNT:0),1);
160print "</td></tr>\n";
161
162if (! empty($conf->paybox->enabled) || ! empty($conf->paypal->enabled))
163{
164    // Jump to an online payment page
165    $var=! $var;
166    print '<tr '.$bcdd[$var].'><td>';
167    print $langs->trans("MEMBER_NEWFORM_PAYONLINE");
168    print '</td><td width="60" align="right">';
169    $listofval=array();
170    if (! empty($conf->paybox->enabled)) $listofval['paybox']='Paybox';
171    if (! empty($conf->paypal->enabled)) $listofval['paypal']='PayPal';
172    print $form->selectarray("MEMBER_NEWFORM_PAYONLINE",$listofval,(! empty($conf->global->MEMBER_NEWFORM_PAYONLINE)?$conf->global->MEMBER_NEWFORM_PAYONLINE:''),1);
173    print "</td></tr>\n";
174}
175
176print '</table>';
177
178print '<center>';
179print '<input type="submit" class="button" value="'.$langs->trans("Modify").'">';
180print '</center>';
181
182print '</form>';
183
184dol_fiche_end();
185
186
187print '<br>';
188//print $langs->trans('FollowingLinksArePublic').'<br>';
189print img_picto('','object_globe.png').' '.$langs->trans('BlankSubscriptionForm').':<br>';
190print '<a target="_blank" href="'.DOL_URL_ROOT.'/public/members/new.php">'.DOL_MAIN_URL_ROOT.'/public/members/new.php</a>';
191
192/*
193print '<table class="border" cellspacing="0" cellpadding="3">';
194print '<tr class="liste_titre"><td>'.$langs->trans("Description").'</td><td>'.$langs->trans("URL").'</td></tr>';
195print '<tr><td>'.$langs->trans("BlankSubscriptionForm").'</td><td>'..'</td></tr>';
196print '<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>';
197print '<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>';
198print '</table>';
199*/
200
201llxFooter();
202
203$db->close();
204?>