* Copyright (C) 2006-2015 Laurent Destailleur * Copyright (C) 2006-2012 Regis Houssin * Copyright (C) 2011 Juanjo Menent * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ /** * \file htdocs/adherents/admin/website.php * \ingroup member * \brief File of main public page for member module * \author Laurent Destailleur */ require '../../main.inc.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/member.lib.php'; require_once DOL_DOCUMENT_ROOT.'/adherents/class/adherent_type.class.php'; // Load translation files required by the page $langs->loadLangs(array("admin","members")); $action=GETPOST('action', 'alpha'); if (! $user->admin) accessforbidden(); /* * Actions */ if ($action == 'setMEMBER_ENABLE_PUBLIC') { if (GETPOST('value')) dolibarr_set_const($db, 'MEMBER_ENABLE_PUBLIC', 1, 'chaine', 0, '', $conf->entity); else dolibarr_set_const($db, 'MEMBER_ENABLE_PUBLIC', 0, 'chaine', 0, '', $conf->entity); } if ($action == 'update') { $public=GETPOST('MEMBER_ENABLE_PUBLIC'); $amount=GETPOST('MEMBER_NEWFORM_AMOUNT'); $editamount=GETPOST('MEMBER_NEWFORM_EDITAMOUNT'); $payonline=GETPOST('MEMBER_NEWFORM_PAYONLINE'); $forcetype=GETPOST('MEMBER_NEWFORM_FORCETYPE'); $res=dolibarr_set_const($db, "MEMBER_ENABLE_PUBLIC", $public, 'chaine', 0, '', $conf->entity); $res=dolibarr_set_const($db, "MEMBER_NEWFORM_AMOUNT", $amount, 'chaine', 0, '', $conf->entity); $res=dolibarr_set_const($db, "MEMBER_NEWFORM_EDITAMOUNT", $editamount, 'chaine', 0, '', $conf->entity); $res=dolibarr_set_const($db, "MEMBER_NEWFORM_PAYONLINE", $payonline, 'chaine', 0, '', $conf->entity); if ($forcetype < 0) $res=dolibarr_del_const($db, "MEMBER_NEWFORM_FORCETYPE", $conf->entity); else $res=dolibarr_set_const($db, "MEMBER_NEWFORM_FORCETYPE", $forcetype, 'chaine', 0, '', $conf->entity); if (! $res > 0) $error++; if (! $error) { setEventMessages($langs->trans("SetupSaved"), null, 'mesgs'); } else { setEventMessages($langs->trans("Error"), null, 'errors'); } } /* * View */ $form=new Form($db); $help_url='EN:Module_Foundations|FR:Module_Adhérents|ES:Módulo_Miembros'; llxHeader('', $langs->trans("MembersSetup"), $help_url); $linkback=''.$langs->trans("BackToModuleList").''; print load_fiche_titre($langs->trans("MembersSetup"), $linkback, 'title_setup'); $head = member_admin_prepare_head(); print '
'; print ''; print ''; dol_fiche_head($head, 'website', $langs->trans("Members"), -1, 'user'); if ($conf->use_javascript_ajax) { print "\n".''."\n"; } print ''.$langs->trans("BlankSubscriptionFormDesc").'

'; $enabledisablehtml = $langs->trans("EnablePublicSubscriptionForm").' '; if (empty($conf->global->MEMBER_ENABLE_PUBLIC)) { // Button off, click to enable $enabledisablehtml.=''; $enabledisablehtml.=img_picto($langs->trans("Disabled"), 'switch_off'); $enabledisablehtml.=''; } else { // Button on, click to disable $enabledisablehtml.=''; $enabledisablehtml.=img_picto($langs->trans("Activated"), 'switch_on'); $enabledisablehtml.=''; } print $enabledisablehtml; print ''; print '
'; if (! empty($conf->global->MEMBER_ENABLE_PUBLIC)) { print '
'; print ''; print ''; print ''; print ''; print "\n"; // Force Type $adht = new AdherentType($db); print '\n"; // Amount print '\n"; // Can edit print '\n"; // Jump to an online payment page print '\n"; print '
'.$langs->trans("Parameter").''.$langs->trans("Value").'
'; print $langs->trans("ForceMemberType"); print ''; $listofval = array(-1 => $langs->trans("Undefined")); $listofval += $adht->liste_array(); $forcetype = $conf->global->MEMBER_NEWFORM_FORCETYPE ?: -1; print $form->selectarray("MEMBER_NEWFORM_FORCETYPE", $listofval, $forcetype, count($listetype)>1?1:0); print "
'; print $langs->trans("DefaultAmount"); print ''; print ''; print "
'; print $langs->trans("CanEditAmount"); print ''; print $form->selectyesno("MEMBER_NEWFORM_EDITAMOUNT", (! empty($conf->global->MEMBER_NEWFORM_EDITAMOUNT)?$conf->global->MEMBER_NEWFORM_EDITAMOUNT:0), 1); print "
'; print $langs->trans("MEMBER_NEWFORM_PAYONLINE"); print ''; $listofval=array(); $listofval['-1']=$langs->trans('No'); $listofval['all']=$langs->trans('Yes').' ('.$langs->trans("VisitorCanChooseItsPaymentMode").')'; if (! empty($conf->paybox->enabled)) $listofval['paybox']='Paybox'; if (! empty($conf->paypal->enabled)) $listofval['paypal']='PayPal'; if (! empty($conf->stripe->enabled)) $listofval['stripe']='Stripe'; print $form->selectarray("MEMBER_NEWFORM_PAYONLINE", $listofval, (! empty($conf->global->MEMBER_NEWFORM_PAYONLINE)?$conf->global->MEMBER_NEWFORM_PAYONLINE:''), 0); print "
'; print '
'; print ''; print '
'; } dol_fiche_end(); print '
'; if (! empty($conf->global->MEMBER_ENABLE_PUBLIC)) { print '
'; //print $langs->trans('FollowingLinksArePublic').'
'; print img_picto('', 'object_globe.png').' '.$langs->trans('BlankSubscriptionForm').':
'; if ($conf->multicompany->enabled) { $entity_qr='?entity='.$conf->entity; } else { $entity_qr=''; } // Define $urlwithroot $urlwithouturlroot=preg_replace('/'.preg_quote(DOL_URL_ROOT, '/').'$/i', '', trim($dolibarr_main_url_root)); $urlwithroot=$urlwithouturlroot.DOL_URL_ROOT; // This is to use external domain name found into config file //$urlwithroot=DOL_MAIN_URL_ROOT; // This is to use same domain name than current print ''.$urlwithroot.'/public/members/new.php'.$entity_qr.''; } // End of page llxFooter(); $db->close();