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