dolibarr 21.0.0-beta
resource.php
Go to the documentation of this file.
1<?php
2/* Copyright (C) 2016 Florian HENRY <florian.henry@atm-consulting.fr>
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 */
19
26// Load Dolibarr environment
27require '../main.inc.php';
28
29// Class
30require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php';
31require_once DOL_DOCUMENT_ROOT.'/core/lib/ajax.lib.php';
32require_once DOL_DOCUMENT_ROOT.'/core/lib/resource.lib.php';
33require_once DOL_DOCUMENT_ROOT.'/resource/class/html.formresource.class.php';
34
43// Load translation files required by the page
44$langs->loadLangs(array("admin", "resource"));
45
46// Security check
47if (!$user->admin) {
49}
50
51$action = GETPOST('action', 'aZ09');
52
53
54/*
55 * Actions
56 */
57
58if ($action == 'updateoptions') {
59 if (GETPOST('activate_RESOURCE_USE_SEARCH_TO_SELECT') != '') {
60 if (dolibarr_set_const($db, "RESOURCE_USE_SEARCH_TO_SELECT", GETPOST('activate_RESOURCE_USE_SEARCH_TO_SELECT'), 'chaine', 0, '', $conf->entity)) {
61 setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
62 } else {
63 setEventMessages($langs->trans("Error"), null, 'errors');
64 }
65 }
66}
67
68/*
69 * View
70 */
71
72llxHeader('', $langs->trans('ResourceSetup'), '', '', 0, 0, '', '', '', 'mod-admin page-resource');
73
74$form = new Form($db);
75
76$linkback = '<a href="'.DOL_URL_ROOT.'/admin/modules.php?restore_lastsearch_values=1">'.$langs->trans("BackToModuleList").'</a>';
77print load_fiche_titre($langs->trans('ResourceSetup'), $linkback, 'title_setup');
78
80
81print dol_get_fiche_head($head, 'general', $langs->trans("ResourceSingular"), -1, 'action');
82
83print '<form method="POST" action="'.$_SERVER['PHP_SELF'].'">';
84print '<input type="hidden" name="token" value="'.newToken().'">';
85print '<input type="hidden" name="action" value="updateoptions">';
86
87print '<div class="div-table-responsive-no-min">';
88print '<table class="noborder centpercent">';
89print '<tr class="liste_titre">';
90print '<td>'.$langs->trans("Parameters").'</td>'."\n";
91print '<td class="right">'.$langs->trans("Value").'</td>'."\n";
92print '<td></td>';
93
94
95// Use an Ajax form for the product choice
96print '<tr class="oddeven">';
97print '<td width="80%">'.$langs->trans("UseSearchToSelectResource").'</td>';
98if (empty($conf->use_javascript_ajax)) {
99 print '<td class="nowrap right" colspan="2">';
100 print $langs->trans("NotAvailableWhenAjaxDisabled");
101 print '</td>';
102} else {
103 print '<td width="60" class="right">';
104 $arrval = array(
105 $langs->trans("No"),
106 $langs->trans("Yes").' ('.$langs->trans("NumberOfKeyToSearch", 1).')',
107 $langs->trans("Yes").' ('.$langs->trans("NumberOfKeyToSearch", 2).')',
108 $langs->trans("Yes").' ('.$langs->trans("NumberOfKeyToSearch", 3).')',
109 );
110 print $form->selectarray("activate_RESOURCE_USE_SEARCH_TO_SELECT", $arrval, getDolGlobalInt('RESOURCE_USE_SEARCH_TO_SELECT'));
111 print '</td>';
112 print '<td class="right">';
113 print '<input type="submit" class="button small" name="RESOURCE_USE_SEARCH_TO_SELECT" value="'.$langs->trans("Modify").'">';
114 print '</td>';
115}
116print '</tr>';
117
118
119print '<tr class="oddeven">';
120print '<td>'.$langs->trans('EnableResourceUsedInEventCheck').'</td>';
121print '<td class="right">';
122echo ajax_constantonoff('RESOURCE_USED_IN_EVENT_CHECK');
123print '</td>';
124print '<td></td>';
125print '</tr>';
126
127/*
128print '<tr class="oddeven">';
129print '<td>'.$langs->trans('DisabledResourceLinkUser').'</td>';
130print '<td class="right">';
131echo ajax_constantonoff('RESOURCE_HIDE_ADD_CONTACT_USER');
132print '</td>';
133print '<td></td>';
134print '</tr>';
135
136
137print '<tr class="oddeven">';
138print '<td>'.$langs->trans('DisabledResourceLinkContact').'</td>';
139print '<td class="right">';
140echo ajax_constantonoff('RESOURCE_HIDE_ADD_CONTACT_THIPARTY');
141print '</td>';
142print '<td></td>';
143print '</tr>';
144*/
145
146print '</table>';
147print '</div>';
148
149print '</form>';
150
151
152//RESOURCE_HIDE_ADD_CONTACT_USER
153//RESOURCE_HIDE_ADD_CONTACT_THIPARTY
154
155print dol_get_fiche_end();
156
157// End of page
158llxFooter();
159$db->close();
dolibarr_set_const($db, $name, $value, $type='chaine', $visible=0, $note='', $entity=1)
Insert a parameter (key,value) into database (delete old key then insert it again).
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 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.
setEventMessages($mesg, $mesgs, $style='mesgs', $messagekey='', $noduplicate=0, $attop=0)
Set event messages in dol_events session object.
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.
getDolGlobalInt($key, $default=0)
Return a Dolibarr global constant int value.
GETPOST($paramname, $check='alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
global $conf
The following vars must be defined: $type2label $form $conf, $lang, The following vars may also be de...
Definition member.php:79
resource_admin_prepare_head()
Prepare head for admin tabs.
accessforbidden($message='', $printheader=1, $printfooter=1, $showonlymessage=0, $params=null)
Show a message to say access is forbidden and stop program.