dolibarr 21.0.0-beta
list.php
Go to the documentation of this file.
1<?php
2/* Copyright (C) 2013-2017 Laurent Destailleur <eldy@users.sourceforge.net>
3 * Copyright (C) 2014 Marcos García <marcosgdf@gmail.com>
4 * Copyright (C) 2024 Frédéric France <frederic.france@free.fr>
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
26// Load Dolibarr environment
27require '../main.inc.php';
28require_once DOL_DOCUMENT_ROOT."/core/lib/admin.lib.php";
29require_once DOL_DOCUMENT_ROOT."/core/lib/files.lib.php";
30require_once DOL_DOCUMENT_ROOT."/opensurvey/class/opensurveysondage.class.php";
31
40// Load translation files required by the page
41$langs->load("opensurvey");
42
43$action = GETPOST('action', 'aZ09') ? GETPOST('action', 'aZ09') : 'view'; // The action 'add', 'create', 'edit', 'update', 'view', ...
44$massaction = GETPOST('massaction', 'alpha'); // The bulk action (combo box choice into lists)
45$show_files = GETPOSTINT('show_files'); // Show files area generated by bulk actions ?
46$confirm = GETPOST('confirm', 'alpha'); // Result of a confirmation
47$cancel = GETPOST('cancel', 'alpha'); // We click on a Cancel button
48$toselect = GETPOST('toselect', 'array'); // Array of ids of elements selected into a list
49$contextpage = GETPOST('contextpage', 'aZ') ? GETPOST('contextpage', 'aZ') : 'opensurveylist'; // To manage different context of search
50$backtopage = GETPOST('backtopage', 'alpha'); // Go back to a dedicated page
51$optioncss = GETPOST('optioncss', 'aZ'); // Option for the css output (always '' except when 'print')
52$search_all = trim(GETPOST('search_all', 'alphanohtml'));
53
54$id = GETPOST('id', 'alpha');
55$search_ref = GETPOST('search_ref', 'alpha');
56$search_title = GETPOST('search_title', 'alpha');
57$search_status = GETPOST('search_status', 'alpha');
58
59// Load variable for pagination
60$limit = GETPOSTINT('limit') ? GETPOSTINT('limit') : $conf->liste_limit;
61$sortfield = GETPOST('sortfield', 'aZ09comma');
62$sortorder = GETPOST('sortorder', 'aZ09comma');
63$page = GETPOSTISSET('pageplusone') ? (GETPOSTINT('pageplusone') - 1) : GETPOSTINT("page");
64if (empty($page) || $page == -1 || GETPOST('button_search', 'alpha') || GETPOST('button_removefilter', 'alpha') || (empty($toselect) && $massaction === '0')) {
65 $page = 0;
66} // If $page is not defined, or '' or -1 or if we click on clear filters or if we select empty mass action
67$offset = $limit * $page;
68$pageprev = $page - 1;
69$pagenext = $page + 1;
70
71// Initialize a technical objects
72$object = new Opensurveysondage($db);
73$opensurvey_static = new Opensurveysondage($db);
74
75$extrafields = new ExtraFields($db);
76$diroutputmassaction = $conf->opensurvey->dir_output.'/temp/massgeneration/'.$user->id;
77$hookmanager->initHooks(array('surveylist')); // Note that conf->hooks_modules contains array
78// Fetch optionals attributes and labels
79$extrafields->fetch_name_optionals_label($object->table_element);
80$search_array_options = $extrafields->getOptionalsFromPost($object->table_element, '', 'search_');
81
82// Default sort order (if not yet defined by previous GETPOST)
83if (!$sortfield) {
84 $sortfield = "p.date_fin";
85}
86if (!$sortorder) {
87 $sortorder = "DESC";
88}
89
90// Security check
91if (!$user->hasRight('opensurvey', 'read')) {
93}
94
95// Definition of fields for list
96$arrayfields = array();
97// TODO
98/* foreach ($arrayfields as $key => $val) {
99 // If $val['visible']==0, then we never show the field
100 if (!empty($val['visible'])) {
101 $arrayfields['t.'.$key] = array('label' => $val['label'], 'checked' => (($val['visible'] < 0) ? 0 : 1), 'enabled' => $val['enabled'], 'position' => $val['position']);
102 }
103} */
104// Extra fields
105if (isset($extrafields->attributes[$object->table_element]['label']) && is_array($extrafields->attributes[$object->table_element]['label']) && count($extrafields->attributes[$object->table_element]['label']) > 0) {
106 foreach ($extrafields->attributes[$object->table_element]['label'] as $key => $val) {
107 if (!empty($extrafields->attributes[$object->table_element]['list'][$key])) {
108 $arrayfields["ef.".$key] = array(
109 'label' => $extrafields->attributes[$object->table_element]['label'][$key],
110 'checked' => (($extrafields->attributes[$object->table_element]['list'][$key] < 0) ? 0 : 1),
111 'position' => $extrafields->attributes[$object->table_element]['pos'][$key],
112 'enabled' => (abs($extrafields->attributes[$object->table_element]['list'][$key]) != 3 && $extrafields->attributes[$object->table_element]['perms'][$key])
113 );
114 }
115 }
116}
117$object->fields = dol_sort_array($object->fields, 'position');
118$arrayfields = dol_sort_array($arrayfields, 'position');
119
120$permissiontoread = $user->hasRight('opensurvey', 'read');
121$permissiontoadd = $user->hasRight('opensurvey', 'write');
122// permission delete doesn't exists
123$permissiontodelete = $user->hasRight('opensurvey', 'write');
124
125
126/*
127 * Actions
128 */
129
130if (GETPOST('cancel', 'alpha')) {
131 $action = 'list';
132 $massaction = '';
133}
134if (!GETPOST('confirmmassaction', 'alpha') && $massaction != 'presend' && $massaction != 'confirm_presend') {
135 $massaction = '';
136}
137
138$parameters = array();
139$reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks
140if ($reshook < 0) {
141 setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
142}
143
144if (empty($reshook)) {
145 // Selection of new fields
146 include DOL_DOCUMENT_ROOT.'/core/actions_changeselectedfields.inc.php';
147
148 // Purge search criteria
149 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
150 $search_status = '';
151 $search_title = '';
152 $search_ref = '';
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 = 'Opensurveysondage';
163 $objectlabel = 'Opensurveysondage';
164 $uploaddir = $conf->opensurvey->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//$help_url="EN:Module_MyObject|FR:Module_MyObject_FR|ES:Módulo_MyObject";
178$help_url = '';
179$title = $langs->trans('OpenSurveyArea');
180
181
182$sql = "SELECT p.id_sondage as rowid, p.fk_user_creat, p.format, p.date_fin, p.status, p.titre as title, p.nom_admin, p.tms,";
183$sql .= " u.login, u.firstname, u.lastname";
184$sql .= " FROM ".MAIN_DB_PREFIX."opensurvey_sondage as p";
185$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."user u ON u.rowid = p.fk_user_creat";
186$sql .= " WHERE p.entity IN (".getEntity('survey').")";
187if ($search_status != '-1' && $search_status != '') {
188 $sql .= natural_search("p.status", $search_status, 2);
189}
190if (!empty($search_expired) && $search_expired == 'expired') {
191 $sql .= " AND p.date_fin < '".$db->idate($now)."'";
192}
193if (!empty($search_expired) && $search_expired == 'opened') {
194 $sql .= " AND p.date_fin >= '".$db->idate($now)."'";
195}
196if (!empty($search_ref)) {
197 $sql .= natural_search("p.id_sondage", $search_ref);
198}
199if (!empty($search_title)) {
200 $sql .= natural_search("p.titre", $search_title);
201}
202// Add where from extra fields
203include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_sql.tpl.php';
204// Add where from hooks
205$parameters = array();
206$reshook = $hookmanager->executeHooks('printFieldListWhere', $parameters, $object); // Note that $action and $object may have been modified by hook
207$sql .= $hookmanager->resPrint;
208
209$sql .= $db->order($sortfield, $sortorder);
210
211// Count total nb of records
212$nbtotalofrecords = '';
213if (!getDolGlobalInt('MAIN_DISABLE_FULL_SCANLIST')) {
214 $resql = $db->query($sql);
215 $nbtotalofrecords = $db->num_rows($resql);
216 if (($page * $limit) > $nbtotalofrecords) { // if total of record found is smaller than page * limit, goto and load page 0
217 $page = 0;
218 $offset = 0;
219 }
220}
221// if total of record found is smaller than limit, no need to do paging and to restart another select with limits set.
222if (is_numeric($nbtotalofrecords) && $limit > $nbtotalofrecords) {
223 $num = $nbtotalofrecords;
224} else {
225 $sql .= $db->plimit($limit + 1, $offset);
226
227 $resql = $db->query($sql);
228 if (!$resql) {
229 dol_print_error($db);
230 exit;
231 }
232
233 $num = $db->num_rows($resql);
234}
235
236// Direct jump if only one record found
237if ($num == 1 && getDolGlobalString('MAIN_SEARCH_DIRECT_OPEN_IF_ONLY_ONE') && $search_all) {
238 $obj = $db->fetch_object($resql);
239 $id = $obj->rowid;
240 header("Location: ".dol_buildpath('/opensurvey/card.php', 1).'?id='.$id);
241 exit;
242}
243
244
245// Output page
246// --------------------------------------------------------------------
247
248llxHeader('', $title, $help_url, '', 0, 0, '', '', '', 'bodyforlist');
249
250$arrayofselected = is_array($toselect) ? $toselect : array();
251
252$param = '';
253if (/* !empty($contextpage) && */ $contextpage != $_SERVER["PHP_SELF"]) { // $contextpage can't be empty
254 $param .= '&contextpage='.urlencode($contextpage);
255}
256if ($limit > 0 && $limit != $conf->liste_limit) {
257 $param .= '&limit='.((int) $limit);
258}
259$fieldtosortuser = !getDolGlobalString('MAIN_FIRSTNAME_NAME_POSITION') ? 'firstname' : 'lastname';
260
261if ($optioncss != '') {
262 $param .= '&optioncss='.urlencode($optioncss);
263}
264// Add $param from extra fields
265include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_param.tpl.php';
266
267// List of mass actions available
268$arrayofmassactions = array(
269 //'presend'=>img_picto('', 'email', 'class="pictofixedwidth"').$langs->trans("SendByMail"),
270 //'builddoc'=>img_picto('', 'pdf', 'class="pictofixedwidth"').$langs->trans("PDFMerge"),
271);
272if ($permissiontodelete) {
273 $arrayofmassactions['predelete'] = img_picto('', 'delete', 'class="pictofixedwidth"').$langs->trans("Delete");
274}
275if (GETPOSTINT('nomassaction') || in_array($massaction, array('presend', 'predelete'))) {
276 $arrayofmassactions = array();
277}
278$massactionbutton = $form->selectMassAction('', $arrayofmassactions);
279
280
281// List of surveys into database
282
283print '<form method="POST" id="searchFormList" action="'.$_SERVER["PHP_SELF"].'">';
284if ($optioncss != '') {
285 print '<input type="hidden" name="optioncss" value="'.$optioncss.'">';
286}
287print '<input type="hidden" name="token" value="'.newToken().'">';
288print '<input type="hidden" name="formfilteraction" id="formfilteraction" value="list">';
289print '<input type="hidden" name="action" value="list">';
290print '<input type="hidden" name="sortfield" value="'.$sortfield.'">';
291print '<input type="hidden" name="sortorder" value="'.$sortorder.'">';
292print '<input type="hidden" name="contextpage" value="'.$contextpage.'">';
293
294$newcardbutton = '';
295$newcardbutton .= dolGetButtonTitle($langs->trans('NewSurvey'), '', 'fa fa-plus-circle', DOL_URL_ROOT.'/opensurvey/wizard/index.php', '', $user->hasRight('opensurvey', 'write'));
296
297print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, 'poll', 0, $newcardbutton, '', $limit, 0, 0, 1);
298
299// Add code for pre mass action (confirmation or email presend form)
300$topicmail = "SendOpenSurveyRef";
301$modelmail = "opensurvey";
302$objecttmp = new Opensurveysondage($db);
303$trackid = 'surv'.$object->id;
304include DOL_DOCUMENT_ROOT.'/core/tpl/massactions_pre.tpl.php';
305
306
307if ($search_all) {
308 // Ensure $fieldstosearchall is set and array
309 if (!isset($fieldstosearchall) || !is_array($fieldstosearchall)) {
310 $fieldstosearchall = array();
311 }
312 foreach ($fieldstosearchall as $key => $val) {
313 $fieldstosearchall[$key] = $langs->trans($val);
314 }
315 print '<div class="divsearchfieldfilter">'.$langs->trans("FilterOnInto", $search_all).implode(', ', $fieldstosearchall).'</div>';
316}
317
318$moreforfilter = '';
319/*$moreforfilter.='<div class="divsearchfield">';
320$moreforfilter.= $langs->trans('MyFilter') . ': <input type="text" name="search_myfield" value="'.dol_escape_htmltag($search_myfield).'">';
321$moreforfilter.= '</div>';*/
322
323$parameters = array();
324$reshook = $hookmanager->executeHooks('printFieldPreListTitle', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
325if (empty($reshook)) {
326 $moreforfilter .= $hookmanager->resPrint;
327} else {
328 $moreforfilter = $hookmanager->resPrint;
329}
330
331if (!empty($moreforfilter)) {
332 print '<div class="liste_titre liste_titre_bydiv centpercent">';
333 print $moreforfilter;
334 print '</div>';
335}
336
337$varpage = empty($contextpage) ? $_SERVER["PHP_SELF"] : $contextpage;
338//$selectedfields=$form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage); // This also change content of $arrayfields
339$selectedfields = '';
340$selectedfields .= (count($arrayofmassactions) ? $form->showCheckAddButtons('checkforselect', 1) : '');
341
342print '<div class="div-table-responsive">';
343print '<table class="tagtable liste'.($moreforfilter ? " listwithfilterbefore" : "").'">'."\n";
344
345// Fields title search
346// --------------------------------------------------------------------
347print '<tr class="liste_titre_filter">';
348// Action column
349if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
350 print '<td class="liste_titre maxwidthsearch">';
351 $searchpicto = $form->showFilterButtons('left');
352 print $searchpicto;
353 print '</td>';
354}
355print '<td class="liste_titre"><input type="text" class="maxwidth100" name="search_ref" value="'.dol_escape_htmltag($search_ref).'"></td>';
356print '<td class="liste_titre"><input type="text" class="maxwidth100" name="search_title" value="'.dol_escape_htmltag($search_title).'"></td>';
357print '<td class="liste_titre"></td>';
358print '<td class="liste_titre"></td>';
359print '<td class="liste_titre"></td>';
360print '<td class="liste_titre"></td>';
361print '<td class="liste_titre"></td>';
362$arraystatus = array('-1' => '&nbsp;', '0' => $langs->trans("Draft"), '1' => $langs->trans("Opened"), '2' => $langs->trans("Closed"));
363print '<td class="liste_titre" align="center">'.$form->selectarray('search_status', $arraystatus, $search_status, 0, 0, 0, '', 0, 0, 0, '', 'onroghtofpage').'</td>';
364// Extra fields
365include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_input.tpl.php';
366
367// Fields from hook
368$parameters = array('arrayfields' => $arrayfields);
369$reshook = $hookmanager->executeHooks('printFieldListOption', $parameters, $object); // Note that $action and $object may have been modified by hook
370print $hookmanager->resPrint;
371// Action column
372if (!getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
373 print '<td class="liste_titre maxwidthsearch">';
374 $searchpicto = $form->showFilterButtons();
375 print $searchpicto;
376 print '</td>';
377}
378print '</tr>'."\n";
379
380
381// Fields title label
382// --------------------------------------------------------------------
383print '<tr class="liste_titre">';
384// Action column
385if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
386 print getTitleFieldOfList($selectedfields, 0, $_SERVER["PHP_SELF"], '', '', '', 'align="center"', $sortfield, $sortorder, 'maxwidthsearch ')."\n";
387}
388print_liste_field_titre("Ref", $_SERVER["PHP_SELF"], "p.id_sondage", $param, "", "", $sortfield, $sortorder);
389print_liste_field_titre("Title", $_SERVER["PHP_SELF"], "p.titre", $param, "", "", $sortfield, $sortorder);
390print_liste_field_titre("Type", $_SERVER["PHP_SELF"], "p.format", $param, "", "", $sortfield, $sortorder);
391print_liste_field_titre("Author", $_SERVER["PHP_SELF"], "u.".$fieldtosortuser, $param, "", "", $sortfield, $sortorder);
392print_liste_field_titre("NbOfVoters", $_SERVER["PHP_SELF"], "", $param, "", 'align="right"', $sortfield, $sortorder);
393print_liste_field_titre("ExpireDate", $_SERVER["PHP_SELF"], "p.date_fin", $param, "", 'align="center"', $sortfield, $sortorder);
394print_liste_field_titre("DateLastModification", $_SERVER["PHP_SELF"], "p.tms", $param, "", 'align="center"', $sortfield, $sortorder);
395print_liste_field_titre("Status", $_SERVER["PHP_SELF"], "p.status", $param, "", 'align="center"', $sortfield, $sortorder);
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);
400$reshook = $hookmanager->executeHooks('printFieldListTitle', $parameters, $object); // Note that $action and $object may have been modified by hook
401print $hookmanager->resPrint;
402// Action column
403if (!getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
404 print getTitleFieldOfList($selectedfields, 0, $_SERVER["PHP_SELF"], '', '', '', 'align="center"', $sortfield, $sortorder, 'maxwidthsearch ')."\n";
405}
406print '</tr>'."\n";
407
408
409
410// Loop on record
411// --------------------------------------------------------------------
412$i = 0;
413$totalarray = array();
414$totalarray['nbfield'] = 0;
415while ($i < min($num, $limit)) {
416 $obj = $db->fetch_object($resql);
417 if (empty($obj)) {
418 break; // Should not happen
419 }
420
421 $nbuser = 0;
422 $sql2 = 'select COUNT(*) as nb from '.MAIN_DB_PREFIX."opensurvey_user_studs where id_sondage='".$db->escape($obj->rowid)."'";
423 $resql2 = $db->query($sql2);
424 if ($resql2) {
425 $obj2 = $db->fetch_object($resql2);
426 $nbuser = $obj2->nb;
427 } else {
428 dol_print_error($db);
429 }
430
431 $opensurvey_static->id = $obj->rowid;
432 $opensurvey_static->ref = $obj->rowid;
433 $opensurvey_static->title = $obj->title;
434 $opensurvey_static->status = $obj->status;
435 $opensurvey_static->date_fin = $db->jdate($obj->date_fin);
436
437 // Show here line of result
438 print '<tr class="oddeven">';
439 // Action column
440 if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
441 print '<td class="nowrap center">';
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($obj->rowid, $arrayofselected)) {
445 $selected = 1;
446 }
447 print '<input id="cb'.$obj->rowid.'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.$obj->rowid.'"'.($selected ? ' checked="checked"' : '').'>';
448 }
449 print '</td>';
450 }
451
452 // Ref
453 print '<td class="tdoverflowmax150">';
454 print $opensurvey_static->getNomUrl(1);
455 print '</td>';
456 if (!$i) {
457 $totalarray['nbfield']++;
458 }
459
460 // Title
461 print '<td class="tdoverflowmax125">'.dol_htmlentities($obj->title).'</td>';
462 if (!$i) {
463 $totalarray['nbfield']++;
464 }
465
466 // Type
467 print '<td class="tdoverflowmax100">';
468 $type = ($obj->format == 'A') ? 'classic' : 'date';
469 print img_picto('', dol_buildpath('/opensurvey/img/'.($type == 'classic' ? 'chart-32.png' : 'calendar-32.png'), 1), 'width="16"', 1);
470 print ' '.$langs->trans($type == 'classic' ? "TypeClassic" : "TypeDate");
471 print '</td>';
472 if (!$i) {
473 $totalarray['nbfield']++;
474 }
475
476 print '<td class="tdoverflowmax100">';
477 // Author
478 if ($obj->fk_user_creat) {
479 $userstatic = new User($db);
480 $userstatic->id = $obj->fk_user_creat;
481 $userstatic->firstname = $obj->firstname;
482 $userstatic->lastname = $obj->lastname;
483 $userstatic->login = $userstatic->getFullName($langs, 0, -1, 48);
484
485 print $userstatic->getLoginUrl(1);
486 } else {
487 print dol_htmlentities($obj->nom_admin);
488 }
489 print '</td>';
490 if (!$i) {
491 $totalarray['nbfield']++;
492 }
493
494 // Nb of voters
495 print'<td class="right">'.$nbuser.'</td>'."\n";
496 if (!$i) {
497 $totalarray['nbfield']++;
498 }
499
500 print '<td class="center">'.dol_print_date($db->jdate($obj->date_fin), 'day');
501 if ($db->jdate($obj->date_fin) < $now && $obj->status == Opensurveysondage::STATUS_VALIDATED) {
502 print img_warning($langs->trans("Expired"));
503 }
504 print '</td>';
505 if (!$i) {
506 $totalarray['nbfield']++;
507 }
508
509 print '<td class="center">'.dol_print_date($db->jdate($obj->tms), 'dayhour');
510 print '</td>';
511 if (!$i) {
512 $totalarray['nbfield']++;
513 }
514
515 print '<td class="center">'.$opensurvey_static->getLibStatut(5).'</td>'."\n";
516 if (!$i) {
517 $totalarray['nbfield']++;
518 }
519
520 // Extra fields
521 include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_print_fields.tpl.php';
522 // Fields from hook
523 $parameters = array('arrayfields' => $arrayfields, 'obj' => $obj, 'i' => $i, 'totalarray' => &$totalarray);
524 $reshook = $hookmanager->executeHooks('printFieldListValue', $parameters, $object); // Note that $action and $object may have been modified by hook
525 print $hookmanager->resPrint;
526 // Action column
527 if (!getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
528 print '<td class="nowrap center">';
529 if ($massactionbutton || $massaction) { // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined
530 $selected = 0;
531 if (in_array($obj->rowid, $arrayofselected)) {
532 $selected = 1;
533 }
534 print '<input id="cb'.$obj->rowid.'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.$obj->rowid.'"'.($selected ? ' checked="checked"' : '').'>';
535 }
536 print '</td>';
537 }
538 if (!$i) {
539 $totalarray['nbfield']++;
540 }
541
542 print '</tr>'."\n";
543 $i++;
544}
545
546// Show total line
547include DOL_DOCUMENT_ROOT.'/core/tpl/list_print_total.tpl.php';
548
549
550// If no record found
551if ($num == 0) {
552 $colspan = 8;
553 foreach ($arrayfields as $key => $val) {
554 if (!empty($val['checked'])) {
555 $colspan++;
556 }
557 }
558 print '<tr><td colspan="'.$colspan.'"><span class="opacitymedium">'.$langs->trans("NoRecordFound").'</span></td></tr>';
559}
560
561
562$db->free($resql);
563
564$parameters = array('arrayfields' => $arrayfields, 'sql' => $sql);
565$reshook = $hookmanager->executeHooks('printFieldListFooter', $parameters, $object); // Note that $action and $object may have been modified by hook
566print $hookmanager->resPrint;
567
568print '</table>'."\n";
569print '</div>'."\n";
570
571print '</form>'."\n";
572
573if (in_array('builddoc', array_keys($arrayofmassactions)) && ($nbtotalofrecords === '' || $nbtotalofrecords)) {
574 $hidegeneratedfilelistifempty = 1;
575 if ($massaction == 'builddoc' || $action == 'remove_file' || $show_files) {
576 $hidegeneratedfilelistifempty = 0;
577 }
578
579 require_once DOL_DOCUMENT_ROOT.'/core/class/html.formfile.class.php';
580 $formfile = new FormFile($db);
581
582 // Show list of available documents
583 $urlsource = $_SERVER['PHP_SELF'].'?sortfield='.$sortfield.'&sortorder='.$sortorder;
584 $urlsource .= str_replace('&amp;', '&', $param);
585
586 $filedir = $diroutputmassaction;
587 $genallowed = $permissiontoread;
588 $delallowed = $permissiontoadd;
589
590 print $formfile->showdocuments('massfilesarea_mymodule', '', $filedir, $urlsource, 0, $delallowed, '', 1, 1, 0, 48, 1, $param, $title, '', '', '', null, $hidegeneratedfilelistifempty);
591}
592
593// End of page
594llxFooter();
595$db->close();
$id
Definition account.php:48
if( $user->socid > 0) if(! $user->hasRight('accounting', 'chartofaccount')) $object
Definition card.php:66
llxFooter($comment='', $zone='private', $disabledoutputofmessages=0)
Empty footer.
Definition wrapper.php:87
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 offer components to list and upload files.
Class to manage generation of HTML components Only common components must be here.
Put here description of your class.
const STATUS_VALIDATED
Validated/Opened status.
Class to manage Dolibarr users.
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_warning($titlealt='default', $moreatt='', $morecss='pictowarning')
Show warning logo.
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.
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...
print_liste_field_titre($name, $file="", $field="", $begin="", $moreparam="", $moreattrib="", $sortfield="", $sortorder="", $prefix="", $tooltip="", $forcenowrapcolumntitle=0)
Show title line of an array.
dol_htmlentities($string, $flags=ENT_QUOTES|ENT_SUBSTITUTE, $encoding='UTF-8', $double_encode=false)
Replace htmlentities functions.
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_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...
getDolGlobalString($key, $default='')
Return a Dolibarr global constant string value.
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.