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