dolibarr 25.0.0-alpha
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-2026 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// Add hook to complete $arrayfield
94$parameters = array('arrayfields' => &$arrayfields);
95$reshook = $hookmanager->executeHooks('completeArrayFields', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
96
97// List of fields to search into when doing a "search in all"
98$fieldstosearchall = array();
99foreach ($object->fields as $key => $val) {
100 if (!empty($val['searchall'])) {
101 $fieldstosearchall['t.'.$key] = $val['label'];
102 }
103}
104
105if (getDolGlobalString('MAIN_USE_ADVANCED_PERMS')) {
106 if (!$user->hasRight("user", "group_advance", "read") && !$user->admin) {
108 }
109}
110
111if (!$user->hasRight("user", "user", "read") && !$user->admin) {
113}
114
115// Define if user can modify other users and permissions
116$caneditperms = (isModEnabled('multicompany') && !empty($user->entity) && getDolGlobalString('MULTICOMPANY_TRANSVERSE_MODE') ? false : (!empty($user->admin) || $user->hasRight("user", "user", "write")));
117$permissiontodelete = $caneditperms;
118// Advanced permissions
119if (getDolGlobalString('MAIN_USE_ADVANCED_PERMS')) {
120 $caneditperms = (isModEnabled('multicompany') && !empty($user->entity) && getDolGlobalString('MULTICOMPANY_TRANSVERSE_MODE') ? false : ($user->admin || $user->hasRight("user", "group_advance", "write")));
121}
122
123
124/*
125 * Actions
126 */
127
128if (GETPOST('cancel', 'alpha')) {
129 $action = 'list';
130 $massaction = '';
131}
132if (!GETPOST('confirmmassaction', 'alpha') && $massaction != 'presend' && $massaction != 'confirm_presend') {
133 $massaction = '';
134}
135
136$parameters = array('arrayfields' => &$arrayfields);
137$reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks
138if ($reshook < 0) {
139 setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
140}
141
142if (empty($reshook)) {
143 // Selection of new fields
144 include DOL_DOCUMENT_ROOT.'/core/actions_changeselectedfields.inc.php';
145
146 // Purge search criteria
147 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
148 foreach ($object->fields as $key => $val) {
149 $search[$key] = '';
150 if (preg_match('/^(date|timestamp|datetime)/', $val['type'])) {
151 $search[$key.'_dtstart'] = '';
152 $search[$key.'_dtend'] = '';
153 }
154 }
155 $search_all = '';
156 $toselect = array();
157 $search_array_options = array();
158 }
159 if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x', 'alpha') || GETPOST('button_removefilter', 'alpha')
160 || GETPOST('button_search_x', 'alpha') || GETPOST('button_search.x', 'alpha') || GETPOST('button_search', 'alpha')) {
161 $massaction = ''; // Protection to avoid mass action if we force a new search during a mass action confirmation
162 }
163
164 // Mass actions
165 $objectclass = 'UserGroup';
166 $objectlabel = 'UserGroup';
167 $uploaddir = $conf->user->dir_output;
168 include DOL_DOCUMENT_ROOT.'/core/actions_massactions.inc.php';
169}
170
171
172/*
173 * View
174 */
175
176$form = new Form($db);
177
178$now = dol_now();
179
180$title = $langs->trans("UserGroups");
181$help_url = '';
182$morejs = array();
183$morecss = array();
184
185// Build and execute select
186// --------------------------------------------------------------------
187$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";
188
189$sqlfields = $sql;
190
191$sql .= " FROM ".MAIN_DB_PREFIX."usergroup as g";
192$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."usergroup_user as ugu ON ugu.fk_usergroup = g.rowid";
193$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."usergroup_rights as ugr ON ugr.fk_usergroup = g.rowid";
194if (isModEnabled('multicompany') && $conf->entity == 1 && (getDolGlobalInt('MULTICOMPANY_TRANSVERSE_MODE') || ($user->admin && !$user->entity))) {
195 $sql .= " WHERE g.entity IS NOT NULL";
196} else {
197 $sql .= " WHERE g.entity IN (0,".((int) $conf->entity).")";
198}
199if (!empty($search_group)) {
200 natural_search(array("g.nom", "g.note"), $search_group);
201}
202if ($search_all) {
203 $sql .= natural_search(array("g.nom", "g.note"), $search_all);
204}
205$sql .= " GROUP BY g.rowid, g.nom, g.note, g.entity, g.datec, g.tms";
206
207// Count total nb of records
208$nbtotalofrecords = '';
209if (!getDolGlobalInt('MAIN_DISABLE_FULL_SCANLIST')) {
210 /* The fast and low memory method to get and count full list converts the sql into a sql count */
211 $sqlforcount = preg_replace('/^'.preg_quote($sqlfields, '/').'/', 'SELECT COUNT(DISTINCT g.rowid) as nbtotalofrecords', $sql);
212 $sqlforcount = preg_replace('/GROUP BY .*$/', '', $sqlforcount);
213 $resql = $db->query($sqlforcount);
214 if ($resql) {
215 $objforcount = $db->fetch_object($resql);
216 $nbtotalofrecords = $objforcount->nbtotalofrecords;
217 } else {
219 }
220
221 if (($page * $limit) > (int) $nbtotalofrecords) { // if total resultset is smaller than paging size (filtering), goto and load page 0
222 $page = 0;
223 $offset = 0;
224 }
225 $db->free($resql);
226}
227
228// Complete request and execute it with limit
229$sql .= $db->order($sortfield, $sortorder);
230if ($limit) {
231 $sql .= $db->plimit($limit + 1, $offset);
232}
233$resql = $db->query($sql);
234if (!$resql) {
236 exit;
237}
238
239$num = $db->num_rows($resql);
240
241$i = 0;
242
243
244// Output page
245// --------------------------------------------------------------------
246
247llxHeader('', $title, $help_url, '', 0, 0, $morejs, $morecss, '', 'bodyforlist mod-user page-group_list');
248
249$arrayofselected = is_array($toselect) ? $toselect : array();
250
251$param = "&search_group=".urlencode($search_group)."&search_all=".urlencode($search_all);
252if (!empty($mode)) {
253 $param .= '&mode='.urlencode($mode);
254}
255if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) {
256 $param .= '&contextpage='.urlencode($contextpage);
257}
258if ($limit > 0 && $limit != $conf->liste_limit) {
259 $param .= '&limit='.((int) $limit);
260}
261if ($optioncss != '') {
262 $param .= '&optioncss='.urlencode($optioncss);
263}
264
265foreach ($search as $key => $val) {
266 if (is_array($search[$key])) {
267 foreach ($search[$key] as $skey) {
268 if ($skey != '') {
269 $param .= '&search_'.$key.'[]='.urlencode($skey);
270 }
271 }
272 } elseif (preg_match('/(_dtstart|_dtend)$/', $key) && !empty($val)) {
273 $param .= '&search_'.$key.'month='.GETPOSTINT('search_'.$key.'month');
274 $param .= '&search_'.$key.'day='.GETPOSTINT('search_'.$key.'day');
275 $param .= '&search_'.$key.'year='.GETPOSTINT('search_'.$key.'year');
276 } elseif ($search[$key] != '') {
277 $param .= '&search_'.$key.'='.urlencode($search[$key]);
278 }
279}
280// Add $param from extra fields
281include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_param.tpl.php';
282// Add $param from hooks
283$parameters = array('param' => &$param);
284$reshook = $hookmanager->executeHooks('printFieldListSearchParam', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
285$param .= $hookmanager->resPrint;
286
287// List of mass actions available
288$arrayofmassactions = array(
289 //'validate'=>img_picto('', 'check', 'class="pictofixedwidth"').$langs->trans("Validate"),
290 //'generate_doc'=>img_picto('', 'pdf', 'class="pictofixedwidth"').$langs->trans("ReGeneratePDF"),
291 //'builddoc'=>img_picto('', 'pdf', 'class="pictofixedwidth"').$langs->trans("PDFMerge"),
292 //'presend'=>img_picto('', 'email', 'class="pictofixedwidth"').$langs->trans("SendByMail"),
293);
294if (!empty($permissiontodelete)) {
295 $arrayofmassactions['predelete'] = img_picto('', 'delete', 'class="pictofixedwidth"').$langs->trans("Delete");
296}
297if (GETPOSTINT('nomassaction') || in_array($massaction, array('presend', 'predelete'))) {
298 $arrayofmassactions = array();
299}
300$massactionbutton = $form->selectMassAction('', $arrayofmassactions);
301
302print '<form method="POST" id="searchFormList" action="'.$_SERVER["PHP_SELF"].'">'."\n";
303if ($optioncss != '') {
304 print '<input type="hidden" name="optioncss" value="'.$optioncss.'">';
305}
306print '<input type="hidden" name="token" value="'.newToken().'">';
307print '<input type="hidden" name="formfilteraction" id="formfilteraction" value="list">';
308print '<input type="hidden" name="action" value="list">';
309print '<input type="hidden" name="sortfield" value="'.$sortfield.'">';
310print '<input type="hidden" name="sortorder" value="'.$sortorder.'">';
311print '<input type="hidden" name="page" value="'.$page.'">';
312print '<input type="hidden" name="contextpage" value="'.$contextpage.'">';
313print '<input type="hidden" name="page_y" value="">';
314print '<input type="hidden" name="mode" value="'.$mode.'">';
315
316$newcardbutton = '';
317$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'));
318$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'));
319
320if ($caneditperms) {
321 $newcardbutton .= dolGetButtonTitleSeparator();
322 $newcardbutton .= dolGetButtonTitle($langs->trans('NewGroup'), '', 'fa fa-plus-circle', DOL_URL_ROOT.'/user/group/card.php?action=create&leftmenu=', '', $caneditperms ? 1 : 0);
323}
324
325print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, 'object_'.$object->picto, 0, $newcardbutton, '', $limit, 0, 0, 1);
326
327// Add code for pre mass action (confirmation or email presend form)
328$topicmail = "SendGroup";
329$modelmail = "group";
330$objecttmp = new UserGroup($db);
331$trackid = 'grp'.$object->id;
332include DOL_DOCUMENT_ROOT.'/core/tpl/massactions_pre.tpl.php';
333
334if ($search_all) {
335 $setupstring = '';
336 // @phan-suppress-next-line PhanEmptyForeach
337 foreach ($fieldstosearchall as $key => $val) {
338 $fieldstosearchall[$key] = $langs->trans($val);
339 $setupstring .= $key."=".$val.";";
340 }
341 print '<!-- Search done like if GROUP_QUICKSEARCH_ON_FIELDS = '.$setupstring.' -->'."\n";
342 print '<div class="divsearchfieldfilter">'.$langs->trans("FilterOnInto", $search_all).implode(', ', $fieldstosearchall).'</div>'."\n";
343}
344
345$moreforfilter = '';
346
347$parameters = array();
348$reshook = $hookmanager->executeHooks('printFieldPreListTitle', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
349if (empty($reshook)) {
350 $moreforfilter .= $hookmanager->resPrint;
351} else {
352 $moreforfilter = $hookmanager->resPrint;
353}
354
355if (!empty($moreforfilter)) {
356 print '<div class="liste_titre liste_titre_bydiv centpercent">';
357 print $moreforfilter;
358 print '</div>';
359}
360
361$varpage = empty($contextpage) ? $_SERVER["PHP_SELF"] : $contextpage;
362$htmlofselectarray = $form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage, $conf->main_checkbox_left_column ? 'left' : ''); // This also change content of $arrayfields with user setup
363$selectedfields = ($mode != 'kanban' ? $htmlofselectarray : '');
364$selectedfields .= (count($arrayofmassactions) ? $form->showCheckAddButtons('checkforselect', 1) : '');
365
366print '<div class="div-table-responsive">'; // You can use div-table-responsive-no-min if you don't need reserved height for your table
367print '<table class="tagtable nobottomiftotal noborder liste'.($moreforfilter ? " listwithfilterbefore" : "").'">'."\n";
368
369
370$totalarray = array();
371$totalarray['nbfield'] = 0;
372
373// Fields title label
374// --------------------------------------------------------------------
375print '<tr class="liste_titre_filter">';
376// Action column
377if ($conf->main_checkbox_left_column) {
378 print getTitleFieldOfList($selectedfields, 0, $_SERVER["PHP_SELF"], '', '', $param, '', $sortfield, $sortorder, 'center maxwidthsearch ')."\n";
379 $totalarray['nbfield']++;
380}
381print_liste_field_titre("Group", $_SERVER["PHP_SELF"], "g.nom", '', $param, "", $sortfield, $sortorder);
382$totalarray['nbfield']++;
383//multicompany
384if (isModEnabled('multicompany') && isset($mc) && is_object($mc) && !getDolGlobalString('MULTICOMPANY_TRANSVERSE_MODE') && $conf->entity == 1) {
385 print_liste_field_titre("Entity", $_SERVER["PHP_SELF"], "g.entity", '', $param, '', $sortfield, $sortorder, 'center ');
386 $totalarray['nbfield']++;
387}
388print_liste_field_titre("NbOfUsers", $_SERVER["PHP_SELF"], "nb", '', $param, '', $sortfield, $sortorder, 'center ');
389$totalarray['nbfield']++;
390print_liste_field_titre("NbOfPermissions", $_SERVER["PHP_SELF"], "nbpermissions", '', $param, '', $sortfield, $sortorder, 'center ');
391$totalarray['nbfield']++;
392print_liste_field_titre("DateCreationShort", $_SERVER["PHP_SELF"], "g.datec", '', $param, '', $sortfield, $sortorder, 'center ');
393$totalarray['nbfield']++;
394print_liste_field_titre("DateLastModification", $_SERVER["PHP_SELF"], "g.tms", '', $param, '', $sortfield, $sortorder, 'center ');
395$totalarray['nbfield']++;
396// Extra fields
397include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_title.tpl.php';
398// Hook fields
399$parameters = array('arrayfields' => $arrayfields, 'param' => $param, 'sortfield' => $sortfield, 'sortorder' => $sortorder, 'totalarray' => &$totalarray);
400$reshook = $hookmanager->executeHooks('printFieldListTitle', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
401print $hookmanager->resPrint;
402/*if (!empty($arrayfields['anotherfield']['checked'])) {
403 print '<th class="liste_titre right">'.$langs->trans("AnotherField").'</th>';
404 $totalarray['nbfield']++;
405 }*/
406// Action column
407if (!$conf->main_checkbox_left_column) {
408 print getTitleFieldOfList($selectedfields, 0, $_SERVER["PHP_SELF"], '', '', $param, '', $sortfield, $sortorder, 'center maxwidthsearch ')."\n";
409 $totalarray['nbfield']++;
410}
411print '</tr>'."\n";
412
413
414// Loop on record
415// --------------------------------------------------------------------
416$i = 0;
417$savnbfield = $totalarray['nbfield'];
418$totalarray = array();
419$totalarray['nbfield'] = 0;
420$imaxinloop = ($limit ? min($num, $limit) : $num);
421while ($i < $imaxinloop) {
422 $obj = $db->fetch_object($resql);
423 if (empty($obj)) {
424 break; // Should not happen
425 }
426
427 // Store properties in $object
428 $object->setVarsFromFetchObj($obj);
429
430 $object->name = $obj->name;
431 $object->note = $obj->note;
432 $object->nb_rights = $obj->nbpermissions;
433 $object->nb_users = $obj->nb;
434
435 if ($mode == 'kanban') {
436 if ($i == 0) {
437 print '<tr class="trkanban"><td colspan="'.$savnbfield.'">';
438 print '<div class="box-flex-container kanban">';
439 }
440 // Output Kanban
441 $selected = -1;
442 if ($massactionbutton || $massaction) { // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined
443 $selected = 0;
444 if (in_array($object->id, $arrayofselected)) {
445 $selected = 1;
446 }
447 }
448 print $object->getKanbanView('', array('selected' => $selected));
449 if ($i == ($imaxinloop - 1)) {
450 print '</div>';
451 print '</td></tr>';
452 }
453 } else {
454 // Show line of result
455 print '<tr data-rowid="'.$object->id.'" class="oddeven">';
456 // Action column
457 if ($conf->main_checkbox_left_column) {
458 print '<td class="nowrap center">';
459 if ($massactionbutton || $massaction) { // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined
460 $selected = 0;
461 if (in_array($object->id, $arrayofselected)) {
462 $selected = 1;
463 }
464 print '<input id="cb'.$object->id.'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.$object->id.'"'.($selected ? ' checked="checked"' : '').'>';
465 }
466 print '</td>';
467 if (!$i) {
468 $totalarray['nbfield']++;
469 }
470 }
471
472 print '<td class="tdoverflowmax200">';
473 print $object->getNomUrl(1);
474 if (isModEnabled('multicompany') && !$obj->entity) {
475 print img_picto($langs->trans("GlobalGroup"), 'superadmin');
476 }
477 print "</td>";
478 if (!$i) {
479 $totalarray['nbfield']++;
480 }
481
482 // Multicompany column
483 if (isModEnabled('multicompany') && isset($mc) && is_object($mc) && !getDolGlobalString('MULTICOMPANY_TRANSVERSE_MODE') && $conf->entity == 1) {
484 $mc->getInfo($obj->entity);
485 print '<td class="center">'.dol_escape_htmltag($mc->label).'</td>';
486 if (!$i) {
487 $totalarray['nbfield']++;
488 }
489 }
490
491 // Nb of users in group
492 print '<td class="center">'.($obj->nb ? dol_escape_htmltag($obj->nb) : '').'</td>';
493 if (!$i) {
494 $totalarray['nbfield']++;
495 }
496 print '<td class="center">';
497 print '<a href="'.DOL_URL_ROOT.'/user/group/perms.php?id='.$obj->rowid.'">'.dol_escape_htmltag($obj->nbpermissions).'</a>';
498 print '</td>';
499 if (!$i) {
500 $totalarray['nbfield']++;
501 }
502 print '<td class="center nowraponall">'.dol_print_date($db->jdate($obj->datec), "dayhour").'</td>';
503 if (!$i) {
504 $totalarray['nbfield']++;
505 }
506 print '<td class="center nowraponall">'.dol_print_date($db->jdate($obj->tms), "dayhour").'</td>';
507 if (!$i) {
508 $totalarray['nbfield']++;
509 }
510 // Extra fields
511 include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_print_fields.tpl.php';
512 // Fields from hook
513 $parameters = array('arrayfields' => $arrayfields, 'object' => $object, 'obj' => $obj, 'i' => $i, 'totalarray' => &$totalarray);
514 $reshook = $hookmanager->executeHooks('printFieldListValue', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
515 print $hookmanager->resPrint;
516 // Action column
517 if (empty($conf->main_checkbox_left_column)) {
518 print '<td class="nowrap center">';
519 if ($massactionbutton || $massaction) { // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined
520 $selected = 0;
521 if (in_array($object->id, $arrayofselected)) {
522 $selected = 1;
523 }
524 print '<input id="cb'.$object->id.'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.$object->id.'"'.($selected ? ' checked="checked"' : '').'>';
525 }
526 print '</td>';
527 if (!$i) {
528 $totalarray['nbfield']++;
529 }
530 }
531
532 print '</tr>'."\n";
533 }
534 $i++;
535}
536
537// Show total line
538include DOL_DOCUMENT_ROOT.'/core/tpl/list_print_total.tpl.php';
539
540// If no record found
541if ($num == 0) {
542 /*$colspan = 1;
543 foreach ($arrayfields as $key => $val) {
544 if (!empty($val['checked'])) {
545 $colspan++;
546 }
547 }*/
548 $colspan = $savnbfield;
549 print '<tr><td colspan="'.$colspan.'"><span class="opacitymedium">'.$langs->trans("NoRecordFound").'</span></td></tr>';
550}
551
552$db->free($resql);
553
554$parameters = array('arrayfields' => $arrayfields, 'sql' => $sql);
555$reshook = $hookmanager->executeHooks('printFieldListFooter', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
556print $hookmanager->resPrint;
557
558print '</table>'."\n";
559print '</div>'."\n";
560
561print '</form>'."\n";
562
563// End of page
564llxFooter();
565$db->close();
if(! $sortfield) if(! $sortorder) $object
Definition account.php:100
$totalarray
Definition list.php:501
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.
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.
GETPOST($paramname, $check='alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0, $nodefault=0)
Return value of a param into GET or POST supervariable.
GETPOSTINT($paramname, $method=0, $nodefault=0)
Return the value of a $_GET or $_POST supervariable, converted into integer.
getDolGlobalString($key, $default='')
Return a Dolibarr global constant string value.
isModEnabled($module)
Is Dolibarr module enabled.
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)
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.
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.
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...
Definition html.lib.php:172
accessforbidden($message='', $printheader=1, $printfooter=1, $showonlymessage=0, $params=null)
Show a message to say access is forbidden and stop program.