dolibarr 24.0.0-beta
list.php
Go to the documentation of this file.
1<?php
2/* Copyright (C) 2002-2003 Rodolphe Quiedeville <rodolphe@quiedeville.org>
3 * Copyright (C) 2004-2018 Laurent Destailleur <eldy@users.sourceforge.net>
4 * Copyright (C) 2005-2024 Regis Houssin <regis.houssin@inodbox.com>
5 * Copyright (C) 2011 Herve Prot <herve.prot@symeos.com>
6 * Copyright (C) 2019-2026 Frédéric France <frederic.france@free.fr>
7 * Copyright (C) 2025 MDW <mdeweerd@users.noreply.github.com>
8 *
9 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License as published by
11 * the Free Software Foundation; either version 3 of the License, or
12 * (at your option) any later version.
13 *
14 * This program is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 * GNU General Public License for more details.
18 *
19 * You should have received a copy of the GNU General Public License
20 * along with this program. If not, see <https://www.gnu.org/licenses/>.
21 */
22
29// Load Dolibarr environment
30require '../../main.inc.php';
39require_once DOL_DOCUMENT_ROOT.'/user/class/usergroup.class.php';
40
41
42// Load translation files required by page
43$langs->loadLangs(array("users"));
44
45$action = GETPOST('action', 'aZ09') ? GETPOST('action', 'aZ09') : 'view'; // The action 'create'/'add', 'edit'/'update', 'view', ...
46$massaction = GETPOST('massaction', 'alpha'); // The bulk action (combo box choice into lists)
47$show_files = GETPOSTINT('show_files'); // Show files area generated by bulk actions ?
48$confirm = GETPOST('confirm', 'alpha'); // Result of a confirmation
49$cancel = GETPOST('cancel', 'alpha'); // We click on a Cancel button
50$toselect = GETPOST('toselect', 'array:int'); // Array of ids of elements selected into a list
51$contextpage = GETPOST('contextpage', 'aZ') ? GETPOST('contextpage', 'aZ') : str_replace('_', '', basename(dirname(__FILE__)).basename(__FILE__, '.php')); // To manage different context of search
52$backtopage = GETPOST('backtopage', 'alpha'); // Go back to a dedicated page
53$optioncss = GETPOST('optioncss', 'aZ'); // Option for the css output (always '' except when 'print')
54$mode = GETPOST('mode', 'aZ'); // The output mode ('list', 'kanban', 'hierarchy', 'calendar', ...)
55
56$search_all = trim(GETPOST('search_all', 'alphanohtml'));
57$search_group = GETPOST('search_group');
58$search = array();
59
60// Load variable for pagination
61$limit = GETPOSTINT('limit') ? GETPOSTINT('limit') : $conf->liste_limit;
62$sortfield = GETPOST('sortfield', 'aZ09comma');
63$sortorder = GETPOST('sortorder', 'aZ09comma');
64$page = GETPOSTISSET('pageplusone') ? (GETPOSTINT('pageplusone') - 1) : GETPOSTINT('page');
65if (empty($page) || $page < 0 || GETPOST('button_search', 'alpha') || GETPOST('button_removefilter', 'alpha')) {
66 // If $page is not defined, or '' or -1 or if we click on clear filters
67 $page = 0;
68}
69$offset = $limit * $page;
70$pageprev = $page - 1;
71$pagenext = $page + 1;
72
73// Initialize a technical objects
74$object = new UserGroup($db);
75
76//$diroutputmassaction = $conf->mymodule->dir_output.'/temp/massgeneration/'.$user->id;
77$hookmanager->initHooks(array($contextpage)); // Note that conf->hooks_modules contains array of activated contexes
78
79// Fetch optionals attributes and labels
80$extrafields->fetch_name_optionals_label($object->table_element);
81//$extrafields->fetch_name_optionals_label($object->table_element_line);
82
83$search_array_options = $extrafields->getOptionalsFromPost($object->table_element, '', 'search_');
84
85if (!$sortfield) {
86 $sortfield = "g.nom";
87}
88if (!$sortorder) {
89 $sortorder = "ASC";
90}
91
92$arrayfields = array();
93
94// List of fields to search into when doing a "search in all"
95$fieldstosearchall = array();
96foreach ($object->fields as $key => $val) {
97 if (!empty($val['searchall'])) {
98 $fieldstosearchall['t.'.$key] = $val['label'];
99 }
100}
101
102if (getDolGlobalString('MAIN_USE_ADVANCED_PERMS')) {
103 if (!$user->hasRight("user", "group_advance", "read") && !$user->admin) {
105 }
106}
107
108if (!$user->hasRight("user", "user", "read") && !$user->admin) {
110}
111
112// Define if user can modify other users and permissions
113$caneditperms = (isModEnabled('multicompany') && !empty($user->entity) && getDolGlobalString('MULTICOMPANY_TRANSVERSE_MODE') ? false : (!empty($user->admin) || $user->hasRight("user", "user", "write")));
114$permissiontodelete = $caneditperms;
115// Advanced permissions
116if (getDolGlobalString('MAIN_USE_ADVANCED_PERMS')) {
117 $caneditperms = (isModEnabled('multicompany') && !empty($user->entity) && getDolGlobalString('MULTICOMPANY_TRANSVERSE_MODE') ? false : ($user->admin || $user->hasRight("user", "group_advance", "write")));
118}
119
120
121/*
122 * Actions
123 */
124
125if (GETPOST('cancel', 'alpha')) {
126 $action = 'list';
127 $massaction = '';
128}
129if (!GETPOST('confirmmassaction', 'alpha') && $massaction != 'presend' && $massaction != 'confirm_presend') {
130 $massaction = '';
131}
132
133$parameters = array('arrayfields' => &$arrayfields);
134$reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks
135if ($reshook < 0) {
136 setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
137}
138
139if (empty($reshook)) {
140 // Selection of new fields
141 include DOL_DOCUMENT_ROOT.'/core/actions_changeselectedfields.inc.php';
142
143 // Purge search criteria
144 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
145 foreach ($object->fields as $key => $val) {
146 $search[$key] = '';
147 if (preg_match('/^(date|timestamp|datetime)/', $val['type'])) {
148 $search[$key.'_dtstart'] = '';
149 $search[$key.'_dtend'] = '';
150 }
151 }
152 $search_all = '';
153 $toselect = array();
154 $search_array_options = array();
155 }
156 if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x', 'alpha') || GETPOST('button_removefilter', 'alpha')
157 || GETPOST('button_search_x', 'alpha') || GETPOST('button_search.x', 'alpha') || GETPOST('button_search', 'alpha')) {
158 $massaction = ''; // Protection to avoid mass action if we force a new search during a mass action confirmation
159 }
160
161 // Mass actions
162 $objectclass = 'UserGroup';
163 $objectlabel = 'UserGroup';
164 $uploaddir = $conf->user->dir_output;
165 include DOL_DOCUMENT_ROOT.'/core/actions_massactions.inc.php';
166}
167
168
169/*
170 * View
171 */
172
173$form = new Form($db);
174
175$now = dol_now();
176
177$title = $langs->trans("UserGroups");
178$help_url = '';
179$morejs = array();
180$morecss = array();
181
182// Build and execute select
183// --------------------------------------------------------------------
184$sql = "SELECT g.rowid, g.nom as name, g.note, g.entity, g.datec, g.tms, COUNT(DISTINCT ugu.fk_user) as nb, COUNT(DISTINCT ugr.fk_id) as nbpermissions";
185
186$sqlfields = $sql;
187
188$sql .= " FROM ".MAIN_DB_PREFIX."usergroup as g";
189$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."usergroup_user as ugu ON ugu.fk_usergroup = g.rowid";
190$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."usergroup_rights as ugr ON ugr.fk_usergroup = g.rowid";
191if (isModEnabled('multicompany') && $conf->entity == 1 && (getDolGlobalInt('MULTICOMPANY_TRANSVERSE_MODE') || ($user->admin && !$user->entity))) {
192 $sql .= " WHERE g.entity IS NOT NULL";
193} else {
194 $sql .= " WHERE g.entity IN (0,".$conf->entity.")";
195}
196if (!empty($search_group)) {
197 natural_search(array("g.nom", "g.note"), $search_group);
198}
199if ($search_all) {
200 $sql .= natural_search(array("g.nom", "g.note"), $search_all);
201}
202$sql .= " GROUP BY g.rowid, g.nom, g.note, g.entity, g.datec, g.tms";
203
204// Count total nb of records
205$nbtotalofrecords = '';
206if (!getDolGlobalInt('MAIN_DISABLE_FULL_SCANLIST')) {
207 /* The fast and low memory method to get and count full list converts the sql into a sql count */
208 $sqlforcount = preg_replace('/^'.preg_quote($sqlfields, '/').'/', 'SELECT COUNT(DISTINCT g.rowid) as nbtotalofrecords', $sql);
209 $sqlforcount = preg_replace('/GROUP BY .*$/', '', $sqlforcount);
210 $resql = $db->query($sqlforcount);
211 if ($resql) {
212 $objforcount = $db->fetch_object($resql);
213 $nbtotalofrecords = $objforcount->nbtotalofrecords;
214 } else {
216 }
217
218 if (($page * $limit) > (int) $nbtotalofrecords) { // if total resultset is smaller than paging size (filtering), goto and load page 0
219 $page = 0;
220 $offset = 0;
221 }
222 $db->free($resql);
223}
224
225// Complete request and execute it with limit
226$sql .= $db->order($sortfield, $sortorder);
227if ($limit) {
228 $sql .= $db->plimit($limit + 1, $offset);
229}
230$resql = $db->query($sql);
231if (!$resql) {
233 exit;
234}
235
236$num = $db->num_rows($resql);
237
238$i = 0;
239
240
241// Output page
242// --------------------------------------------------------------------
243
244llxHeader('', $title, $help_url, '', 0, 0, $morejs, $morecss, '', 'bodyforlist mod-user page-group_list');
245
246$arrayofselected = is_array($toselect) ? $toselect : array();
247
248$param = "&search_group=".urlencode($search_group)."&search_all=".urlencode($search_all);
249if (!empty($mode)) {
250 $param .= '&mode='.urlencode($mode);
251}
252if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) {
253 $param .= '&contextpage='.urlencode($contextpage);
254}
255if ($limit > 0 && $limit != $conf->liste_limit) {
256 $param .= '&limit='.((int) $limit);
257}
258if ($optioncss != '') {
259 $param .= '&optioncss='.urlencode($optioncss);
260}
261
262foreach ($search as $key => $val) {
263 if (is_array($search[$key])) {
264 foreach ($search[$key] as $skey) {
265 if ($skey != '') {
266 $param .= '&search_'.$key.'[]='.urlencode($skey);
267 }
268 }
269 } elseif (preg_match('/(_dtstart|_dtend)$/', $key) && !empty($val)) {
270 $param .= '&search_'.$key.'month='.GETPOSTINT('search_'.$key.'month');
271 $param .= '&search_'.$key.'day='.GETPOSTINT('search_'.$key.'day');
272 $param .= '&search_'.$key.'year='.GETPOSTINT('search_'.$key.'year');
273 } elseif ($search[$key] != '') {
274 $param .= '&search_'.$key.'='.urlencode($search[$key]);
275 }
276}
277// Add $param from extra fields
278include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_param.tpl.php';
279// Add $param from hooks
280$parameters = array('param' => &$param);
281$reshook = $hookmanager->executeHooks('printFieldListSearchParam', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
282$param .= $hookmanager->resPrint;
283
284// List of mass actions available
285$arrayofmassactions = array(
286 //'validate'=>img_picto('', 'check', 'class="pictofixedwidth"').$langs->trans("Validate"),
287 //'generate_doc'=>img_picto('', 'pdf', 'class="pictofixedwidth"').$langs->trans("ReGeneratePDF"),
288 //'builddoc'=>img_picto('', 'pdf', 'class="pictofixedwidth"').$langs->trans("PDFMerge"),
289 //'presend'=>img_picto('', 'email', 'class="pictofixedwidth"').$langs->trans("SendByMail"),
290);
291if (!empty($permissiontodelete)) {
292 $arrayofmassactions['predelete'] = img_picto('', 'delete', 'class="pictofixedwidth"').$langs->trans("Delete");
293}
294if (GETPOSTINT('nomassaction') || in_array($massaction, array('presend', 'predelete'))) {
295 $arrayofmassactions = array();
296}
297$massactionbutton = $form->selectMassAction('', $arrayofmassactions);
298
299print '<form method="POST" id="searchFormList" action="'.$_SERVER["PHP_SELF"].'">'."\n";
300if ($optioncss != '') {
301 print '<input type="hidden" name="optioncss" value="'.$optioncss.'">';
302}
303print '<input type="hidden" name="token" value="'.newToken().'">';
304print '<input type="hidden" name="formfilteraction" id="formfilteraction" value="list">';
305print '<input type="hidden" name="action" value="list">';
306print '<input type="hidden" name="sortfield" value="'.$sortfield.'">';
307print '<input type="hidden" name="sortorder" value="'.$sortorder.'">';
308print '<input type="hidden" name="page" value="'.$page.'">';
309print '<input type="hidden" name="contextpage" value="'.$contextpage.'">';
310print '<input type="hidden" name="page_y" value="">';
311print '<input type="hidden" name="mode" value="'.$mode.'">';
312
313$newcardbutton = '';
314$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'));
315$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'));
316
317if ($caneditperms) {
318 $newcardbutton .= dolGetButtonTitleSeparator();
319 $newcardbutton .= dolGetButtonTitle($langs->trans('NewGroup'), '', 'fa fa-plus-circle', DOL_URL_ROOT.'/user/group/card.php?action=create&leftmenu=', '', $caneditperms ? 1 : 0);
320}
321
322print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, 'object_'.$object->picto, 0, $newcardbutton, '', $limit, 0, 0, 1);
323
324// Add code for pre mass action (confirmation or email presend form)
325$topicmail = "SendGroup";
326$modelmail = "group";
327$objecttmp = new UserGroup($db);
328$trackid = 'grp'.$object->id;
329include DOL_DOCUMENT_ROOT.'/core/tpl/massactions_pre.tpl.php';
330
331if ($search_all) {
332 $setupstring = '';
333 // @phan-suppress-next-line PhanEmptyForeach
334 foreach ($fieldstosearchall as $key => $val) {
335 $fieldstosearchall[$key] = $langs->trans($val);
336 $setupstring .= $key."=".$val.";";
337 }
338 print '<!-- Search done like if GROUP_QUICKSEARCH_ON_FIELDS = '.$setupstring.' -->'."\n";
339 print '<div class="divsearchfieldfilter">'.$langs->trans("FilterOnInto", $search_all).implode(', ', $fieldstosearchall).'</div>'."\n";
340}
341
342$moreforfilter = '';
343
344$parameters = array();
345$reshook = $hookmanager->executeHooks('printFieldPreListTitle', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
346if (empty($reshook)) {
347 $moreforfilter .= $hookmanager->resPrint;
348} else {
349 $moreforfilter = $hookmanager->resPrint;
350}
351
352if (!empty($moreforfilter)) {
353 print '<div class="liste_titre liste_titre_bydiv centpercent">';
354 print $moreforfilter;
355 print '</div>';
356}
357
358$varpage = empty($contextpage) ? $_SERVER["PHP_SELF"] : $contextpage;
359$htmlofselectarray = $form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage, $conf->main_checkbox_left_column ? 'left' : ''); // This also change content of $arrayfields with user setup
360$selectedfields = ($mode != 'kanban' ? $htmlofselectarray : '');
361$selectedfields .= (count($arrayofmassactions) ? $form->showCheckAddButtons('checkforselect', 1) : '');
362
363print '<div class="div-table-responsive">'; // You can use div-table-responsive-no-min if you don't need reserved height for your table
364print '<table class="tagtable nobottomiftotal noborder liste'.($moreforfilter ? " listwithfilterbefore" : "").'">'."\n";
365
366
367$totalarray = array();
368$totalarray['nbfield'] = 0;
369
370// Fields title label
371// --------------------------------------------------------------------
372print '<tr class="liste_titre_filter">';
373// Action column
374if ($conf->main_checkbox_left_column) {
375 print getTitleFieldOfList($selectedfields, 0, $_SERVER["PHP_SELF"], '', '', $param, '', $sortfield, $sortorder, 'center maxwidthsearch ')."\n";
376 $totalarray['nbfield']++;
377}
378print_liste_field_titre("Group", $_SERVER["PHP_SELF"], "g.nom", '', $param, "", $sortfield, $sortorder);
379$totalarray['nbfield']++;
380//multicompany
381if (isModEnabled('multicompany') && isset($mc) && is_object($mc) && !getDolGlobalString('MULTICOMPANY_TRANSVERSE_MODE') && $conf->entity == 1) {
382 print_liste_field_titre("Entity", $_SERVER["PHP_SELF"], "g.entity", '', $param, '', $sortfield, $sortorder, 'center ');
383 $totalarray['nbfield']++;
384}
385print_liste_field_titre("NbOfUsers", $_SERVER["PHP_SELF"], "nb", '', $param, '', $sortfield, $sortorder, 'center ');
386$totalarray['nbfield']++;
387print_liste_field_titre("NbOfPermissions", $_SERVER["PHP_SELF"], "nbpermissions", '', $param, '', $sortfield, $sortorder, 'center ');
388$totalarray['nbfield']++;
389print_liste_field_titre("DateCreationShort", $_SERVER["PHP_SELF"], "g.datec", '', $param, '', $sortfield, $sortorder, 'center ');
390$totalarray['nbfield']++;
391print_liste_field_titre("DateLastModification", $_SERVER["PHP_SELF"], "g.tms", '', $param, '', $sortfield, $sortorder, 'center ');
392$totalarray['nbfield']++;
393// Extra fields
394include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_title.tpl.php';
395// Hook fields
396$parameters = array('arrayfields' => $arrayfields, 'param' => $param, 'sortfield' => $sortfield, 'sortorder' => $sortorder, 'totalarray' => &$totalarray);
397$reshook = $hookmanager->executeHooks('printFieldListTitle', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
398print $hookmanager->resPrint;
399/*if (!empty($arrayfields['anotherfield']['checked'])) {
400 print '<th class="liste_titre right">'.$langs->trans("AnotherField").'</th>';
401 $totalarray['nbfield']++;
402 }*/
403// Action column
404if (!$conf->main_checkbox_left_column) {
405 print getTitleFieldOfList($selectedfields, 0, $_SERVER["PHP_SELF"], '', '', $param, '', $sortfield, $sortorder, 'center maxwidthsearch ')."\n";
406 $totalarray['nbfield']++;
407}
408print '</tr>'."\n";
409
410
411// Loop on record
412// --------------------------------------------------------------------
413$i = 0;
414$savnbfield = $totalarray['nbfield'];
415$totalarray = array();
416$totalarray['nbfield'] = 0;
417$imaxinloop = ($limit ? min($num, $limit) : $num);
418while ($i < $imaxinloop) {
419 $obj = $db->fetch_object($resql);
420 if (empty($obj)) {
421 break; // Should not happen
422 }
423
424 // Store properties in $object
425 $object->setVarsFromFetchObj($obj);
426
427 $object->name = $obj->name;
428 $object->note = $obj->note;
429 $object->nb_rights = $obj->nbpermissions;
430 $object->nb_users = $obj->nb;
431
432 if ($mode == 'kanban') {
433 if ($i == 0) {
434 print '<tr class="trkanban"><td colspan="'.$savnbfield.'">';
435 print '<div class="box-flex-container kanban">';
436 }
437 // Output Kanban
438 $selected = -1;
439 if ($massactionbutton || $massaction) { // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined
440 $selected = 0;
441 if (in_array($object->id, $arrayofselected)) {
442 $selected = 1;
443 }
444 }
445 print $object->getKanbanView('', array('selected' => $selected));
446 if ($i == ($imaxinloop - 1)) {
447 print '</div>';
448 print '</td></tr>';
449 }
450 } else {
451 // Show line of result
452 print '<tr data-rowid="'.$object->id.'" class="oddeven">';
453 // Action column
454 if ($conf->main_checkbox_left_column) {
455 print '<td class="nowrap center">';
456 if ($massactionbutton || $massaction) { // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined
457 $selected = 0;
458 if (in_array($object->id, $arrayofselected)) {
459 $selected = 1;
460 }
461 print '<input id="cb'.$object->id.'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.$object->id.'"'.($selected ? ' checked="checked"' : '').'>';
462 }
463 print '</td>';
464 if (!$i) {
465 $totalarray['nbfield']++;
466 }
467 }
468
469 print '<td class="tdoverflowmax200">';
470 print $object->getNomUrl(1);
471 if (isModEnabled('multicompany') && !$obj->entity) {
472 print img_picto($langs->trans("GlobalGroup"), 'superadmin');
473 }
474 print "</td>";
475 if (!$i) {
476 $totalarray['nbfield']++;
477 }
478
479 // Multicompany column
480 if (isModEnabled('multicompany') && isset($mc) && is_object($mc) && !getDolGlobalString('MULTICOMPANY_TRANSVERSE_MODE') && $conf->entity == 1) {
481 $mc->getInfo($obj->entity);
482 print '<td class="center">'.dol_escape_htmltag($mc->label).'</td>';
483 if (!$i) {
484 $totalarray['nbfield']++;
485 }
486 }
487
488 // Nb of users in group
489 print '<td class="center">'.($obj->nb ? dol_escape_htmltag($obj->nb) : '').'</td>';
490 if (!$i) {
491 $totalarray['nbfield']++;
492 }
493 print '<td class="center">';
494 print '<a href="'.DOL_URL_ROOT.'/user/group/perms.php?id='.$obj->rowid.'">'.dol_escape_htmltag($obj->nbpermissions).'</a>';
495 print '</td>';
496 if (!$i) {
497 $totalarray['nbfield']++;
498 }
499 print '<td class="center nowraponall">'.dol_print_date($db->jdate($obj->datec), "dayhour").'</td>';
500 if (!$i) {
501 $totalarray['nbfield']++;
502 }
503 print '<td class="center nowraponall">'.dol_print_date($db->jdate($obj->tms), "dayhour").'</td>';
504 if (!$i) {
505 $totalarray['nbfield']++;
506 }
507 // Extra fields
508 include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_print_fields.tpl.php';
509 // Fields from hook
510 $parameters = array('arrayfields' => $arrayfields, 'object' => $object, 'obj' => $obj, 'i' => $i, 'totalarray' => &$totalarray);
511 $reshook = $hookmanager->executeHooks('printFieldListValue', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
512 print $hookmanager->resPrint;
513 // Action column
514 if (empty($conf->main_checkbox_left_column)) {
515 print '<td class="nowrap center">';
516 if ($massactionbutton || $massaction) { // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined
517 $selected = 0;
518 if (in_array($object->id, $arrayofselected)) {
519 $selected = 1;
520 }
521 print '<input id="cb'.$object->id.'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.$object->id.'"'.($selected ? ' checked="checked"' : '').'>';
522 }
523 print '</td>';
524 if (!$i) {
525 $totalarray['nbfield']++;
526 }
527 }
528
529 print '</tr>'."\n";
530 }
531 $i++;
532}
533
534// Show total line
535include DOL_DOCUMENT_ROOT.'/core/tpl/list_print_total.tpl.php';
536
537// If no record found
538if ($num == 0) {
539 /*$colspan = 1;
540 foreach ($arrayfields as $key => $val) {
541 if (!empty($val['checked'])) {
542 $colspan++;
543 }
544 }*/
545 $colspan = $savnbfield;
546 print '<tr><td colspan="'.$colspan.'"><span class="opacitymedium">'.$langs->trans("NoRecordFound").'</span></td></tr>';
547}
548
549$db->free($resql);
550
551$parameters = array('arrayfields' => $arrayfields, 'sql' => $sql);
552$reshook = $hookmanager->executeHooks('printFieldListFooter', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
553print $hookmanager->resPrint;
554
555print '</table>'."\n";
556print '</div>'."\n";
557
558print '</form>'."\n";
559
560// End of page
561llxFooter();
562$db->close();
if(! $sortfield) if(! $sortorder) $object
Definition account.php:100
$totalarray
Definition list.php:497
llxFooter($comment='', $zone='private', $disabledoutputofmessages=0)
Empty footer.
Definition wrapper.php:91
if(!defined('NOREQUIRESOC')) if(!defined( 'NOREQUIRETRAN')) if(!defined('NOTOKENRENEWAL')) if(!defined( 'NOREQUIREMENU')) if(!defined('NOREQUIREHTML')) if(!defined( 'NOREQUIREAJAX')) llxHeader($head='', $title='', $help_url='', $target='', $disablejs=0, $disablehead=0, $arrayofjs='', $arrayofcss='', $morequerystring='', $morecssonbody='', $replacemainareaby='', $disablenofollow=0, $disablenoindex=0)
Empty header.
Definition wrapper.php:73
Class to manage generation of HTML components Only common components must be here.
Class to manage user groups.
if(!isModEnabled('ai')||!getDolGlobalString('AI_ASSISTANT_ENABLED')) global $conf
The main.inc.php has been included so the following variable are now defined:
if(!isModEnabled('ai')||!getDolGlobalString('AI_ASSISTANT_ENABLED')) global $db
API class for accounts.
dol_now($mode='gmt')
Return date for now.
setEventMessages($mesg, $mesgs, $style='mesgs', $messagekey='', $noduplicate=0, $attop=0)
Set event messages in dol_events session object.
print_liste_field_titre($name, $file="", $field="", $begin="", $param="", $moreattrib="", $sortfield="", $sortorder="", $prefix="", $tooltip="", $forcenowrapcolumntitle=0)
Show title line of an array.
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, $allowothertags=array())
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.
natural_search($fields, $value, $mode=0, $nofirstand=0, $sqltoadd='')
Generate natural SQL search string for a criteria (this criteria can be tested on one or several fiel...
getDolGlobalInt($key, $default=0)
Return a Dolibarr global constant int value.
getTitleFieldOfList($name, $thead=0, $file="", $field="", $begin="", $moreparam="", $moreattrib="", $sortfield="", $sortorder="", $prefix="", $disablesortlink=0, $tooltip='', $forcenowrapcolumntitle=0)
Get title line of an array.
GETPOST($paramname, $check='alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
dol_print_error($db=null, $error='', $errors=null)
Displays error message system with all the information to facilitate the diagnosis and the escalation...
getDolGlobalString($key, $default='')
Return a Dolibarr global constant string value.
isModEnabled($module)
Is Dolibarr module enabled.
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.