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