dolibarr  17.0.4
conferenceorbooth_list.php
Go to the documentation of this file.
1 <?php
2 /* Copyright (C) 2007-2017 Laurent Destailleur <eldy@users.sourceforge.net>
3  * Copyright (C) 2021 Florian Henry <florian.henry@scopen.fr>
4  * Copyright (C) 2023 Frédéric France <frederic.france@netlogic.fr>
5  *
6  * This program is free software; you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License as published by
8  * the Free Software Foundation; either version 3 of the License, or
9  * (at your option) any later version.
10  *
11  * This program is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14  * GNU General Public License for more details.
15  *
16  * You should have received a copy of the GNU General Public License
17  * along with this program. If not, see <https://www.gnu.org/licenses/>.
18  */
19 
27 // Load Dolibarr environment
28 require '../main.inc.php';
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 require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php';
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 
39 global $dolibarr_main_url_root;
40 
41 // for other modules
42 //dol_include_once('/othermodule/class/otherobject.class.php');
43 
44 // Load translation files required by the page
45 $langs->loadLangs(array("eventorganization", "other", "projects", "companies"));
46 
47 // Get Parameters
48 $action = GETPOST('action', 'aZ09') ? GETPOST('action', 'aZ09') : 'view'; // The action 'create'/'add', 'edit'/'update', 'view', ...
49 $massaction = GETPOST('massaction', 'alpha'); // The bulk action (combo box choice into lists)
50 $show_files = GETPOST('show_files', 'int'); // Show files area generated by bulk actions ?
51 $confirm = GETPOST('confirm', 'alpha'); // Result of a confirmation
52 $cancel = GETPOST('cancel', 'alpha'); // We click on a Cancel button
53 $toselect = GETPOST('toselect', 'array'); // Array of ids of elements selected into a list
54 $contextpage = GETPOST('contextpage', 'aZ') ? GETPOST('contextpage', 'aZ') : str_replace('_', '', basename(dirname(__FILE__)).basename(__FILE__, '.php')); // To manage different context of search
55 $backtopage = GETPOST('backtopage', 'alpha'); // Go back to a dedicated page
56 $optioncss = GETPOST('optioncss', 'aZ'); // Option for the css output (always '' except when 'print')
57 $mode = GETPOST('mode', 'aZ'); // The output mode ('list', 'kanban', 'hierarchy', 'calendar', ...)
58 
59 $id = GETPOST('id', 'int');
60 $projectid = GETPOST('projectid', 'int');
61 $projectref = GETPOST('ref', 'alpha');
62 
63 // Load variable for pagination
64 $limit = GETPOST('limit', 'int') ? GETPOST('limit', 'int') : $conf->liste_limit;
65 $sortfield = GETPOST('sortfield', 'aZ09comma');
66 $sortorder = GETPOST('sortorder', 'aZ09comma');
67 $page = GETPOSTISSET('pageplusone') ? (GETPOST('pageplusone') - 1) : GETPOST("page", 'int');
68 if (empty($page) || $page < 0 || GETPOST('button_search', 'alpha') || GETPOST('button_removefilter', 'alpha')) {
69  // If $page is not defined, or '' or -1 or if we click on clear filters
70  $page = 0;
71 }
72 $offset = $limit * $page;
73 $pageprev = $page - 1;
74 $pagenext = $page + 1;
75 
76 // Initialize technical objects
77 $project = new Project($db);
78 $object = new ConferenceOrBooth($db);
79 $extrafields = new ExtraFields($db);
80 $diroutputmassaction = $conf->eventorganization->dir_output.'/temp/massgeneration/'.$user->id;
81 $hookmanager->initHooks(array($contextpage)); // Note that conf->hooks_modules contains array
82 
83 // Fetch optionals attributes and labels
84 $extrafields->fetch_name_optionals_label($object->table_element);
85 //$extrafields->fetch_name_optionals_label($object->table_element_line);
86 
87 $search_array_options = $extrafields->getOptionalsFromPost($object->table_element, '', 'search_');
88 
89 // Default sort order (if not yet defined by previous GETPOST)
90 if (!$sortfield) {
91  reset($object->fields); // Reset is required to avoid key() to return null.
92  $sortfield = "t.".key($object->fields); // Set here default search field. By default 1st field in definition.
93 }
94 if (!$sortorder) {
95  $sortorder = "ASC";
96 }
97 
98 // Initialize array of search criterias
99 $search_all = GETPOST('search_all', 'alphanohtml') ? GETPOST('search_all', 'alphanohtml') : GETPOST('sall', 'alphanohtml');
100 $search = array();
101 foreach ($object->fields as $key => $val) {
102  if (GETPOST('search_'.$key, 'alpha') !== '') {
103  $search[$key] = GETPOST('search_'.$key, 'alpha');
104  }
105  if (preg_match('/^(date|timestamp|datetime)/', $val['type'])) {
106  $search[$key.'_dtstart'] = dol_mktime(0, 0, 0, GETPOST('search_'.$key.'_dtstartmonth', 'int'), GETPOST('search_'.$key.'_dtstartday', 'int'), GETPOST('search_'.$key.'_dtstartyear', 'int'));
107  $search[$key.'_dtend'] = dol_mktime(23, 59, 59, GETPOST('search_'.$key.'_dtendmonth', 'int'), GETPOST('search_'.$key.'_dtendday', 'int'), GETPOST('search_'.$key.'_dtendyear', 'int'));
108  }
109 }
110 
111 // List of fields to search into when doing a "search in all"
112 $fieldstosearchall = array();
113 foreach ($object->fields as $key => $val) {
114  if (!empty($val['searchall'])) {
115  $fieldstosearchall['t.'.$key] = $val['label'];
116  }
117 }
118 
119 // Definition of array of fields for columns
120 $arrayfields = array();
121 foreach ($object->fields as $key => $val) {
122  // If $val['visible']==0, then we never show the field
123  if (!empty($val['visible'])) {
124  $visible = (int) dol_eval($val['visible'], 1);
125  $arrayfields['t.'.$key] = array(
126  'label'=>$val['label'],
127  'checked'=>(($visible < 0) ? 0 : 1),
128  'enabled'=>(abs($visible) != 3 && dol_eval($val['enabled'], 1)),
129  'position'=>$val['position'],
130  'help'=> isset($val['help']) ? $val['help'] : ''
131  );
132  }
133 }
134 // Extra fields
135 include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_array_fields.tpl.php';
136 
137 $object->fields = dol_sort_array($object->fields, 'position');
138 $arrayfields = dol_sort_array($arrayfields, 'position');
139 
140 $permissiontoread = $user->rights->eventorganization->read;
141 $permissiontoadd = $user->rights->eventorganization->write;
142 $permissiontodelete = $user->rights->eventorganization->delete;
143 
144 // Security check
145 if (!isModEnabled('eventorganization')) {
146  accessforbidden('Module eventorganization not enabled');
147 }
148 $socid = 0;
149 if ($user->socid > 0) { // Protection if external user
150  //$socid = $user->socid;
151  accessforbidden();
152 }
153 $result = restrictedArea($user, 'eventorganization');
154 if (!$permissiontoread) accessforbidden();
155 
156 
157 /*
158  * Actions
159  */
160 
161 if (preg_match('/^set/', $action) && ($projectid > 0 || $projectref) && !empty($user->rights->eventorganization->write)) {
162  //If "set" fields keys is in projects fields
163  $project_attr=preg_replace('/^set/', '', $action);
164  if (array_key_exists($project_attr, $project->fields)) {
165  $result = $project->fetch($projectid, $projectref);
166  if ($result < 0) {
167  setEventMessages(null, $project->errors, 'errors');
168  } else {
169  $projectid = $project->id;
170  $project->{$project_attr}=GETPOST($project_attr);
171  $result=$project->update($user);
172  if ($result < 0) {
173  setEventMessages(null, $project->errors, 'errors');
174  }
175  }
176  }
177 }
178 /*if ($action=='setaccept_conference_suggestions' && !empty(GETPOST('cancel', 'alpha'))) {
179 
180 }*/
181 //setaccept_booth_suggestions
182 if (GETPOST('cancel', 'alpha')) {
183  $action = 'list';
184  $massaction = '';
185 }
186 if (!GETPOST('confirmmassaction', 'alpha') && $massaction != 'presend'
187  && $massaction != 'presend_attendees'
188  && $massaction != 'confirm_presend'
189  && $massaction != 'confirm_presend_attendees') {
190  $massaction = '';
191 }
192 
193 
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 = 'ConferenceOrBooth';
225  $objectlabel = 'ConferenceOrBooth';
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 $form = new Form($db);
237 $now = dol_now();
238 
239 //$help_url = "EN:Module_ConferenceOrBooth|FR:Module_ConferenceOrBooth_FR|ES:Módulo_ConferenceOrBooth";
240 $help_url = '';
241 $title = $langs->trans('ListOfConferencesOrBooths');
242 $morejs = array();
243 $morecss = array();
244 
245 if ($projectid > 0 || $projectref) {
246  $result = $project->fetch($projectid, $projectref);
247  if ($result < 0) {
248  setEventMessages(null, $project->errors, 'errors');
249  } else {
250  $projectid = $project->id;
251  }
252  $result = $project->fetch_thirdparty();
253  if ($result < 0) {
254  setEventMessages(null, $project->errors, 'errors');
255  }
256  $result = $project->fetch_optionals();
257  if ($result < 0) {
258  setEventMessages(null, $project->errors, 'errors');
259  }
260 
261  $help_url = "EN:Module_Projects|FR:Module_Projets|ES:M&oacute;dulo_Proyectos";
262  $title = $langs->trans("Project") . ' - ' . $langs->trans("EventOrganizationConfOrBoothes") . ' - ' . $project->ref . ' ' . $project->name;
263  if (!empty($conf->global->MAIN_HTML_TITLE) && preg_match('/projectnameonly/', $conf->global->MAIN_HTML_TITLE) && $project->name) {
264  $title = $project->ref . ' ' . $project->name . ' - ' . $langs->trans("ListOfConferencesOrBooths");
265  }
266 }
267 
268 // Output page
269 // --------------------------------------------------------------------
270 
271 llxHeader('', $title, $help_url);
272 
273 
274 if ($projectid > 0) {
275  // To verify role of users
276  //$userAccess = $object->restrictedProjectArea($user,'read');
277  $userWrite = $project->restrictedProjectArea($user, 'write');
278  //$userDelete = $object->restrictedProjectArea($user,'delete');
279  //print "userAccess=".$userAccess." userWrite=".$userWrite." userDelete=".$userDelete;
280 
281  $head = project_prepare_head($project);
282  print dol_get_fiche_head($head, 'eventorganisation', $langs->trans("ConferenceOrBoothTab"), -1, ($project->public ? 'projectpub' : 'project'));
283 
284  // Project card
285  $linkback = '<a href="'.DOL_URL_ROOT.'/projet/list.php?restore_lastsearch_values=1">'.$langs->trans("BackToList").'</a>';
286 
287  $morehtmlref = '<div class="refidno">';
288  // Title
289  $morehtmlref .= $project->title;
290  // Thirdparty
291  if (isset($project->thirdparty->id) && $project->thirdparty->id > 0) {
292  $morehtmlref .= '<br>'.$project->thirdparty->getNomUrl(1, 'project');
293  }
294  $morehtmlref .= '</div>';
295 
296  // Define a complementary filter for search of next/prev ref.
297  if (empty($user->rights->project->all->lire)) {
298  $objectsListId = $project->getProjectsAuthorizedForUser($user, 0, 0);
299  $project->next_prev_filter = " rowid IN (".$db->sanitize(count($objectsListId) ? join(',', array_keys($objectsListId)) : '0').")";
300  }
301 
302  dol_banner_tab($project, 'ref', $linkback, 1, 'ref', 'ref', $morehtmlref);
303 
304  print '<div class="fichecenter">';
305  print '<div class="fichehalfleft">';
306  print '<div class="underbanner clearboth"></div>';
307 
308  print '<table class="border tableforfield centpercent">';
309 
310  // Usage
311  if (!empty($conf->global->PROJECT_USE_OPPORTUNITIES) || empty($conf->global->PROJECT_HIDE_TASKS) || isModEnabled('eventorganization')) {
312  print '<tr><td class="tdtop">';
313  print $langs->trans("Usage");
314  print '</td>';
315  print '<td>';
316  if (!empty($conf->global->PROJECT_USE_OPPORTUNITIES)) {
317  print '<input type="checkbox" disabled name="usage_opportunity"'.($project->usage_opportunity ? ' checked="checked"' : '').'"> ';
318  $htmltext = $langs->trans("ProjectFollowOpportunity");
319  print $form->textwithpicto($langs->trans("ProjectFollowOpportunity"), $htmltext);
320  print '<br>';
321  }
322  if (empty($conf->global->PROJECT_HIDE_TASKS)) {
323  print '<input type="checkbox" disabled name="usage_task"'.($project->usage_task ? ' checked="checked"' : '').'"> ';
324  $htmltext = $langs->trans("ProjectFollowTasks");
325  print $form->textwithpicto($langs->trans("ProjectFollowTasks"), $htmltext);
326  print '<br>';
327  }
328  if (empty($conf->global->PROJECT_HIDE_TASKS) && !empty($conf->global->PROJECT_BILL_TIME_SPENT)) {
329  print '<input type="checkbox" disabled name="usage_bill_time"'.($project->usage_bill_time ? ' checked="checked"' : '').'"> ';
330  $htmltext = $langs->trans("ProjectBillTimeDescription");
331  print $form->textwithpicto($langs->trans("BillTime"), $htmltext);
332  print '<br>';
333  }
334  if (isModEnabled('eventorganization')) {
335  print '<input type="checkbox" disabled name="usage_organize_event"'.($project->usage_organize_event ? ' checked="checked"' : '').'"> ';
336  $htmltext = $langs->trans("EventOrganizationDescriptionLong");
337  print $form->textwithpicto($langs->trans("ManageOrganizeEvent"), $htmltext);
338  }
339  print '</td></tr>';
340  }
341 
342  // Visibility
343  print '<tr><td class="titlefield">'.$langs->trans("Visibility").'</td><td>';
344  if ($project->public == 0) {
345  print img_picto($langs->trans('PrivateProject'), 'private', 'class="paddingrightonly"');
346  print $langs->trans("PrivateProject");
347  } else {
348  print img_picto($langs->trans('SharedProject'), 'world', 'class="paddingrightonly"');
349  print $langs->trans("SharedProject");
350  }
351  print '</td></tr>';
352 
353  // Budget
354  print '<tr><td>'.$langs->trans("Budget").'</td><td>';
355  if (strcmp($project->budget_amount, '')) {
356  print '<span class="amount">'.price($project->budget_amount, '', $langs, 1, 0, 0, $conf->currency).'</span>';
357  }
358  print '</td></tr>';
359 
360  // Date start - end project
361  print '<tr><td>'.$langs->trans("Dates").' ('.$langs->trans("Project").')</td><td>';
362  $start = dol_print_date($project->date_start, 'day');
363  print ($start ? $start : '?');
364  $end = dol_print_date($project->date_end, 'day');
365  print ' - ';
366  print ($end ? $end : '?');
367  if ($object->hasDelay()) {
368  print img_warning("Late");
369  }
370  print '</td></tr>';
371 
372  // Date start - end of event
373  print '<tr><td>'.$langs->trans("Dates").' ('.$langs->trans("Event").')</td><td>';
374  $start = dol_print_date($project->date_start_event, 'day');
375  print ($start ? $start : '?');
376  $end = dol_print_date($project->date_end_event, 'day');
377  print ' - ';
378  print ($end ? $end : '?');
379  if ($object->hasDelay()) {
380  print img_warning("Late");
381  }
382  print '</td></tr>';
383 
384  // Location event
385  print '<tr><td>'.$langs->trans("Location").'</td><td>';
386  print $project->location;
387  print '</td></tr>';
388 
389  // Other attributes
390  $cols = 2;
391  $objectconf = $object;
392  $object = $project;
393  include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_view.tpl.php';
394  $object = $objectconf;
395 
396  print '</table>';
397 
398  print '</div>';
399  print '<div class="fichehalfright">';
400  print '<div class="underbanner clearboth"></div>';
401 
402  print '<table class="border tableforfield centpercent">';
403 
404  // Description
405  print '<tr><td class="titlefield tdtop">'.$langs->trans("Description").'</td><td class="valuefield">';
406  print dol_htmlentitiesbr($project->description);
407  print '</td></tr>';
408 
409  // Categories
410  if (isModEnabled('categorie')) {
411  print '<tr><td class="titlefield valignmiddle">'.$langs->trans("Categories").'</td><td class="valuefield">';
412  print $form->showCategories($project->id, Categorie::TYPE_PROJECT, 1);
413  print "</td></tr>";
414  }
415 
416  print '<tr><td class="titlefield">';
417  $typeofdata = 'checkbox:'.($project->accept_conference_suggestions ? ' checked="checked"' : '');
418  $htmltext = $langs->trans("AllowUnknownPeopleSuggestConfHelp");
419  print $form->editfieldkey('AllowUnknownPeopleSuggestConf', 'accept_conference_suggestions', '', $project, $permissiontoadd, $typeofdata, '', 0, 0, 'projectid', $htmltext);
420  print '</td><td class="valuefield">';
421  print $form->editfieldval('AllowUnknownPeopleSuggestConf', 'accept_conference_suggestions', '1', $project, $permissiontoadd, $typeofdata, '', 0, 0, '', 0, '', 'projectid');
422  print "</td></tr>";
423 
424  print '<tr><td class="titlefield">';
425  $typeofdata = 'checkbox:'.($project->accept_booth_suggestions ? ' checked="checked"' : '');
426  $htmltext = $langs->trans("AllowUnknownPeopleSuggestBoothHelp");
427  print $form->editfieldkey('AllowUnknownPeopleSuggestBooth', 'accept_booth_suggestions', '', $project, $permissiontoadd, $typeofdata, '', 0, 0, 'projectid', $htmltext);
428  print '</td><td class="valuefield">';
429  print $form->editfieldval('AllowUnknownPeopleSuggestBooth', 'accept_booth_suggestions', '1', $project, $permissiontoadd, $typeofdata, '', 0, 0, '', 0, '', 'projectid');
430  print "</td></tr>";
431 
432  print '<tr><td class="titlefield">';
433  print $form->editfieldkey($form->textwithpicto($langs->trans('PriceOfBooth'), $langs->trans("PriceOfBoothHelp")), 'price_booth', '', $project, $permissiontoadd, 'amount', '', 0, 0, 'projectid');
434  print '</td><td class="valuefield">';
435  print $form->editfieldval($form->textwithpicto($langs->trans('PriceOfBooth'), $langs->trans("PriceOfBoothHelp")), 'price_booth', $project->price_booth, $project, $permissiontoadd, 'amount', '', 0, 0, '', 0, '', 'projectid');
436  print "</td></tr>";
437 
438  print '<tr><td class="titlefield">';
439  print $form->editfieldkey($form->textwithpicto($langs->trans('PriceOfRegistration'), $langs->trans("PriceOfRegistrationHelp")), 'price_registration', '', $project, $permissiontoadd, 'amount', '', 0, 0, 'projectid');
440  print '</td><td class="valuefield">';
441  print $form->editfieldval($form->textwithpicto($langs->trans('PriceOfRegistration'), $langs->trans("PriceOfRegistrationHelp")), 'price_registration', $project->price_registration, $project, $permissiontoadd, 'amount', '', 0, 0, '', 0, '', 'projectid');
442  print "</td></tr>";
443 
444  print '<tr><td class="titlefield">';
445  print $form->editfieldkey($form->textwithpicto($langs->trans('MaxNbOfAttendees'), ''), 'max_attendees', '', $project, $permissiontoadd, 'integer:3', '', 0, 0, 'projectid');
446  print '</td><td class="valuefield">';
447  print $form->editfieldval($form->textwithpicto($langs->trans('MaxNbOfAttendees'), ''), 'max_attendees', $project->max_attendees, $project, $permissiontoadd, 'integer:3', '', 0, 0, '', 0, '', 'projectid');
448  print "</td></tr>";
449 
450  print '<tr><td class="titlefield valignmiddle">'.$langs->trans("EventOrganizationICSLink").'</td><td class="valuefield">';
451  // Define $urlwithroot
452  $urlwithouturlroot = preg_replace('/'.preg_quote(DOL_URL_ROOT, '/').'$/i', '', trim($dolibarr_main_url_root));
453  $urlwithroot = $urlwithouturlroot.DOL_URL_ROOT;
454 
455  // Show message
456  $message = '<a target="_blank" rel="noopener noreferrer" href="'.$urlwithroot.'/public/agenda/agendaexport.php?format=ical'.($conf->entity > 1 ? "&entity=".$conf->entity : "");
457  $message .= '&exportkey='.urlencode(getDolGlobalString('MAIN_AGENDA_XCAL_EXPORTKEY', '...'));
458  $message .= "&project=".$projectid.'&module='.urlencode('@eventorganization').'&status='.ConferenceOrBooth::STATUS_CONFIRMED.'">'.$langs->trans('DownloadICSLink').img_picto('', 'download', 'class="paddingleft"').'</a>';
459  print $message;
460  print "</td></tr>";
461 
462  // Link to the submit vote/register page
463  print '<tr><td class="titlefield">';
464  //print '<span class="opacitymedium">';
465  print $form->textwithpicto($langs->trans("SuggestOrVoteForConfOrBooth"), $langs->trans("EvntOrgRegistrationHelpMessage"));
466  //print '</span>';
467  print '</td><td class="valuefield">';
468  $linksuggest = $dolibarr_main_url_root.'/public/project/index.php?id='.((int) $project->id);
469  $encodedsecurekey = dol_hash(getDolGlobalString('EVENTORGANIZATION_SECUREKEY').'conferenceorbooth'.((int) $project->id), 'md5');
470  $linksuggest .= '&securekey='.urlencode($encodedsecurekey);
471  //print '<div class="urllink">';
472  //print '<input type="text" value="'.$linksuggest.'" id="linkregister" class="quatrevingtpercent paddingrightonly">';
473  print '<div class="tdoverflowmax200 inline-block valignmiddle"><a target="_blank" href="'.$linksuggest.'" class="quatrevingtpercent">'.$linksuggest.'</a></div>';
474  print '<a target="_blank" rel="noopener noreferrer" href="'.$linksuggest.'">'.img_picto('', 'globe').'</a>';
475  //print '</div>';
476  //print ajax_autoselect("linkregister");
477  print '</td></tr>';
478 
479  // Link to the subscribe
480  print '<tr><td class="titlefield">';
481  //print '<span class="opacitymedium">';
482  print $langs->trans("PublicAttendeeSubscriptionGlobalPage");
483  //print '</span>';
484  print '</td><td class="valuefield">';
485  $link_subscription = $dolibarr_main_url_root.'/public/eventorganization/attendee_new.php?id='.((int) $project->id).'&type=global';
486  $encodedsecurekey = dol_hash(getDolGlobalString('EVENTORGANIZATION_SECUREKEY').'conferenceorbooth'.((int) $project->id), 'md5');
487  $link_subscription .= '&securekey='.urlencode($encodedsecurekey);
488  //print '<div class="urllink">';
489  //print '<input type="text" value="'.$linkregister.'" id="linkregister" class="quatrevingtpercent paddingrightonly">';
490  print '<div class="tdoverflowmax200 inline-block valignmiddle"><a target="_blank" href="'.$link_subscription.'" class="quatrevingtpercent">'.$link_subscription.'</a></div>';
491  print '<a target="_blank" rel="noopener noreferrer" rel="noopener noreferrer" href="'.$link_subscription.'">'.img_picto('', 'globe').'</a>';
492  //print '</div>';
493  //print ajax_autoselect("linkregister");
494  print '</td></tr>';
495 
496  print '</table>';
497 
498  print '</div>';
499  print '</div>';
500 
501  print '<div class="clearboth"></div>';
502 
503  print dol_get_fiche_end();
504 }
505 
506 if (!empty($project->id)) {
507  $head = conferenceorboothProjectPrepareHead($project);
508  $tab = 'conferenceorbooth';
509 
510  print dol_get_fiche_head($head, $tab, $langs->trans("Project"), -1, ($project->public ? 'projectpub' : 'project'), 0, '', 'reposition');
511 }
512 
513 // Build and execute select
514 // --------------------------------------------------------------------
515 $sql = 'SELECT ';
516 $sql .= $object->getFieldList('t');
517 
518 // Add fields from extrafields
519 if (!empty($extrafields->attributes[$object->table_element]['label'])) {
520  foreach ($extrafields->attributes[$object->table_element]['label'] as $key => $val) {
521  $sql .= ($extrafields->attributes[$object->table_element]['type'][$key] != 'separate' ? ", ef.".$key." as options_".$key : '');
522  }
523 }
524 // Add fields from hooks
525 $parameters = array();
526 $reshook = $hookmanager->executeHooks('printFieldListSelect', $parameters, $object); // Note that $action and $object may have been modified by hook
527 $sql .= preg_replace('/^,/', '', $hookmanager->resPrint);
528 $sql = preg_replace('/,\s*$/', '', $sql);
529 //$sql .= ", COUNT(rc.rowid) as anotherfield";
530 
531 $sqlfields = $sql; // $sql fields to remove for count total
532 
533 $sql .= " FROM ".MAIN_DB_PREFIX.$object->table_element." as t";
534 if (isset($extrafields->attributes[$object->table_element]['label']) && is_array($extrafields->attributes[$object->table_element]['label']) && count($extrafields->attributes[$object->table_element]['label'])) {
535  $sql .= " LEFT JOIN ".MAIN_DB_PREFIX.$object->table_element."_extrafields as ef on (t.id = ef.fk_object)";
536 }
537 $sql .= " INNER JOIN ".MAIN_DB_PREFIX."c_actioncomm as cact ON cact.id=t.fk_action AND cact.module LIKE '%@eventorganization'";
538 // Add table from hooks
539 $parameters = array();
540 $reshook = $hookmanager->executeHooks('printFieldListFrom', $parameters, $object); // Note that $action and $object may have been modified by hook
541 $sql .= $hookmanager->resPrint;
542 if ($object->ismultientitymanaged == 1) {
543  $sql .= " WHERE t.entity IN (".getEntity($object->element).")";
544 } else {
545  $sql .= " WHERE 1 = 1";
546 }
547 if ($projectid > 0) {
548  $sql .= " AND t.fk_project = ".((int) $project->id);
549 }
550 foreach ($search as $key => $val) {
551  if (array_key_exists($key, $object->fields)) {
552  if ($key == 'status' && $search[$key] == -1) {
553  continue;
554  }
555  $mode_search = (($object->isInt($object->fields[$key]) || $object->isFloat($object->fields[$key])) ? 1 : 0);
556  if ((strpos($object->fields[$key]['type'], 'integer:') === 0) || (strpos($object->fields[$key]['type'], 'sellist:') === 0) || !empty($object->fields[$key]['arrayofkeyval'])) {
557  if ($search[$key] == '-1' || ($search[$key] === '0' && (empty($object->fields[$key]['arrayofkeyval']) || !array_key_exists('0', $object->fields[$key]['arrayofkeyval'])))) {
558  $search[$key] = '';
559  }
560  $mode_search = 2;
561  }
562  if ($search[$key] != '') {
563  $sql .= natural_search("t.".$db->escape($key), $search[$key], (($key == 'status') ? 2 : $mode_search));
564  }
565  } else {
566  if (preg_match('/(_dtstart|_dtend)$/', $key) && $search[$key] != '') {
567  $columnName = preg_replace('/(_dtstart|_dtend)$/', '', $key);
568  if (preg_match('/^(date|timestamp|datetime)/', $object->fields[$columnName]['type'])) {
569  if (preg_match('/_dtstart$/', $key)) {
570  $sql .= " AND t.".$db->escape($columnName)." >= '".$db->idate($search[$key])."'";
571  }
572  if (preg_match('/_dtend$/', $key)) {
573  $sql .= " AND t.".$db->escape($columnName)." <= '".$db->idate($search[$key])."'";
574  }
575  }
576  }
577  }
578 }
579 
580 if ($search_all) {
581  $sql .= natural_search(array_keys($fieldstosearchall), $search_all);
582 }
583 //$sql.= dolSqlDateFilter("t.field", $search_xxxday, $search_xxxmonth, $search_xxxyear);
584 // Add where from extra fields
585 include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_sql.tpl.php';
586 // Add where from hooks
587 $parameters = array();
588 $reshook = $hookmanager->executeHooks('printFieldListWhere', $parameters, $object); // Note that $action and $object may have been modified by hook
589 $sql .= $hookmanager->resPrint;
590 
591 // Count total nb of records
592 $nbtotalofrecords = '';
593 if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) {
594  /* The fast and low memory method to get and count full list converts the sql into a sql count */
595  $sqlforcount = preg_replace('/^'.preg_quote($sqlfields, '/').'/', 'SELECT COUNT(*) as nbtotalofrecords', $sql);
596  $sqlforcount = preg_replace('/GROUP BY .*$/', '', $sqlforcount);
597  $resql = $db->query($sqlforcount);
598  if ($resql) {
599  $objforcount = $db->fetch_object($resql);
600  $nbtotalofrecords = $objforcount->nbtotalofrecords;
601  } else {
602  dol_print_error($db);
603  }
604 
605  if (($page * $limit) > $nbtotalofrecords) { // if total resultset is smaller then paging size (filtering), goto and load page 0
606  $page = 0;
607  $offset = 0;
608  }
609  $db->free($resql);
610 }
611 
612 // Complete request and execute it with limit
613 $sql .= $db->order($sortfield, $sortorder);
614 
615 if ($limit) {
616  $sql .= $db->plimit($limit + 1, $offset);
617 }
618 
619 $resql = $db->query($sql);
620 if (!$resql) {
621  dol_print_error($db);
622  exit;
623 }
624 
625 $num = $db->num_rows($resql);
626 
627 // Direct jump if only one record found
628 if ($num == 1 && !empty($conf->global->MAIN_SEARCH_DIRECT_OPEN_IF_ONLY_ONE) && $search_all && !$page) {
629  $obj = $db->fetch_object($resql);
630  $id = $obj->rowid;
631  header("Location: ".DOL_URL_ROOT.'/eventorganization/conferenceorbooth_card.php?id='.((int) $id));
632  exit;
633 }
634 
635 $arrayofselected = is_array($toselect) ? $toselect : array();
636 
637 $param = '';
638 if (!empty($mode)) {
639  $param .= '&mode='.urlencode($mode);
640 }
641 if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) {
642  $param .= '&contextpage='.urlencode($contextpage);
643 }
644 if ($limit > 0 && $limit != $conf->liste_limit) {
645  $param .= '&limit='.urlencode($limit);
646 }
647 if ($optioncss != '') {
648  $param .= '&optioncss='.urlencode($optioncss);
649 }
650 if ($project->id > 0) {
651  $param .= '&projectid='.((int) $project->id);
652 }
653 foreach ($search as $key => $val) {
654  if (is_array($search[$key])) {
655  foreach ($search[$key] as $skey) {
656  if ($skey != '') {
657  $param .= '&search_'.$key.'[]='.urlencode($skey);
658  }
659  }
660  } elseif (preg_match('/(_dtstart|_dtend)$/', $key) && !empty($val)) {
661  $param .= '&search_'.$key.'month='.((int) GETPOST('search_'.$key.'month', 'int'));
662  $param .= '&search_'.$key.'day='.((int) GETPOST('search_'.$key.'day', 'int'));
663  $param .= '&search_'.$key.'year='.((int) GETPOST('search_'.$key.'year', 'int'));
664  } elseif ($search[$key] != '') {
665  $param .= '&search_'.$key.'='.urlencode($search[$key]);
666  }
667 }
668 // Add $param from extra fields
669 include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_param.tpl.php';
670 // Add $param from hooks
671 $parameters = array();
672 $reshook = $hookmanager->executeHooks('printFieldListSearchParam', $parameters, $object); // Note that $action and $object may have been modified by hook
673 $param .= $hookmanager->resPrint;
674 
675 // List of mass actions available
676 $arrayofmassactions = array(
677  //'validate'=>img_picto('', 'check', 'class="pictofixedwidth"').$langs->trans("Validate"),
678  //'generate_doc'=>img_picto('', 'pdf', 'class="pictofixedwidth"').$langs->trans("ReGeneratePDF"),
679  //'builddoc'=>img_picto('', 'pdf', 'class="pictofixedwidth"').$langs->trans("PDFMerge"),
680  'presend'=>img_picto('', 'email', 'class="pictofixedwidth"').$langs->trans("SendByMail").' ('.$langs->trans("ToSpeakers").')',
681  //'presend_attendees'=>img_picto('', 'email', 'class="pictofixedwidth"').$langs->trans("SendByMail").' - '.$langs->trans("Attendees"),
682 );
683 if (!empty($permissiontodelete)) {
684  $arrayofmassactions['predelete'] = img_picto('', 'delete', 'class="pictofixedwidth"').$langs->trans("Delete");
685 }
686 if (GETPOST('nomassaction', 'int') || in_array($massaction, array('presend', 'predelete'))) {
687  $arrayofmassactions = array();
688 }
689 $massactionbutton = $form->selectMassAction('', $arrayofmassactions);
690 
691 print '<form method="POST" id="searchFormList" action="'.$_SERVER["PHP_SELF"].(!empty($projectid)?'?projectid='.$projectid:'').'">'."\n";
692 if ($optioncss != '') {
693  print '<input type="hidden" name="optioncss" value="'.$optioncss.'">';
694 }
695 print '<input type="hidden" name="token" value="'.newToken().'">';
696 print '<input type="hidden" name="formfilteraction" id="formfilteraction" value="list">';
697 print '<input type="hidden" name="action" value="list">';
698 print '<input type="hidden" name="sortfield" value="'.$sortfield.'">';
699 print '<input type="hidden" name="sortorder" value="'.$sortorder.'">';
700 print '<input type="hidden" name="page" value="'.$page.'">';
701 print '<input type="hidden" name="contextpage" value="'.$contextpage.'">';
702 print '<input type="hidden" name="page_y" value="">';
703 print '<input type="hidden" name="mode" value="'.$mode.'">';
704 
705 
706 $title = $langs->trans("EventOrganizationConfOrBoothes");
707 
708 $newcardbutton = dolGetButtonTitle($langs->trans('New'), '', 'fa fa-plus-circle', DOL_URL_ROOT.'/eventorganization/conferenceorbooth_card.php?action=create'.(!empty($project->id)?'&withproject=1&fk_project='.$project->id:'').(!empty($project->socid)?'&fk_soc='.$project->socid:'').'&backtopage='.urlencode($_SERVER['PHP_SELF']).(!empty($project->id)?'?projectid='.$project->id:''), '', $permissiontoadd);
709 
710 print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, $object->picto, 0, $newcardbutton, '', $limit, 0, 0, 1);
711 
712 
713 // Add code for pre mass action (confirmation or email presend form)
714 $topicmail = '';
715 $modelmail = "conferenceorbooth";
716 $objecttmp = new ConferenceOrBooth($db);
717 $trackid = 'conferenceorbooth_'.$object->id;
718 $withmaindocfilemail = 0;
719 include DOL_DOCUMENT_ROOT.'/core/tpl/massactions_pre.tpl.php';
720 
721 
722 if ($search_all) {
723  $setupstring = '';
724  foreach ($fieldstosearchall as $key => $val) {
725  $fieldstosearchall[$key] = $langs->trans($val);
726  $setupstring .= $key."=".$val.";";
727  }
728  print '<!-- Search done like if PRODUCT_QUICKSEARCH_ON_FIELDS = '.$setupstring.' -->'."\n";
729  print '<div class="divsearchfieldfilter">'.$langs->trans("FilterOnInto", $search_all).join(', ', $fieldstosearchall).'</div>'."\n";
730 }
731 
732 $moreforfilter = '';
733 /*$moreforfilter.='<div class="divsearchfield">';
734 $moreforfilter.= $langs->trans('MyFilter') . ': <input type="text" name="search_myfield" value="'.dol_escape_htmltag($search_myfield).'">';
735 $moreforfilter.= '</div>';*/
736 
737 $parameters = array();
738 $reshook = $hookmanager->executeHooks('printFieldPreListTitle', $parameters, $object); // Note that $action and $object may have been modified by hook
739 if (empty($reshook)) {
740  $moreforfilter .= $hookmanager->resPrint;
741 } else {
742  $moreforfilter = $hookmanager->resPrint;
743 }
744 
745 if (!empty($moreforfilter)) {
746  print '<div class="liste_titre liste_titre_bydiv centpercent">';
747  print $moreforfilter;
748  print '</div>';
749 }
750 
751 $varpage = empty($contextpage) ? $_SERVER["PHP_SELF"] : $contextpage;
752 $selectedfields = $form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage, getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN', '')); // This also change content of $arrayfields
753 $selectedfields .= (count($arrayofmassactions) ? $form->showCheckAddButtons('checkforselect', 1) : '');
754 
755 
756 print '<div class="div-table-responsive">'; // You can use div-table-responsive-no-min if you dont need reserved height for your table
757 print '<table class="tagtable nobottomiftotal liste'.($moreforfilter ? " listwithfilterbefore" : "").'">'."\n";
758 
759 
760 // Fields title search
761 // --------------------------------------------------------------------
762 print '<tr class="liste_titre">';
763 // Action column
764 if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
765  print '<td class="liste_titre maxwidthsearch">';
766  $searchpicto = $form->showFilterButtons('left');
767  print $searchpicto;
768  print '</td>';
769 }
770 foreach ($object->fields as $key => $val) {
771  $searchkey = empty($search[$key]) ? '' : $search[$key];
772  $cssforfield = (empty($val['csslist']) ? (empty($val['css']) ? '' : $val['css']) : $val['csslist']);
773  if ($key == 'status') {
774  $cssforfield .= ($cssforfield ? ' ' : '').'center';
775  } elseif (in_array($val['type'], array('date', 'datetime', 'timestamp'))) {
776  $cssforfield .= ($cssforfield ? ' ' : '').'center';
777  } elseif (in_array($val['type'], array('timestamp'))) {
778  $cssforfield .= ($cssforfield ? ' ' : '').'nowrap';
779  } elseif (in_array($val['type'], array('double(24,8)', 'double(6,3)', 'integer', 'real', 'price')) && $key != 'rowid' && $key != 'ref' && $val['label'] != 'TechnicalID' && empty($val['arrayofkeyval'])) {
780  $cssforfield .= ($cssforfield ? ' ' : '').'right';
781  }
782  if (!empty($arrayfields['t.'.$key]['checked'])) {
783  print '<td class="liste_titre'.($cssforfield ? ' '.$cssforfield : '').'">';
784  if (!empty($val['arrayofkeyval']) && is_array($val['arrayofkeyval'])) {
785  print $form->selectarray('search_'.$key, $val['arrayofkeyval'], (isset($search[$key]) ? $search[$key] : ''), $val['notnull'], 0, 0, '', 1, 0, 0, '', 'maxwidth100'.($key == 'status' ? ' search_status onrightofpage' : ''), 1);
786  } elseif ((strpos($val['type'], 'integer:') === 0) || (strpos($val['type'], 'sellist:') === 0)) {
787  print $object->showInputField($val, $key, (isset($search[$key]) ? $search[$key] : ''), '', '', 'search_', $cssforfield.' maxwidth250', 1);
788  } elseif (preg_match('/^(date|timestamp|datetime)/', $val['type'])) {
789  print '<div class="nowrap">';
790  print $form->selectDate($search[$key.'_dtstart'] ? $search[$key.'_dtstart'] : '', "search_".$key."_dtstart", 0, 0, 1, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans('From'));
791  print '</div>';
792  print '<div class="nowrap">';
793  print $form->selectDate($search[$key.'_dtend'] ? $search[$key.'_dtend'] : '', "search_".$key."_dtend", 0, 0, 1, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans('to'));
794  print '</div>';
795  } elseif ($key == 'lang') {
796  require_once DOL_DOCUMENT_ROOT.'/core/class/html.formadmin.class.php';
797  $formadmin = new FormAdmin($db);
798  print $formadmin->select_language($search[$key], 'search_lang', 0, null, 1, 0, 0, 'minwidth150 maxwidth200', 2);
799  } else {
800  print '<input type="text" class="flat maxwidth75" name="search_'.$key.'" value="'.dol_escape_htmltag(isset($search[$key]) ? $search[$key] : '').'">';
801  }
802  print '</td>';
803  }
804 }
805 // Extra fields
806 include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_input.tpl.php';
807 
808 // Fields from hook
809 $parameters = array('arrayfields'=>$arrayfields);
810 $reshook = $hookmanager->executeHooks('printFieldListOption', $parameters, $object); // Note that $action and $object may have been modified by hook
811 print $hookmanager->resPrint;
812 // Action column
813 if (!getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
814  print '<td class="liste_titre maxwidthsearch">';
815  $searchpicto = $form->showFilterButtons();
816  print $searchpicto;
817  print '</td>';
818 }
819 print '</tr>'."\n";
820 
821 $totalarray = array();
822 $totalarray['nbfield'] = 0;
823 
824 // Fields title label
825 // --------------------------------------------------------------------
826 print '<tr class="liste_titre">';
827 if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
828  print getTitleFieldOfList(($mode != 'kanban' ? $selectedfields : ''), 0, $_SERVER["PHP_SELF"], '', '', '', '', $sortfield, $sortorder, 'center maxwidthsearch ')."\n";
829 }
830 foreach ($object->fields as $key => $val) {
831  $cssforfield = (empty($val['csslist']) ? (empty($val['css']) ? '' : $val['css']) : $val['csslist']);
832  if ($key == 'status') {
833  $cssforfield .= ($cssforfield ? ' ' : '').'center';
834  } elseif (in_array($val['type'], array('date', 'datetime', 'timestamp'))) {
835  $cssforfield .= ($cssforfield ? ' ' : '').'center';
836  } elseif (in_array($val['type'], array('timestamp'))) {
837  $cssforfield .= ($cssforfield ? ' ' : '').'nowrap';
838  } elseif (in_array($val['type'], array('double(24,8)', 'double(6,3)', 'integer', 'real', 'price')) && $key != 'rowid' && $key != 'ref' && $val['label'] != 'TechnicalID' && empty($val['arrayofkeyval'])) {
839  $cssforfield .= ($cssforfield ? ' ' : '').'right';
840  }
841  $cssforfield = preg_replace('/small\s*/', '', $cssforfield); // the 'small' css must not be used for the title label
842  if (!empty($arrayfields['t.'.$key]['checked'])) {
843  print getTitleFieldOfList($arrayfields['t.'.$key]['label'], 0, $_SERVER['PHP_SELF'], 't.'.$key, '', $param, ($cssforfield ? 'class="'.$cssforfield.'"' : ''), $sortfield, $sortorder, ($cssforfield ? $cssforfield.' ' : ''))."\n";
844  $totalarray['nbfield']++;
845  }
846 }
847 // Extra fields
848 include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_title.tpl.php';
849 // Hook fields
850 $parameters = array('arrayfields'=>$arrayfields, 'param'=>$param, 'sortfield'=>$sortfield, 'sortorder'=>$sortorder, 'totalarray'=>&$totalarray);
851 $reshook = $hookmanager->executeHooks('printFieldListTitle', $parameters, $object); // Note that $action and $object may have been modified by hook
852 print $hookmanager->resPrint;
853 // Action column
854 if (!getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
855  print getTitleFieldOfList(($mode != 'kanban' ? $selectedfields : ''), 0, $_SERVER["PHP_SELF"], '', '', '', '', $sortfield, $sortorder, 'center maxwidthsearch ')."\n";
856 }
857 $totalarray['nbfield']++;
858 print '</tr>'."\n";
859 
860 
861 // Detect if we need a fetch on each output line
862 $needToFetchEachLine = 0;
863 if (isset($extrafields->attributes[$object->table_element]['computed']) && is_array($extrafields->attributes[$object->table_element]['computed']) && count($extrafields->attributes[$object->table_element]['computed']) > 0) {
864  foreach ($extrafields->attributes[$object->table_element]['computed'] as $key => $val) {
865  if (preg_match('/\$object/', $val)) {
866  $needToFetchEachLine++; // There is at least one compute field that use $object
867  }
868  }
869 }
870 
871 
872 // Loop on record
873 // --------------------------------------------------------------------
874 $i = 0;
875 $savnbfield = $totalarray['nbfield'];
876 $totalarray = array();
877 $totalarray['nbfield'] = 0;
878 $imaxinloop = ($limit ? min($num, $limit) : $num);
879 while ($i < $imaxinloop) {
880  $obj = $db->fetch_object($resql);
881  if (empty($obj)) {
882  break; // Should not happen
883  }
884 
885  // Store properties in $object
886  $object->setVarsFromFetchObj($obj);
887 
888  if ($mode == 'kanban') {
889  if ($i == 0) {
890  print '<tr><td colspan="'.$savnbfield.'">';
891  print '<div class="box-flex-container">';
892  }
893  // Output Kanban
894  print $object->getKanbanView('');
895  if ($i == ($imaxinloop - 1)) {
896  print '</div>';
897  print '</td></tr>';
898  }
899  } else {
900  // Show here line of result
901  $j = 0;
902  print '<tr data-rowid="'.$object->id.'" class="oddeven">';
903  // Action column
904  if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
905  print '<td class="nowrap center">';
906  if ($massactionbutton || $massaction) { // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined
907  $selected = 0;
908  if (in_array($object->id, $arrayofselected)) {
909  $selected = 1;
910  }
911  print '<input id="cb'.$object->id.'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.$object->id.'"'.($selected ? ' checked="checked"' : '').'>';
912  }
913  print '</td>';
914  if (!$i) {
915  $totalarray['nbfield']++;
916  }
917  }
918  foreach ($object->fields as $key => $val) {
919  $cssforfield = (empty($val['csslist']) ? (empty($val['css']) ? '' : $val['css']) : $val['csslist']);
920  if (in_array($val['type'], array('date', 'datetime', 'timestamp'))) {
921  $cssforfield .= ($cssforfield ? ' ' : '').'center';
922  } elseif ($key == 'status') {
923  $cssforfield .= ($cssforfield ? ' ' : '').'center';
924  }
925 
926  if (in_array($val['type'], array('timestamp'))) {
927  $cssforfield .= ($cssforfield ? ' ' : '').'nowrap';
928  } elseif ($key == 'ref') {
929  $cssforfield .= ($cssforfield ? ' ' : '').'nowrap';
930  }
931 
932  if (in_array($val['type'], array('double(24,8)', 'double(6,3)', 'integer', 'real', 'price')) && !in_array($key, array('rowid', 'ref', 'status')) && empty($val['arrayofkeyval'])) {
933  $cssforfield .= ($cssforfield ? ' ' : '').'right';
934  }
935  //if (in_array($key, array('fk_soc', 'fk_user', 'fk_warehouse'))) $cssforfield = 'tdoverflowmax100';
936 
937  if (!empty($arrayfields['t.'.$key]['checked'])) {
938  print '<td'.($cssforfield ? ' class="'.$cssforfield.(preg_match('/tdoverflow/', $cssforfield) ? ' classfortooltip' : '').'"' : '');
939  if (preg_match('/tdoverflow/', $cssforfield)) {
940  print ' title="'.dol_escape_htmltag($object->$key).'"';
941  }
942  print '>';
943  if ($key == 'status') {
944  print $object->getLibStatut(5);
945  } elseif ($key == 'ref') {
946  print $object->getNomUrl(1, 0, '', (($projectid > 0)?'withproject':''));
947  } else {
948  print $object->showOutputField($val, $key, $object->$key, '');
949  }
950  print '</td>';
951  if (!$i) {
952  $totalarray['nbfield']++;
953  }
954  if (!empty($val['isameasure']) && $val['isameasure'] == 1) {
955  if (!$i) {
956  $totalarray['pos'][$totalarray['nbfield']] = 't.'.$key;
957  }
958  if (!isset($totalarray['val'])) {
959  $totalarray['val'] = array();
960  }
961  if (!isset($totalarray['val']['t.'.$key])) {
962  $totalarray['val']['t.'.$key] = 0;
963  }
964  $totalarray['val']['t.'.$key] += $object->$key;
965  }
966  }
967  }
968  // Extra fields
969  include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_print_fields.tpl.php';
970  // Fields from hook
971  $parameters = array('arrayfields'=>$arrayfields, 'object'=>$object, 'obj'=>$obj, 'i'=>$i, 'totalarray'=>&$totalarray);
972  $reshook = $hookmanager->executeHooks('printFieldListValue', $parameters, $object); // Note that $action and $object may have been modified by hook
973  print $hookmanager->resPrint;
974  // Action column
975  if (!getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
976  print '<td class="nowrap center">';
977  if ($massactionbutton || $massaction) { // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined
978  $selected = 0;
979  if (in_array($object->id, $arrayofselected)) {
980  $selected = 1;
981  }
982  print '<input id="cb'.$object->id.'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.$object->id.'"'.($selected ? ' checked="checked"' : '').'>';
983  }
984  print '</td>';
985  if (!$i) {
986  $totalarray['nbfield']++;
987  }
988  }
989 
990  print '</tr>'."\n";
991  }
992 
993  $i++;
994 }
995 
996 // Show total line
997 include DOL_DOCUMENT_ROOT.'/core/tpl/list_print_total.tpl.php';
998 
999 // If no record found
1000 if ($num == 0) {
1001  $colspan = 1;
1002  foreach ($arrayfields as $key => $val) {
1003  if (!empty($val['checked'])) {
1004  $colspan++;
1005  }
1006  }
1007  print '<tr><td colspan="'.$colspan.'"><span class="opacitymedium">'.$langs->trans("NoRecordFound").'</span></td></tr>';
1008 }
1009 
1010 
1011 $db->free($resql);
1012 
1013 $parameters = array('arrayfields'=>$arrayfields, 'sql'=>$sql);
1014 $reshook = $hookmanager->executeHooks('printFieldListFooter', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
1015 print $hookmanager->resPrint;
1016 
1017 print '</table>'."\n";
1018 print '</div>'."\n";
1019 
1020 print '</form>'."\n";
1021 
1022 if (in_array('builddoc', $arrayofmassactions) && ($nbtotalofrecords === '' || $nbtotalofrecords)) {
1023  $hidegeneratedfilelistifempty = 1;
1024  if ($massaction == 'builddoc' || $action == 'remove_file' || $show_files) {
1025  $hidegeneratedfilelistifempty = 0;
1026  }
1027 
1028  require_once DOL_DOCUMENT_ROOT.'/core/class/html.formfile.class.php';
1029  $formfile = new FormFile($db);
1030 
1031  // Show list of available documents
1032  $urlsource = $_SERVER['PHP_SELF'].'?sortfield='.$sortfield.'&sortorder='.$sortorder;
1033  $urlsource .= str_replace('&amp;', '&', $param);
1034 
1035  $filedir = $diroutputmassaction;
1036  $genallowed = $permissiontoread;
1037  $delallowed = $permissiontoadd;
1038 
1039  print $formfile->showdocuments('massfilesarea_eventorganization', '', $filedir, $urlsource, 0, $delallowed, '', 1, 1, 0, 48, 1, $param, $title, '', '', '', null, $hidegeneratedfilelistifempty);
1040 }
1041 
1042 // End of page
1043 llxFooter();
1044 $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 ConferenceOrBooth.
Class to manage standard extra fields.
Class to generate html code for admin pages.
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
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.
if(!function_exists('utf8_encode')) if(!function_exists('utf8_decode')) getDolGlobalString($key, $default='')
Return dolibarr global constant string value.
GETPOSTISSET($paramname)
Return true if we are in a context of submitting the parameter $paramname from a POST of a form.
dol_htmlentitiesbr($stringtoencode, $nl2brmode=0, $pagecodefrom='UTF-8', $removelasteolbr=1)
This function is called to encode a string into a HTML string but differs from htmlentities because a...
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.