dolibarr 25.0.0-alpha
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';
35require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php';
36require_once DOL_DOCUMENT_ROOT.'/core/lib/ajax.lib.php';
37require_once DOL_DOCUMENT_ROOT.'/core/lib/resource.lib.php';
38require_once DOL_DOCUMENT_ROOT.'/resource/class/html.formresource.class.php';
39
40// Load translation files required by the page
41$langs->loadLangs(array("admin", "resource"));
42
43// Security check
44if (!$user->admin) {
46}
47
48$action = GETPOST('action', 'aZ09');
49
50
51/*
52 * Actions
53 */
54
55if ($action == 'updateoptions') {
56 if (GETPOST('activate_RESOURCE_USE_SEARCH_TO_SELECT') != '') {
57 if (dolibarr_set_const($db, "RESOURCE_USE_SEARCH_TO_SELECT", GETPOST('activate_RESOURCE_USE_SEARCH_TO_SELECT'), 'chaine', 0, '', $conf->entity)) {
58 setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
59 } else {
60 setEventMessages($langs->trans("Error"), null, 'errors');
61 }
62 }
63}
64
65/*
66 * View
67 */
68
69llxHeader('', $langs->trans('ResourceSetup'), '', '', 0, 0, '', '', '', 'mod-admin page-resource');
70
71$form = new Form($db);
72
73$linkback = '<a href="'.dolBuildUrl(DOL_URL_ROOT.'/admin/modules.php', ['restore_lastsearch_values' => 1]).'">'.img_picto($langs->trans("BackToModuleList"), 'back', 'class="pictofixedwidth"').'<span class="hideonsmartphone">'.$langs->trans("BackToModuleList").'</span></a>';
74
75print load_fiche_titre($langs->trans('ResourceSetup'), $linkback, 'title_setup');
76
78
79print dol_get_fiche_head($head, 'general', $langs->trans("ResourceSingular"), -1, 'action');
80
81print '<form method="POST" action="'.$_SERVER['PHP_SELF'].'" spellcheck="false">';
82print '<input type="hidden" name="token" value="'.newToken().'">';
83print '<input type="hidden" name="action" value="updateoptions">';
84
85print '<div class="div-table-responsive-no-min">';
86print '<table class="noborder centpercent">';
87print '<tr class="liste_titre">';
88print '<td>'.$langs->trans("Parameters").'</td>'."\n";
89print '<td class="right"></td>'."\n";
90print '<td></td>';
91
92
93// Use an Ajax form for the product choice
94print '<tr class="oddeven">';
95print '<td width="80%">'.$langs->trans("UseSearchToSelectResource").'</td>';
96if (empty($conf->use_javascript_ajax)) {
97 print '<td class="nowrap right" colspan="2">';
98 print $langs->trans("NotAvailableWhenAjaxDisabled");
99 print '</td>';
100} else {
101 print '<td width="60" class="right">';
102 $arrval = array(
103 0 => array('label' => $langs->trans("No")),
104 1 => array('label' => $langs->trans("Yes").' ('.$langs->trans("NumberOfKeyToSearch", 1).')', 'labelhtml' => $langs->trans("Yes").' <span class="opacitymedium small">('.$langs->trans("NumberOfKeyToSearch", 1).')</span>'),
105 2 => array('label' => $langs->trans("Yes").' ('.$langs->trans("NumberOfKeyToSearch", 2).')', 'labelhtml' => $langs->trans("Yes").' <span class="opacitymedium small">('.$langs->trans("NumberOfKeyToSearch", 2).')</span>'),
106 3 => array('label' => $langs->trans("Yes").' ('.$langs->trans("NumberOfKeyToSearch", 3).')', 'labelhtml' => $langs->trans("Yes").' <span class="opacitymedium small">('.$langs->trans("NumberOfKeyToSearch", 3).')</span>'),
107 );
108 print $form->selectarray("activate_RESOURCE_USE_SEARCH_TO_SELECT", $arrval, getDolGlobalInt('RESOURCE_USE_SEARCH_TO_SELECT'));
109 print '</td>';
110 print '<td class="right">';
111 print '<input type="submit" class="button small" name="RESOURCE_USE_SEARCH_TO_SELECT" value="'.$langs->trans("Modify").'">';
112 print '</td>';
113}
114print '</tr>';
115
116
117print '<tr class="oddeven">';
118print '<td>'.$langs->trans('EnableResourceUsedInEventCheck').'</td>';
119print '<td class="right">';
120echo ajax_constantonoff('RESOURCE_USED_IN_EVENT_CHECK');
121print '</td>';
122print '<td></td>';
123print '</tr>';
124
125/*
126print '<tr class="oddeven">';
127print '<td>'.$langs->trans('DisabledResourceLinkUser').'</td>';
128print '<td class="right">';
129echo ajax_constantonoff('RESOURCE_HIDE_ADD_CONTACT_USER');
130print '</td>';
131print '<td></td>';
132print '</tr>';
133
134
135print '<tr class="oddeven">';
136print '<td>'.$langs->trans('DisabledResourceLinkContact').'</td>';
137print '<td class="right">';
138echo ajax_constantonoff('RESOURCE_HIDE_ADD_CONTACT_THIPARTY');
139print '</td>';
140print '<td></td>';
141print '</tr>';
142*/
143
144print '</table>';
145print '</div>';
146
147print '</form>';
148
149
150//RESOURCE_HIDE_ADD_CONTACT_USER
151//RESOURCE_HIDE_ADD_CONTACT_THIPARTY
152
153print dol_get_fiche_end();
154
155// End of page
156llxFooter();
157$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).
llxFooter($comment='', $zone='private', $disabledoutputofmessages=0)
Empty footer.
Definition wrapper.php:91
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:73
Class to manage generation of HTML components Only common components must be here.
if(!isModEnabled('ai')||!getDolGlobalString('AI_ASSISTANT_ENABLED')) global $conf
The main.inc.php has been included so the following variable are now defined:
getDolGlobalInt($key, $default=0)
Return a Dolibarr global constant int value.
GETPOST($paramname, $check='alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0, $nodefault=0)
Return value of a param into GET or POST supervariable.
dol_get_fiche_head($links=array(), $active='', $title='', $notab=0, $picto='', $pictoisfullpath=0, $morehtmlright='', $morecss='', $limittoshow=0, $moretabssuffix='', $dragdropfile=0, $morecssdiv='')
Show tabs of a record.
Definition html.lib.php:540
dol_get_fiche_end($notab=0)
Return tab footer of a card.
Definition html.lib.php:738
load_fiche_titre($title, $morehtmlright='', $picto='generic', $pictoisfullpath=0, $id='', $morecssontable='', $morehtmlcenter='', $morecssonpicto='widthpictotitle')
Load a title with picto.
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.