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) 2019 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 <http://www.gnu.org/licenses/>.
17  */
18 
25 // Load Dolibarr environment
26 require '../../main.inc.php';
27 
28 // Libraries
29 require_once DOL_DOCUMENT_ROOT."/core/lib/admin.lib.php";
30 require_once '../lib/zapier.lib.php';
31 
32 // Translations
33 $langs->loadLangs(array("admin", "zapier@zapier"));
34 
35 // Access control
36 if (!$user->admin) accessforbidden();
37 
38 // Parameters
39 $action = GETPOST('action', 'aZ09');
40 $backtopage = GETPOST('backtopage', 'alpha');
41 
42 $arrayofparameters = array(
43  'ZAPIERFORDOLIBARR_MYPARAM1'=>array('css'=>'minwidth200', 'enabled'=>1),
44  'ZAPIERFORDOLIBARR_MYPARAM2'=>array('css'=>'minwidth500', 'enabled'=>1)
45 );
46 
47 
48 /*
49  * Actions
50  */
51 if ((float) DOL_VERSION >= 6) {
52  include DOL_DOCUMENT_ROOT.'/core/actions_setmoduleoptions.inc.php';
53 }
54 
55 
56 /*
57  * View
58  */
59 
60 $page_name = "ZapierSetup";
61 llxHeader('', $langs->trans($page_name));
62 
63 // Subheader
64 $linkback = '<a href="'.($backtopage ? $backtopage : DOL_URL_ROOT.'/admin/modules.php?restore_lastsearch_values=1').'">'.$langs->trans("BackToModuleList").'</a>';
65 
66 print load_fiche_titre($langs->trans($page_name), $linkback, 'object_zapier@zapier');
67 
68 // Configuration header
69 $head = zapierAdminPrepareHead();
70 print dol_get_fiche_head($head, 'settings', '', -1, "zapier@zapier");
71 
72 // Setup page goes here
73 echo $langs->trans("ZapierSetupPage").'<br><br>';
74 
75 
76 if ($action == 'edit') {
77  print '<form method="POST" action="'.$_SERVER["PHP_SELF"].'">';
78  print '<input type="hidden" name="token" value="'.newToken().'">';
79  print '<input type="hidden" name="action" value="update">';
80 
81  print '<table class="noborder centpercent">';
82  print '<tr class="liste_titre"><td class="titlefield">'.$langs->trans("Parameter").'</td><td>'.$langs->trans("Value").'</td></tr>';
83 
84  foreach ($arrayofparameters as $key => $val) {
85  print '<tr class="oddeven"><td>';
86  print $form->textwithpicto($langs->trans($key), $langs->trans($key.'Tooltip'));
87  print '</td><td><input name="'.$key.'" class="flat '.(empty($val['css']) ? 'minwidth200' : $val['css']).'" value="'.$conf->global->$key.'"></td></tr>';
88  }
89  print '</table>';
90 
91  print '<br><div class="center">';
92  print '<input class="button button-save" type="submit" value="'.$langs->trans("Save").'">';
93  print '</div>';
94 
95  print '</form>';
96  print '<br>';
97 } else {
98  if (!empty($arrayofparameters)) {
99  print '<table class="noborder centpercent">';
100  print '<tr class="liste_titre"><td class="titlefield">'.$langs->trans("Parameter").'</td><td>'.$langs->trans("Value").'</td></tr>';
101 
102  foreach ($arrayofparameters as $key => $val) {
103  print '<tr class="oddeven"><td>';
104  print $form->textwithpicto($langs->trans($key), $langs->trans($key.'Tooltip'));
105  print '</td><td>'.$conf->global->$key.'</td></tr>';
106  }
107 
108  print '</table>';
109 
110  print '<div class="tabsAction">';
111  print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?action=edit">'.$langs->trans("Modify").'</a>';
112  print '</div>';
113  } else {
114  print '<br>'.$langs->trans("NothingToSetup");
115  }
116 }
117 
118 
119 // Page end
121 
122 llxFooter();
123 $db->close();
GETPOST($paramname, $check= 'alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
zapierAdminPrepareHead()
Prepare admin pages header.
Definition: zapier.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