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