dolibarr  x.y.z
conferenceorboothattendee_list.php
Go to the documentation of this file.
1 <?php
2 /* Copyright (C) 2017 Laurent Destailleur <eldy@users.sourceforge.net>
3  * Copyright (C) 2021 Florian Henry <florian.henry@scopen.fr>
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 
26 // Load Dolibarr environment
27 require '../main.inc.php';
28 
29 require_once DOL_DOCUMENT_ROOT.'/core/class/html.formcompany.class.php';
30 require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php';
31 require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php';
32 require_once DOL_DOCUMENT_ROOT.'/core/lib/project.lib.php';
33 
34 require_once DOL_DOCUMENT_ROOT.'/eventorganization/class/conferenceorbooth.class.php';
35 require_once DOL_DOCUMENT_ROOT.'/eventorganization/class/conferenceorboothattendee.class.php';
36 require_once DOL_DOCUMENT_ROOT.'/eventorganization/lib/eventorganization_conferenceorbooth.lib.php';
37 require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php';
38 if (isModEnabled('categorie')) {
39  require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php';
40 }
41 
42 global $dolibarr_main_url_root;
43 
44 // for other modules
45 //dol_include_once('/othermodule/class/otherobject.class.php');
46 
47 // Load translation files required by the page
48 $langs->loadLangs(array("eventorganization", "other", "projects"));
49 
50 // Get Paramters
51 $action = GETPOST('action', 'aZ09') ?GETPOST('action', 'aZ09') : 'view'; // The action 'add', 'create', 'edit', 'update', 'view', ...
52 $massaction = GETPOST('massaction', 'alpha'); // The bulk action (combo box choice into lists)
53 $show_files = GETPOST('show_files', 'int'); // Show files area generated by bulk actions ?
54 $confirm = GETPOST('confirm', 'alpha'); // Result of a confirmation
55 $cancel = GETPOST('cancel', 'alpha'); // We click on a Cancel button
56 $toselect = GETPOST('toselect', 'array'); // Array of ids of elements selected into a list
57 $contextpage = GETPOST('contextpage', 'aZ') ? GETPOST('contextpage', 'aZ') : 'conferenceorboothattendeelist'; // To manage different context of search
58 $backtopage = GETPOST('backtopage', 'alpha'); // Go back to a dedicated page
59 $optioncss = GETPOST('optioncss', 'aZ'); // Option for the css output (always '' except when 'print')
60 
61 $id = GETPOST('id', 'int');
62 $conf_or_booth_id = GETPOST('conforboothid', 'int');
63 
64 $withproject = GETPOST('withproject', 'int');
65 $fk_project = GETPOST('fk_project', 'int') ? GETPOST('fk_project', 'int') : GETPOST('projectid', 'int');
66 $projectid = $fk_project;
67 
68 $withProjectUrl='';
69 
70 // Load variable for pagination
71 $limit = GETPOST('limit', 'int') ? GETPOST('limit', 'int') : $conf->liste_limit;
72 $sortfield = GETPOST('sortfield', 'aZ09comma');
73 $sortorder = GETPOST('sortorder', 'aZ09comma');
74 $page = GETPOSTISSET('pageplusone') ? (GETPOST('pageplusone') - 1) : GETPOST("page", 'int');
75 if (empty($page) || $page < 0 || GETPOST('button_search', 'alpha') || GETPOST('button_removefilter', 'alpha')) {
76  $page = 0;
77 } // If $page is not defined, or '' or -1 or if we click on clear filters
78 $offset = $limit * $page;
79 $pageprev = $page - 1;
80 $pagenext = $page + 1;
81 
82 // Initialize technical objects
83 $object = new ConferenceOrBoothAttendee($db);
84 $extrafields = new ExtraFields($db);
85 $projectstatic = new Project($db);
86 $diroutputmassaction = $conf->eventorganization->dir_output.'/temp/massgeneration/'.$user->id;
87 $hookmanager->initHooks(array('conferenceorboothattendeelist')); // Note that conf->hooks_modules contains array
88 
89 // Fetch optionals attributes and labels
90 $extrafields->fetch_name_optionals_label($object->table_element);
91 //$extrafields->fetch_name_optionals_label($object->table_element_line);
92 
93 $search_array_options = $extrafields->getOptionalsFromPost($object->table_element, '', 'search_');
94 
95 // Default sort order (if not yet defined by previous GETPOST)
96 if (!$sortfield) {
97  reset($object->fields); // Reset is required to avoid key() to return null.
98  $sortfield = "t.".key($object->fields); // Set here default search field. By default 1st field in definition.
99 }
100 if (!$sortorder) {
101  $sortorder = "ASC";
102 }
103 
104 // Initialize array of search criterias
105 $search_all = GETPOST('search_all', 'alphanohtml');
106 $search = array();
107 foreach ($object->fields as $key => $val) {
108  if (GETPOST('search_'.$key, 'alpha') !== '') {
109  $search[$key] = GETPOST('search_'.$key, 'alpha');
110  }
111  if (preg_match('/^(date|timestamp|datetime)/', $val['type'])) {
112  $search[$key.'_dtstart'] = dol_mktime(0, 0, 0, GETPOST('search_'.$key.'_dtstartmonth', 'int'), GETPOST('search_'.$key.'_dtstartday', 'int'), GETPOST('search_'.$key.'_dtstartyear', 'int'));
113  $search[$key.'_dtend'] = dol_mktime(23, 59, 59, GETPOST('search_'.$key.'_dtendmonth', 'int'), GETPOST('search_'.$key.'_dtendday', 'int'), GETPOST('search_'.$key.'_dtendyear', 'int'));
114  }
115 }
116 
117 // List of fields to search into when doing a "search in all"
118 $fieldstosearchall = array();
119 foreach ($object->fields as $key => $val) {
120  if (!empty($val['searchall'])) {
121  $fieldstosearchall['t.'.$key] = $val['label'];
122  }
123 }
124 
125 // Definition of array of fields for columns
126 $arrayfields = array();
127 foreach ($object->fields as $key => $val) {
128  // If $val['visible']==0, then we never show the field
129  if (!empty($val['visible'])) {
130  $visible = (int) dol_eval($val['visible'], 1, 1, '1');
131  $arrayfields['t.'.$key] = array(
132  'label'=>$val['label'],
133  'checked'=>(($visible < 0) ? 0 : 1),
134  'enabled'=>($visible != 3 && dol_eval($val['enabled'], 1, 1, '1')),
135  'position'=>$val['position'],
136  'help'=> isset($val['help']) ? $val['help'] : ''
137  );
138  }
139 }
140 // Extra fields
141 include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_array_fields.tpl.php';
142 
143 $object->fields = dol_sort_array($object->fields, 'position');
144 $arrayfields = dol_sort_array($arrayfields, 'position');
145 
146 // Permissions
147 $permissiontoread = $user->rights->eventorganization->read;
148 $permissiontoadd = $user->rights->eventorganization->write;
149 $permissiontodelete = $user->rights->eventorganization->delete;
150 
151 // Security check
152 if (empty($conf->eventorganization->enabled)) {
153  accessforbidden('Module not enabled');
154 }
155 $socid = 0;
156 if ($user->socid > 0) { // Protection if external user
157  //$socid = $user->socid;
158  accessforbidden();
159 }
160 $result = restrictedArea($user, 'eventorganization');
161 if (!$permissiontoread) accessforbidden();
162 
163 
164 /*
165  * Actions
166  */
167 
168 if (preg_match('/^set/', $action) && $projectid > 0 && !empty($user->rights->eventorganization->write)) {
169  $project = new Project($db);
170  //If "set" fields keys is in projects fields
171  $project_attr=preg_replace('/^set/', '', $action);
172  if (array_key_exists($project_attr, $project->fields)) {
173  $result = $project->fetch($projectid);
174  if ($result < 0) {
175  setEventMessages(null, $project->errors, 'errors');
176  } else {
177  $project->{$project_attr}=GETPOST($project_attr);
178  $result=$project->update($user);
179  if ($result < 0) {
180  setEventMessages(null, $project->errors, 'errors');
181  }
182  }
183  }
184 }
185 
186 if (GETPOST('cancel', 'alpha')) {
187  $action = 'list';
188  $massaction = '';
189 }
190 if (!GETPOST('confirmmassaction', 'alpha') && $massaction != 'presend' && $massaction != 'confirm_presend'
191 && $massaction != 'presend'
192 && $massaction != 'confirm_presend') {
193  $massaction = '';
194 }
195 
196 $parameters = array();
197 $reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks
198 if ($reshook < 0) {
199  setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
200 }
201 
202 if (empty($reshook)) {
203  // Selection of new fields
204  include DOL_DOCUMENT_ROOT.'/core/actions_changeselectedfields.inc.php';
205 
206  // Purge search criteria
207  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
208  foreach ($object->fields as $key => $val) {
209  $search[$key] = '';
210  if (preg_match('/^(date|timestamp|datetime)/', $val['type'])) {
211  $search[$key.'_dtstart'] = '';
212  $search[$key.'_dtend'] = '';
213  }
214  }
215  $toselect = array();
216  $search_array_options = array();
217  }
218  if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x', 'alpha') || GETPOST('button_removefilter', 'alpha')
219  || GETPOST('button_search_x', 'alpha') || GETPOST('button_search.x', 'alpha') || GETPOST('button_search', 'alpha')) {
220  $massaction = ''; // Protection to avoid mass action if we force a new search during a mass action confirmation
221  }
222 
223  // Mass actions
224  $objectclass = 'ConferenceOrBoothAttendee';
225  $objectlabel = 'ConferenceOrBoothAttendee';
226  $uploaddir = $conf->eventorganization->dir_output;
227  include DOL_DOCUMENT_ROOT.'/eventorganization/core/actions_massactions_mail.inc.php';
228  include DOL_DOCUMENT_ROOT.'/core/actions_massactions.inc.php';
229 }
230 
231 
232 
233 /*
234  * View
235  */
236 
237 $form = new Form($db);
238 $now = dol_now();
239 
240 //$help_url="EN:Module_ConferenceOrBoothAttendee|FR:Module_ConferenceOrBoothAttendee_FR|ES:Módulo_ConferenceOrBoothAttendee";
241 $help_url = '';
242 if ($confOrBooth->id > 0) {
243  $title = $langs->trans('ListOfAttendeesPerConference');
244 } else {
245  $title = $langs->trans('ListOfAttendeesOfEvent');
246 }
247 $morejs = array();
248 $morecss = array();
249 
250 $confOrBooth = new ConferenceOrBooth($db);
251 if ($conf_or_booth_id > 0) {
252  $result = $confOrBooth->fetch($conf_or_booth_id);
253  if ($result < 0) {
254  setEventMessages(null, $confOrBooth->errors, 'errors');
255  } else {
256  $fk_project = $confOrBooth->fk_project;
257  }
258 }
259 
260 if ($fk_project > 0) {
261  $result = $projectstatic->fetch($fk_project);
262  if ($result < 0) {
263  setEventMessages(null, $projectstatic->errors, 'errors');
264  }
265 }
266 
267 
268 // Build and execute select
269 // --------------------------------------------------------------------
270 $sql = 'SELECT ';
271 $sql .= $object->getFieldList('t');
272 // Add fields from extrafields
273 if (!empty($extrafields->attributes[$object->table_element]['label'])) {
274  foreach ($extrafields->attributes[$object->table_element]['label'] as $key => $val) {
275  $sql .= ($extrafields->attributes[$object->table_element]['type'][$key] != 'separate' ? ", ef.".$key." as options_".$key : '');
276  }
277 }
278 // Add fields from hooks
279 $parameters = array();
280 $reshook = $hookmanager->executeHooks('printFieldListSelect', $parameters, $object); // Note that $action and $object may have been modified by hook
281 $sql .= preg_replace('/^,/', '', $hookmanager->resPrint);
282 $sql = preg_replace('/,\s*$/', '', $sql);
283 $sql .= " FROM ".MAIN_DB_PREFIX.$object->table_element." as t";
284 if (!empty($confOrBooth->id)) {
285  $sql .= " INNER JOIN ".MAIN_DB_PREFIX."actioncomm as a on a.id=t.fk_actioncomm AND a.id=".((int) $confOrBooth->id);
286 }
287 if (isset($extrafields->attributes[$object->table_element]['label']) && is_array($extrafields->attributes[$object->table_element]['label']) && count($extrafields->attributes[$object->table_element]['label'])) {
288  $sql .= " LEFT JOIN ".MAIN_DB_PREFIX.$object->table_element."_extrafields as ef on (t.rowid = ef.fk_object)";
289 }
290 // Add table from hooks
291 $parameters = array();
292 $reshook = $hookmanager->executeHooks('printFieldListFrom', $parameters, $object); // Note that $action and $object may have been modified by hook
293 $sql .= $hookmanager->resPrint;
294 if ($object->ismultientitymanaged == 1) {
295  $sql .= " WHERE t.entity IN (".getEntity($object->element).")";
296 } else {
297  $sql .= " WHERE 1 = 1";
298 }
299 if (!empty($projectstatic->id)) {
300  $sql .= " AND t.fk_project=".((int) $projectstatic->id);
301 }
302 foreach ($search as $key => $val) {
303  if (array_key_exists($key, $object->fields)) {
304  if ($key == 'status' && $search[$key] == -1) {
305  continue;
306  }
307  $mode_search = (($object->isInt($object->fields[$key]) || $object->isFloat($object->fields[$key])) ? 1 : 0);
308  if ((strpos($object->fields[$key]['type'], 'integer:') === 0) || (strpos($object->fields[$key]['type'], 'sellist:') === 0) || !empty($object->fields[$key]['arrayofkeyval'])) {
309  if ($search[$key] == '-1' || ($search[$key] === '0' && (empty($object->fields[$key]['arrayofkeyval']) || !array_key_exists('0', $object->fields[$key]['arrayofkeyval'])))) {
310  $search[$key] = '';
311  }
312  $mode_search = 2;
313  }
314  if ($search[$key] != '') {
315  $sql .= natural_search($key, $search[$key], (($key == 'status') ? 2 : $mode_search));
316  }
317  } else {
318  if (preg_match('/(_dtstart|_dtend)$/', $key) && $search[$key] != '') {
319  $columnName = preg_replace('/(_dtstart|_dtend)$/', '', $key);
320  if (preg_match('/^(date|timestamp|datetime)/', $object->fields[$columnName]['type'])) {
321  if (preg_match('/_dtstart$/', $key)) {
322  $sql .= " AND t.".$columnName." >= '".$db->idate($search[$key])."'";
323  }
324  if (preg_match('/_dtend$/', $key)) {
325  $sql .= " AND t." . $columnName . " <= '" . $db->idate($search[$key]) . "'";
326  }
327  }
328  }
329  }
330 }
331 if ($search_all) {
332  $sql .= natural_search(array_keys($fieldstosearchall), $search_all);
333 }
334 //$sql.= dolSqlDateFilter("t.field", $search_xxxday, $search_xxxmonth, $search_xxxyear);
335 // Add where from extra fields
336 include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_sql.tpl.php';
337 // Add where from hooks
338 $parameters = array();
339 $reshook = $hookmanager->executeHooks('printFieldListWhere', $parameters, $object); // Note that $action and $object may have been modified by hook
340 $sql .= $hookmanager->resPrint;
341 
342 
343 $sql .= $db->order($sortfield, $sortorder);
344 
345 // Count total nb of records
346 $nbtotalofrecords = '';
347 if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) {
348  $resql = $db->query($sql);
349  $nbtotalofrecords = $db->num_rows($resql);
350  if (($page * $limit) > $nbtotalofrecords) { // if total of record found is smaller than page * limit, goto and load page 0
351  $page = 0;
352  $offset = 0;
353  }
354 }
355 // if total of record found is smaller than limit, no need to do paging and to restart another select with limits set.
356 if (is_numeric($nbtotalofrecords) && ($limit > $nbtotalofrecords || empty($limit))) {
357  $num = $nbtotalofrecords;
358 } else {
359  if ($limit) {
360  $sql .= $db->plimit($limit + 1, $offset);
361  }
362 
363  $resql = $db->query($sql);
364  if (!$resql) {
365  dol_print_error($db);
366  exit;
367  }
368 
369  $num = $db->num_rows($resql);
370 }
371 
372 // Direct jump if only one record found
373 if ($num == 1 && !empty($conf->global->MAIN_SEARCH_DIRECT_OPEN_IF_ONLY_ONE) && $search_all && !$page) {
374  $obj = $db->fetch_object($resql);
375  $id = $obj->rowid;
376  header("Location: ".dol_buildpath('/eventorganization/conferenceorboothattendee_card.php', 1).'?id='.$id);
377  exit;
378 }
379 
380 
381 
382 llxHeader('', $title, $help_url, '', 0, 0, $morejs, $morecss, '', 'classforhorizontalscrolloftabs');
383 
384 
385 
386 if ($projectstatic->id > 0 || $confOrBooth > 0) {
387  if (!empty($conf->global->PROJECT_ALLOW_COMMENT_ON_PROJECT) && method_exists($projectstatic, 'fetchComments') && empty($projectstatic->comments)) {
388  $projectstatic->fetchComments();
389  }
390  if (!empty($projectstatic->socid)) {
391  $projectstatic->fetch_thirdparty();
392  }
393 
394  $withProjectUrl='';
395  $object->project = clone $projectstatic;
396 
397  if (!empty($withproject)) {
398  // Tabs for project
399  $tab = 'eventorganisation';
400  $withProjectUrl = "&withproject=1";
401  $head = project_prepare_head($projectstatic);
402 
403  print dol_get_fiche_head($head, $tab, $langs->trans("Project"), -1, ($projectstatic->public ? 'projectpub' : 'project'), 0, '', '');
404 
405  $param = ($mode == 'mine' ? '&mode=mine' : '');
406 
407  // Project card
408 
409  $linkback = '<a href="'.DOL_URL_ROOT.'/projet/list.php?restore_lastsearch_values=1">'.$langs->trans("BackToList").'</a>';
410 
411  $morehtmlref = '<div class="refidno">';
412  // Title
413  $morehtmlref .= $projectstatic->title;
414  // Thirdparty
415  if ($projectstatic->thirdparty->id > 0) {
416  $morehtmlref .= '<br>'.$projectstatic->thirdparty->getNomUrl(1, 'project');
417  }
418  $morehtmlref .= '</div>';
419 
420  // Define a complementary filter for search of next/prev ref.
421  if (empty($user->rights->projet->all->lire)) {
422  $objectsListId = $projectstatic->getProjectsAuthorizedForUser($user, 0, 0);
423  $projectstatic->next_prev_filter = " rowid IN (".$db->sanitize(count($objectsListId) ?join(',', array_keys($objectsListId)) : '0').")";
424  }
425 
426  dol_banner_tab($projectstatic, 'project_ref', $linkback, 1, 'ref', 'ref', $morehtmlref);
427 
428  print '<div class="fichecenter">';
429  print '<div class="fichehalfleft">';
430  print '<div class="underbanner clearboth"></div>';
431 
432  print '<table class="border tableforfield centpercent">';
433 
434  // Usage
435  if (!empty($conf->global->PROJECT_USE_OPPORTUNITIES) || empty($conf->global->PROJECT_HIDE_TASKS) || isModEnabled('eventorganization')) {
436  print '<tr><td class="tdtop">';
437  print $langs->trans("Usage");
438  print '</td>';
439  print '<td>';
440  if (!empty($conf->global->PROJECT_USE_OPPORTUNITIES)) {
441  print '<input type="checkbox" disabled name="usage_opportunity"'.(GETPOSTISSET('usage_opportunity') ? (GETPOST('usage_opportunity', 'alpha') != '' ? ' checked="checked"' : '') : ($projectstatic->usage_opportunity ? ' checked="checked"' : '')).'"> ';
442  $htmltext = $langs->trans("ProjectFollowOpportunity");
443  print $form->textwithpicto($langs->trans("ProjectFollowOpportunity"), $htmltext);
444  print '<br>';
445  }
446  if (empty($conf->global->PROJECT_HIDE_TASKS)) {
447  print '<input type="checkbox" disabled name="usage_task"'.(GETPOSTISSET('usage_task') ? (GETPOST('usage_task', 'alpha') != '' ? ' checked="checked"' : '') : ($projectstatic->usage_task ? ' checked="checked"' : '')).'"> ';
448  $htmltext = $langs->trans("ProjectFollowTasks");
449  print $form->textwithpicto($langs->trans("ProjectFollowTasks"), $htmltext);
450  print '<br>';
451  }
452  if (empty($conf->global->PROJECT_HIDE_TASKS) && !empty($conf->global->PROJECT_BILL_TIME_SPENT)) {
453  print '<input type="checkbox" disabled name="usage_bill_time"'.(GETPOSTISSET('usage_bill_time') ? (GETPOST('usage_bill_time', 'alpha') != '' ? ' checked="checked"' : '') : ($projectstatic->usage_bill_time ? ' checked="checked"' : '')).'"> ';
454  $htmltext = $langs->trans("ProjectBillTimeDescription");
455  print $form->textwithpicto($langs->trans("BillTime"), $htmltext);
456  print '<br>';
457  }
458  if (isModEnabled('eventorganization')) {
459  print '<input type="checkbox" disabled name="usage_organize_event"'.(GETPOSTISSET('usage_organize_event') ? (GETPOST('usage_organize_event', 'alpha') != '' ? ' checked="checked"' : '') : ($projectstatic->usage_organize_event ? ' checked="checked"' : '')).'"> ';
460  $htmltext = $langs->trans("EventOrganizationDescriptionLong");
461  print $form->textwithpicto($langs->trans("ManageOrganizeEvent"), $htmltext);
462  }
463  print '</td></tr>';
464  }
465 
466  // Visibility
467  print '<tr><td class="titlefield">'.$langs->trans("Visibility").'</td><td>';
468  if ($projectstatic->public == 0) {
469  print img_picto($langs->trans('PrivateProject'), 'private', 'class="paddingrightonly"');
470  print $langs->trans("PrivateProject");
471  } else {
472  print img_picto($langs->trans('SharedProject'), 'world', 'class="paddingrightonly"');
473  print $langs->trans("SharedProject");
474  }
475  print '</td></tr>';
476 
477  // Budget
478  print '<tr><td>'.$langs->trans("Budget").'</td><td>';
479  if (strcmp($projectstatic->budget_amount, '')) {
480  print '<span class="amount">'.price($projectstatic->budget_amount, '', $langs, 1, 0, 0, $conf->currency).'</span>';
481  }
482  print '</td></tr>';
483 
484  // Date start - end project
485  print '<tr><td>'.$langs->trans("Dates").' ('.$langs->trans("Project").')</td><td>';
486  $start = dol_print_date($projectstatic->date_start, 'day');
487  print ($start ? $start : '?');
488  $end = dol_print_date($projectstatic->date_end, 'day');
489  print ' - ';
490  print ($end ? $end : '?');
491  if ($projectstatic->hasDelay()) {
492  print img_warning("Late");
493  }
494  print '</td></tr>';
495 
496  // Date start - end of event
497  print '<tr><td>'.$langs->trans("Dates").' ('.$langs->trans("Event").')</td><td>';
498  $start = dol_print_date($projectstatic->date_start_event, 'day');
499  print ($start ? $start : '?');
500  $end = dol_print_date($projectstatic->date_end_event, 'day');
501  print ' - ';
502  print ($end ? $end : '?');
503  if ($projectstatic->hasDelay()) {
504  print img_warning("Late");
505  }
506  print '</td></tr>';
507 
508  // Location event
509  print '<tr><td>'.$langs->trans("Location").'</td><td>';
510  print $projectstatic->location;
511  print '</td></tr>';
512 
513  // Other attributes
514  $cols = 2;
515  $objectconf = $object;
516  $object = $projectstatic;
517  include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_view.tpl.php';
518  $object = $objectconf;
519 
520  print '</table>';
521 
522  print '</div>';
523 
524  print '<div class="fichehalfright">';
525  print '<div class="underbanner clearboth"></div>';
526 
527  print '<table class="border tableforfield centpercent">';
528 
529  // Description
530  print '<td class="titlefield tdtop">'.$langs->trans("Description").'</td><td>';
531  print nl2br($projectstatic->description);
532  print '</td></tr>';
533 
534  // Categories
535  if (isModEnabled('categorie')) {
536  print '<tr><td class="valignmiddle">'.$langs->trans("Categories").'</td><td>';
537  print $form->showCategories($projectstatic->id, 'project', 1);
538  print "</td></tr>";
539  }
540 
541  print '<tr><td class="nowrap">';
542  $typeofdata = 'checkbox:'.($projectstatic->accept_conference_suggestions ? ' checked="checked"' : '');
543  $htmltext = $langs->trans("AllowUnknownPeopleSuggestConfHelp");
544  print $form->editfieldkey('AllowUnknownPeopleSuggestConf', 'accept_conference_suggestions', '', $projectstatic, 0, $typeofdata, '', 0, 0, 'projectid', $htmltext);
545  print '</td><td>';
546  print $form->editfieldval('AllowUnknownPeopleSuggestConf', 'accept_conference_suggestions', '1', $projectstatic, 0, $typeofdata, '', 0, 0, '', 0, '', 'projectid');
547  print "</td></tr>";
548 
549  print '<tr><td>';
550  $typeofdata = 'checkbox:'.($projectstatic->accept_booth_suggestions ? ' checked="checked"' : '');
551  $htmltext = $langs->trans("AllowUnknownPeopleSuggestBoothHelp");
552  print $form->editfieldkey('AllowUnknownPeopleSuggestBooth', 'accept_booth_suggestions', '', $projectstatic, 0, $typeofdata, '', 0, 0, 'projectid', $htmltext);
553  print '</td><td>';
554  print $form->editfieldval('AllowUnknownPeopleSuggestBooth', 'accept_booth_suggestions', '1', $projectstatic, 0, $typeofdata, '', 0, 0, '', 0, '', 'projectid');
555  print "</td></tr>";
556 
557  print '<tr><td>';
558  print $form->editfieldkey($form->textwithpicto($langs->trans('PriceOfBooth'), $langs->trans("PriceOfBoothHelp")), 'price_booth', '', $projectstatic, 0, 'amount', '', 0, 0, 'projectid');
559  print '</td><td>';
560  print $form->editfieldval($form->textwithpicto($langs->trans('PriceOfBooth'), $langs->trans("PriceOfBoothHelp")), 'price_booth', $projectstatic->price_booth, $projectstatic, 0, 'amount', '', 0, 0, '', 0, '', 'projectid');
561  print "</td></tr>";
562 
563  print '<tr><td>';
564  print $form->editfieldkey($form->textwithpicto($langs->trans('PriceOfRegistration'), $langs->trans("PriceOfRegistrationHelp")), 'price_registration', '', $projectstatic, 0, 'amount', '', 0, 0, 'projectid');
565  print '</td><td>';
566  print $form->editfieldval($form->textwithpicto($langs->trans('PriceOfRegistration'), $langs->trans("PriceOfRegistrationHelp")), 'price_registration', $projectstatic->price_registration, $projectstatic, 0, 'amount', '', 0, 0, '', 0, '', 'projectid');
567  print "</td></tr>";
568 
569  print '<tr><td class="titlefield">';
570  print $form->editfieldkey($form->textwithpicto($langs->trans('MaxNbOfAttendees'), ''), 'max_attendees', '', $projectstatic, $permissiontoadd, 'integer:3', '&withproject=1', 0, 0, 'projectid');
571  print '</td><td class="valuefield">';
572  print $form->editfieldval($form->textwithpicto($langs->trans('MaxNbOfAttendees'), ''), 'max_attendees', $projectstatic->max_attendees, $projectstatic, $permissiontoadd, 'integer:3', '', 0, 0, '&withproject=1', 0, '', 'projectid');
573  print "</td></tr>";
574 
575  print '<tr><td valign="middle">'.$langs->trans("EventOrganizationICSLink").'</td><td>';
576  // Define $urlwithroot
577  $urlwithouturlroot = preg_replace('/'.preg_quote(DOL_URL_ROOT, '/').'$/i', '', trim($dolibarr_main_url_root));
578  $urlwithroot = $urlwithouturlroot.DOL_URL_ROOT;
579 
580  // Show message
581  $message = '<a target="_blank" rel="noopener noreferrer" href="'.$urlwithroot.'/public/agenda/agendaexport.php?format=ical'.($conf->entity > 1 ? "&entity=".$conf->entity : "");
582  $message .= '&exportkey='.($conf->global->MAIN_AGENDA_XCAL_EXPORTKEY ?urlencode($conf->global->MAIN_AGENDA_XCAL_EXPORTKEY) : '...');
583  $message .= "&project=".$projectstatic->id.'&module='.urlencode('@eventorganization').'&status='.ConferenceOrBooth::STATUS_CONFIRMED.'">'.$langs->trans('DownloadICSLink').img_picto('', 'download', 'class="paddingleft"').'</a>';
584  print $message;
585  print "</td></tr>";
586 
587  // Link to the submit vote/register page
588  print '<tr><td>';
589  //print '<span class="opacitymedium">';
590  print $form->textwithpicto($langs->trans("SuggestOrVoteForConfOrBooth"), $langs->trans("EvntOrgRegistrationHelpMessage"));
591  //print '</span>';
592  print '</td><td>';
593  $linksuggest = $dolibarr_main_url_root.'/public/project/index.php?id='.$projectstatic->id;
594  $encodedsecurekey = dol_hash($conf->global->EVENTORGANIZATION_SECUREKEY.'conferenceorbooth'.$projectstatic->id, 'md5');
595  $linksuggest .= '&securekey='.urlencode($encodedsecurekey);
596  //print '<div class="urllink">';
597  //print '<input type="text" value="'.$linksuggest.'" id="linkregister" class="quatrevingtpercent paddingrightonly">';
598  print '<div class="tdoverflowmax200 inline-block valignmiddle"><a target="_blank" rel="noopener noreferrer" href="'.$linksuggest.'" class="quatrevingtpercent">'.$linksuggest.'</a></div>';
599  print '<a target="_blank" rel="noopener noreferrer" href="'.$linksuggest.'">'.img_picto('', 'globe').'</a>';
600  //print '</div>';
601  //print ajax_autoselect("linkregister");
602  print '</td></tr>';
603 
604  // Link to the subscribe
605  print '<tr><td>';
606  //print '<span class="opacitymedium">';
607  print $langs->trans("PublicAttendeeSubscriptionGlobalPage");
608  //print '</span>';
609  print '</td><td>';
610  $link_subscription = $dolibarr_main_url_root.'/public/eventorganization/attendee_new.php?id='.$projectstatic->id.'&type=global';
611  $encodedsecurekey = dol_hash($conf->global->EVENTORGANIZATION_SECUREKEY.'conferenceorbooth'.$projectstatic->id, 'md5');
612  $link_subscription .= '&securekey='.urlencode($encodedsecurekey);
613  //print '<div class="urllink">';
614  //print '<input type="text" value="'.$linkregister.'" id="linkregister" class="quatrevingtpercent paddingrightonly">';
615  print '<div class="tdoverflowmax200 inline-block valignmiddle"><a target="_blank" href="'.$link_subscription.'" class="quatrevingtpercent">'.$link_subscription.'</a></div>';
616  print '<a target="_blank" rel="noopener noreferrer" href="'.$link_subscription.'">'.img_picto('', 'globe').'</a>';
617  //print '</div>';
618  //print ajax_autoselect("linkregister");
619  print '</td></tr>';
620 
621  print '</table>';
622 
623  print '</div>';
624  print '</div>';
625 
626  print '<div class="clearboth"></div>';
627 
628  print dol_get_fiche_end();
629 
630  if (empty($confOrBooth->id)) {
631  $head = conferenceorboothProjectPrepareHead($projectstatic);
632  $tab = 'attendees';
633  print dol_get_fiche_head($head, $tab, $langs->trans("Project"), -1, ($project->public ? 'projectpub' : 'project'), 0, '', 'reposition');
634  }
635  }
636 
637  if ($confOrBooth->id > 0) {
638  $head = conferenceorboothPrepareHead($confOrBooth, $withproject);
639 
640  print dol_get_fiche_head($head, 'attendees', $langs->trans("ConferenceOrBooth"), -1, $object->picto);
641 
642  $object_evt = $object;
643  $object = $confOrBooth;
644 
645  dol_banner_tab($object, 'ref', '', 0);
646 
647  print '<div class="fichecenter">';
648  print '<div class="fichehalfleft">';
649  print '<div class="underbanner clearboth"></div>';
650  print '<table class="border centpercent tableforfield">' . "\n";
651 
652  include DOL_DOCUMENT_ROOT . '/core/tpl/commonfields_view.tpl.php';
653 
654  // Other attributes. Fields from hook formObjectOptions and Extrafields.
655  include DOL_DOCUMENT_ROOT . '/core/tpl/extrafields_view.tpl.php';
656  $object = $object_evt;
657  print '</table>';
658  print '</div>';
659  print '</div>';
660 
661  print '<div class="clearboth"></div>';
662 
663  print dol_get_fiche_end();
664  }
665 }
666 
667 $arrayofselected = is_array($toselect) ? $toselect : array();
668 
669 $param = '';
670 if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) {
671  $param .= '&contextpage='.urlencode($contextpage);
672 }
673 if ($limit > 0 && $limit != $conf->liste_limit) {
674  $param .= '&limit='.urlencode($limit);
675 }
676 foreach ($search as $key => $val) {
677  if (is_array($search[$key]) && count($search[$key])) {
678  foreach ($search[$key] as $skey) {
679  if ($skey != '') {
680  $param .= '&search_'.$key.'[]='.urlencode($skey);
681  }
682  }
683  } elseif ($search[$key] != '') {
684  $param .= '&search_'.$key.'='.urlencode($search[$key]);
685  }
686 }
687 if ($confOrBooth->id > 0) {
688  $param .= '&conforboothid='.urlencode($confOrBooth->id);
689 }
690 if ($projectstatic->id > 0) {
691  $param .= '&fk_project='.urlencode($projectstatic->id);
692 }
693 $param .= $withProjectUrl;
694 if ($optioncss != '') {
695  $param .= '&optioncss='.urlencode($optioncss);
696 }
697 
698 // Add $param from extra fields
699 include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_param.tpl.php';
700 // Add $param from hooks
701 $parameters = array();
702 $reshook = $hookmanager->executeHooks('printFieldListSearchParam', $parameters, $object); // Note that $action and $object may have been modified by hook
703 $param .= $hookmanager->resPrint;
704 
705 // List of mass actions available
706 $arrayofmassactions = array(
707  //'validate'=>img_picto('', 'check', 'class="pictofixedwidth"').$langs->trans("Validate"),
708  //'generate_doc'=>img_picto('', 'pdf', 'class="pictofixedwidth"').$langs->trans("ReGeneratePDF"),
709  //'builddoc'=>img_picto('', 'pdf', 'class="pictofixedwidth"').$langs->trans("PDFMerge"),
710  'presend'=>img_picto('', 'email', 'class="pictofixedwidth"').$langs->trans("SendByMail"),
711 );
712 if ($permissiontodelete) {
713  $arrayofmassactions['predelete'] = img_picto('', 'delete', 'class="pictofixedwidth"').$langs->trans("Delete");
714 }
715 if (GETPOST('nomassaction', 'int') || in_array($massaction, array('presend', 'predelete'))) {
716  $arrayofmassactions = array();
717 }
718 $massactionbutton = $form->selectMassAction('', $arrayofmassactions);
719 
720 print '<form method="POST" id="searchFormList" action="'.$_SERVER["PHP_SELF"].(!empty($conf_or_booth_id)?'?conforboothid='.$conf_or_booth_id:'').'">'."\n";
721 if ($optioncss != '') {
722  print '<input type="hidden" name="optioncss" value="'.$optioncss.'">';
723 }
724 print '<input type="hidden" name="token" value="'.newToken().'">';
725 print '<input type="hidden" name="formfilteraction" id="formfilteraction" value="list">';
726 print '<input type="hidden" name="action" value="list">';
727 print '<input type="hidden" name="sortfield" value="'.$sortfield.'">';
728 print '<input type="hidden" name="sortorder" value="'.$sortorder.'">';
729 print '<input type="hidden" name="contextpage" value="'.$contextpage.'">';
730 print '<input type="hidden" name="withproject" value="'.$withproject.'">';
731 print '<input type="hidden" name="fk_project" value="'.$fk_project.'">';
732 print '<input type="hidden" name="page_y" value="">';
733 
734 $params = array('morecss'=>'reposition');
735 $newcardbutton = dolGetButtonTitle($langs->trans('New'), '', 'fa fa-plus-circle', DOL_URL_ROOT.'/eventorganization/conferenceorboothattendee_card.php?action=create'.(!empty($confOrBooth->id)?'&conforboothid='.$confOrBooth->id:'').(!empty($projectstatic->id)?'&fk_project='.$projectstatic->id:'').$withProjectUrl.'&backtopage='.urlencode($_SERVER['PHP_SELF'].'?projectid='.$projectstatic->id.(empty($confOrBooth->id) ? '' : '&conforboothid='.$confOrBooth->id).$withProjectUrl), '', $permissiontoadd, $params);
736 
737 print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, $object->picto, 0, $newcardbutton, '', $limit, 0, 0, 1);
738 
739 
740 // Add code for pre mass action (confirmation or email presend form)
741 $topicmail = $projectstatic->title;
742 $modelmail = "conferenceorbooth";
743 $objecttmp = new ConferenceOrBoothAttendee($db);
744 $trackid = 'conferenceorbooth_'.$object->id;
745 $withmaindocfilemail = 0;
746 include DOL_DOCUMENT_ROOT.'/core/tpl/massactions_pre.tpl.php';
747 
748 
749 if ($search_all) {
750  foreach ($fieldstosearchall as $key => $val) {
751  $fieldstosearchall[$key] = $langs->trans($val);
752  }
753  print '<div class="divsearchfieldfilter">'.$langs->trans("FilterOnInto", $search_all).join(', ', $fieldstosearchall).'</div>';
754 }
755 
756 $moreforfilter = '';
757 /*$moreforfilter.='<div class="divsearchfield">';
758 $moreforfilter.= $langs->trans('MyFilter') . ': <input type="text" name="search_myfield" value="'.dol_escape_htmltag($search_myfield).'">';
759 $moreforfilter.= '</div>';*/
760 
761 $parameters = array();
762 $reshook = $hookmanager->executeHooks('printFieldPreListTitle', $parameters, $object); // Note that $action and $object may have been modified by hook
763 if (empty($reshook)) {
764  $moreforfilter .= $hookmanager->resPrint;
765 } else {
766  $moreforfilter = $hookmanager->resPrint;
767 }
768 
769 if (!empty($moreforfilter)) {
770  print '<div class="liste_titre liste_titre_bydiv centpercent">';
771  print $moreforfilter;
772  print '</div>';
773 }
774 
775 $varpage = empty($contextpage) ? $_SERVER["PHP_SELF"] : $contextpage;
776 $selectedfields = $form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage); // This also change content of $arrayfields
777 $selectedfields .= (count($arrayofmassactions) ? $form->showCheckAddButtons('checkforselect', 1) : '');
778 
779 print '<div class="div-table-responsive">'; // You can use div-table-responsive-no-min if you dont need reserved height for your table
780 print '<table class="tagtable nobottomiftotal liste'.($moreforfilter ? " listwithfilterbefore" : "").'">'."\n";
781 
782 
783 // Fields title search
784 // --------------------------------------------------------------------
785 print '<tr class="liste_titre">';
786 foreach ($object->fields as $key => $val) {
787  $cssforfield = (empty($val['css']) ? '' : $val['css']);
788  if ($key == 'status') {
789  $cssforfield .= ($cssforfield ? ' ' : '').'center';
790  } elseif (in_array($val['type'], array('date', 'datetime', 'timestamp'))) {
791  $cssforfield .= ($cssforfield ? ' ' : '').'center';
792  } elseif (in_array($val['type'], array('timestamp'))) {
793  $cssforfield .= ($cssforfield ? ' ' : '').'nowrap';
794  } elseif (in_array($val['type'], array('double(24,8)', 'double(6,3)', 'integer', 'real', 'price')) && !in_array($key, array('rowid', 'ref')) && $val['label'] != 'TechnicalID') {
795  $cssforfield .= ($cssforfield ? ' ' : '').'right';
796  }
797  if (!empty($arrayfields['t.'.$key]['checked'])) {
798  print '<td class="liste_titre'.($cssforfield ? ' '.$cssforfield : '').'">';
799  if (!empty($val['arrayofkeyval']) && is_array($val['arrayofkeyval'])) {
800  print $form->selectarray('search_'.$key, $val['arrayofkeyval'], $search[$key], $val['notnull'], 0, 0, '', 1, 0, 0, '', 'maxwidth100', 1);
801  } elseif ((strpos($val['type'], 'integer:') === 0) || (strpos($val['type'], 'sellist:')=== 0)) {
802  print $object->showInputField($val, $key, $search[$key], '', '', 'search_', 'maxwidth125', 1);
803  } elseif (!preg_match('/^(date|timestamp|datetime)/', $val['type'])) {
804  print '<input type="text" class="flat maxwidth75" name="search_'.$key.'" value="'.dol_escape_htmltag($search[$key]).'">';
805  } elseif (preg_match('/^(date|timestamp|datetime)/', $val['type'])) {
806  print '<div class="nowrap">';
807  print $form->selectDate($search[$key.'_dtstart'] ? $search[$key.'_dtstart'] : '', "search_".$key."_dtstart", 0, 0, 1, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans('From'));
808  print '</div>';
809  print '<div class="nowrap">';
810  print $form->selectDate($search[$key.'_dtend'] ? $search[$key.'_dtend'] : '', "search_".$key."_dtend", 0, 0, 1, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans('to'));
811  print '</div>';
812  }
813  print '</td>';
814  }
815 }
816 // Extra fields
817 include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_input.tpl.php';
818 
819 // Fields from hook
820 $parameters = array('arrayfields'=>$arrayfields);
821 $reshook = $hookmanager->executeHooks('printFieldListOption', $parameters, $object); // Note that $action and $object may have been modified by hook
822 print $hookmanager->resPrint;
823 // Action column
824 print '<td class="liste_titre maxwidthsearch">';
825 $searchpicto = $form->showFilterButtons();
826 print $searchpicto;
827 print '</td>';
828 print '</tr>'."\n";
829 
830 
831 // Fields title label
832 // --------------------------------------------------------------------
833 print '<tr class="liste_titre">';
834 foreach ($object->fields as $key => $val) {
835  $cssforfield = (empty($val['csslist']) ? (empty($val['css']) ? '' : $val['css']) : $val['csslist']);
836  if ($key == 'status') {
837  $cssforfield .= ($cssforfield ? ' ' : '').'center';
838  } elseif (in_array($val['type'], array('date', 'datetime', 'timestamp'))) {
839  $cssforfield .= ($cssforfield ? ' ' : '').'center';
840  } elseif (in_array($val['type'], array('timestamp'))) {
841  $cssforfield .= ($cssforfield ? ' ' : '').'nowrap';
842  } elseif (in_array($val['type'], array('double(24,8)', 'double(6,3)', 'integer', 'real', 'price')) && !in_array($key, array('rowid', 'ref')) && $val['label'] != 'TechnicalID') {
843  $cssforfield .= ($cssforfield ? ' ' : '').'right';
844  }
845  if (!empty($arrayfields['t.'.$key]['checked'])) {
846  print getTitleFieldOfList($arrayfields['t.'.$key]['label'], 0, $_SERVER['PHP_SELF'], 't.'.$key, '', $param, ($cssforfield ? 'class="'.$cssforfield.'"' : ''), $sortfield, $sortorder, ($cssforfield ? $cssforfield.' ' : ''))."\n";
847  }
848 }
849 // Extra fields
850 include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_title.tpl.php';
851 // Hook fields
852 $parameters = array('arrayfields'=>$arrayfields, 'param'=>$param, 'sortfield'=>$sortfield, 'sortorder'=>$sortorder);
853 $reshook = $hookmanager->executeHooks('printFieldListTitle', $parameters, $object); // Note that $action and $object may have been modified by hook
854 print $hookmanager->resPrint;
855 // Action column
856 print getTitleFieldOfList($selectedfields, 0, $_SERVER["PHP_SELF"], '', '', '', '', $sortfield, $sortorder, 'center maxwidthsearch ')."\n";
857 print '</tr>'."\n";
858 
859 
860 // Detect if we need a fetch on each output line
861 $needToFetchEachLine = 0;
862 if (isset($extrafields->attributes[$object->table_element]['computed']) && is_array($extrafields->attributes[$object->table_element]['computed']) && count($extrafields->attributes[$object->table_element]['computed']) > 0) {
863  foreach ($extrafields->attributes[$object->table_element]['computed'] as $key => $val) {
864  if (preg_match('/\$object/', $val)) {
865  $needToFetchEachLine++; // There is at least one compute field that use $object
866  }
867  }
868 }
869 
870 
871 // Loop on record
872 // --------------------------------------------------------------------
873 $i = 0;
874 $totalarray = array();
875 while ($i < ($limit ? min($num, $limit) : $num)) {
876  $obj = $db->fetch_object($resql);
877  if (empty($obj)) {
878  break; // Should not happen
879  }
880 
881  // Store properties in $object
882  $object->setVarsFromFetchObj($obj);
883 
884  // Show here line of result
885  print '<tr class="oddeven">';
886  foreach ($object->fields as $key => $val) {
887  $cssforfield = (empty($val['css']) ? '' : $val['css']);
888  if (in_array($val['type'], array('date', 'datetime', 'timestamp'))) {
889  $cssforfield .= ($cssforfield ? ' ' : '').'center';
890  } elseif ($key == 'status') {
891  $cssforfield .= ($cssforfield ? ' ' : '').'center';
892  }
893 
894  if (in_array($val['type'], array('timestamp'))) {
895  $cssforfield .= ($cssforfield ? ' ' : '').'nowrap left';
896  } elseif ($key == 'ref') {
897  $cssforfield .= ($cssforfield ? ' ' : '').'nowrap';
898  }
899 
900  if (in_array($val['type'], array('double(24,8)', 'double(6,3)', 'integer', 'real', 'price')) && !in_array($key, array('rowid', 'ref', 'status'))) {
901  $cssforfield .= ($cssforfield ? ' ' : '').'right';
902  }
903  //if (in_array($key, array('fk_soc', 'fk_user', 'fk_warehouse'))) $cssforfield = 'tdoverflowmax100';
904 
905  if (!empty($arrayfields['t.'.$key]['checked'])) {
906  print '<td'.($cssforfield ? ' class="'.$cssforfield.'"' : '').'>';
907  if ($key == 'status') {
908  print $object->getLibStatut(5);
909  } elseif ($key == 'ref') {
910  $optionLink = (!empty($withproject)?'conforboothidproject':'conforboothid');
911  if (empty($confOrBooth->id)) {
912  $optionLink='projectid';
913  }
914  print $object->getNomUrl(1, $optionLink);
915  } else {
916  print $object->showOutputField($val, $key, $object->$key, '');
917  }
918  print '</td>';
919  if (!$i) {
920  $totalarray['nbfield']++;
921  }
922  if (!empty($val['isameasure']) && $val['isameasure'] == 1) {
923  if (!$i) {
924  $totalarray['pos'][$totalarray['nbfield']] = 't.'.$key;
925  }
926  if (!isset($totalarray['val'])) {
927  $totalarray['val'] = array();
928  }
929  if (!isset($totalarray['val']['t.'.$key])) {
930  $totalarray['val']['t.'.$key] = 0;
931  }
932  $totalarray['val']['t.'.$key] += $object->$key;
933  }
934  }
935  }
936  // Extra fields
937  include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_print_fields.tpl.php';
938  // Fields from hook
939  $parameters = array('arrayfields'=>$arrayfields, 'object'=>$object, 'obj'=>$obj, 'i'=>$i, 'totalarray'=>&$totalarray);
940  $reshook = $hookmanager->executeHooks('printFieldListValue', $parameters, $object); // Note that $action and $object may have been modified by hook
941  print $hookmanager->resPrint;
942  // Action column
943  print '<td class="nowrap center">';
944  if ($massactionbutton || $massaction) { // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined
945  $selected = 0;
946  if (in_array($object->id, $arrayofselected)) {
947  $selected = 1;
948  }
949  print '<input id="cb'.$object->id.'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.$object->id.'"'.($selected ? ' checked="checked"' : '').'>';
950  }
951  print '</td>';
952  if (!$i) {
953  $totalarray['nbfield']++;
954  }
955 
956  print '</tr>'."\n";
957 
958  $i++;
959 }
960 
961 // Show total line
962 include DOL_DOCUMENT_ROOT.'/core/tpl/list_print_total.tpl.php';
963 
964 // If no record found
965 if ($num == 0) {
966  $colspan = 1;
967  foreach ($arrayfields as $key => $val) {
968  if (!empty($val['checked'])) {
969  $colspan++;
970  }
971  }
972  print '<tr><td colspan="'.$colspan.'"><span class="opacitymedium">'.$langs->trans("NoRecordFound").'</span></td></tr>';
973 }
974 
975 
976 $db->free($resql);
977 
978 $parameters = array('arrayfields'=>$arrayfields, 'sql'=>$sql);
979 $reshook = $hookmanager->executeHooks('printFieldListFooter', $parameters, $object); // Note that $action and $object may have been modified by hook
980 print $hookmanager->resPrint;
981 
982 print '</table>'."\n";
983 print '</div>'."\n";
984 
985 print '</form>'."\n";
986 
987 if (in_array('builddoc', $arrayofmassactions) && ($nbtotalofrecords === '' || $nbtotalofrecords)) {
988  $hidegeneratedfilelistifempty = 1;
989  if ($massaction == 'builddoc' || $action == 'remove_file' || $show_files) {
990  $hidegeneratedfilelistifempty = 0;
991  }
992 
993  require_once DOL_DOCUMENT_ROOT.'/core/class/html.formfile.class.php';
994  $formfile = new FormFile($db);
995 
996  // Show list of available documents
997  $urlsource = $_SERVER['PHP_SELF'].'?sortfield='.$sortfield.'&sortorder='.$sortorder;
998  $urlsource .= str_replace('&amp;', '&', $param);
999 
1000  $filedir = $diroutputmassaction;
1001  $genallowed = $permissiontoread;
1002  $delallowed = $permissiontoadd;
1003 
1004  print $formfile->showdocuments('massfilesarea_eventorganization', '', $filedir, $urlsource, 0, $delallowed, '', 1, 1, 0, 48, 1, $param, $title, '', '', '', null, $hidegeneratedfilelistifempty);
1005 }
1006 
1007 // End of page
1008 llxFooter();
1009 $db->close();
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:118
if(!defined('NOREQUIRESOC')) if(!defined('NOREQUIRETRAN')) if(!defined('NOTOKENRENEWAL')) if(!defined('NOREQUIREMENU')) if(!defined('NOREQUIREHTML')) if(!defined('NOREQUIREAJAX')) llxHeader()
Empty header.
Definition: wrapper.php:56
llxFooter()
Empty footer.
Definition: wrapper.php:70
Class for ConferenceOrBoothAttendee.
Class for ConferenceOrBooth.
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.
Class to manage projects.
if(isModEnabled('facture') &&!empty($user->rights->facture->lire)) if((isModEnabled('fournisseur') &&empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD) && $user->hasRight("fournisseur", "facture", "lire"))||(isModEnabled('supplier_invoice') && $user->hasRight("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->hasRight("commande", "lire") &&empty($conf->global->WORKFLOW_DISABLE_CREATE_INVOICE_FROM_ORDER)) $resql
Social contributions to pay.
Definition: index.php:745
if($cancel &&! $id) if($action=='add' &&! $cancel) if($action=='delete') if($id) $form
Actions.
Definition: card.php:143
conferenceorboothPrepareHead($object, $with_project=0)
Prepare array of tabs for ConferenceOrBooth.
conferenceorboothProjectPrepareHead($object)
Prepare array of tabs for ConferenceOrBooth Project tab.
dol_banner_tab($object, $paramid, $morehtml='', $shownav=1, $fieldid='rowid', $fieldref='ref', $morehtmlref='', $moreparam='', $nodbprefix=0, $morehtmlleft='', $morehtmlstatus='', $onlybanner=0, $morehtmlright='')
Show tab footer of a card.
dol_mktime($hour, $minute, $second, $month, $day, $year, $gm='auto', $check=1)
Return a timestamp date built from detailed informations (by default a local PHP server timestamp) Re...
dol_get_fiche_head($links=array(), $active='', $title='', $notab=0, $picto='', $pictoisfullpath=0, $morehtmlright='', $morecss='', $limittoshow=0, $moretabssuffix='')
Show tabs of a record.
img_warning($titlealt='default', $moreatt='', $morecss='pictowarning')
Show warning logo.
dol_escape_htmltag($stringtoescape, $keepb=0, $keepn=0, $noescapetags='', $escapeonlyhtmltags=0)
Returns text escaped for inclusion in HTML alt or title tags, or into values of HTML input fields.
dol_print_error($db='', $error='', $errors=null)
Displays error message system with all the information to facilitate the diagnosis and the escalation...
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_get_fiche_end($notab=0)
Return tab footer of a card.
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...
setEventMessages($mesg, $mesgs, $style='mesgs', $messagekey='')
Set event messages in dol_events session object.
dol_print_date($time, $format='', $tzoutput='auto', $outputlangs='', $encodetooutput=false)
Output date in a string format according to outputlangs (or langs if not defined).
dol_now($mode='auto')
Return date for now.
img_picto($titlealt, $picto, $moreatt='', $pictoisfullpath=false, $srconly=0, $notitle=0, $alt='', $morecss='', $marginleftonlyshort=2)
Show picto whatever it's its name (generic function)
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_eval($s, $returnvalue=0, $hideerrors=1, $onlysimplestring='1')
Replace eval function to add more security.
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.
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.
dol_buildpath($path, $type=0, $returnemptyifnotfound=0)
Return path of url or filesystem.
GETPOSTISSET($paramname)
Return true if we are in a context of submitting the parameter $paramname from a POST of a form.
isModEnabled($module)
Is Dolibarr module enabled.
$nbtotalofrecords
Count total nb of records.
Definition: list.php:329
project_prepare_head(Project $project, $moreparam='')
Prepare array with list of tabs.
Definition: project.lib.php:38
restrictedArea(User $user, $features, $object=0, $tableandshare='', $feature2='', $dbt_keyfield='fk_soc', $dbt_select='rowid', $isdraft=0, $mode=0)
Check permissions of a user to show a page and an object.
dol_hash($chain, $type='0')
Returns a hash (non reversible encryption) of a string.
accessforbidden($message='', $printheader=1, $printfooter=1, $showonlymessage=0, $params=null)
Show a message to say access is forbidden and stop program.