dolibarr  16.0.5
website_options.php
1 <?php
2 /* Copyright (C) 2004-2017 Laurent Destailleur <eldy@users.sourceforge.net>
3  *
4  * This program is free software; you can redistribute it and/or modify
5  * it under the terms of the GNU General Public License as published by
6  * the Free Software Foundation; either version 3 of the License, or
7  * (at your option) any later version.
8  *
9  * This program is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12  * GNU General Public License for more details.
13  *
14  * You should have received a copy of the GNU General Public License
15  * along with this program. If not, see <https://www.gnu.org/licenses/>.
16  */
17 
24 require '../main.inc.php';
25 require_once DOL_DOCUMENT_ROOT.'/core/class/html.formadmin.class.php';
26 require_once DOL_DOCUMENT_ROOT.'/core/class/html.formcompany.class.php';
27 require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php';
28 require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
29 require_once DOL_DOCUMENT_ROOT.'/core/lib/website.lib.php';
30 require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php';
31 require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php';
32 require_once DOL_DOCUMENT_ROOT.'/website/class/website.class.php';
33 
34 // Load translation files required by the page
35 $langs->loadLangs(array('errors', 'admin', 'companies', 'website'));
36 
37 $action = GETPOST('action', 'alpha') ?GETPOST('action', 'alpha') : 'view';
38 $confirm = GETPOST('confirm', 'alpha');
39 $backtopage = GETPOST('backtopage', 'alpha');
40 
41 $rowid = GETPOST('rowid', 'alpha');
42 
43 if (!$user->admin) {
45 }
46 
47 $status = 1;
48 
49 // Load variable for pagination
50 $limit = GETPOST('limit', 'int') ?GETPOST('limit', 'int') : $conf->liste_limit;
51 $sortfield = GETPOST('sortfield', 'aZ09comma');
52 $sortorder = GETPOST('sortorder', 'aZ09comma');
53 $page = GETPOSTISSET('pageplusone') ? (GETPOST('pageplusone') - 1) : GETPOST("page", 'int');
54 if (empty($page) || $page == -1) {
55  $page = 0;
56 } // If $page is not defined, or '' or -1
57 $offset = $limit * $page;
58 $pageprev = $page - 1;
59 $pagenext = $page + 1;
60 
61 // Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context
62 $hookmanager->initHooks(array('admin'));
63 
64 $arrayofparameters = array('WEBSITE_USE_WEBSITE_ACCOUNTS'=>array('css'=>'minwidth200'));
65 
66 
67 /*
68  * Actions
69  */
70 
71 include DOL_DOCUMENT_ROOT.'/core/actions_setmoduleoptions.inc.php';
72 
73 
74 /*
75  * View
76  */
77 
78 $form = new Form($db);
79 $formadmin = new FormAdmin($db);
80 
81 llxHeader('', $langs->trans("WebsiteSetup"));
82 
83 $titre = $langs->trans("WebsiteSetup");
84 $linkback = '<a href="'.($backtopage ? $backtopage : DOL_URL_ROOT.'/admin/modules.php').'">'.$langs->trans("BackToModuleList").'</a>';
85 print load_fiche_titre($titre, $linkback, 'title_setup');
86 
87 // Onglets
88 $head = array();
89 $h = 0;
90 
91 $head[$h][0] = DOL_URL_ROOT."/admin/website.php";
92 $head[$h][1] = $langs->trans("WebSites");
93 $head[$h][2] = 'website';
94 $h++;
95 
96 $head[$h][0] = DOL_URL_ROOT."/admin/website_options.php";
97 $head[$h][1] = $langs->trans("Options");
98 $head[$h][2] = 'options';
99 $h++;
100 
101 print dol_get_fiche_head($head, 'options', '', -1);
102 
103 
104 if ($action == 'edit') {
105  print '<form method="POST" action="'.$_SERVER["PHP_SELF"].'">';
106  print '<input type="hidden" name="token" value="'.newToken().'">';
107  print '<input type="hidden" name="action" value="update">';
108 
109  print '<table class="noborder centpercent">';
110  print '<tr class="liste_titre"><td class="titlefield">'.$langs->trans("Parameter").'</td><td>'.$langs->trans("Value").'</td></tr>';
111 
112  foreach ($arrayofparameters as $key => $val) {
113  print '<tr class="oddeven"><td>';
114  print $form->textwithpicto($langs->trans($key), $langs->trans($key.'Tooltip'));
115  print '</td><td><input name="'.$key.'" class="flat '.(empty($val['css']) ? 'minwidth200' : $val['css']).'" value="'.getDolGlobalString($key).'"></td></tr>';
116  }
117 
118  print '</table>';
119 
120  print '<br><div class="center">';
121  print '<input class="button button-save" type="submit" value="'.$langs->trans("Save").'">';
122  print '</div>';
123 
124  print '</form>';
125  print '<br>';
126 } else {
127  print '<table class="noborder centpercent">';
128  print '<tr class="liste_titre"><td class="titlefield">'.$langs->trans("Parameter").'</td><td>'.$langs->trans("Value").'</td></tr>';
129 
130  foreach ($arrayofparameters as $key => $val) {
131  print '<tr class="oddeven"><td>';
132  print $form->textwithpicto($langs->trans($key), $langs->trans($key.'Tooltip'));
133  print '</td><td>'.getDolGlobalString($key).'</td></tr>';
134  }
135 
136  print '</table>';
137 
138  print '<div class="tabsAction">';
139  print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?action=edit&token='.newToken().'">'.$langs->trans("Modify").'</a>';
140  print '</div>';
141 }
142 
143 
144 print dol_get_fiche_end();
145 
146 // End of page
147 llxFooter();
148 $db->close();
llxFooter
llxFooter()
Empty footer.
Definition: wrapper.php:73
load_fiche_titre
load_fiche_titre($titre, $morehtmlright='', $picto='generic', $pictoisfullpath=0, $id='', $morecssontable='', $morehtmlcenter='')
Load a title with picto.
Definition: functions.lib.php:5204
GETPOST
GETPOST($paramname, $check='alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
Definition: functions.lib.php:484
$form
if($cancel &&! $id) if($action=='add' &&! $cancel) if($action=='delete') if($id) $form
Actions.
Definition: card.php:142
FormAdmin
Class to generate html code for admin pages.
Definition: html.formadmin.class.php:30
dol_get_fiche_head
dol_get_fiche_head($links=array(), $active='', $title='', $notab=0, $picto='', $pictoisfullpath=0, $morehtmlright='', $morecss='', $limittoshow=0, $moretabssuffix='')
Show tabs of a record.
Definition: functions.lib.php:1822
getDolGlobalString
if(!function_exists('utf8_encode')) if(!function_exists('utf8_decode')) getDolGlobalString($key, $default='')
Return dolibarr global constant string value.
Definition: functions.lib.php:80
newToken
newToken()
Return the value of token currently saved into session with name 'newtoken'.
Definition: functions.lib.php:10878
dol_get_fiche_end
dol_get_fiche_end($notab=0)
Return tab footer of a card.
Definition: functions.lib.php:2018
GETPOSTISSET
GETPOSTISSET($paramname)
Return true if we are in a context of submitting the parameter $paramname from a POST of a form.
Definition: functions.lib.php:386
Form
Class to manage generation of HTML components Only common components must be here.
Definition: html.form.class.php:52
accessforbidden
accessforbidden($message='', $printheader=1, $printfooter=1, $showonlymessage=0, $params=null)
Show a message to say access is forbidden and stop program Calling this function terminate execution ...
Definition: security.lib.php:933
llxHeader
if(!defined('NOREQUIRESOC')) if(!defined('NOREQUIRETRAN')) if(!defined('NOCSRFCHECK')) if(!defined('NOTOKENRENEWAL')) if(!defined('NOREQUIREMENU')) if(!defined('NOREQUIREHTML')) if(!defined('NOREQUIREAJAX')) llxHeader()
Empty header.
Definition: wrapper.php:59