dolibarr  7.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  *
4  * This program is free software; you can redistribute it and/or modify
5  * it under the terms of the GNU General Public License as published by
6  * the Free Software Foundation; either version 3 of the License, or
7  * (at your option) any later version.
8  *
9  * This program is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12  * GNU General Public License for more details.
13  *
14  * You should have received a copy of the GNU General Public License
15  * along with this program. If not, see <http://www.gnu.org/licenses/>.
16  *
17  */
18 
25 require '../main.inc.php';
26 
27 // Class
28 require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php';
29 require_once DOL_DOCUMENT_ROOT.'/core/lib/ajax.lib.php';
30 require_once DOL_DOCUMENT_ROOT.'/core/lib/resource.lib.php';
31 if (! empty($conf->resouce->enabled)) require_once DOL_DOCUMENT_ROOT . '/resource/class/html.formresource.class.php';
32 
33 $langs->load("admin");
34 $langs->load("resource");
35 
36 // Security check
37 if (!$user->admin)
39 
40 $action = GETPOST('action', 'alpha');
41 
42 
43 /*
44  * Actions
45  */
46 
47 if ($action == 'updateoptions')
48 {
49  if (GETPOST('activate_RESOURCE_USE_SEARCH_TO_SELECT'))
50  {
51  if (dolibarr_set_const($db, "RESOURCE_USE_SEARCH_TO_SELECT", GETPOST('activate_RESOURCE_USE_SEARCH_TO_SELECT'), 'chaine', 0, '', $conf->entity))
52  {
53  setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
54  } else {
55  setEventMessages($langs->trans("Error"), null, 'errors');
56  }
57  }
58 }
59 
60 /*
61  * View
62  */
63 
64 llxHeader('',$langs->trans('ResourceSetup'));
65 
66 $form = new Form($db);
67 
68 $linkback='<a href="'.DOL_URL_ROOT.'/admin/modules.php">'.$langs->trans("BackToModuleList").'</a>';
69 print load_fiche_titre($langs->trans('ResourceSetup'),$linkback,'title_setup');
70 
71 $head=resource_admin_prepare_head();
72 
73 dol_fiche_head($head, 'general', $langs->trans("ResourceSingular"), 0, 'action');
74 
75 print '<form method="POST" action="'.$_SERVER['PHP_SELF'].'">';
76 print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
77 print '<input type="hidden" name="action" value="updateoptions">';
78 
79 $var=true;
80 print '<table class="noborder" width="100%">';
81 print '<tr class="liste_titre">';
82 print '<td>'.$langs->trans("Parameters").'</td>'."\n";
83 print '<td align="right" width="60">'.$langs->trans("Value").'</td>'."\n";
84 print '<td></td>';
85 
86 
87 // Utilisation formulaire Ajax sur choix produit
88 
89 print '<tr class="oddeven">';
90 print '<td width="80%">'.$langs->trans("UseSearchToSelectResource").'</td>';
91 if (empty($conf->use_javascript_ajax))
92 {
93  print '<td class="nowrap" align="right" colspan="2">';
94  print $langs->trans("NotAvailableWhenAjaxDisabled");
95  print '</td>';
96 }
97 else
98 {
99  print '<td width="60" align="right">';
100  $arrval=array(
101  '0'=>$langs->trans("No"),
102  '1'=>$langs->trans("Yes").' ('.$langs->trans("NumberOfKeyToSearch",1).')',
103  '2'=>$langs->trans("Yes").' ('.$langs->trans("NumberOfKeyToSearch",2).')',
104  '3'=>$langs->trans("Yes").' ('.$langs->trans("NumberOfKeyToSearch",3).')',
105  );
106  print $form->selectarray("activate_RESOURCE_USE_SEARCH_TO_SELECT",$arrval,$conf->global->RESOURCE_USE_SEARCH_TO_SELECT);
107  print '</td>';
108  print '<td align="right">';
109  print '<input type="submit" class="button" name="RESOURCE_USE_SEARCH_TO_SELECT" value="'.$langs->trans("Modify").'">';
110  print '</td>';
111 }
112 print '</tr>';
113 
114 
115 print '<tr class="oddeven">';
116 print '<td>'.$langs->trans('DisabledResourceLinkUser').'</td>';
117 print '<td>';
118 echo ajax_constantonoff('RESOURCE_HIDE_ADD_CONTACT_USER');
119 print '</td>';
120 print '<td></td>';
121 print '</tr>';
122 
123 
124 print '<tr class="oddeven">';
125 print '<td>'.$langs->trans('DisabledResourceLinkContact').'</td>';
126 print '<td>';
127 echo ajax_constantonoff('RESOURCE_HIDE_ADD_CONTACT_THIPARTY');
128 print '</td>';
129 print '<td></td>';
130 print '</tr>';
131 
132 print '</table>';
133 
134 print '</form>';
135 
136 
137 //RESOURCE_HIDE_ADD_CONTACT_USER
138 //RESOURCE_HIDE_ADD_CONTACT_THIPARTY
139 
140 dol_fiche_end();
141 
142 
143 llxFooter();
144 $db->close();
llxFooter()
Empty footer.
Definition: wrapper.php:58
setEventMessages($mesg, $mesgs, $style='mesgs')
Set event messages in dol_events session object.
dol_fiche_head($links=array(), $active='0', $title='', $notab=0, $picto='', $pictoisfullpath=0, $morehtmlright='')
Show tab header of a card.
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).
Definition: admin.lib.php:485
if(empty($reshook)) $form
View.
Definition: perms.php:103
GETPOST($paramname, $check='none', $method=0, $filter=NULL, $options=NULL, $noreplace=0)
Return value of a param into GET or POST supervariable.
accessforbidden($message='', $printheader=1, $printfooter=1, $showonlymessage=0)
Show a message to say access is forbidden and stop program Calling this function terminate execution ...
Class to manage generation of HTML components Only common components must be here.
dol_fiche_end($notab=0)
Show tab footer of a card.
load_fiche_titre($titre, $morehtmlright='', $picto='title_generic.png', $pictoisfullpath=0, $id=0, $morecssontable='', $morehtmlcenter='')
Load a title with picto.
llxHeader()
Empty header.
Definition: wrapper.php:46
print
Draft customers invoices.
Definition: index.php:91
ajax_constantonoff($code, $input=array(), $entity=null, $revertonoff=0, $strict=0)
On/off button for constant.
Definition: ajax.lib.php:500