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