dolibarr 19.0.4
list.php
Go to the documentation of this file.
1<?php
2/* Copyright (C) 2016 Marcos GarcĂ­a <marcosgdf@gmail.com>
3 * Copyright (C) 2022 Open-Dsi <support@open-dsi.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';
27require_once DOL_DOCUMENT_ROOT.'/product/class/product.class.php';
28require_once DOL_DOCUMENT_ROOT.'/variants/class/ProductAttribute.class.php';
29
30// Load translation files required by the page
31$langs->loadLangs(array("products", "other"));
32
33$action = GETPOST('action', 'aZ09') ? GETPOST('action', 'aZ09') : 'view'; // The action 'create'/'add', 'edit'/'update', 'view', ...
34$massaction = GETPOST('massaction', 'alpha'); // The bulk action (combo box choice into lists)
35$show_files = GETPOST('show_files', 'int'); // Show files area generated by bulk actions ?
36$confirm = GETPOST('confirm', 'alpha'); // Result of a confirmation
37$cancel = GETPOST('cancel', 'alpha'); // We click on a Cancel button
38$toselect = GETPOST('toselect', 'array'); // Array of ids of elements selected into a list
39$contextpage = GETPOST('contextpage', 'aZ') ? GETPOST('contextpage', 'aZ') : str_replace('_', '', basename(dirname(__FILE__)).basename(__FILE__, '.php')); // To manage different context of search
40$backtopage = GETPOST('backtopage', 'alpha'); // Go back to a dedicated page
41$optioncss = GETPOST('optioncss', 'aZ'); // Option for the css output (always '' except when 'print')
42$mode = GETPOST('mode', 'aZ'); // The output mode ('list', 'kanban', 'hierarchy', 'calendar', ...)
43
44$id = GETPOST('id', 'int');
45
46// Load variable for pagination
47$limit = GETPOST('limit', 'int') ? GETPOST('limit', 'int') : $conf->liste_limit;
48$sortfield = GETPOST('sortfield', 'aZ09comma');
49$sortorder = GETPOST('sortorder', 'aZ09comma');
50$page = GETPOSTISSET('pageplusone') ? (GETPOST('pageplusone') - 1) : GETPOST("page", 'int');
51if (empty($page) || $page < 0 || GETPOST('button_search', 'alpha') || GETPOST('button_removefilter', 'alpha')) {
52 // If $page is not defined, or '' or -1 or if we click on clear filters
53 $page = 0;
54}
55$offset = $limit * $page;
56$pageprev = $page - 1;
57$pagenext = $page + 1;
58
59// Initialize technical objects
60$object = new ProductAttribute($db);
61//$extrafields = new ExtraFields($db);
62$diroutputmassaction = $conf->variants->dir_output.'/temp/massgeneration/'.$user->id;
63$hookmanager->initHooks(array('productattributelist')); // Note that conf->hooks_modules contains array
64
65// Fetch optionals attributes and labels
66//$extrafields->fetch_name_optionals_label($object->table_element);
67
68//$search_array_options = $extrafields->getOptionalsFromPost($object->table_element, '', 'search_');
69
70// Default sort order (if not yet defined by previous GETPOST)
71if (!$sortfield) {
72 $sortfield = "t.position"; // Set here default search field. By default 1st field in definition.
73}
74if (!$sortorder) {
75 $sortorder = "ASC";
76}
77
78// Initialize array of search criterias
79$search_all = GETPOST('search_all', 'alphanohtml');
80$search = array();
81foreach ($object->fields as $key => $val) {
82 if (GETPOST('search_'.$key, 'alpha') !== '') {
83 $search[$key] = GETPOST('search_'.$key, 'alpha');
84 }
85 if (preg_match('/^(date|timestamp|datetime)/', $val['type'])) {
86 $search[$key.'_dtstart'] = dol_mktime(0, 0, 0, GETPOST('search_'.$key.'_dtstartmonth', 'int'), GETPOST('search_'.$key.'_dtstartday', 'int'), GETPOST('search_'.$key.'_dtstartyear', 'int'));
87 $search[$key.'_dtend'] = dol_mktime(23, 59, 59, GETPOST('search_'.$key.'_dtendmonth', 'int'), GETPOST('search_'.$key.'_dtendday', 'int'), GETPOST('search_'.$key.'_dtendyear', 'int'));
88 }
89}
90$search['nb_of_values'] = GETPOST('search_nb_of_values', 'alpha');
91$search['nb_products'] = GETPOST('search_nb_products', 'alpha');
92
93// List of fields to search into when doing a "search in all"
94$fieldstosearchall = array();
95foreach ($object->fields as $key => $val) {
96 if (!empty($val['searchall'])) {
97 $fieldstosearchall['t.'.$key] = $val['label'];
98 }
99}
100$parameters = array('fieldstosearchall'=>$fieldstosearchall);
101$reshook = $hookmanager->executeHooks('completeFieldsToSearchAll', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks
102if ($reshook > 0) {
103 $fieldstosearchall = empty($hookmanager->resArray['fieldstosearchall']) ? array() : $hookmanager->resArray['fieldstosearchall'];
104} elseif ($reshook == 0) {
105 $fieldstosearchall = array_merge($fieldstosearchall, empty($hookmanager->resArray['fieldstosearchall']) ? array() : $hookmanager->resArray['fieldstosearchall']);
106}
107
108// Definition of array of fields for columns
109$arrayfields = array();
110foreach ($object->fields as $key => $val) {
111 // If $val['visible']==0, then we never show the field
112 if (!empty($val['visible'])) {
113 $visible = (int) dol_eval($val['visible'], 1);
114 $arrayfields['t.'.$key] = array(
115 'label'=>$val['label'],
116 'checked'=>(($visible < 0) ? 0 : 1),
117 'enabled'=>(abs($visible) != 3 && dol_eval($val['enabled'], 1)),
118 'position'=>$val['position'],
119 'help'=> isset($val['help']) ? $val['help'] : ''
120 );
121 }
122}
123$arrayfields['nb_of_values'] = array(
124 'label' => $langs->trans('NbOfDifferentValues'),
125 'checked' => 1,
126 'enabled' => 1,
127 'position' => 40,
128 'help' => ''
129);
130$arrayfields['nb_products'] = array(
131 'label' => $langs->trans('NbProducts'),
132 'checked' => 1,
133 'enabled' => 1,
134 'position' => 50,
135 'help' => ''
136);
137// Extra fields
138//include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_array_fields.tpl.php';
139
140$object->fields = dol_sort_array($object->fields, 'position');
141$arrayfields = dol_sort_array($arrayfields, 'position');
142
143$permissiontoread = $user->hasRight('variants', 'read');
144$permissiontoadd = $user->hasRight('variants', 'write');
145$permissiontodelete = $user->hasRight('variants', 'delete');
146
147// Security check
148if (!isModEnabled('variants')) {
149 accessforbidden('Module not enabled');
150}
151$socid = 0;
152if ($user->socid > 0) { // Protection if external user
153 //$socid = $user->socid;
155}
156if (!$permissiontoread) {
158}
159
160
161/*
162 * Actions
163 */
164
165if (GETPOST('cancel', 'alpha')) {
166 $action = 'list';
167 $massaction = '';
168}
169if (!GETPOST('confirmmassaction', 'alpha') && $massaction != 'presend' && $massaction != 'confirm_presend') {
170 $massaction = '';
171}
172
173$parameters = array();
174$reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks
175if ($reshook < 0) {
176 setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
177}
178
179if (empty($reshook)) {
180 // Selection of new fields
181 include DOL_DOCUMENT_ROOT.'/core/actions_changeselectedfields.inc.php';
182
183 // Purge search criteria
184 if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x', 'alpha') || GETPOST('button_removefilter', 'alpha')) { // All tests are required to be compatible with all browsers
185 foreach ($object->fields as $key => $val) {
186 $search[$key] = '';
187 if (preg_match('/^(date|timestamp|datetime)/', $val['type'])) {
188 $search[$key.'_dtstart'] = '';
189 $search[$key.'_dtend'] = '';
190 }
191 }
192 $search['nb_of_values'] = '';
193 $search['nb_products'] = '';
194 $toselect = array();
195 $search_array_options = array();
196 }
197 if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x', 'alpha') || GETPOST('button_removefilter', 'alpha')
198 || GETPOST('button_search_x', 'alpha') || GETPOST('button_search.x', 'alpha') || GETPOST('button_search', 'alpha')) {
199 $massaction = ''; // Protection to avoid mass action if we force a new search during a mass action confirmation
200 }
201
202 if ($action == 'up' && $permissiontoadd) {
203 $object->attributeMoveUp($rowid);
204
205 header('Location: '.$_SERVER['PHP_SELF']);
206 exit();
207 } elseif ($action == 'down' && $permissiontoadd) {
208 $object->attributeMoveDown($rowid);
209
210 header('Location: '.$_SERVER['PHP_SELF']);
211 exit();
212 }
213
214 // Mass actions
215 $objectclass = 'ProductAttribute';
216 $objectlabel = 'ProductAttribute';
217 $uploaddir = $conf->variants->dir_output;
218 include DOL_DOCUMENT_ROOT.'/core/actions_massactions.inc.php';
219}
220
221
222
223/*
224 * View
225 */
226
227$form = new Form($db);
228
229$now = dol_now();
230
231$help_url = '';
232$title = $langs->trans("ProductAttributes");
233$morejs = array();
234$morecss = array();
235
236
237// Build and execute select
238// --------------------------------------------------------------------
239$sql = "SELECT COUNT(DISTINCT pav.rowid) AS nb_of_values, COUNT(DISTINCT pac2v.fk_prod_combination) AS nb_products, ";
240$sql .= $object->getFieldList("t");
241// Add fields from extrafields
242//if (!empty($extrafields->attributes[$object->table_element]['label'])) {
243// foreach ($extrafields->attributes[$object->table_element]['label'] as $key => $val) {
244// $sql .= ($extrafields->attributes[$object->table_element]['type'][$key] != 'separate' ? "ef.".$key." as options_".$key.", " : "");
245// }
246//}
247// Add fields from hooks
248$parameters = array();
249$reshook = $hookmanager->executeHooks('printFieldListSelect', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
250$sql .= $hookmanager->resPrint;
251$sql = preg_replace('/,\s*$/', '', $sql);
252$sql .= " FROM ".MAIN_DB_PREFIX.$object->table_element." as t";
253//if (isset($extrafields->attributes[$object->table_element]['label']) && is_array($extrafields->attributes[$object->table_element]['label']) && count($extrafields->attributes[$object->table_element]['label'])) {
254// $sql .= " LEFT JOIN ".MAIN_DB_PREFIX.$object->table_element."_extrafields as ef on (t.rowid = ef.fk_object)";
255//}
256$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."product_attribute_combination2val AS pac2v ON pac2v.fk_prod_attr = t.rowid";
257$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."product_attribute_value AS pav ON pav.fk_product_attribute = t.rowid";
258// Add table from hooks
259$parameters = array();
260$reshook = $hookmanager->executeHooks('printFieldListFrom', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
261$sql .= $hookmanager->resPrint;
262if ($object->ismultientitymanaged == 1) {
263 $sql .= " WHERE t.entity IN (".getEntity($object->element).")";
264} else {
265 $sql .= " WHERE 1 = 1";
266}
267foreach ($search as $key => $val) {
268 if (array_key_exists($key, $object->fields)) {
269 if ($key == 'status' && $search[$key] == -1) {
270 continue;
271 }
272 $mode_search = (($object->isInt($object->fields[$key]) || $object->isFloat($object->fields[$key])) ? 1 : 0);
273 if ((strpos($object->fields[$key]['type'], 'integer:') === 0) || (strpos($object->fields[$key]['type'], 'sellist:') === 0) || !empty($object->fields[$key]['arrayofkeyval'])) {
274 if ($search[$key] == '-1' || ($search[$key] === '0' && (empty($object->fields[$key]['arrayofkeyval']) || !array_key_exists('0', $object->fields[$key]['arrayofkeyval'])))) {
275 $search[$key] = '';
276 }
277 $mode_search = 2;
278 }
279 if ($search[$key] != '') {
280 $sql .= natural_search("t.".$db->escape($key), $search[$key], (($key == 'status') ? 2 : $mode_search));
281 }
282 } else {
283 if (preg_match('/(_dtstart|_dtend)$/', $key) && $search[$key] != '') {
284 $columnName = preg_replace('/(_dtstart|_dtend)$/', '', $key);
285 if (preg_match('/^(date|timestamp|datetime)/', $object->fields[$columnName]['type'])) {
286 if (preg_match('/_dtstart$/', $key)) {
287 $sql .= " AND t.".$db->escape($columnName)." >= '".$db->idate($search[$key])."'";
288 }
289 if (preg_match('/_dtend$/', $key)) {
290 $sql .= " AND t.".$db->escape($columnName)." <= '".$db->idate($search[$key])."'";
291 }
292 }
293 }
294 }
295}
296if ($search_all) {
297 $sql .= natural_search(array_keys($fieldstosearchall), $search_all);
298}
299//$sql.= dolSqlDateFilter("t.field", $search_xxxday, $search_xxxmonth, $search_xxxyear);
300// Add where from extra fields
301//include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_sql.tpl.php';
302// Add where from hooks
303$parameters = array();
304$reshook = $hookmanager->executeHooks('printFieldListWhere', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
305$sql .= $hookmanager->resPrint;
306
307$hasgroupby = true;
308$sql .= " GROUP BY ";
309foreach ($object->fields as $key => $val) {
310 $sql .= "t." . $key . ", ";
311}
312// Add fields from extrafields
313//if (!empty($extrafields->attributes[$object->table_element]['label'])) {
314// foreach ($extrafields->attributes[$object->table_element]['label'] as $key => $val) {
315// $sql .= ($extrafields->attributes[$object->table_element]['type'][$key] != 'separate' ? "ef.".$key.', ' : '');
316// }
317//}
318// Add where from hooks
319$parameters = array();
320$reshook = $hookmanager->executeHooks('printFieldListGroupBy', $parameters, $object); // Note that $action and $object may have been modified by hook
321$sql .= $hookmanager->resPrint;
322$sql = preg_replace("/,\s*$/", "", $sql);
323
324$sql .= " HAVING 1=1";
325if ($search['nb_of_values'] != '') {
326 $sql .= natural_search("nb_of_values", $search['nb_of_values'], 1);
327}
328if ($search['nb_products'] != '') {
329 $sql .= natural_search("nb_products", $search['nb_products'], 1);
330}
331// Add HAVING from hooks
332$parameters = array();
333$reshook = $hookmanager->executeHooks('printFieldListHaving', $parameters, $object); // Note that $action and $object may have been modified by hook
334$sql .= empty($hookmanager->resPrint) ? "" : " ".$hookmanager->resPrint;
335
336// Count total nb of records
337$nbtotalofrecords = '';
338if (!getDolGlobalInt('MAIN_DISABLE_FULL_SCANLIST')) {
339 /* This old and fast method to get and count full list returns all record so use a high amount of memory.
340 $resql = $db->query($sql);
341 $nbtotalofrecords = $db->num_rows($resql);
342 */
343 /* The slow method does not consume memory on mysql (not tested on pgsql) */
344 /*$resql = $db->query($sql, 0, 'auto', 1);
345 while ($db->fetch_object($resql)) {
346 $nbtotalofrecords++;
347 }*/
348 /* The fast and low memory method to get and count full list converts the sql into a sql count */
349 $sqlforcount = preg_replace("/^SELECT[a-z0-9\._\s\‍(\‍),]+FROM/i", "SELECT COUNT(*) as nbtotalofrecords FROM", $sql);
350 $resql = $db->query($sqlforcount);
351 if ($resql) {
352 if ($hasgroupby) {
353 $nbtotalofrecords = $db->num_rows($resql);
354 } else {
355 $objforcount = $db->fetch_object($resql);
356 $nbtotalofrecords = $objforcount->nbtotalofrecords;
357 }
358 if (($page * $limit) > $nbtotalofrecords) { // if total resultset is smaller than the paging size (filtering), goto and load page 0
359 $page = 0;
360 $offset = 0;
361 }
362 $db->free($resql);
363 }
364}
365
366// Complete request and execute it with limit
367$sql .= $db->order($sortfield, $sortorder);
368if ($limit) {
369 $sql .= $db->plimit($limit + 1, $offset);
370}
371
372$resql = $db->query($sql);
373if (!$resql) {
374 dol_print_error($db);
375 exit;
376}
377
378$num = $db->num_rows($resql);
379
380
381// Direct jump if only one record found
382if ($num == 1 && getDolGlobalString('MAIN_SEARCH_DIRECT_OPEN_IF_ONLY_ONE') && $search_all && !$page) {
383 $obj = $db->fetch_object($resql);
384 $id = $obj->rowid;
385 header("Location: " . dol_buildpath('/variants/card.php', 2) . '?id=' . $id);
386 exit;
387}
388
389
390// Output page
391// --------------------------------------------------------------------
392
393llxHeader('', $title, $help_url, '', 0, 0, $morejs, $morecss, '', '');
394
395$arrayofselected = is_array($toselect) ? $toselect : array();
396
397$param = '';
398if (!empty($mode)) {
399 $param .= '&mode='.urlencode($mode);
400}
401if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) {
402 $param .= '&contextpage='.urlencode($contextpage);
403}
404if ($limit > 0 && $limit != $conf->liste_limit) {
405 $param .= '&limit='.((int) $limit);
406}
407foreach ($search as $key => $val) {
408 if (is_array($search[$key])) {
409 foreach ($search[$key] as $skey) {
410 if ($skey != '') {
411 $param .= '&search_'.$key.'[]='.urlencode($skey);
412 }
413 }
414 } elseif (preg_match('/(_dtstart|_dtend)$/', $key) && !empty($val)) {
415 $param .= '&search_'.$key.'month='.((int) GETPOST('search_'.$key.'month', 'int'));
416 $param .= '&search_'.$key.'day='.((int) GETPOST('search_'.$key.'day', 'int'));
417 $param .= '&search_'.$key.'year='.((int) GETPOST('search_'.$key.'year', 'int'));
418 } elseif ($search[$key] != '') {
419 $param .= '&search_'.$key.'='.urlencode($search[$key]);
420 }
421}
422if ($optioncss != '') {
423 $param .= '&optioncss='.urlencode($optioncss);
424}
425// Add $param from extra fields
426include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_param.tpl.php';
427// Add $param from hooks
428$parameters = array('param' => &$param);
429$reshook = $hookmanager->executeHooks('printFieldListSearchParam', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
430$param .= $hookmanager->resPrint;
431
432// List of mass actions available
433$arrayofmassactions = array(
434 //'validate'=>img_picto('', 'check', 'class="pictofixedwidth"').$langs->trans("Validate"),
435 //'generate_doc'=>img_picto('', 'pdf', 'class="pictofixedwidth"').$langs->trans("ReGeneratePDF"),
436 //'builddoc'=>img_picto('', 'pdf', 'class="pictofixedwidth"').$langs->trans("PDFMerge"),
437 //'presend'=>img_picto('', 'email', 'class="pictofixedwidth"').$langs->trans("SendByMail"),
438);
439if (!empty($permissiontodelete)) {
440 $arrayofmassactions['predelete'] = img_picto('', 'delete', 'class="pictofixedwidth"').$langs->trans("Delete");
441}
442if (GETPOST('nomassaction', 'int') || in_array($massaction, array('presend', 'predelete'))) {
443 $arrayofmassactions = array();
444}
445$massactionbutton = $form->selectMassAction('', $arrayofmassactions);
446
447print '<form method="POST" id="searchFormList" action="'.$_SERVER["PHP_SELF"].'">'."\n";
448if ($optioncss != '') {
449 print '<input type="hidden" name="optioncss" value="'.$optioncss.'">';
450}
451print '<input type="hidden" name="token" value="'.newToken().'">';
452print '<input type="hidden" name="formfilteraction" id="formfilteraction" value="list">';
453print '<input type="hidden" name="action" value="list">';
454print '<input type="hidden" name="sortfield" value="'.$sortfield.'">';
455print '<input type="hidden" name="sortorder" value="'.$sortorder.'">';
456print '<input type="hidden" name="page" value="'.$page.'">';
457print '<input type="hidden" name="contextpage" value="'.$contextpage.'">';
458print '<input type="hidden" name="page_y" value="">';
459print '<input type="hidden" name="mode" value="'.$mode.'">';
460
461$newcardbutton = '';
462$newcardbutton .= dolGetButtonTitle($langs->trans('ViewList'), '', 'fa fa-bars imgforviewmode', $_SERVER["PHP_SELF"].'?mode=common'.preg_replace('/(&|\?)*mode=[^&]+/', '', $param), '', ((empty($mode) || $mode == 'common') ? 2 : 1), array('morecss'=>'reposition'));
463$newcardbutton .= dolGetButtonTitle($langs->trans('ViewKanban'), '', 'fa fa-th-list imgforviewmode', $_SERVER["PHP_SELF"].'?mode=kanban'.preg_replace('/(&|\?)*mode=[^&]+/', '', $param), '', ($mode == 'kanban' ? 2 : 1), array('morecss'=>'reposition'));
464$newcardbutton .= dolGetButtonTitleSeparator();
465$newcardbutton .= dolGetButtonTitle($langs->trans('New'), '', 'fa fa-plus-circle', DOL_URL_ROOT.'/variants/card.php?action=create&backtopage='.urlencode($_SERVER['PHP_SELF']), '', $permissiontoadd);
466
467print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, 'object_'.$object->picto, 0, $newcardbutton, '', $limit, 0, 0, 1);
468
469// Add code for pre mass action (confirmation or email presend form)
470$topicmail = "SendProductAttributeRef";
471$modelmail = "productattribute";
472$objecttmp = new ProductAttribute($db);
473$trackid = 'pa'.$object->id;
474include DOL_DOCUMENT_ROOT.'/core/tpl/massactions_pre.tpl.php';
475
476if ($search_all) {
477 $setupstring = '';
478 foreach ($fieldstosearchall as $key => $val) {
479 $fieldstosearchall[$key] = $langs->trans($val);
480 $setupstring .= $key."=".$val.";";
481 }
482 print '<!-- Search done like if MYOBJECT_QUICKSEARCH_ON_FIELDS = '.$setupstring.' -->'."\n";
483 print '<div class="divsearchfieldfilter">'.$langs->trans("FilterOnInto", $search_all).join(', ', $fieldstosearchall).'</div>'."\n";
484}
485
486$moreforfilter = '';
487/*$moreforfilter.='<div class="divsearchfield">';
488$moreforfilter.= $langs->trans('MyFilter') . ': <input type="text" name="search_myfield" value="'.dol_escape_htmltag($search_myfield).'">';
489$moreforfilter.= '</div>';*/
490
491$parameters = array();
492$reshook = $hookmanager->executeHooks('printFieldPreListTitle', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
493if (empty($reshook)) {
494 $moreforfilter .= $hookmanager->resPrint;
495} else {
496 $moreforfilter = $hookmanager->resPrint;
497}
498
499if (!empty($moreforfilter)) {
500 print '<div class="liste_titre liste_titre_bydiv centpercent">';
501 print $moreforfilter;
502 $parameters = array();
503 $reshook = $hookmanager->executeHooks('printFieldPreListTitle', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
504 print $hookmanager->resPrint;
505 print '</div>';
506}
507
508$varpage = empty($contextpage) ? $_SERVER["PHP_SELF"] : $contextpage;
509$selectedfields = ($mode != 'kanban' ? $form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage, getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN', '')) : ''); // This also change content of $arrayfields
510$selectedfields .= (count($arrayofmassactions) ? $form->showCheckAddButtons('checkforselect', 1) : '');
511
512print '<div class="div-table-responsive">'; // You can use div-table-responsive-no-min if you dont need reserved height for your table
513print '<table id="tableattributes" class="tagtable nobottomiftotal liste'.($moreforfilter ? " listwithfilterbefore" : "").'">'."\n";
514
515
516// Fields title search
517// --------------------------------------------------------------------
518print '<tr class="liste_titre_filter">';
519// Action column
520if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
521 print '<td class="liste_titre center maxwidthsearch">';
522 $searchpicto = $form->showFilterButtons('left');
523 print $searchpicto;
524 print '</td>';
525}
526foreach ($object->fields as $key => $val) {
527 $searchkey = empty($search[$key]) ? '' : $search[$key];
528 $cssforfield = (empty($val['csslist']) ? (empty($val['css']) ? '' : $val['css']) : $val['csslist']);
529 if ($key == 'status') {
530 $cssforfield .= ($cssforfield ? ' ' : '').'center';
531 } elseif (in_array($val['type'], array('date', 'datetime', 'timestamp'))) {
532 $cssforfield .= ($cssforfield ? ' ' : '').'center';
533 } elseif (in_array($val['type'], array('timestamp'))) {
534 $cssforfield .= ($cssforfield ? ' ' : '').'nowrap';
535 } elseif (in_array($val['type'], array('double(24,8)', 'double(6,3)', 'integer', 'real', 'price')) && !in_array($key, array('id', 'rowid', 'ref', 'status')) && $val['label'] != 'TechnicalID' && empty($val['arrayofkeyval'])) {
536 $cssforfield .= ($cssforfield ? ' ' : '').'right';
537 }
538 if (!empty($arrayfields['t.'.$key]['checked'])) {
539 print '<td class="liste_titre'.($cssforfield ? ' '.$cssforfield : '').($key == 'status' ? ' parentonrightofpage' : '').'">';
540 if (!empty($val['arrayofkeyval']) && is_array($val['arrayofkeyval'])) {
541 print $form->selectarray('search_'.$key, $val['arrayofkeyval'], (isset($search[$key]) ? $search[$key] : ''), $val['notnull'], 0, 0, '', 1, 0, 0, '', 'maxwidth100'.($key == 'status' ? ' search_status width100 onrightofpage' : ''), 1);
542 } elseif ((strpos($val['type'], 'integer:') === 0) || (strpos($val['type'], 'sellist:') === 0)) {
543 print $object->showInputField($val, $key, (isset($search[$key]) ? $search[$key] : ''), '', '', 'search_', $cssforfield.' maxwidth250', 1);
544 } elseif (preg_match('/^(date|timestamp|datetime)/', $val['type'])) {
545 print '<div class="nowrap">';
546 print $form->selectDate($search[$key.'_dtstart'] ? $search[$key.'_dtstart'] : '', "search_".$key."_dtstart", 0, 0, 1, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans('From'));
547 print '</div>';
548 print '<div class="nowrap">';
549 print $form->selectDate($search[$key.'_dtend'] ? $search[$key.'_dtend'] : '', "search_".$key."_dtend", 0, 0, 1, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans('to'));
550 print '</div>';
551 } elseif ($key == 'lang') {
552 require_once DOL_DOCUMENT_ROOT.'/core/class/html.formadmin.class.php';
553 $formadmin = new FormAdmin($db);
554 print $formadmin->select_language($search[$key], 'search_lang', 0, null, 1, 0, 0, 'minwidth150 maxwidth200', 2);
555 } else {
556 print '<input type="text" class="flat maxwidth75" name="search_'.$key.'" value="'.dol_escape_htmltag(isset($search[$key]) ? $search[$key] : '').'">';
557 }
558 print '</td>';
559 }
560}
561// Extra fields
562include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_input.tpl.php';
563// Fields from hook
564$parameters = array('arrayfields'=>$arrayfields);
565$reshook = $hookmanager->executeHooks('printFieldListOption', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
566print $hookmanager->resPrint;
567
568$key = 'nb_of_values';
569if (!empty($arrayfields[$key]['checked'])) {
570 print '<td class="liste_titre center">';
571 print '<input type="text" class="flat maxwidth75" name="search_'.$key.'" value="'.dol_escape_htmltag(isset($search[$key]) ? $search[$key] : '').'">';
572 print '</td>';
573}
574$key = 'nb_products';
575if (!empty($arrayfields[$key]['checked'])) {
576 print '<td class="liste_titre center">';
577 print '<input type="text" class="flat maxwidth75" name="search_'.$key.'" value="'.dol_escape_htmltag(isset($search[$key]) ? $search[$key] : '').'">';
578 print '</td>';
579}
580// Action column
581if (!getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
582 print '<td class="liste_titre center maxwidthsearch">';
583 $searchpicto = $form->showFilterButtons();
584 print $searchpicto;
585 print '</td>';
586}
587// Move
588print '<td class="liste_titre linecolmove width25"></td>';
589print '</tr>'."\n";
590
591$totalarray = array();
592$totalarray['nbfield'] = 0;
593
594// Fields title label
595// --------------------------------------------------------------------
596print '<tr class="liste_titre">';
597if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
598 print getTitleFieldOfList($selectedfields, 0, $_SERVER["PHP_SELF"], '', '', '', '', $sortfield, $sortorder, 'center maxwidthsearch ')."\n";
599 $totalarray['nbfield']++;
600}
601foreach ($object->fields as $key => $val) {
602 $cssforfield = (empty($val['csslist']) ? (empty($val['css']) ? '' : $val['css']) : $val['csslist']);
603 if ($key == 'status') {
604 $cssforfield .= ($cssforfield ? ' ' : '').'center';
605 } elseif (in_array($val['type'], array('date', 'datetime', 'timestamp'))) {
606 $cssforfield .= ($cssforfield ? ' ' : '').'center';
607 } elseif (in_array($val['type'], array('timestamp'))) {
608 $cssforfield .= ($cssforfield ? ' ' : '').'nowrap';
609 } elseif (in_array($val['type'], array('double(24,8)', 'double(6,3)', 'integer', 'real', 'price')) && !in_array($key, array('id', 'rowid', 'ref', 'status')) && $val['label'] != 'TechnicalID' && empty($val['arrayofkeyval'])) {
610 $cssforfield .= ($cssforfield ? ' ' : '').'right';
611 }
612 $cssforfield = preg_replace('/small\s*/', '', $cssforfield); // the 'small' css must not be used for the title label
613 if (!empty($arrayfields['t.'.$key]['checked'])) {
614 print getTitleFieldOfList($arrayfields['t.'.$key]['label'], 0, $_SERVER['PHP_SELF'], 't.'.$key, '', $param, ($cssforfield ? 'class="'.$cssforfield.'"' : ''), $sortfield, $sortorder, ($cssforfield ? $cssforfield.' ' : ''), 0, (empty($val['helplist']) ? '' : $val['helplist']))."\n";
615 $totalarray['nbfield']++;
616 }
617}
618// Extra fields
619include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_title.tpl.php';
620// Hook fields
621$parameters = array('arrayfields'=>$arrayfields, 'param'=>$param, 'sortfield'=>$sortfield, 'sortorder'=>$sortorder, 'totalarray'=>&$totalarray);
622$reshook = $hookmanager->executeHooks('printFieldListTitle', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
623print $hookmanager->resPrint;
624
625$key = 'nb_of_values';
626if (!empty($arrayfields[$key]['checked'])) {
627 print getTitleFieldOfList($arrayfields[$key]['label'], 0, $_SERVER['PHP_SELF'], $key, '', $param, 'class="center"', $sortfield, $sortorder, 'center ')."\n";
628}
629$key = 'nb_products';
630if (!empty($arrayfields[$key]['checked'])) {
631 print getTitleFieldOfList($arrayfields[$key]['label'], 0, $_SERVER['PHP_SELF'], $key, '', $param, 'class="center"', $sortfield, $sortorder, 'center ')."\n";
632}
633// Action column
634if (!getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
635 print getTitleFieldOfList($selectedfields, 0, $_SERVER["PHP_SELF"], '', '', '', '', $sortfield, $sortorder, 'center maxwidthsearch ')."\n";
636 $totalarray['nbfield']++;
637}
638// Move
639print getTitleFieldOfList('', 0, '', '', '', '', '', '', '', 'linecolmove ')."\n";
640print '</tr>'."\n";
641
642
643// Detect if we need a fetch on each output line
644$needToFetchEachLine = 0;
645//if (isset($extrafields->attributes[$object->table_element]['computed']) && is_array($extrafields->attributes[$object->table_element]['computed']) && count($extrafields->attributes[$object->table_element]['computed']) > 0) {
646// foreach ($extrafields->attributes[$object->table_element]['computed'] as $key => $val) {
647// if (!is_null($val) && preg_match('/\$object/', $val)) {
648// $needToFetchEachLine++; // There is at least one compute field that use $object
649// }
650// }
651//}
652
653
654// Loop on record
655// --------------------------------------------------------------------
656$i = 0;
657$savnbfield = $totalarray['nbfield'];
658$totalarray = array();
659$totalarray['nbfield'] = 0;
660$imaxinloop = ($limit ? min($num, $limit) : $num);
661while ($i < $imaxinloop) {
662 $obj = $db->fetch_object($resql);
663 if (empty($obj)) {
664 break; // Should not happen
665 }
666
667 // Store properties in $object
668 $object->setVarsFromFetchObj($obj);
669
670 if ($mode == 'kanban') {
671 if ($i == 0) {
672 print '<tr class="trkanban"><td colspan="'.$savnbfield.'">';
673 print '<div class="box-flex-container kanban">';
674 }
675 // Output Kanban
676 $selected = -1;
677 if ($massactionbutton || $massaction) { // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined
678 $selected = 0;
679 if (in_array($object->id, $arrayofselected)) {
680 $selected = 1;
681 }
682 }
683 print $object->getKanbanView('', array('selected' => $selected));
684 if ($i == ($imaxinloop - 1)) {
685 print '</div>';
686 print '</td></tr>';
687 }
688 } else {
689 // Show here line of result
690 $j = 0;
691 print '<tr data-rowid="'.$object->id.'" class="oddeven">';
692 // Action column
693 if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
694 print '<td class="nowrap center">';
695 if ($massactionbutton || $massaction) { // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined
696 $selected = 0;
697 if (in_array($object->id, $arrayofselected)) {
698 $selected = 1;
699 }
700 print '<input id="cb'.$object->id.'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.$object->id.'"'.($selected ? ' checked="checked"' : '').'>';
701 }
702 print '</td>';
703 if (!$i) {
704 $totalarray['nbfield']++;
705 }
706 }
707 foreach ($object->fields as $key => $val) {
708 $cssforfield = (empty($val['csslist']) ? (empty($val['css']) ? '' : $val['css']) : $val['csslist']);
709 if (in_array($val['type'], array('date', 'datetime', 'timestamp'))) {
710 $cssforfield .= ($cssforfield ? ' ' : '') . 'center';
711 } elseif ($key == 'status') {
712 $cssforfield .= ($cssforfield ? ' ' : '') . 'center';
713 }
714
715 if (in_array($val['type'], array('timestamp'))) {
716 $cssforfield .= ($cssforfield ? ' ' : '') . 'nowrap';
717 } elseif ($key == 'ref') {
718 $cssforfield .= ($cssforfield ? ' ' : '') . 'nowrap';
719 }
720
721 if (in_array($val['type'], array('double(24,8)', 'double(6,3)', 'integer', 'real', 'price')) && !in_array($key, array('rowid', 'status')) && empty($val['arrayofkeyval'])) {
722 $cssforfield .= ($cssforfield ? ' ' : '') . 'right';
723 }
724 //if (in_array($key, array('fk_soc', 'fk_user', 'fk_warehouse'))) $cssforfield = 'tdoverflowmax100';
725
726 if (!empty($arrayfields['t.' . $key]['checked'])) {
727 print '<td'.($cssforfield ? ' class="'.$cssforfield.(preg_match('/tdoverflow/', $cssforfield) ? ' classfortooltip' : '').'"' : '');
728 if (preg_match('/tdoverflow/', $cssforfield) && !is_numeric($object->$key)) {
729 print ' title="'.dol_escape_htmltag($object->$key).'"';
730 }
731 print '>';
732 if ($key == 'status') {
733 print $object->getLibStatut(5);
734 } elseif ($key == 'rowid') {
735 print $object->showOutputField($val, $key, $object->id, '');
736 } else {
737 print $object->showOutputField($val, $key, $object->$key, '');
738 }
739 print '</td>';
740 if (!$i) {
741 $totalarray['nbfield']++;
742 }
743 if (!empty($val['isameasure']) && $val['isameasure'] == 1) {
744 if (!$i) {
745 $totalarray['pos'][$totalarray['nbfield']] = 't.' . $key;
746 }
747 if (!isset($totalarray['val'])) {
748 $totalarray['val'] = array();
749 }
750 if (!isset($totalarray['val']['t.' . $key])) {
751 $totalarray['val']['t.' . $key] = 0;
752 }
753 $totalarray['val']['t.' . $key] += $object->$key;
754 }
755 }
756 }
757 // Extra fields
758 include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_print_fields.tpl.php';
759 // Fields from hook
760 $parameters = array('arrayfields'=>$arrayfields, 'object'=>$object, 'obj'=>$obj, 'i'=>$i, 'totalarray'=>&$totalarray);
761 $reshook = $hookmanager->executeHooks('printFieldListValue', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
762 print $hookmanager->resPrint;
763 // Other
764 $key = 'nb_of_values';
765 if (!empty($arrayfields[$key]['checked'])) {
766 print '<td class="center">';
767 print $obj->$key;
768 print '</td>';
769 if (!$i) {
770 $totalarray['nbfield']++;
771 }
772 }
773 $key = 'nb_products';
774 if (!empty($arrayfields[$key]['checked'])) {
775 print '<td class="center">';
776 print $obj->$key;
777 print '</td>';
778 if (!$i) {
779 $totalarray['nbfield']++;
780 }
781 }
782 // Action column
783 if (!getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
784 print '<td class="nowrap center">';
785 if ($massactionbutton || $massaction) { // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined
786 $selected = 0;
787 if (in_array($object->id, $arrayofselected)) {
788 $selected = 1;
789 }
790 print '<input id="cb'.$object->id.'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.$object->id.'"'.($selected ? ' checked="checked"' : '').'>';
791 }
792 print '</td>';
793 if (!$i) {
794 $totalarray['nbfield']++;
795 }
796 }
797 // Move
798 print '<td class="center linecolmove tdlineupdown">';
799 if ($i > 0) {
800 print '<a class="lineupdown" href="' . $_SERVER['PHP_SELF'] . '?action=up&amp;rowid=' . $obj->rowid . '">' . img_up('default', 0, 'imgupforline') . '</a>';
801 }
802 if ($i < $num - 1) {
803 print '<a class="lineupdown" href="' . $_SERVER['PHP_SELF'] . '?action=down&amp;rowid=' . $obj->rowid . '">' . img_down('default', 0, 'imgdownforline') . '</a>';
804 }
805 print '</td>';
806
807 print '</tr>' . "\n";
808 }
809
810 $i++;
811}
812
813// Show total line
814include DOL_DOCUMENT_ROOT.'/core/tpl/list_print_total.tpl.php';
815
816// If no record found
817if ($num == 0) {
818 $colspan = 3;
819 foreach ($arrayfields as $key => $val) {
820 if (!empty($val['checked'])) {
821 $colspan++;
822 }
823 }
824 print '<tr><td colspan="'.$colspan.'"><span class="opacitymedium">'.$langs->trans("NoRecordFound").'</span></td></tr>';
825}
826
827$db->free($resql);
828
829$parameters = array('arrayfields'=>$arrayfields, 'sql'=>$sql);
830$reshook = $hookmanager->executeHooks('printFieldListFooter', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
831print $hookmanager->resPrint;
832
833print '</table>'."\n";
834print '</div>'."\n";
835
836print '</form>'."\n";
837
838$forcereloadpage = !getDolGlobalString('MAIN_FORCE_RELOAD_PAGE') ? 0 : 1;
839$tagidfortablednd = (empty($tagidfortablednd) ? 'tableattributes' : $tagidfortablednd);
840?>
841 <script>
842 $(document).ready(function(){
843 $(".imgupforline, .imgdownforline").hide();
844 $(".lineupdown").removeAttr('href');
845 $(".tdlineupdown")
846 .css("background-image", 'url(<?php echo DOL_URL_ROOT.'/theme/'.$conf->theme.'/img/grip.png'; ?>)')
847 .css("background-repeat", "no-repeat")
848 .css("background-position", "center center")
849 .hover(
850 function () {
851 $(this).addClass('showDragHandle');
852 }, function () {
853 $(this).removeClass('showDragHandle');
854 }
855 );
856
857 $("#<?php echo $tagidfortablednd; ?>").tableDnD({
858 onDrop: function(table, row) {
859 console.log('drop');
860 $('#<?php echo $tagidfortablednd; ?> tr[data-element=extrafield]').attr('id', ''); // Set extrafields id to empty value in order to ignore them in tableDnDSerialize function
861 $('#<?php echo $tagidfortablednd; ?> tr[data-ignoreidfordnd=1]').attr('id', ''); // Set id to empty value in order to ignore them in tableDnDSerialize function
862 var reloadpage = "<?php echo $forcereloadpage; ?>";
863 var roworder = cleanSerialize(decodeURI($("#<?php echo $tagidfortablednd; ?>").tableDnDSerialize()));
864 $.post("<?php echo DOL_URL_ROOT; ?>/variants/ajax/orderAttribute.php",
865 {
866 roworder: roworder,
867 token: "<?php echo currentToken(); ?>"
868 },
869 function() {
870 if (reloadpage == 1) {
871 location.href = '<?php echo dol_escape_htmltag($_SERVER['PHP_SELF']).'?'.dol_escape_htmltag($_SERVER['QUERY_STRING']); ?>';
872 }
873 });
874 },
875 onDragClass: "dragClass",
876 dragHandle: "td.tdlineupdown"
877 });
878 });
879 </script>
880<?php
881
882if (in_array('builddoc', array_keys($arrayofmassactions)) && ($nbtotalofrecords === '' || $nbtotalofrecords)) {
883 $hidegeneratedfilelistifempty = 1;
884 if ($massaction == 'builddoc' || $action == 'remove_file' || $show_files) {
885 $hidegeneratedfilelistifempty = 0;
886 }
887
888 require_once DOL_DOCUMENT_ROOT.'/core/class/html.formfile.class.php';
889 $formfile = new FormFile($db);
890
891 // Show list of available documents
892 $urlsource = $_SERVER['PHP_SELF'].'?sortfield='.$sortfield.'&sortorder='.$sortorder;
893 $urlsource .= str_replace('&amp;', '&', $param);
894
895 $filedir = $diroutputmassaction;
896 $genallowed = $permissiontoread;
897 $delallowed = $permissiontoadd;
898
899 print $formfile->showdocuments('massfilesarea_productattribute', '', $filedir, $urlsource, 0, $delallowed, '', 1, 1, 0, 48, 1, $param, $title, '', '', '', null, $hidegeneratedfilelistifempty);
900}
901
902// End of page
903llxFooter();
904$db->close();
if(!defined('NOREQUIRESOC')) if(!defined( 'NOREQUIRETRAN')) if(!defined('NOTOKENRENEWAL')) if(!defined( 'NOREQUIREMENU')) if(!defined('NOREQUIREHTML')) if(!defined( 'NOREQUIREAJAX')) llxHeader()
Empty header.
Definition wrapper.php:55
llxFooter()
Empty footer.
Definition wrapper.php:69
Class to generate html code for admin pages.
Class to offer components to list and upload files.
Class to manage generation of HTML components Only common components must be here.
Class ProductAttribute Used to represent a product attribute.
dol_mktime($hour, $minute, $second, $month, $day, $year, $gm='auto', $check=1)
Return a timestamp date built from detailed informations (by default a local PHP server timestamp) Re...
dol_print_error($db='', $error='', $errors=null)
Displays error message system with all the information to facilitate the diagnosis and the escalation...
dolGetButtonTitle($label, $helpText='', $iconClass='fa fa-file', $url='', $id='', $status=1, $params=array())
Function dolGetButtonTitle : this kind of buttons are used in title in list.
natural_search($fields, $value, $mode=0, $nofirstand=0)
Generate natural SQL search string for a criteria (this criteria can be tested on one or several fiel...
img_down($titlealt='default', $selected=0, $moreclass='')
Show down arrow logo.
dol_now($mode='auto')
Return date for now.
getDolGlobalInt($key, $default=0)
Return a Dolibarr global constant int value.
img_picto($titlealt, $picto, $moreatt='', $pictoisfullpath=false, $srconly=0, $notitle=0, $alt='', $morecss='', $marginleftonlyshort=2)
Show picto whatever it's its name (generic function)
dol_sort_array(&$array, $index, $order='asc', $natsort=0, $case_sensitive=0, $keepindex=0)
Advanced sort array by second index function, which produces ascending (default) or descending output...
dol_eval($s, $returnvalue=0, $hideerrors=1, $onlysimplestring='1')
Replace eval function to add more security.
getTitleFieldOfList($name, $thead=0, $file="", $field="", $begin="", $moreparam="", $moreattrib="", $sortfield="", $sortorder="", $prefix="", $disablesortlink=0, $tooltip='', $forcenowrapcolumntitle=0)
Get title line of an array.
dolGetButtonTitleSeparator($moreClass="")
Add space between dolGetButtonTitle.
GETPOST($paramname, $check='alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
setEventMessages($mesg, $mesgs, $style='mesgs', $messagekey='', $noduplicate=0)
Set event messages in dol_events session object.
print_barre_liste($titre, $page, $file, $options='', $sortfield='', $sortorder='', $morehtmlcenter='', $num=-1, $totalnboflines='', $picto='generic', $pictoisfullpath=0, $morehtmlright='', $morecss='', $limit=-1, $hideselectlimit=0, $hidenavigation=0, $pagenavastextinput=0, $morehtmlrightbeforearrow='')
Print a title with navigation controls for pagination.
dol_buildpath($path, $type=0, $returnemptyifnotfound=0)
Return path of url or filesystem.
getDolGlobalString($key, $default='')
Return dolibarr global constant string value.
img_up($titlealt='default', $selected=0, $moreclass='')
Show top arrow logo.
dol_escape_htmltag($stringtoescape, $keepb=0, $keepn=0, $noescapetags='', $escapeonlyhtmltags=0, $cleanalsojavascript=0)
Returns text escaped for inclusion in HTML alt or title or value tags, or into values of HTML input f...
accessforbidden($message='', $printheader=1, $printfooter=1, $showonlymessage=0, $params=null)
Show a message to say access is forbidden and stop program.