dolibarr 21.0.0-beta
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-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';
27
28// Libraries
29require_once DOL_DOCUMENT_ROOT . '/core/lib/admin.lib.php';
30require_once DOL_DOCUMENT_ROOT . '/zapier/lib/zapier.lib.php';
31
41// Translations
42$langs->loadLangs(array('admin', 'zapier'));
43
44// Access control
45if (!$user->admin) {
47}
48
49// Parameters
50$action = GETPOST('action', 'aZ09');
51$backtopage = GETPOST('backtopage', 'alpha');
52
53$arrayofparameters = array(
54 // 'ZAPIERFORDOLIBARR_MYPARAM1'=>array('css'=>'minwidth200', 'enabled'=>1),
55 // 'ZAPIERFORDOLIBARR_MYPARAM2'=>array('css'=>'minwidth500', 'enabled'=>1)
56);
57
58if (!isModEnabled('zapier')) {
60}
61if (empty($user->admin)) {
63}
64
65
66/*
67 * Actions
68 */
69
70include DOL_DOCUMENT_ROOT . '/core/actions_setmoduleoptions.inc.php';
71
72/*
73 * View
74 */
75
76$page_name = 'ZapierForDolibarrSetup';
77$help_url = 'EN:Module_Zapier';
78llxHeader('', $langs->trans($page_name), $help_url, '', 0, 0, '', '', '', 'mod-zapier page-admin_setup');
79
80// Subheader
81$linkback = '<a href="' . ($backtopage ? $backtopage : DOL_URL_ROOT . '/admin/modules.php?restore_lastsearch_values=1') . '">' . $langs->trans("BackToModuleList") . '</a>';
82
83print load_fiche_titre($langs->trans($page_name), $linkback, 'object_zapier');
84
85// Configuration header
87print dol_get_fiche_head($head, 'settings', '', -1, "zapier");
88
89if (!empty($arrayofparameters)) {
90 if ($action == 'edit') {
91 print '<form method="POST" action="' . $_SERVER["PHP_SELF"] . '">';
92 print '<input type="hidden" name="token" value="' . newToken() . '">';
93 print '<input type="hidden" name="action" value="update">';
94
95 print '<table class="noborder centpercent">';
96 print '<tr class="liste_titre"><td class="titlefield">' . $langs->trans("Parameter") . '</td><td>' . $langs->trans("Value") . '</td></tr>';
97
98 foreach ($arrayofparameters as $key => $val) {
99 print '<tr class="oddeven"><td>';
100 print $form->textwithpicto($langs->trans($key), $langs->trans($key . 'Tooltip'));
101 print '</td><td><input name="' . $key . '" class="flat ' . (empty($val['css']) ? 'minwidth200' : $val['css']) . '" value="' . getDolGlobalString($key) . '"></td></tr>';
102 }
103 print '</table>';
104
105 print '<br><div class="center">';
106 print '<input class="button button-save" type="submit" value="' . $langs->trans("Save") . '">';
107 print '</div>';
108
109 print '</form>';
110 print '<br>';
111 } else {
112 print '<table class="noborder centpercent">';
113 print '<tr class="liste_titre"><td class="titlefield">' . $langs->trans("Parameter") . '</td><td>' . $langs->trans("Value") . '</td></tr>';
114
115 foreach ($arrayofparameters as $key => $val) {
116 print '<tr class="oddeven"><td>';
117 print $form->textwithpicto($langs->trans($key), $langs->trans($key . 'Tooltip'));
118 print '</td><td>' . getDolGlobalString($key) . '</td></tr>';
119 }
120
121 print '</table>';
122
123 print '<div class="tabsAction">';
124 print '<a class="butAction" href="' . $_SERVER["PHP_SELF"] . '?action=edit&token=' . newToken() . '">' . $langs->trans("Modify") . '</a>';
125 print '</div>';
126 }
127} else {
128 // Setup page goes here
129 echo '<br><br><span class="opacitymediumdisabled">' . $langs->trans("ZapierSetupPage") . '</span><br><br>';
130 //print '<br>'.$langs->trans("NothingToSetup");
131}
132
133
134// Page end
135print dol_get_fiche_end();
136
137llxFooter();
138$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
llxFooter()
Footer empty.
Definition document.php:107
load_fiche_titre($title, $morehtmlright='', $picto='generic', $pictoisfullpath=0, $id='', $morecssontable='', $morehtmlcenter='')
Load a title with picto.
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.
accessforbidden($message='', $printheader=1, $printfooter=1, $showonlymessage=0, $params=null)
Show a message to say access is forbidden and stop program.
zapierAdminPrepareHead()
Prepare admin pages header.