dolibarr 20.0.0
website.php
Go to the documentation of this file.
1<?php
2/* Copyright (C) 2001-2002 Rodolphe Quiedeville <rodolphe@quiedeville.org>
3 * Copyright (C) 2006-2015 Laurent Destailleur <eldy@users.sourceforge.net>
4 * Copyright (C) 2006-2012 Regis Houssin <regis.houssin@inodbox.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 <https://www.gnu.org/licenses/>.
19 */
20
27// Load Dolibarr environment
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';
32require_once DOL_DOCUMENT_ROOT.'/partnership/lib/partnership.lib.php';
33require_once DOL_DOCUMENT_ROOT.'/partnership/class/partnership.class.php';
34
35// Load translation files required by the page
36$langs->loadLangs(array("admin", "partnership"));
37
38$action = GETPOST('action', 'aZ09');
39
40$error = 0;
41
42if (!$user->admin) {
44}
45
46
47/*
48 * Actions
49 */
50
51if ($action == 'setPARTNERSHIP_ENABLE_PUBLIC') {
52 if (GETPOST('value')) {
53 dolibarr_set_const($db, 'PARTNERSHIP_ENABLE_PUBLIC', 1, 'chaine', 0, '', $conf->entity);
54 } else {
55 dolibarr_set_const($db, 'PARTNERSHIP_ENABLE_PUBLIC', 0, 'chaine', 0, '', $conf->entity);
56 }
57}
58
59if ($action == 'update') {
60 $public = GETPOST('PARTNERSHIP_ENABLE_PUBLIC');
61
62 $res = dolibarr_set_const($db, "PARTNERSHIP_ENABLE_PUBLIC", $public, 'chaine', 0, '', $conf->entity);
63
64 if (!($res > 0)) {
65 $error++;
66 }
67
68 if (!$error) {
69 setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
70 } else {
71 setEventMessages($langs->trans("Error"), null, 'errors');
72 }
73}
74
75
76/*
77 * View
78 */
79
80$form = new Form($db);
81
82$title = $langs->trans('PartnershipSetup');
83$help_url = '';
84//$help_url = 'EN:Module_Partnership|FR:Module_Adh&eacute;rents|ES:M&oacute;dulo_Miembros';
85llxHeader('', $title, $help_url, '', 0, 0, '', '', '', 'mod-partnership page-admin-website');
86
87
88$linkback = '<a href="'.DOL_URL_ROOT.'/admin/modules.php?restore_lastsearch_values=1">'.$langs->trans("BackToModuleList").'</a>';
89print load_fiche_titre($title, $linkback, 'title_setup');
90
92
93
94
95print '<form action="'.$_SERVER["PHP_SELF"].'" method="post">';
96print '<input type="hidden" name="action" value="update">';
97print '<input type="hidden" name="token" value="'.newToken().'">';
98
99print dol_get_fiche_head($head, 'website', $langs->trans("Partnerships"), -1, 'partnership');
100
101if ($conf->use_javascript_ajax) {
102 print "\n".'<script type="text/javascript" language="javascript">';
103 print 'jQuery(document).ready(function () {
104 function initemail()
105 {
106 if (jQuery("#PARTNERSHIP_NEWFORM_PAYONLINE").val()==\'-1\')
107 {
108 jQuery("#tremail").hide();
109 }
110 else
111 {
112 jQuery("#tremail").show();
113 }
114 }
115 function initfields()
116 {
117 if (jQuery("#PARTNERSHIP_ENABLE_PUBLIC").val()==\'0\')
118 {
119 jQuery("#trforcetype, #tramount, #tredit, #trpayment, #tremail").hide();
120 }
121 if (jQuery("#PARTNERSHIP_ENABLE_PUBLIC").val()==\'1\')
122 {
123 jQuery("#trforcetype, #tramount, #tredit, #trpayment").show();
124 if (jQuery("#PARTNERSHIP_NEWFORM_PAYONLINE").val()==\'-1\') jQuery("#tremail").hide();
125 else jQuery("#tremail").show();
126 }
127 }
128 initfields();
129 jQuery("#PARTNERSHIP_ENABLE_PUBLIC").change(function() { initfields(); });
130 jQuery("#PARTNERSHIP_NEWFORM_PAYONLINE").change(function() { initemail(); });
131 })';
132 print '</script>'."\n";
133}
134
135
136print '<span class="opacitymedium">'.$langs->trans("PublicFormRegistrationPartnerDesc").'</span><br><br>';
137
138$param = '';
139
140$enabledisablehtml = $langs->trans("EnablePublicSubscriptionForm").' ';
141if (!getDolGlobalString('PARTNERSHIP_ENABLE_PUBLIC')) {
142 // Button off, click to enable
143 $enabledisablehtml .= '<a class="reposition valignmiddle" href="'.$_SERVER["PHP_SELF"].'?action=setPARTNERSHIP_ENABLE_PUBLIC&token='.newToken().'&value=1'.$param.'">';
144 $enabledisablehtml .= img_picto($langs->trans("Disabled"), 'switch_off');
145 $enabledisablehtml .= '</a>';
146} else {
147 // Button on, click to disable
148 $enabledisablehtml .= '<a class="reposition valignmiddle" href="'.$_SERVER["PHP_SELF"].'?action=setPARTNERSHIP_ENABLE_PUBLIC&token='.newToken().'&value=0'.$param.'">';
149 $enabledisablehtml .= img_picto($langs->trans("Activated"), 'switch_on');
150 $enabledisablehtml .= '</a>';
151}
152print $enabledisablehtml;
153print '<input type="hidden" id="PARTNERSHIP_ENABLE_PUBLIC" name="PARTNERSHIP_ENABLE_PUBLIC" value="'.(!getDolGlobalString('PARTNERSHIP_ENABLE_PUBLIC') ? 0 : 1).'">';
154
155
156print '<br>';
157
158
159/*
160if (!empty($conf->global->PARTNERSHIP_ENABLE_PUBLIC)) {
161 print '<br>';
162
163 print '<div class="div-table-responsive-no-min">';
164 print '<table class="noborder centpercent">';
165
166 print '<tr class="liste_titre">';
167 print '<td>'.$langs->trans("Parameter").'</td>';
168 print '<td class="right">'.$langs->trans("Value").'</td>';
169 print "</tr>\n";
170
171 // Amount
172 print '<tr class="oddeven" id="tramount"><td>';
173 print $langs->trans("DefaultAmount");
174 print '</td><td class="right">';
175 print '<input type="text" class="right width75" id="PARTNERSHIP_NEWFORM_AMOUNT" name="PARTNERSHIP_NEWFORM_AMOUNT" value="'.(!empty($conf->global->PARTNERSHIP_NEWFORM_AMOUNT) ? $conf->global->PARTNERSHIP_NEWFORM_AMOUNT : '').'">';
176 print "</td></tr>\n";
177
178 // Jump to an online payment page
179 print '<tr class="oddeven" id="trpayment"><td>';
180 print $langs->trans("PARTNERSHIP_NEWFORM_PAYONLINE");
181 print '</td><td class="right">';
182 $listofval = array();
183 $listofval['-1'] = $langs->trans('No');
184 $listofval['all'] = $langs->trans('Yes').' ('.$langs->trans("VisitorCanChooseItsPaymentMode").')';
185 if (isModEnabled('paybox')) {
186 $listofval['paybox'] = 'Paybox';
187 }
188 if (isModEnabled('paypal')) {
189 $listofval['paypal'] = 'PayPal';
190 }
191 if (isModEnabled('stripe')) {
192 $listofval['stripe'] = 'Stripe';
193 }
194 print $form->selectarray("PARTNERSHIP_NEWFORM_PAYONLINE", $listofval, (!empty($conf->global->PARTNERSHIP_NEWFORM_PAYONLINE) ? $conf->global->PARTNERSHIP_NEWFORM_PAYONLINE : ''), 0);
195 print "</td></tr>\n";
196
197
198 print '</table>';
199 print '</div>';
200
201 print '<div class="center">';
202 print '<input type="submit" class="button button-edit" value="'.$langs->trans("Modify").'">';
203 print '</div>';
204}
205*/
206
207
208print dol_get_fiche_end();
209
210print '</form>';
211
212
213if (getDolGlobalString('PARTNERSHIP_ENABLE_PUBLIC')) {
214 print '<br>';
215 //print $langs->trans('FollowingLinksArePublic').'<br>';
216 print img_picto('', 'globe').' <span class="opacitymedium">'.$langs->trans('BlankSubscriptionForm').'</span><br>';
217 if (isModEnabled('multicompany')) {
218 $entity_qr = '?entity='.$conf->entity;
219 } else {
220 $entity_qr = '';
221 }
222
223 // Define $urlwithroot
224 $urlwithouturlroot = preg_replace('/'.preg_quote(DOL_URL_ROOT, '/').'$/i', '', trim($dolibarr_main_url_root));
225 $urlwithroot = $urlwithouturlroot.DOL_URL_ROOT; // This is to use external domain name found into config file
226 //$urlwithroot=DOL_MAIN_URL_ROOT; // This is to use same domain name than current
227
228 print '<div class="urllink">';
229 print '<input type="text" id="publicurlmember" class="quatrevingtpercentminusx" value="'.$urlwithroot.'/public/partnership/new.php'.$entity_qr.'">';
230 print '<a target="_blank" rel="noopener noreferrer" href="'.$urlwithroot.'/public/partnership/new.php'.$entity_qr.'">'.img_picto('', 'globe', 'class="paddingleft"').'</a>';
231 print '</div>';
232 print ajax_autoselect('publicurlmember');
233}
234
235// End of page
236llxFooter();
237$db->close();
dolibarr_set_const($db, $name, $value, $type='chaine', $visible=0, $note='', $entity=1)
Insert a parameter (key,value) into database (delete old key then insert it again).
if(!defined('NOREQUIRESOC')) if(!defined( 'NOREQUIRETRAN')) if(!defined('NOTOKENRENEWAL')) if(!defined( 'NOREQUIREMENU')) if(!defined('NOREQUIREHTML')) if(!defined( 'NOREQUIREAJAX')) llxHeader()
Empty header.
Definition wrapper.php:55
llxFooter()
Empty footer.
Definition wrapper.php:69
Class to manage generation of HTML components Only common components must be here.
load_fiche_titre($title, $morehtmlright='', $picto='generic', $pictoisfullpath=0, $id='', $morecssontable='', $morehtmlcenter='')
Load a title with picto.
img_picto($titlealt, $picto, $moreatt='', $pictoisfullpath=0, $srconly=0, $notitle=0, $alt='', $morecss='', $marginleftonlyshort=2)
Show picto whatever it's its name (generic function)
dol_get_fiche_head($links=array(), $active='', $title='', $notab=0, $picto='', $pictoisfullpath=0, $morehtmlright='', $morecss='', $limittoshow=0, $moretabssuffix='', $dragdropfile=0)
Show tabs of a record.
dol_get_fiche_end($notab=0)
Return tab footer of a card.
ajax_autoselect($htmlname, $addlink='', $textonlink='Link')
Make content of an input box selected when we click into input field.
newToken()
Return the value of token currently saved into session with name 'newtoken'.
GETPOST($paramname, $check='alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
setEventMessages($mesg, $mesgs, $style='mesgs', $messagekey='', $noduplicate=0)
Set event messages in dol_events session object.
getDolGlobalString($key, $default='')
Return dolibarr global constant string value.
partnershipAdminPrepareHead()
Prepare admin pages header.
accessforbidden($message='', $printheader=1, $printfooter=1, $showonlymessage=0, $params=null)
Show a message to say access is forbidden and stop program.