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