dolibarr  13.0.2
setup.php
Go to the documentation of this file.
1 <?php
2 /* Copyright (C) 2004-2017 Laurent Destailleur <eldy@users.sourceforge.net>
3  * Copyright (C) 2018 Alexandre Spangaro <aspangaro@open-dsi.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 require '../../main.inc.php';
26 require_once DOL_DOCUMENT_ROOT.'/core/lib/asset.lib.php';
27 require_once DOL_DOCUMENT_ROOT."/core/lib/admin.lib.php";
28 
29 global $langs, $user;
30 
31 // Load translation files required by the page
32 $langs->loadLangs(array("admin", "assets"));
33 
34 // Access control
35 if (!$user->admin) accessforbidden();
36 
37 // Parameters
38 $action = GETPOST('action', 'aZ09');
39 $backtopage = GETPOST('backtopage', 'alpha');
40 
41 $arrayofparameters = array('FIXEDASSETS_MYPARAM1'=>array('css'=>'minwidth200'), 'FIXEDASSETS_MYPARAM2'=>array('css'=>'minwidth500'));
42 
43 
44 /*
45  * Actions
46  */
47 
48 include DOL_DOCUMENT_ROOT.'/core/actions_setmoduleoptions.inc.php';
49 
50 
51 /*
52  * View
53  */
54 
55 llxHeader('', $langs->trans("AssetsSetup"));
56 
57 $linkback = '<a href="'.DOL_URL_ROOT.'/admin/modules.php">'.$langs->trans("BackToModuleList").'</a>';
58 print load_fiche_titre($langs->trans("AssetsSetup"), $linkback, 'title_setup');
59 
60 
61 $head = asset_admin_prepare_head();
62 
63 print dol_get_fiche_head($head, 'settings', $langs->trans("Assets"), -1, 'generic');
64 
65 
66 if ($action == 'edit')
67 {
68  print '<form method="POST" action="'.$_SERVER["PHP_SELF"].'">';
69  print '<input type="hidden" name="token" value="'.newToken().'">';
70  print '<input type="hidden" name="action" value="update">';
71 
72  print '<table class="noborder centpercent">';
73  print '<tr class="liste_titre"><td class="titlefield">'.$langs->trans("Parameter").'</td><td>'.$langs->trans("Value").'</td></tr>';
74 
75  foreach ($arrayofparameters as $key => $val)
76  {
77  print '<tr class="oddeven"><td>';
78  print $form->textwithpicto($langs->trans($key), $langs->trans($key.'Tooltip'));
79  print '</td><td><input name="'.$key.'" class="flat '.(empty($val['css']) ? 'minwidth200' : $val['css']).'" value="'.$conf->global->$key.'"></td></tr>';
80  }
81 
82  print '</table>';
83 
84  print '<br><div class="center">';
85  print '<input class="button button-save" type="submit" value="'.$langs->trans("Save").'">';
86  print '</div>';
87 
88  print '</form>';
89  print '<br>';
90 } else {
91  print '<table class="noborder centpercent">';
92  print '<tr class="liste_titre"><td class="titlefield">'.$langs->trans("Parameter").'</td><td>'.$langs->trans("Value").'</td></tr>';
93 
94  foreach ($arrayofparameters as $key => $val)
95  {
96  print '<tr class="oddeven"><td>';
97  print $form->textwithpicto($langs->trans($key), $langs->trans($key.'Tooltip'));
98  print '</td><td>'.$conf->global->$key.'</td></tr>';
99  }
100 
101  print '</table>';
102 
103  print '<div class="tabsAction">';
104  print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?action=edit">'.$langs->trans("Modify").'</a>';
105  print '</div>';
106 }
107 
109 
110 // End of page
111 llxFooter();
112 $db->close();
GETPOST($paramname, $check= 'alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
asset_admin_prepare_head()
Prepare admin pages header.
Definition: asset.lib.php:29
llxHeader()
Empty header.
Definition: wrapper.php:45
load_fiche_titre($titre, $morehtmlright= '', $picto= 'generic', $pictoisfullpath=0, $id= '', $morecssontable= '', $morehtmlcenter= '')
Load a title with picto.
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 ...
dol_get_fiche_head($links=array(), $active= '', $title= '', $notab=0, $picto= '', $pictoisfullpath=0, $morehtmlright= '', $morecss= '', $limittoshow=0, $moretabssuffix= '')
Show tabs of a record.
print
Draft customers invoices.
Definition: index.php:89
dol_get_fiche_end($notab=0)
Return tab footer of a card.
llxFooter()
Empty footer.
Definition: wrapper.php:59