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