dolibarr 21.0.0-beta
myobject_list.php
Go to the documentation of this file.
1<?php
2/* Copyright (C) 2007-2017 Laurent Destailleur <eldy@users.sourceforge.net>
3 * Copyright (C) 2024 Frédéric France <frederic.france@free.fr>
4 * Copyright (C) ---Replace with your own copyright and developer email---
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 3 of the License, or
9 * (at your option) any later version.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program. If not, see <https://www.gnu.org/licenses/>.
18 */
19
27// General defined Options
28//if (! defined('CSRFCHECK_WITH_TOKEN')) define('CSRFCHECK_WITH_TOKEN', '1'); // Force use of CSRF protection with tokens even for GET
29//if (! defined('MAIN_AUTHENTICATION_MODE')) define('MAIN_AUTHENTICATION_MODE', 'aloginmodule'); // Force authentication handler
30//if (! defined('MAIN_LANG_DEFAULT')) define('MAIN_LANG_DEFAULT', 'auto'); // Force LANG (language) to a particular value
31//if (! defined('MAIN_SECURITY_FORCECSP')) define('MAIN_SECURITY_FORCECSP', 'none'); // Disable all Content Security Policies
32//if (! defined('NOBROWSERNOTIF')) define('NOBROWSERNOTIF', '1'); // Disable browser notification
33//if (! defined('NOIPCHECK')) define('NOIPCHECK', '1'); // Do not check IP defined into conf $dolibarr_main_restrict_ip
34//if (! defined('NOLOGIN')) define('NOLOGIN', '1'); // Do not use login - if this page is public (can be called outside logged session). This includes the NOIPCHECK too.
35//if (! defined('NOREQUIREAJAX')) define('NOREQUIREAJAX', '1'); // Do not load ajax.lib.php library
36//if (! defined('NOREQUIREDB')) define('NOREQUIREDB', '1'); // Do not create database handler $db
37//if (! defined('NOREQUIREHTML')) define('NOREQUIREHTML', '1'); // Do not load html.form.class.php
38//if (! defined('NOREQUIREMENU')) define('NOREQUIREMENU', '1'); // Do not load and show top and left menu
39//if (! defined('NOREQUIRESOC')) define('NOREQUIRESOC', '1'); // Do not load object $mysoc
40//if (! defined('NOREQUIRETRAN')) define('NOREQUIRETRAN', '1'); // Do not load object $langs
41//if (! defined('NOREQUIREUSER')) define('NOREQUIREUSER', '1'); // Do not load object $user
42//if (! defined('NOSCANGETFORINJECTION')) define('NOSCANGETFORINJECTION', '1'); // Do not check injection attack on GET parameters
43//if (! defined('NOSCANPOSTFORINJECTION')) define('NOSCANPOSTFORINJECTION', '1'); // Do not check injection attack on POST parameters
44//if (! defined('NOSESSION')) define('NOSESSION', '1'); // On CLI mode, no need to use web sessions
45//if (! defined('NOSTYLECHECK')) define('NOSTYLECHECK', '1'); // Do not check style html tag into posted data
46//if (! defined('NOTOKENRENEWAL')) define('NOTOKENRENEWAL', '1'); // Do not roll the Anti CSRF token (used if MAIN_SECURITY_CSRF_WITH_TOKEN is on)
47
48
49// Load Dolibarr environment
50$res = 0;
51// Try main.inc.php into web root known defined into CONTEXT_DOCUMENT_ROOT (not always defined)
52if (!$res && !empty($_SERVER["CONTEXT_DOCUMENT_ROOT"])) {
53 $res = @include $_SERVER["CONTEXT_DOCUMENT_ROOT"]."/main.inc.php";
54}
55// Try main.inc.php into web root detected using web root calculated from SCRIPT_FILENAME
56$tmp = empty($_SERVER['SCRIPT_FILENAME']) ? '' : $_SERVER['SCRIPT_FILENAME'];
57$tmp2 = realpath(__FILE__);
58$i = strlen($tmp) - 1;
59$j = strlen($tmp2) - 1;
60while ($i > 0 && $j > 0 && isset($tmp[$i]) && isset($tmp2[$j]) && $tmp[$i] == $tmp2[$j]) {
61 $i--;
62 $j--;
63}
64if (!$res && $i > 0 && file_exists(substr($tmp, 0, ($i + 1))."/main.inc.php")) {
65 $res = @include substr($tmp, 0, ($i + 1))."/main.inc.php";
66}
67if (!$res && $i > 0 && file_exists(dirname(substr($tmp, 0, ($i + 1)))."/main.inc.php")) {
68 $res = @include dirname(substr($tmp, 0, ($i + 1)))."/main.inc.php";
69}
70// Try main.inc.php using relative path
71if (!$res && file_exists("../main.inc.php")) {
72 $res = @include "../main.inc.php";
73}
74if (!$res && file_exists("../../main.inc.php")) {
75 $res = @include "../../main.inc.php";
76}
77if (!$res && file_exists("../../../main.inc.php")) {
78 $res = @include "../../../main.inc.php";
79}
80if (!$res) {
81 die("Include of main fails");
82}
83
84require_once DOL_DOCUMENT_ROOT.'/core/class/html.formcompany.class.php';
85require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php';
86require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php';
87// load module libraries
88require_once __DIR__.'/class/myobject.class.php';
89// for other modules
90//dol_include_once('/othermodule/class/otherobject.class.php');
91
100// Load translation files required by the page
101$langs->loadLangs(array("mymodule@mymodule", "other"));
102
103// Get parameters
104$action = GETPOST('action', 'aZ09') ? GETPOST('action', 'aZ09') : 'view'; // The action 'create'/'add', 'edit'/'update', 'view', ...
105$massaction = GETPOST('massaction', 'alpha'); // The bulk action (combo box choice into lists)
106$show_files = GETPOSTINT('show_files'); // Show files area generated by bulk actions ?
107$confirm = GETPOST('confirm', 'alpha'); // Result of a confirmation
108$cancel = GETPOST('cancel', 'alpha'); // We click on a Cancel button
109$toselect = GETPOST('toselect', 'array:int'); // Array of ids of elements selected into a list
110$contextpage = GETPOST('contextpage', 'aZ') ? GETPOST('contextpage', 'aZ') : str_replace('_', '', basename(dirname(__FILE__)).basename(__FILE__, '.php')); // To manage different context of search
111$backtopage = GETPOST('backtopage', 'alpha'); // Go back to a dedicated page
112$optioncss = GETPOST('optioncss', 'aZ'); // Option for the css output (always '' except when 'print')
113$mode = GETPOST('mode', 'aZ'); // The display mode ('list', 'kanban', 'hierarchy', 'calendar', 'gantt', ...)
114$groupby = GETPOST('groupby', 'aZ09'); // Example: $groupby = 'p.fk_opp_status' or $groupby = 'p.fk_statut'
115
116$id = GETPOSTINT('id');
117$ref = GETPOST('ref', 'alpha');
118
119// Load variable for pagination
120$limit = GETPOSTINT('limit') ? GETPOSTINT('limit') : $conf->liste_limit;
121$sortfield = GETPOST('sortfield', 'aZ09comma');
122$sortorder = GETPOST('sortorder', 'aZ09comma');
123$page = GETPOSTISSET('pageplusone') ? (GETPOSTINT('pageplusone') - 1) : GETPOSTINT('page');
124if (empty($page) || $page < 0 || GETPOST('button_search', 'alpha') || GETPOST('button_removefilter', 'alpha')) {
125 // If $page is not defined, or '' or -1 or if we click on clear filters
126 $page = 0;
127}
128$offset = $limit * $page;
129$pageprev = $page - 1;
130$pagenext = $page + 1;
131
132// Initialize technical objects
133$object = new MyObject($db);
134$extrafields = new ExtraFields($db);
135$diroutputmassaction = $conf->mymodule->dir_output.'/temp/massgeneration/'.$user->id;
136$hookmanager->initHooks(array($contextpage)); // Note that conf->hooks_modules contains array of activated contexes
137
138// Fetch optionals attributes and labels
139$extrafields->fetch_name_optionals_label($object->table_element);
140//$extrafields->fetch_name_optionals_label($object->table_element_line);
141
142$search_array_options = $extrafields->getOptionalsFromPost($object->table_element, '', 'search_');
143
144// Default sort order (if not yet defined by previous GETPOST)
145if (!$sortfield) {
146 reset($object->fields); // Reset is required to avoid key() to return null.
147 $sortfield = "t.".key($object->fields); // Set here default search field. By default 1st field in definition.
148}
149if (!$sortorder) {
150 $sortorder = "ASC";
151}
152
153// Initialize array of search criteria
154$search_all = trim(GETPOST('search_all', 'alphanohtml'));
155$search = array();
156foreach ($object->fields as $key => $val) {
157 if (GETPOST('search_'.$key, 'alpha') !== '') {
158 $search[$key] = GETPOST('search_'.$key, 'alpha');
159 }
160 if (preg_match('/^(date|timestamp|datetime)/', $val['type'])) {
161 $search[$key.'_dtstart'] = dol_mktime(0, 0, 0, GETPOSTINT('search_'.$key.'_dtstartmonth'), GETPOSTINT('search_'.$key.'_dtstartday'), GETPOSTINT('search_'.$key.'_dtstartyear'));
162 $search[$key.'_dtend'] = dol_mktime(23, 59, 59, GETPOSTINT('search_'.$key.'_dtendmonth'), GETPOSTINT('search_'.$key.'_dtendday'), GETPOSTINT('search_'.$key.'_dtendyear'));
163 }
164}
165
166$fieldstosearchall = array();
167// List of fields to search into when doing a "search in all"
168// foreach ($object->fields as $key => $val) {
169// if (!empty($val['searchall'])) {
170// $fieldstosearchall['t.'.$key] = $val['label'];
171// }
172// }
173// $parameters = array('fieldstosearchall'=>$fieldstosearchall);
174// $reshook = $hookmanager->executeHooks('completeFieldsToSearchAll', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks
175// if ($reshook > 0) {
176// $fieldstosearchall = empty($hookmanager->resArray['fieldstosearchall']) ? array() : $hookmanager->resArray['fieldstosearchall'];
177// } elseif ($reshook == 0) {
178// $fieldstosearchall = array_merge($fieldstosearchall, empty($hookmanager->resArray['fieldstosearchall']) ? array() : $hookmanager->resArray['fieldstosearchall']);
179// }
180
181// Definition of array of fields for columns
182$tableprefix = 't';
183$arrayfields = array();
184foreach ($object->fields as $key => $val) {
185 // If $val['visible']==0, then we never show the field
186 if (!empty($val['visible'])) {
187 $visible = (int) dol_eval((string) $val['visible'], 1);
188 $arrayfields[$tableprefix.'.'.$key] = array(
189 'label' => $val['label'],
190 'checked' => (($visible < 0) ? 0 : 1),
191 'enabled' => (abs($visible) != 3 && (bool) dol_eval($val['enabled'], 1)),
192 'position' => $val['position'],
193 'help' => isset($val['help']) ? $val['help'] : ''
194 );
195 }
196}
197// Extra fields
198include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_array_fields.tpl.php';
199
200$object->fields = dol_sort_array($object->fields, 'position');
201//$arrayfields['anotherfield'] = array('type'=>'integer', 'label'=>'AnotherField', 'checked'=>1, 'enabled'=>1, 'position'=>90, 'csslist'=>'right');
202$arrayfields = dol_sort_array($arrayfields, 'position');
203
204// There is several ways to check permission.
205// Set $enablepermissioncheck to 1 to enable a minimum low level of checks
206$enablepermissioncheck = getDolGlobalInt('MYMODULE_ENABLE_PERMISSION_CHECK');
207if ($enablepermissioncheck) {
208 $permissiontoread = $user->hasRight('mymodule', 'myobject', 'read');
209 $permissiontoadd = $user->hasRight('mymodule', 'myobject', 'write');
210 $permissiontodelete = $user->hasRight('mymodule', 'myobject', 'delete');
211} else {
212 $permissiontoread = 1;
213 $permissiontoadd = 1;
214 $permissiontodelete = 1;
215}
216
217// Security check (enable the most restrictive one)
218if ($user->socid > 0) {
220}
221//if ($user->socid > 0) accessforbidden();
222//$socid = 0; if ($user->socid > 0) $socid = $user->socid;
223//$isdraft = (($object->status == $object::STATUS_DRAFT) ? 1 : 0);
224//restrictedArea($user, $object->module, 0, $object->table_element, $object->element, 'fk_soc', 'rowid', $isdraft);
225if (!isModEnabled("mymodule")) {
226 accessforbidden('Module mymodule not enabled');
227}
228if (!$permissiontoread) {
230}
231
232
233/*
234 * Actions
235 */
236
237if (GETPOST('cancel', 'alpha')) {
238 $action = 'list';
239 $massaction = '';
240}
241if (!GETPOST('confirmmassaction', 'alpha') && $massaction != 'presend' && $massaction != 'confirm_presend') {
242 $massaction = '';
243}
244
245$parameters = array('arrayfields' => &$arrayfields);
246$reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks
247if ($reshook < 0) {
248 setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
249}
250
251if (empty($reshook)) {
252 // Selection of new fields
253 include DOL_DOCUMENT_ROOT.'/core/actions_changeselectedfields.inc.php';
254
255 // Purge search criteria
256 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
257 foreach ($object->fields as $key => $val) {
258 $search[$key] = '';
259 if (preg_match('/^(date|timestamp|datetime)/', $val['type'])) {
260 $search[$key.'_dtstart'] = '';
261 $search[$key.'_dtend'] = '';
262 }
263 }
264 $search_all = '';
265 $toselect = array();
266 $search_array_options = array();
267 }
268 if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x', 'alpha') || GETPOST('button_removefilter', 'alpha')
269 || GETPOST('button_search_x', 'alpha') || GETPOST('button_search.x', 'alpha') || GETPOST('button_search', 'alpha')) {
270 $massaction = ''; // Protection to avoid mass action if we force a new search during a mass action confirmation
271 }
272
273 // Mass actions
274 $objectclass = 'MyObject';
275 $objectlabel = 'MyObject';
276 $uploaddir = $conf->mymodule->dir_output;
277
278 global $error;
279 include DOL_DOCUMENT_ROOT.'/core/actions_massactions.inc.php';
280
281 // You can add more action here
282 // if ($action == 'xxx' && $permissiontoxxx) ...
283}
284
285
286
287/*
288 * View
289 */
290
291$form = new Form($db);
292
293$now = dol_now();
294
295$title = $langs->trans("MyObjects");
296//$help_url = "EN:Module_MyObject|FR:Module_MyObject_FR|ES:Módulo_MyObject";
297$help_url = '';
298$morejs = array();
299$morecss = array();
300
301
302// Build and execute select
303// --------------------------------------------------------------------
304$sql = "SELECT";
305$sql .= " ".$object->getFieldList('t');
306// Add fields from extrafields
307if (!empty($extrafields->attributes[$object->table_element]['label'])) {
308 foreach ($extrafields->attributes[$object->table_element]['label'] as $key => $val) {
309 $sql .= ($extrafields->attributes[$object->table_element]['type'][$key] != 'separate' ? ", ef.".$key." as options_".$key : "");
310 }
311}
312// Add fields from hooks
313$parameters = array();
314$reshook = $hookmanager->executeHooks('printFieldListSelect', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
315$sql .= $hookmanager->resPrint;
316$sql = preg_replace('/,\s*$/', '', $sql);
317
318$sqlfields = $sql; // $sql fields to remove for count total
319
320$sql .= " FROM ".MAIN_DB_PREFIX.$object->table_element." as t";
321//$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."anothertable as rc ON rc.parent = t.rowid";
322if (isset($extrafields->attributes[$object->table_element]['label']) && is_array($extrafields->attributes[$object->table_element]['label']) && count($extrafields->attributes[$object->table_element]['label'])) {
323 $sql .= " LEFT JOIN ".MAIN_DB_PREFIX.$object->table_element."_extrafields as ef on (t.rowid = ef.fk_object)";
324}
325// Add table from hooks
326$parameters = array();
327$reshook = $hookmanager->executeHooks('printFieldListFrom', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
328$sql .= $hookmanager->resPrint;
329if ($object->ismultientitymanaged == 1) {
330 $sql .= " WHERE t.entity IN (".getEntity($object->element, (GETPOSTINT('search_current_entity') ? 0 : 1)).")";
331} else {
332 $sql .= " WHERE 1 = 1";
333}
334foreach ($search as $key => $val) {
335 if (array_key_exists($key, $object->fields)) {
336 if ($key == 'status' && $search[$key] == -1) {
337 continue;
338 }
339 $mode_search = (($object->isInt($object->fields[$key]) || $object->isFloat($object->fields[$key])) ? 1 : 0);
340 if ((strpos($object->fields[$key]['type'], 'integer:') === 0) || (strpos($object->fields[$key]['type'], 'sellist:') === 0) || !empty($object->fields[$key]['arrayofkeyval'])) {
341 if ($search[$key] == '-1' || ($search[$key] === '0' && (empty($object->fields[$key]['arrayofkeyval']) || !array_key_exists('0', $object->fields[$key]['arrayofkeyval'])))) {
342 $search[$key] = '';
343 }
344 $mode_search = 2;
345 }
346 if ($search[$key] != '') {
347 $sql .= natural_search("t.".$db->sanitize($key), $search[$key], (($key == 'status') ? 2 : $mode_search));
348 }
349 } else {
350 if (preg_match('/(_dtstart|_dtend)$/', $key) && $search[$key] != '') {
351 $columnName = preg_replace('/(_dtstart|_dtend)$/', '', $key);
352 if (preg_match('/^(date|timestamp|datetime)/', $object->fields[$columnName]['type'])) {
353 if (preg_match('/_dtstart$/', $key)) {
354 $sql .= " AND t.".$db->sanitize($columnName)." >= '".$db->idate($search[$key])."'";
355 }
356 if (preg_match('/_dtend$/', $key)) {
357 $sql .= " AND t.".$db->sanitize($columnName)." <= '".$db->idate($search[$key])."'";
358 }
359 }
360 }
361 }
362}
363if ($search_all) {
364 $sql .= natural_search(array_keys($fieldstosearchall), $search_all);
365}
366/*
367// If the internal user must only see his customers, force searching by him
368$search_sale = 0;
369if (!$user->hasRight('societe', 'client', 'voir')) {
370 $search_sale = $user->id;
371}
372// Search on sale representative
373if ($search_sale && $search_sale != '-1') {
374 if ($search_sale == -2) {
375 $sql .= " AND NOT EXISTS (SELECT sc.fk_soc FROM ".MAIN_DB_PREFIX."societe_commerciaux as sc WHERE sc.fk_soc = t.fk_soc)";
376 } elseif ($search_sale > 0) {
377 $sql .= " AND EXISTS (SELECT sc.fk_soc FROM ".MAIN_DB_PREFIX."societe_commerciaux as sc WHERE sc.fk_soc = t.fk_soc AND sc.fk_user = ".((int) $search_sale).")";
378 }
379}
380// Search on socid
381if ($socid) {
382 $sql .= " AND t.fk_soc = ".((int) $socid);
383}
384*/
385//$sql.= dolSqlDateFilter("t.field", $search_xxxday, $search_xxxmonth, $search_xxxyear);
386// Add where from extra fields
387include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_sql.tpl.php';
388// Add where from hooks
389$parameters = array();
390$reshook = $hookmanager->executeHooks('printFieldListWhere', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
391$sql .= $hookmanager->resPrint;
392
393/* If a group by is required
394$sql .= " GROUP BY ";
395foreach($object->fields as $key => $val) {
396 $sql .= "t.".$db->sanitize($key).", ";
397}
398// Add fields from extrafields
399if (!empty($extrafields->attributes[$object->table_element]['label'])) {
400 foreach ($extrafields->attributes[$object->table_element]['label'] as $key => $val) {
401 $sql .= ($extrafields->attributes[$object->table_element]['type'][$key] != 'separate' ? "ef.".$key.', ' : '');
402 }
403}
404// Add groupby from hooks
405$parameters = array();
406$reshook = $hookmanager->executeHooks('printFieldListGroupBy', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
407$sql .= $hookmanager->resPrint;
408$sql = preg_replace('/,\s*$/', '', $sql);
409*/
410
411// Add HAVING from hooks
412/*
413$parameters = array();
414$reshook = $hookmanager->executeHooks('printFieldListHaving', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
415$sql .= empty($hookmanager->resPrint) ? "" : " HAVING 1=1 ".$hookmanager->resPrint;
416*/
417
418// Count total nb of records
419$nbtotalofrecords = '';
420if (!getDolGlobalInt('MAIN_DISABLE_FULL_SCANLIST')) {
421 /* The fast and low memory method to get and count full list converts the sql into a sql count */
422 $sqlforcount = preg_replace('/^'.preg_quote($sqlfields, '/').'/', 'SELECT COUNT(*) as nbtotalofrecords', $sql);
423 $sqlforcount = preg_replace('/GROUP BY .*$/', '', $sqlforcount);
424
425 $resql = $db->query($sqlforcount);
426 if ($resql) {
427 $objforcount = $db->fetch_object($resql);
428 $nbtotalofrecords = $objforcount->nbtotalofrecords;
429 } else {
430 dol_print_error($db);
431 }
432
433 if (($page * $limit) > $nbtotalofrecords) { // if total resultset is smaller than the paging size (filtering), goto and load page 0
434 $page = 0;
435 $offset = 0;
436 }
437 $db->free($resql);
438}
439
440// Complete request and execute it with limit
441$sql .= $db->order($sortfield, $sortorder);
442if ($limit) {
443 $sql .= $db->plimit($limit + 1, $offset);
444}
445
446$resql = $db->query($sql);
447if (!$resql) {
448 dol_print_error($db);
449 exit;
450}
451
452$num = $db->num_rows($resql);
453
454
455// Direct jump if only one record found
456if ($num == 1 && getDolGlobalInt('MAIN_SEARCH_DIRECT_OPEN_IF_ONLY_ONE') && $search_all && !$page) {
457 $obj = $db->fetch_object($resql);
458 $id = $obj->rowid;
459 header("Location: ".dol_buildpath('/mymodule/myobject_card.php', 1).'?id='.((int) $id));
460 exit;
461}
462
463
464// Output page
465// --------------------------------------------------------------------
466
467llxHeader('', $title, $help_url, '', 0, 0, $morejs, $morecss, '', 'mod-mymodule page-list bodyforlist'); // Can use also classforhorizontalscrolloftabs instead of bodyforlist for a horizontal scroll in the table instead of page
468
469// Example : Adding jquery code
470// print '<script type="text/javascript">
471// jQuery(document).ready(function() {
472// function init_myfunc()
473// {
474// jQuery("#myid").removeAttr(\'disabled\');
475// jQuery("#myid").attr(\'disabled\',\'disabled\');
476// }
477// init_myfunc();
478// jQuery("#mybutton").click(function() {
479// init_myfunc();
480// });
481// });
482// </script>';
483
484$arrayofselected = is_array($toselect) ? $toselect : array();
485
486$param = '';
487if (!empty($mode)) {
488 $param .= '&mode='.urlencode($mode);
489}
490if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) {
491 $param .= '&contextpage='.urlencode($contextpage);
492}
493if ($limit > 0 && $limit != $conf->liste_limit) {
494 $param .= '&limit='.((int) $limit);
495}
496if ($optioncss != '') {
497 $param .= '&optioncss='.urlencode($optioncss);
498}
499if ($groupby != '') {
500 $param .= '&groupby='.urlencode($groupby);
501}
502foreach ($search as $key => $val) {
503 if (is_array($search[$key])) {
504 foreach ($search[$key] as $skey) {
505 if ($skey != '') {
506 $param .= '&search_'.$key.'[]='.urlencode($skey);
507 }
508 }
509 } elseif (preg_match('/(_dtstart|_dtend)$/', $key) && !empty($val)) {
510 $param .= '&search_'.$key.'month='.GETPOSTINT('search_'.$key.'month');
511 $param .= '&search_'.$key.'day='.GETPOSTINT('search_'.$key.'day');
512 $param .= '&search_'.$key.'year='.GETPOSTINT('search_'.$key.'year');
513 } elseif ($search[$key] != '') {
514 $param .= '&search_'.$key.'='.urlencode($search[$key]);
515 }
516}
517// Add $param from extra fields
518include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_param.tpl.php';
519// Add $param from hooks
520$parameters = array('param' => &$param);
521$reshook = $hookmanager->executeHooks('printFieldListSearchParam', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
522$param .= $hookmanager->resPrint;
523
524// List of mass actions available
525$arrayofmassactions = array(
526 //'validate'=>img_picto('', 'check', 'class="pictofixedwidth"').$langs->trans("Validate"),
527 //'generate_doc'=>img_picto('', 'pdf', 'class="pictofixedwidth"').$langs->trans("ReGeneratePDF"),
528 //'builddoc'=>img_picto('', 'pdf', 'class="pictofixedwidth"').$langs->trans("PDFMerge"),
529 //'presend'=>img_picto('', 'email', 'class="pictofixedwidth"').$langs->trans("SendByMail"),
530);
531if (!empty($permissiontodelete)) {
532 $arrayofmassactions['predelete'] = img_picto('', 'delete', 'class="pictofixedwidth"').$langs->trans("Delete");
533}
534if (GETPOSTINT('nomassaction') || in_array($massaction, array('presend', 'predelete'))) {
535 $arrayofmassactions = array();
536}
537$massactionbutton = $form->selectMassAction('', $arrayofmassactions);
538
539print '<form method="POST" id="searchFormList" action="'.$_SERVER["PHP_SELF"].'">'."\n";
540if ($optioncss != '') {
541 print '<input type="hidden" name="optioncss" value="'.$optioncss.'">';
542}
543print '<input type="hidden" name="token" value="'.newToken().'">';
544print '<input type="hidden" name="formfilteraction" id="formfilteraction" value="list">';
545print '<input type="hidden" name="action" value="list">';
546print '<input type="hidden" name="sortfield" value="'.$sortfield.'">';
547print '<input type="hidden" name="sortorder" value="'.$sortorder.'">';
548print '<input type="hidden" name="page" value="'.$page.'">';
549print '<input type="hidden" name="contextpage" value="'.$contextpage.'">';
550print '<input type="hidden" name="page_y" value="">';
551print '<input type="hidden" name="mode" value="'.$mode.'">';
552
553
554$newcardbutton = '';
555$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'));
556$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'));
557$newcardbutton .= dolGetButtonTitleSeparator();
558$newcardbutton .= dolGetButtonTitle($langs->trans('New'), '', 'fa fa-plus-circle', dol_buildpath('/mymodule/myobject_card.php', 1).'?action=create&backtopage='.urlencode($_SERVER['PHP_SELF']), '', $permissiontoadd);
559
560print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, $object->picto, 0, $newcardbutton, '', $limit, 0, 0, 1);
561
562// Add code for pre mass action (confirmation or email presend form)
563$topicmail = "SendMyObjectRef";
564$modelmail = "myobject";
565$objecttmp = new MyObject($db);
566$trackid = 'xxxx'.$object->id;
567include DOL_DOCUMENT_ROOT.'/core/tpl/massactions_pre.tpl.php';
568
569if ($search_all) {
570 $setupstring = '';
571 // @phan-suppress-next-line PhanEmptyForeach
572 foreach ($fieldstosearchall as $key => $val) {
573 $fieldstosearchall[$key] = $langs->trans($val);
574 $setupstring .= $key."=".$val.";";
575 }
576 print '<!-- Search done like if MYOBJECT_QUICKSEARCH_ON_FIELDS = '.$setupstring.' -->'."\n";
577 print '<div class="divsearchfieldfilter">'.$langs->trans("FilterOnInto", $search_all).implode(', ', $fieldstosearchall).'</div>'."\n";
578}
579
580$moreforfilter = '';
581/*$moreforfilter.='<div class="divsearchfield">';
582$moreforfilter.= $langs->trans('MyFilter') . ': <input type="text" name="search_myfield" value="'.dol_escape_htmltag($search_myfield).'">';
583$moreforfilter.= '</div>';*/
584
585$parameters = array();
586$reshook = $hookmanager->executeHooks('printFieldPreListTitle', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
587if (empty($reshook)) {
588 $moreforfilter .= $hookmanager->resPrint;
589} else {
590 $moreforfilter = $hookmanager->resPrint;
591}
592$parameters = array(
593 'arrayfields' => &$arrayfields,
594);
595
596if (!empty($moreforfilter)) {
597 print '<div class="liste_titre liste_titre_bydiv centpercent">';
598 print $moreforfilter;
599 print '</div>';
600}
601
602$varpage = empty($contextpage) ? $_SERVER["PHP_SELF"] : $contextpage;
603$htmlofselectarray = $form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage, $conf->main_checkbox_left_column); // This also change content of $arrayfields with user setup
604$selectedfields = ($mode != 'kanban' ? $htmlofselectarray : '');
605$selectedfields .= (count($arrayofmassactions) ? $form->showCheckAddButtons('checkforselect', 1) : '');
606
607print '<div class="div-table-responsive">'; // You can use div-table-responsive-no-min if you don't need reserved height for your table
608print '<table class="tagtable nobottomiftotal noborder liste'.($moreforfilter ? " listwithfilterbefore" : "").'">'."\n";
609
610// Fields title search
611// --------------------------------------------------------------------
612print '<tr class="liste_titre_filter">';
613// Action column
614if ($conf->main_checkbox_left_column) {
615 print '<td class="liste_titre center maxwidthsearch">';
616 $searchpicto = $form->showFilterButtons('left');
617 print $searchpicto;
618 print '</td>';
619}
620foreach ($object->fields as $key => $val) {
621 //$searchkey = empty($search[$key]) ? '' : $search[$key];
622 $cssforfield = (empty($val['csslist']) ? (empty($val['css']) ? '' : $val['css']) : $val['csslist']);
623 if ($key == 'status') {
624 $cssforfield .= ($cssforfield ? ' ' : '').'center';
625 } elseif (in_array($val['type'], array('date', 'datetime', 'timestamp'))) {
626 $cssforfield .= ($cssforfield ? ' ' : '').'center';
627 } elseif (in_array($val['type'], array('timestamp'))) {
628 $cssforfield .= ($cssforfield ? ' ' : '').'nowrap';
629 } 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'])) {
630 $cssforfield .= ($cssforfield ? ' ' : '').'right';
631 }
632 if (!empty($arrayfields['t.'.$key]['checked'])) {
633 print '<td class="liste_titre'.($cssforfield ? ' '.$cssforfield : '').($key == 'status' ? ' parentonrightofpage' : '').'">';
634 if (!empty($val['arrayofkeyval']) && is_array($val['arrayofkeyval'])) {
635 print $form->selectarray('search_'.$key, $val['arrayofkeyval'], (isset($search[$key]) ? $search[$key] : ''), 1, 0, 0, '', 1, 0, 0, '', 'maxwidth100'.($key == 'status' ? ' search_status width100 onrightofpage' : ''), 1);
636 } elseif ((strpos($val['type'], 'integer:') === 0) || (strpos($val['type'], 'sellist:') === 0)) {
637 print $object->showInputField($val, $key, (isset($search[$key]) ? $search[$key] : ''), '', '', 'search_', $cssforfield.' maxwidth250', 1);
638 } elseif (preg_match('/^(date|timestamp|datetime)/', $val['type'])) {
639 print '<div class="nowrap">';
640 print $form->selectDate($search[$key.'_dtstart'] ? $search[$key.'_dtstart'] : '', "search_".$key."_dtstart", 0, 0, 1, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans('From'));
641 print '</div>';
642 print '<div class="nowrap">';
643 print $form->selectDate($search[$key.'_dtend'] ? $search[$key.'_dtend'] : '', "search_".$key."_dtend", 0, 0, 1, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans('to'));
644 print '</div>';
645 } elseif ($key == 'lang') {
646 require_once DOL_DOCUMENT_ROOT.'/core/class/html.formadmin.class.php';
647 $formadmin = new FormAdmin($db);
648 print $formadmin->select_language((isset($search[$key]) ? $search[$key] : ''), 'search_lang', 0, array(), 1, 0, 0, 'minwidth100imp maxwidth125', 2);
649 } else {
650 print '<input type="text" class="flat maxwidth'.(in_array($val['type'], array('integer', 'price')) ? '50' : '75').'" name="search_'.$key.'" value="'.dol_escape_htmltag(isset($search[$key]) ? $search[$key] : '').'">';
651 }
652 print '</td>';
653 }
654}
655// Extra fields
656include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_input.tpl.php';
657
658// Fields from hook
659$parameters = array('arrayfields' => $arrayfields);
660$reshook = $hookmanager->executeHooks('printFieldListOption', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
661print $hookmanager->resPrint;
662/*if (!empty($arrayfields['anotherfield']['checked'])) {
663 print '<td class="liste_titre"></td>';
664}*/
665// Action column
666if (!$conf->main_checkbox_left_column) {
667 print '<td class="liste_titre center maxwidthsearch">';
668 $searchpicto = $form->showFilterButtons();
669 print $searchpicto;
670 print '</td>';
671}
672print '</tr>'."\n";
673
674$totalarray = array();
675$totalarray['nbfield'] = 0;
676
677// Fields title label
678// --------------------------------------------------------------------
679print '<tr class="liste_titre">';
680// Action column
681if ($conf->main_checkbox_left_column) {
682 print getTitleFieldOfList($selectedfields, 0, $_SERVER["PHP_SELF"], '', '', '', '', $sortfield, $sortorder, 'center maxwidthsearch ')."\n";
683 $totalarray['nbfield']++;
684}
685foreach ($object->fields as $key => $val) {
686 $cssforfield = (empty($val['csslist']) ? (empty($val['css']) ? '' : $val['css']) : $val['csslist']);
687 if ($key == 'status') {
688 $cssforfield .= ($cssforfield ? ' ' : '').'center';
689 } elseif (in_array($val['type'], array('date', 'datetime', 'timestamp'))) {
690 $cssforfield .= ($cssforfield ? ' ' : '').'center';
691 } elseif (in_array($val['type'], array('timestamp'))) {
692 $cssforfield .= ($cssforfield ? ' ' : '').'nowrap';
693 } 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'])) {
694 $cssforfield .= ($cssforfield ? ' ' : '').'right';
695 }
696 $cssforfield = preg_replace('/small\s*/', '', $cssforfield); // the 'small' css must not be used for the title label
697 if (!empty($arrayfields['t.'.$key]['checked'])) {
698 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";
699 $totalarray['nbfield']++;
700 }
701}
702// Extra fields
703include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_title.tpl.php';
704// Hook fields
705$parameters = array('arrayfields' => $arrayfields, 'param' => $param, 'sortfield' => $sortfield, 'sortorder' => $sortorder, 'totalarray' => &$totalarray);
706$reshook = $hookmanager->executeHooks('printFieldListTitle', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
707print $hookmanager->resPrint;
708/*if (!empty($arrayfields['anotherfield']['checked'])) {
709 print '<th class="liste_titre right">'.$langs->trans("AnotherField").'</th>';
710 $totalarray['nbfield']++;
711}*/
712// Action column
713if (!$conf->main_checkbox_left_column) {
714 print getTitleFieldOfList($selectedfields, 0, $_SERVER["PHP_SELF"], '', '', '', '', $sortfield, $sortorder, 'center maxwidthsearch ')."\n";
715 $totalarray['nbfield']++;
716}
717print '</tr>'."\n";
718
719// Detect if we need a fetch on each output line
720$needToFetchEachLine = 0;
721if (isset($extrafields->attributes[$object->table_element]['computed']) && is_array($extrafields->attributes[$object->table_element]['computed']) && count($extrafields->attributes[$object->table_element]['computed']) > 0) {
722 foreach ($extrafields->attributes[$object->table_element]['computed'] as $key => $val) {
723 if (!is_null($val) && preg_match('/\$object/', $val)) {
724 $needToFetchEachLine++; // There is at least one compute field that use $object
725 }
726 }
727}
728
729
730// Loop on record
731// --------------------------------------------------------------------
732$i = 0;
733$savnbfield = $totalarray['nbfield'];
734$totalarray = array();
735$totalarray['nbfield'] = 0;
736$imaxinloop = ($limit ? min($num, $limit) : $num);
737while ($i < $imaxinloop) {
738 $obj = $db->fetch_object($resql);
739 if (empty($obj)) {
740 break; // Should not happen
741 }
742
743 // Store properties in $object
744 $object->setVarsFromFetchObj($obj);
745
746 /*
747 $object->thirdparty = null;
748 if ($obj->fk_soc > 0) {
749 if (!empty($conf->cache['thirdparty'][$obj->fk_soc])) {
750 $companyobj = $conf->cache['thirdparty'][$obj->fk_soc];
751 } else {
752 $companyobj = new Societe($db);
753 $companyobj->fetch($obj->fk_soc);
754 $conf->cache['thirdparty'][$obj->fk_soc] = $companyobj;
755 }
756
757 $object->thirdparty = $companyobj;
758 }*/
759
760 if ($mode == 'kanban') {
761 if ($i == 0) {
762 print '<tr class="trkanban"><td colspan="'.$savnbfield.'">';
763 print '<div class="box-flex-container kanban">';
764 }
765 // Output Kanban
766 $selected = -1;
767 if ($massactionbutton || $massaction) { // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined
768 $selected = 0;
769 if (in_array($object->id, $arrayofselected)) {
770 $selected = 1;
771 }
772 }
773 //print $object->getKanbanView('', array('thirdparty'=>$object->thirdparty, 'selected' => $selected));
774 print $object->getKanbanView('', array('selected' => $selected));
775 if ($i == ($imaxinloop - 1)) {
776 print '</div>';
777 print '</td></tr>';
778 }
779 } else {
780 // Show line of result
781 $j = 0;
782 print '<tr data-rowid="'.$object->id.'" class="oddeven">';
783
784 // Action column
785 if ($conf->main_checkbox_left_column) {
786 print '<td class="nowrap center">';
787 if ($massactionbutton || $massaction) { // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined
788 $selected = 0;
789 if (in_array($object->id, $arrayofselected)) {
790 $selected = 1;
791 }
792 print '<input id="cb'.$object->id.'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.$object->id.'"'.($selected ? ' checked="checked"' : '').'>';
793 }
794 print '</td>';
795 if (!$i) {
796 $totalarray['nbfield']++;
797 }
798 }
799 // Fields
800 foreach ($object->fields as $key => $val) {
801 $cssforfield = (empty($val['csslist']) ? (empty($val['css']) ? '' : $val['css']) : $val['csslist']);
802 if (in_array($val['type'], array('date', 'datetime', 'timestamp'))) {
803 $cssforfield .= ($cssforfield ? ' ' : '').'center';
804 } elseif ($key == 'status') {
805 $cssforfield .= ($cssforfield ? ' ' : '').'center';
806 }
807
808 if (in_array($val['type'], array('timestamp'))) {
809 $cssforfield .= ($cssforfield ? ' ' : '').'nowraponall';
810 } elseif ($key == 'ref') {
811 $cssforfield .= ($cssforfield ? ' ' : '').'nowraponall';
812 }
813
814 if (in_array($val['type'], array('double(24,8)', 'double(6,3)', 'integer', 'real', 'price')) && !in_array($key, array('id', 'rowid', 'ref', 'status')) && empty($val['arrayofkeyval'])) {
815 $cssforfield .= ($cssforfield ? ' ' : '').'right';
816 }
817 //if (in_array($key, array('fk_soc', 'fk_user', 'fk_warehouse'))) $cssforfield = 'tdoverflowmax100';
818
819 if (!empty($arrayfields['t.'.$key]['checked'])) {
820 print '<td'.($cssforfield ? ' class="'.$cssforfield.((preg_match('/tdoverflow/', $cssforfield) && !in_array($val['type'], array('ip', 'url')) && !is_numeric($object->$key)) ? ' classfortooltip' : '').'"' : '');
821 if (preg_match('/tdoverflow/', $cssforfield) && !in_array($val['type'], array('ip', 'url')) && !is_numeric($object->$key) && !in_array($key, array('ref'))) {
822 print ' title="'.dol_escape_htmltag($object->$key).'"';
823 }
824 print '>';
825 if ($key == 'status') {
826 print $object->getLibStatut(5);
827 } elseif ($key == 'rowid') {
828 print $object->showOutputField($val, $key, $object->id, '');
829 } else {
830 print $object->showOutputField($val, $key, $object->$key, '');
831 }
832 print '</td>';
833 if (!$i) {
834 $totalarray['nbfield']++;
835 }
836 if (!empty($val['isameasure']) && $val['isameasure'] == 1) {
837 if (!$i) {
838 $totalarray['pos'][$totalarray['nbfield']] = 't.'.$key;
839 }
840 if (!isset($totalarray['val'])) {
841 $totalarray['val'] = array();
842 }
843 if (!isset($totalarray['val']['t.'.$key])) {
844 $totalarray['val']['t.'.$key] = 0;
845 }
846 $totalarray['val']['t.'.$key] += $object->$key;
847 }
848 }
849 }
850 // Extra fields
851 include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_print_fields.tpl.php';
852 // Fields from hook
853 $parameters = array('arrayfields' => $arrayfields, 'object' => $object, 'obj' => $obj, 'i' => $i, 'totalarray' => &$totalarray);
854 $reshook = $hookmanager->executeHooks('printFieldListValue', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
855 print $hookmanager->resPrint;
856
857 /*if (!empty($arrayfields['anotherfield']['checked'])) {
858 print '<td class="right">'.$obj->anotherfield.'</td>';
859 }*/
860
861 // Action column
862 if (empty($conf->main_checkbox_left_column)) {
863 print '<td class="nowrap center">';
864 if ($massactionbutton || $massaction) { // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined
865 $selected = 0;
866 if (in_array($object->id, $arrayofselected)) {
867 $selected = 1;
868 }
869 print '<input id="cb'.$object->id.'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.$object->id.'"'.($selected ? ' checked="checked"' : '').'>';
870 }
871 print '</td>';
872 if (!$i) {
873 $totalarray['nbfield']++;
874 }
875 }
876
877 print '</tr>'."\n";
878 }
879
880 $i++;
881}
882
883// Show total line
884include DOL_DOCUMENT_ROOT.'/core/tpl/list_print_total.tpl.php';
885
886// If no record found
887if ($num == 0) {
888 $colspan = 1;
889 foreach ($arrayfields as $key => $val) {
890 if (!empty($val['checked'])) {
891 $colspan++;
892 }
893 }
894 print '<tr><td colspan="'.$colspan.'"><span class="opacitymedium">'.$langs->trans("NoRecordFound").'</span></td></tr>';
895}
896
897
898$db->free($resql);
899
900$parameters = array('arrayfields' => $arrayfields, 'sql' => $sql);
901$reshook = $hookmanager->executeHooks('printFieldListFooter', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
902print $hookmanager->resPrint;
903
904print '</table>'."\n";
905print '</div>'."\n";
906
907print '</form>'."\n";
908
909if (in_array('builddoc', array_keys($arrayofmassactions)) && ($nbtotalofrecords === '' || $nbtotalofrecords)) {
910 $hidegeneratedfilelistifempty = 1;
911 if ($massaction == 'builddoc' || $action == 'remove_file' || $show_files) {
912 $hidegeneratedfilelistifempty = 0;
913 }
914
915 require_once DOL_DOCUMENT_ROOT.'/core/class/html.formfile.class.php';
916 $formfile = new FormFile($db);
917
918 // Show list of available documents
919 $urlsource = $_SERVER['PHP_SELF'].'?sortfield='.$sortfield.'&sortorder='.$sortorder;
920 $urlsource .= str_replace('&amp;', '&', $param);
921
922 $filedir = $diroutputmassaction;
923 $genallowed = $permissiontoread;
924 $delallowed = $permissiontoadd;
925
926 print $formfile->showdocuments('massfilesarea_'.$object->module, '', $filedir, $urlsource, 0, $delallowed, '', 1, 1, 0, 48, 1, $param, $title, '', '', '', null, $hidegeneratedfilelistifempty);
927}
928
929// End of page
930llxFooter();
931$db->close();
$id
Definition account.php:48
if( $user->socid > 0) if(! $user->hasRight('accounting', 'chartofaccount')) $object
Definition card.php:66
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 standard extra fields.
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 for MyObject.
llxFooter()
Footer empty.
Definition document.php:107
dol_mktime($hour, $minute, $second, $month, $day, $year, $gm='auto', $check=1)
Return a timestamp date built from detailed information (by default a local PHP server timestamp) Rep...
setEventMessages($mesg, $mesgs, $style='mesgs', $messagekey='', $noduplicate=0, $attop=0)
Set event messages in dol_events session object.
print_barre_liste($title, $page, $file, $options='', $sortfield='', $sortorder='', $morehtmlcenter='', $num=-1, $totalnboflines='', $picto='generic', $pictoisfullpath=0, $morehtmlright='', $morecss='', $limit=-1, $selectlimitsuffix=0, $hidenavigation=0, $pagenavastextinput=0, $morehtmlrightbeforearrow='')
Print a title with navigation controls for pagination.
img_picto($titlealt, $picto, $moreatt='', $pictoisfullpath=0, $srconly=0, $notitle=0, $alt='', $morecss='', $marginleftonlyshort=2)
Show picto whatever it's its name (generic function)
GETPOSTINT($paramname, $method=0)
Return the value of a $_GET or $_POST supervariable, converted into integer.
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.
dol_eval($s, $returnvalue=1, $hideerrors=1, $onlysimplestring='1')
Replace eval function to add more security.
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...
dol_now($mode='auto')
Return date for now.
getDolGlobalInt($key, $default=0)
Return a Dolibarr global constant int value.
dol_sort_array(&$array, $index, $order='asc', $natsort=0, $case_sensitive=0, $keepindex=0)
Advanced sort array by the value of a given key, which produces ascending (default) or descending out...
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.
dol_buildpath($path, $type=0, $returnemptyifnotfound=0)
Return path of url or filesystem.
dol_print_error($db=null, $error='', $errors=null)
Displays error message system with all the information to facilitate the diagnosis and the escalation...
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...
global $conf
The following vars must be defined: $type2label $form $conf, $lang, The following vars may also be de...
Definition member.php:79
accessforbidden($message='', $printheader=1, $printfooter=1, $showonlymessage=0, $params=null)
Show a message to say access is forbidden and stop program.