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