dolibarr 21.0.0-beta
website_options.php
1<?php
2/* Copyright (C) 2004-2017 Laurent Destailleur <eldy@users.sourceforge.net>
3 * Copyright (C) 2024 Frédéric France <frederic.france@free.fr>
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 3 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 <https://www.gnu.org/licenses/>.
17 */
18
25// Load Dolibarr environment
26require '../main.inc.php';
27require_once DOL_DOCUMENT_ROOT.'/core/class/html.formadmin.class.php';
28require_once DOL_DOCUMENT_ROOT.'/core/class/html.formcompany.class.php';
29require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php';
30require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
31require_once DOL_DOCUMENT_ROOT.'/core/lib/website.lib.php';
32require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php';
33require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php';
34require_once DOL_DOCUMENT_ROOT.'/website/class/website.class.php';
35
44// Load translation files required by the page
45$langs->loadLangs(array('errors', 'admin', 'companies', 'website'));
46
47$action = GETPOST('action', 'alpha') ? GETPOST('action', 'alpha') : 'view';
48$confirm = GETPOST('confirm', 'alpha');
49$backtopage = GETPOST('backtopage', 'alpha');
50
51// Load variable for pagination
52$limit = GETPOSTINT('limit') ? GETPOSTINT('limit') : $conf->liste_limit;
53$sortfield = GETPOST('sortfield', 'aZ09comma');
54$sortorder = GETPOST('sortorder', 'aZ09comma');
55$page = GETPOSTISSET('pageplusone') ? (GETPOSTINT('pageplusone') - 1) : GETPOSTINT("page");
56if (empty($page) || $page == -1) {
57 $page = 0;
58} // If $page is not defined, or '' or -1
59$offset = $limit * $page;
60$pageprev = $page - 1;
61$pagenext = $page + 1;
62
63// Initialize a technical object to manage hooks of page. Note that conf->hooks_modules contains an array of hook context
64$hookmanager->initHooks(array('admin'));
65
66$arrayofparameters = array('WEBSITE_USE_WEBSITE_ACCOUNTS'=>array('css'=>'minwidth200'));
67
68$status = 1;
69$rowid = GETPOST('rowid', 'alpha');
70
71if (!$user->admin || !isModEnabled('website')) {
73}
74
75// Set this to 1 to use the factory to manage constants. Warning, the generated module will be compatible with version v15+ only
76/*
77$useFormSetup = 1;
78
79if (!class_exists('FormSetup')) {
80 require_once DOL_DOCUMENT_ROOT.'/core/class/html.formsetup.class.php';
81}
82$formSetup = new FormSetup($db);
83
84$item = $formSetup->newItem('NO_PARAM_JUST_TEXT');
85*/
86
87
88/*
89 * Actions
90 */
91
92include DOL_DOCUMENT_ROOT.'/core/actions_setmoduleoptions.inc.php';
93
94
95/*
96 * View
97 */
98
99$form = new Form($db);
100$formadmin = new FormAdmin($db);
101
102llxHeader('', $langs->trans("WebsiteSetup"), '', '', 0, 0, '', '', '', 'mod-admin page-website_options');
103
104$titre = $langs->trans("WebsiteSetup");
105$linkback = '<a href="'.($backtopage ? $backtopage : DOL_URL_ROOT.'/admin/modules.php').'">'.$langs->trans("BackToModuleList").'</a>';
106print load_fiche_titre($titre, $linkback, 'title_setup');
107
108// Onglets
109$head = array();
110$h = 0;
111
112$head[$h][0] = DOL_URL_ROOT."/admin/website.php";
113$head[$h][1] = $langs->trans("WebSites");
114$head[$h][2] = 'website';
115$h++;
116
117$head[$h][0] = DOL_URL_ROOT."/admin/website_options.php";
118$head[$h][1] = $langs->trans("Options");
119$head[$h][2] = 'options';
120$h++;
121
122print dol_get_fiche_head($head, 'options', '', -1);
123
124
125
126print '<div class="div-table-responsive-no-min">';
127print '<table class="noborder centpercent">';
128print '<tr class="liste_titre">';
129print '<td>'.$langs->trans("Parameter").'</td>';
130print '<td align="center" width="20">&nbsp;</td>';
131print '<td align="center" width="100">'.$langs->trans("Value").'</td>'."\n";
132print '</tr>';
133
134
135// Mail required for users
136
137print '<tr class="oddeven">';
138print '<td>';
139print $form->textwithpicto($langs->trans('WEBSITE_USE_WEBSITE_ACCOUNTS'), $langs->trans('WEBSITE_USE_WEBSITE_ACCOUNTSTooltip'));
140print '</td>';
141print '<td align="center" width="20">&nbsp;</td>';
142
143print '<td align="center" width="100">';
144if (!empty($conf->use_javascript_ajax)) {
145 print ajax_constantonoff('WEBSITE_USE_WEBSITE_ACCOUNTS');
146} else {
147 if (!getDolGlobalString('WEBSITE_USE_WEBSITE_ACCOUNTS')) {
148 print '<a href="'.$_SERVER['PHP_SELF'].'?action=set_WEBSITE_USE_WEBSITE_ACCOUNTS&token='.newToken().'">'.img_picto($langs->trans("Disabled"), 'off').'</a>';
149 } else {
150 print '<a href="'.$_SERVER['PHP_SELF'].'?action=del_WEBSITE_USE_WEBSITE_ACCOUNTS&token='.newToken().'">'.img_picto($langs->trans("Enabled"), 'on').'</a>';
151 }
152}
153print '</td></tr>';
154
155
156print '</table>';
157
158if (empty($conf->use_javascript_ajax)) {
159 print '<div class="tabsAction">';
160 print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?action=edit&token='.newToken().'">'.$langs->trans("Modify").'</a>';
161 print '</div>';
162}
163
164print dol_get_fiche_end();
165
166// End of page
167llxFooter();
168$db->close();
if(!defined('NOREQUIRESOC')) if(!defined( 'NOREQUIRETRAN')) if(!defined('NOTOKENRENEWAL')) if(!defined( 'NOREQUIREMENU')) if(!defined('NOREQUIREHTML')) if(!defined( 'NOREQUIREAJAX')) llxHeader($head='', $title='', $help_url='', $target='', $disablejs=0, $disablehead=0, $arrayofjs='', $arrayofcss='', $morequerystring='', $morecssonbody='', $replacemainareaby='', $disablenofollow=0, $disablenoindex=0)
Empty header.
Definition wrapper.php:71
Class to generate html code for admin pages.
Class to manage generation of HTML components Only common components must be here.
llxFooter()
Footer empty.
Definition document.php:107
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)
GETPOSTINT($paramname, $method=0)
Return the value of a $_GET or $_POST supervariable, converted into integer.
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.
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.
getDolGlobalString($key, $default='')
Return a Dolibarr global constant string value.
global $conf
The following vars must be defined: $type2label $form $conf, $lang, The following vars may also be de...
Definition member.php:79
accessforbidden($message='', $printheader=1, $printfooter=1, $showonlymessage=0, $params=null)
Show a message to say access is forbidden and stop program.