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